diff --git a/.claude/architecture/compatibility_0.3.md b/.claude/architecture/compatibility_0.3.md new file mode 100644 index 000000000..5316027f9 --- /dev/null +++ b/.claude/architecture/compatibility_0.3.md @@ -0,0 +1,544 @@ +# PRD: A2A Protocol 0.3 Backward Compatibility Layer + +> **Goal**: Allow the A2A Java SDK (v1.0) to interoperate with agents running protocol v0.3 through a dedicated compatibility layer. + +--- + +## Motivation + +The A2A protocol evolved from v0.3 to v1.0 with significant breaking changes. Existing agents deployed with v0.3 cannot immediately upgrade. This compatibility layer enables a v1.0 SDK to communicate with v0.3 agents across all three transports (JSON-RPC, gRPC, REST) and allows v1.0 servers to accept v0.3 client requests. + +--- + +## Scope + +### In Scope + +- Dedicated `compat-0.3` Maven module structure containing **only** 0.3-specific code +- gRPC code generation from the v0.3 `a2a.proto` +- Dedicated v0.3 client (`Client_v0_3`) exposing only features available in v0.3 +- Server-side conversion layer (`Convert_v0_3_To10RequestHandler`) that accepts v0.3 requests and delegates to v1.0 server-common +- Server-side transport handlers for v0.3 (JSON-RPC, gRPC, REST) +- Bidirectional mapping layer between v0.3 and v1.0 domain objects +- Quarkus reference server implementations for v0.3 +- TCK conformance tests for v0.3 +- Integration test infrastructure (test-jar) for validating conversion layer +- Inclusion in the SDK BOM as separate optional dependencies + +### Out of Scope + +- Changes to existing v1.0 modules (no regressions, no API changes) +- Automatic protocol version detection (client must explicitly choose API version) +- Extras modules (OpenTelemetry, JPA stores, etc.) for v0.3 +- v0.3 format agent card (v0.3 clients must be able to parse v1.0 agent card format) + +### Deferred + +- **Dual-version server deployment**: Running both v1.0 and v0.3 transports simultaneously in a single server instance with a unified agent card + - **Current state**: v0.3 reference servers work standalone; need integration pattern for dual deployment + - **Remaining work**: Define CDI qualifier pattern, path prefix strategy, and unified agent card production + +--- + +## Breaking Changes: v0.3 → v1.0 + +The compatibility layer bridges the following differences: + +### 1. Proto Package Namespace +| Aspect | v0.3 | v1.0 | +|--------|------|------| +| Package | `a2a.v1` | `lf.a2a.v1` | + +### 2. RPC Method Changes +| v0.3 | v1.0 | Change | +|------|------|--------| +| `TaskSubscription` | `SubscribeToTask` | Renamed | +| `GetAgentCard` | `GetExtendedAgentCard` | Renamed | +| `ListTaskPushNotificationConfig` | `ListTaskPushNotificationConfigs` | Pluralized | +| `CreateTaskPushNotificationConfig(CreateTaskPushNotificationConfigRequest)` | `CreateTaskPushNotificationConfig(TaskPushNotificationConfig)` | Parameter type changed | +| — | `ListTasks` | New in v1.0 (no v0.3 equivalent) | + +### 3. HTTP Endpoint Changes +| v0.3 | v1.0 | +|------|------| +| `/v1/message:send` | `/message:send` (+ `/{tenant}/message:send`) | +| `/v1/message:stream` | `/message:stream` (+ tenant) | +| `/v1/{name=tasks/*}` | `/tasks/{id=*}` (+ tenant) | +| `/v1/{name=tasks/*}:cancel` | `/tasks/{id=*}:cancel` (+ tenant) | +| `/v1/{name=tasks/*}:subscribe` | `/tasks/{id=*}:subscribe` (+ tenant) | +| `/v1/card` | `/extendedAgentCard` (+ tenant) | +| `/v1/{parent=task/*/pushNotificationConfigs}` | `/tasks/{task_id=*}/pushNotificationConfigs` (+ tenant) | + +### 4. Configuration Field Changes +| v0.3 `SendMessageConfiguration` | v1.0 `SendMessageConfiguration` | +|----------------------------------|----------------------------------| +| `push_notification` (PushNotificationConfig) | `task_push_notification_config` (TaskPushNotificationConfig) | +| `blocking` (bool, default true) | `return_immediately` (bool, default false) — inverted semantics | +| `history_length` (int32, 0 = unlimited) | `history_length` (optional int32, unset = no limit) | + +### 5. AgentCard / AgentInterface Changes +| v0.3 | v1.0 | +|------|------| +| `url` + `preferred_transport` on AgentCard | Removed; replaced by `supported_interfaces` | +| `additional_interfaces` | Folded into `supported_interfaces` | +| No `tenant` field | `tenant` field added to AgentInterface | +| `transport` field | Renamed to `protocol_binding` | + +### 6. Task State Naming +| v0.3 | v1.0 | +|------|------| +| `TASK_STATE_CANCELLED` | `TASK_STATE_CANCELED` | + +### 7. Structural Changes +- v1.0 removed the `kind` discriminator field from messages +- v1.0 added `reference_task_ids` to `Message` +- v1.0 added `TASK_STATE_REJECTED` enum value (no v0.3 equivalent) + +--- + +## Design Decisions + +### Naming Convention: `_v0_3` Suffix + +All compat-0.3 classes use a `_v0_3` suffix to avoid naming conflicts with v1.0 classes and improve IDE navigation: + +- `Task_v0_3`, `AgentCard_v0_3`, `Client_v0_3` +- `JSONRPCHandler_v0_3`, `GrpcHandler_v0_3`, `RestHandler_v0_3` +- `Convert_v0_3_To10RequestHandler`, `ErrorConverter_v0_3` +- Mappers: `TaskMapper_v0_3`, `MessageSendParamsMapper_v0_3`, etc. + +**Exception**: Generated gRPC classes use the package name `org.a2aproject.sdk.compat03.grpc` without suffix (controlled by proto `java_package` option). + +### Dedicated v0.3 Client + +The compat layer exposes a **dedicated `Client_v0_3`** that only provides features available in v0.3: + +- No `listTasks()` method (absent in v0.3) +- Method names reflect v0.3 semantics where they differ +- The client is a standalone API, not a wrapper around the v1.0 `Client` + +Users must explicitly check the `protocolVersion` field from the agent card and instantiate the correct client accordingly. No automatic version detection. + +### Server-Side Conversion Layer + +Instead of embedding conversion logic in each transport handler, the implementation uses a **dedicated conversion layer** that sits between v0.3 transport handlers and v1.0 server-common: + +``` +v0.3 Client Request + ↓ +v0.3 Transport Handler (JSONRPC/gRPC/REST) + ↓ +Convert_v0_3_To10RequestHandler + ↓ (converts v0.3 → v1.0) +v1.0 DefaultRequestHandler + ↓ +AgentExecutor → AgentEmitter → MainEventBus + ↓ +v1.0 Response + ↓ (converts v1.0 → v0.3) +Convert_v0_3_To10RequestHandler + ↓ +v0.3 Transport Handler + ↓ +v0.3 Client Response +``` + +**Benefits:** +- **Single conversion point**: All v0.3↔v1.0 translation logic lives in `server-conversion` module +- **Transport independence**: JSONRPC, gRPC, and REST handlers share identical conversion logic +- **Testability**: Conversion layer can be tested independently of transport concerns +- **Maintainability**: Changes to conversion rules require updates in one place only + +### TASK_STATE_REJECTED Handling + +`TASK_STATE_REJECTED` (v1.0-only) is mapped to `TASK_STATE_FAILED` when converting to v0.3 wire format. The original state is preserved in metadata (`"original_state": "REJECTED"`) so information is not entirely lost. Both are terminal states, so v0.3 clients can handle the result correctly. + +### Agent Card: v1.0 Only + +The agent card (`/.well-known/agent-card.json`) is produced only using the v1.0 format. The compat layer does not produce a v0.3-format agent card. + +A server that supports both versions should advertise this via a single v1.0 agent card containing multiple `AgentInterface` entries — one per version — each with its own URL and `protocolVersion` field. v0.3 clients must be able to parse the v1.0 agent card format to discover their endpoint. + +**Pros:** +- **Single source of truth**: one agent card at one well-known URL describes all supported versions and transports +- **Simpler server implementation**: no need for separate v0.3 agent card endpoint, serializer, or CDI producer +- **Forward-looking**: encourages v0.3 clients to understand the v1.0 discovery format + +**Cons:** +- **v0.3 clients must parse v1.0 agent card**: pure v0.3 clients that only understand the v0.3 structure need updating + +--- + +## Module Structure + +All compatibility code lives under a top-level `compat-0.3/` directory: + +``` +compat-0.3/ +├── pom.xml # Parent POM for all compat-0.3 submodules +├── spec/ # v0.3 spec types (POJOs) +│ ├── pom.xml +│ └── src/main/java/org/a2aproject/sdk/compat03/spec/ +│ ├── Task_v0_3.java +│ ├── AgentCard_v0_3.java +│ ├── Message_v0_3.java +│ ├── A2AError_v0_3.java # Base error class +│ ├── *Error_v0_3.java # Specific error types +│ └── ... +├── spec-grpc/ # v0.3 proto + generated classes +│ ├── pom.xml +│ └── src/main/ +│ ├── proto/a2a_v0_3.proto # v0.3 proto file (package a2a.v1) +│ └── java/org/a2aproject/sdk/compat03/grpc/ +│ └── [generated classes] # No _v0_3 suffix (generated code) +├── http-client/ # HTTP client abstraction for v0.3 +│ └── pom.xml +├── server-conversion/ # ⭐ Core conversion layer (NEW) +│ ├── pom.xml +│ └── src/main/java/org/a2aproject/sdk/compat03/conversion/ +│ ├── Convert_v0_3_To10RequestHandler.java # Main adapter +│ ├── ErrorConverter_v0_3.java # Error conversion +│ └── mappers/ +│ ├── config/ +│ │ ├── A03ToV10MapperConfig.java # MapStruct config +│ │ └── A2AMappers_v0_3.java # Mapper registry +│ ├── params/ # Request param mappers +│ │ ├── MessageSendParamsMapper_v0_3.java +│ │ ├── TaskQueryParamsMapper_v0_3.java +│ │ ├── CancelTaskParamsMapper_v0_3.java +│ │ └── ... +│ ├── domain/ # Domain object mappers +│ │ ├── TaskMapper_v0_3.java +│ │ ├── MessageMapper_v0_3.java +│ │ ├── TaskStateMapper_v0_3.java +│ │ ├── EventKindMapper_v0_3.java +│ │ └── ... +│ └── result/ # Response result mappers +│ └── ListTaskPushNotificationConfigsResultMapper_v0_3.java +├── client/ # v0.3-compatible client +│ ├── base/ # Client_v0_3 — dedicated 0.3 API +│ │ └── pom.xml +│ └── transport/ +│ ├── spi/ # Transport SPI +│ │ └── pom.xml +│ ├── jsonrpc/ # JSON-RPC client transport for v0.3 +│ │ └── pom.xml +│ ├── grpc/ # gRPC client transport for v0.3 +│ │ └── pom.xml +│ └── rest/ # REST client transport for v0.3 +│ └── pom.xml +├── transport/ # Server-side transport handlers for v0.3 +│ ├── jsonrpc/ # Accept v0.3 JSON-RPC requests +│ │ └── pom.xml +│ ├── grpc/ # Accept v0.3 gRPC requests +│ │ └── pom.xml +│ └── rest/ # Accept v0.3 REST requests +│ └── pom.xml +├── reference/ # Quarkus reference servers for v0.3 +│ ├── jsonrpc/ # Reference JSON-RPC server +│ │ └── pom.xml +│ ├── grpc/ # Reference gRPC server +│ │ └── pom.xml +│ └── rest/ # Reference REST server +│ └── pom.xml +└── tck/ # v0.3 conformance tests + └── pom.xml +``` + +### Java Package Convention + +All compat-0.3 code uses the `org.a2aproject.sdk.compat03` package root: + +- `org.a2aproject.sdk.compat03.spec` — v0.3 spec types +- `org.a2aproject.sdk.compat03.grpc` — generated proto classes +- `org.a2aproject.sdk.compat03.conversion` — conversion layer and mappers +- `org.a2aproject.sdk.compat03.client` — dedicated v0.3 client API +- `org.a2aproject.sdk.compat03.client.transport.{jsonrpc,grpc,rest}` — client transports +- `org.a2aproject.sdk.compat03.transport.{jsonrpc,grpc,rest}` — server transports +- `org.a2aproject.sdk.compat03.server.{apps,grpc,rest}.quarkus` — reference servers +- `org.a2aproject.sdk.compat03.tck` — conformance tests + +**Note**: During this implementation, the main codebase was migrated from `io.github.a2asdk` (groupId) and `io.a2a` (package) to `org.a2aproject.sdk` (both groupId and package) via PRs #750 and #786. + +--- + +## Conversion Layer Architecture + +### Core Component: `Convert_v0_3_To10RequestHandler` + +This is the central adapter that bridges v0.3 transport handlers and v1.0 server-common: + +**Responsibilities:** +- Convert v0.3 params → v1.0 params using mappers +- Delegate to v1.0 `RequestHandler` +- Convert v1.0 results → v0.3 results +- Handle streaming publishers with element-by-element conversion +- Map method name differences (e.g., `onSetTaskPushNotificationConfig` → `onCreateTaskPushNotificationConfig`) + +**Location**: `compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/Convert_v0_3_To10RequestHandler.java` + +### Mapper Organization + +Mappers are organized by function using MapStruct: + +| Category | Purpose | Examples | +|----------|---------|----------| +| **params/** | Convert v0.3 request params → v1.0 | `MessageSendParamsMapper_v0_3`, `TaskQueryParamsMapper_v0_3` | +| **domain/** | Convert core domain objects bidirectionally | `TaskMapper_v0_3`, `MessageMapper_v0_3`, `TaskStateMapper_v0_3` | +| **result/** | Convert v1.0 results → v0.3 | `ListTaskPushNotificationConfigsResultMapper_v0_3` | + +**Key Mappings:** + +| v1.0 Type | v0.3 Type | Notes | +|-----------|-----------|-------| +| `SendMessageConfiguration` | `SendMessageConfiguration_v0_3` | `return_immediately` ↔ `!blocking`, `task_push_notification_config` ↔ `push_notification` | +| `Task` | `Task_v0_3` | `CANCELED` ↔ `CANCELLED` | +| `TaskState.TASK_STATE_REJECTED` | `TaskState_v0_3.TASK_STATE_FAILED` | Map to FAILED + metadata `"original_state": "REJECTED"` | +| `Message` | `Message_v0_3` | Drop `reference_task_ids` for v0.3 | + +### Error Mapping + +The `ErrorConverter_v0_3` class centralizes error translation between v0.3 and v1.0: + +**v0.3 → v1.0 (receiving errors):** +- Extract `code` and `message` from v0.3 `A2AError_v0_3` +- Convert `data` (Object) to `details` (Map): if `data` is a Map, use directly; otherwise wrap as `{"data": value}` +- Instantiate correct v1.0 error class using `A2AErrorCodes.fromCode(code)` + +**v1.0 → v0.3 (sending errors):** +- Extract `code`, `message`, and `details` from v1.0 `A2AError` +- Convert `details` (Map) to `data` (Object) +- For v1.0-only error codes, produce generic error with same code/message + +**Location**: `compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/ErrorConverter_v0_3.java` + +--- + +## Test Infrastructure + +### Test-JAR Pattern + +The `server-conversion` module produces a test-jar containing shared test infrastructure: + +**Exported Classes:** +- `AbstractA2ARequestHandlerTest_v0_3` — Base test class with v1.0 backend setup +- `AbstractA2AServerServerTest_v0_3` — Integration test base for reference servers +- Test fixtures and utilities + +**Maven Configuration:** +```xml + + maven-jar-plugin + + + + test-jar + + + + +``` + +**Consumers:** +- `compat-0.3/transport/jsonrpc` — `JSONRPCHandlerTest_v0_3` +- `compat-0.3/transport/grpc` — `GrpcHandlerTest_v0_3` +- `compat-0.3/transport/rest` — `RestHandlerTest_v0_3` +- `compat-0.3/reference/{jsonrpc,grpc,rest}` — Integration tests + +### Test Coverage + +✅ **Complete:** +- Core transport handler tests (JSONRPC, gRPC, REST) +- Streaming tests (Flow.Publisher, SSE, gRPC server streaming) +- Error mapping tests +- Task state conversion tests +- Reference server integration tests + +🔲 **Deferred:** +- Push notification tests (depends on TestHttpClient porting) +- Test metadata classes (classpath scanning) + +--- + +## User Experience + +### Client: Talking to a v0.3 Agent + +**1. Add the compat client dependency:** + +```xml + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-client + + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-client-transport-jsonrpc + +``` + +**2. Check the agent card and choose the right client:** + +```java +AgentCard card = // ... fetch agent card from /.well-known/agent-card.json + +for (AgentInterface iface : card.supportedInterfaces()) { + if ("0.3".equals(iface.protocolVersion())) { + // Use the compat client for v0.3 agents + Client_v0_3 client = ClientBuilder_v0_3.forUrl(iface.url()) + .transport("JSONRPC") + .build(); + } else if ("1.0".equals(iface.protocolVersion())) { + // Use the standard client for v1.0 agents + Client client = ClientBuilder.forUrl(iface.url()) + .transport("JSONRPC") + .build(); + } +} +``` + +**3. Use the v0.3 client API:** + +`Client_v0_3` exposes only operations available in v0.3. Return types are v0.3 `org.a2aproject.sdk.compat03.spec` domain objects. + +### Server: Serving v0.3 Clients + +A server operator that wants to accept v0.3 clients: + +**1. Add the compat Maven dependency:** + +```xml + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-reference-jsonrpc + +``` + +**2. Provide a v0.3 AgentCard:** + +```java +@Produces @PublicAgentCard +public AgentCard_v0_3 agentCard() { + return AgentCard_v0_3.builder() + .name("My Agent") + .url("http://localhost:8081") + .preferredTransport("JSONRPC") + // ... rest of agent card + .build(); +} +``` + +**3. No changes to AgentExecutor:** + +The existing `AgentExecutor` implementation works unchanged. The compat reference module registers v0.3 transport endpoints via Quarkus CDI auto-discovery and delegates to the same `AgentExecutor` through the v1.0 server pipeline. + +### Server: Serving Both v0.3 and v1.0 (Deferred) + +**Status**: Architecture is in place but dual-version deployment pattern is not yet defined. + +**Remaining work:** +- Define CDI qualifier pattern to differentiate v0.3 and v1.0 beans +- Establish path prefix strategy (e.g., `/v0.3` for compat endpoints) +- Unified agent card production with multiple `AgentInterface` entries +- Integration testing for dual-version scenarios + +**Recommended approach:** +1. Use separate URLs per protocol version (e.g., `http://localhost:9999` for v1.0, `http://localhost:9999/v0.3` for v0.3) +2. Declare both in the v1.0 agent card with different `protocolVersion` values +3. Register both transport handlers via Quarkus CDI with path-based routing + +--- + +## Implementation Summary + +The implementation was completed in phases: + +### Phase 1: Foundation +- Set up module structure and POMs +- Port v0.3 spec types to `compat-0.3/spec` +- Generate v0.3 gRPC classes in `compat-0.3/spec-grpc` +- Apply `_v0_3` suffix naming convention + +### Phase 2: Conversion Layer +- Create `server-conversion` module +- Implement `Convert_v0_3_To10RequestHandler` +- Build MapStruct mappers (params, domain, result) +- Centralize error conversion in `ErrorConverter_v0_3` +- Export test infrastructure via test-jar + +### Phase 3: Transport Handlers +- Implement server-side transport handlers (JSONRPC, gRPC, REST) +- Wire each transport to `Convert_v0_3_To10RequestHandler` +- Test with v1.0 backend via `AbstractA2ARequestHandlerTest_v0_3` + +### Phase 4: Client +- Implement `Client_v0_3` API +- Build client transports (JSONRPC, gRPC, REST) +- Validate against v0.3 spec constraints + +### Phase 5: Reference Servers +- Port Quarkus reference servers (JSONRPC, gRPC, REST) +- Integrate with test infrastructure +- Run integration tests using v0.3 client against v0.3 reference servers + +### Phase 6: Testing & Validation +- Port transport handler tests (37+ tests across 3 transports) +- Port streaming tests (Flow.Publisher, SSE, gRPC) +- Port reference server tests (125+ integration tests passing) +- Enable TCK module + +--- + +## Key Differences from Original Plan + +1. **Conversion layer as separate module**: Original plan embedded mapping in `spec-grpc`; implementation uses dedicated `server-conversion` module with `Convert_v0_3_To10RequestHandler` + +2. **`_v0_3` suffix naming**: Not in original plan; adopted to eliminate IDE naming conflicts (233 out of 284 classes had conflicts) + +3. **No `reference/common` module**: Each reference server is standalone; no shared reference base + +4. **Test-jar pattern**: Test infrastructure exported from `server-conversion` module rather than reference common + +5. **Package migration during implementation**: The main codebase migrated from `io.a2a` to `org.a2aproject.sdk` while this work was in progress (PRs #750, #786) + +6. **Implementation order**: Test infrastructure built early; tests ported incrementally to validate conversion layer + +--- + +## Testing Strategy + +| Component | Test Type | Coverage | +|-----------|-----------|----------| +| Mappers | Unit tests | Round-trip conversion for every mapped type; edge cases (missing fields, v1.0-only features, REJECTED→FAILED) | +| `Convert_v0_3_To10RequestHandler` | Integration tests | Via transport handler tests using real v1.0 backend | +| Transport handlers | Unit + Integration | Handler-level tests + end-to-end via reference servers | +| Client transports | Unit tests | Mocked v0.3 endpoints | +| `Client_v0_3` | Unit tests | API coverage, absence of v1.0-only methods | +| Reference servers | Integration tests | Full request/response cycle with v0.3 client | +| TCK | Conformance tests | Protocol conformance against v0.3 spec | + +--- + +## Status + +✅ **Complete:** +- Module structure and POMs +- v0.3 spec types and gRPC generation +- Server conversion layer with all mappers +- Server-side transport handlers (JSONRPC, gRPC, REST) +- Client API and transports +- Reference servers (JSONRPC, gRPC, REST) +- Test infrastructure (test-jar pattern) +- Core integration tests (125+ passing) +- TCK module enabled + +🔲 **Deferred:** +- Dual v1.0/v0.3 server deployment pattern +- Push notification test porting (requires TestHttpClient) +- Test metadata classes (classpath scanning) + +🧹 **Nice-to-have cleanup:** +- Replace FQNs with imports (97 occurrences in 34 files) +- Unify AgentCard producers across reference modules +- Remove obsolete TODOs diff --git a/boms/extras/src/it/extras-usage-test/src/main/java/org/a2aproject/sdk/test/ExtrasBomVerifier.java b/boms/extras/src/it/extras-usage-test/src/main/java/org/a2aproject/sdk/test/ExtrasBomVerifier.java index 8357ce447..c5b727633 100644 --- a/boms/extras/src/it/extras-usage-test/src/main/java/org/a2aproject/sdk/test/ExtrasBomVerifier.java +++ b/boms/extras/src/it/extras-usage-test/src/main/java/org/a2aproject/sdk/test/ExtrasBomVerifier.java @@ -17,6 +17,7 @@ public class ExtrasBomVerifier extends DynamicBomVerifier { "tck/", // TCK test suite "tests/", // Integration tests "test-utils-docker/", // Test utilities for Docker-based tests + "compat-0.3/", // Compat 0.3 modules (part of SDK BOM, not extras BOM) "extras/queue-manager-replicated/tests-multi-instance/", // Test harness applications "extras/queue-manager-replicated/tests-single-instance/", // Test harness applications "extras/opentelemetry/integration-tests/" // Test harness applications diff --git a/boms/reference/src/it/reference-usage-test/src/main/java/org/a2aproject/sdk/test/ReferenceBomVerifier.java b/boms/reference/src/it/reference-usage-test/src/main/java/org/a2aproject/sdk/test/ReferenceBomVerifier.java index 6b20bb50e..d25473846 100644 --- a/boms/reference/src/it/reference-usage-test/src/main/java/org/a2aproject/sdk/test/ReferenceBomVerifier.java +++ b/boms/reference/src/it/reference-usage-test/src/main/java/org/a2aproject/sdk/test/ReferenceBomVerifier.java @@ -16,7 +16,8 @@ public class ReferenceBomVerifier extends DynamicBomVerifier { "examples/", // Example applications "tck/", // TCK test suite "tests/", // Integration tests - "test-utils-docker/" // Test utilities for Docker-based tests + "test-utils-docker/", // Test utilities for Docker-based tests + "compat-0.3/" // Compat 0.3 modules (part of SDK BOM, not reference BOM) // Note: reference/ is NOT in this list - we want to verify those classes load ); diff --git a/boms/sdk/pom.xml b/boms/sdk/pom.xml index d907539d9..0019ebc1d 100644 --- a/boms/sdk/pom.xml +++ b/boms/sdk/pom.xml @@ -108,6 +108,86 @@ ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec-grpc + ${project.version} + + + + + ${project.groupId} + a2a-java-sdk-compat-0.3-http-client + ${project.version} + + + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client-transport-spi + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client-transport-jsonrpc + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client-transport-grpc + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client-transport-rest + ${project.version} + + + + + ${project.groupId} + a2a-java-sdk-compat-0.3-transport-jsonrpc + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-transport-grpc + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-transport-rest + ${project.version} + + + + + ${project.groupId} + a2a-java-sdk-compat-0.3-reference-jsonrpc + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-reference-grpc + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-reference-rest + ${project.version} + + ${project.groupId} diff --git a/boms/sdk/src/it/sdk-usage-test/pom.xml b/boms/sdk/src/it/sdk-usage-test/pom.xml index 5da56e93e..3d158598b 100644 --- a/boms/sdk/src/it/sdk-usage-test/pom.xml +++ b/boms/sdk/src/it/sdk-usage-test/pom.xml @@ -103,6 +103,72 @@ a2a-java-sdk-transport-rest + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-spec + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-spec-grpc + + + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-http-client + + + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-client + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-client-transport-spi + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-client-transport-jsonrpc + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-client-transport-grpc + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-client-transport-rest + + + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-transport-jsonrpc + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-transport-grpc + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-transport-rest + + + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-reference-jsonrpc + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-reference-grpc + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-reference-rest + + org.slf4j diff --git a/boms/sdk/src/it/sdk-usage-test/src/main/java/org/a2aproject/sdk/test/SdkBomVerifier.java b/boms/sdk/src/it/sdk-usage-test/src/main/java/org/a2aproject/sdk/test/SdkBomVerifier.java index f69d70b85..7f0607b8d 100644 --- a/boms/sdk/src/it/sdk-usage-test/src/main/java/org/a2aproject/sdk/test/SdkBomVerifier.java +++ b/boms/sdk/src/it/sdk-usage-test/src/main/java/org/a2aproject/sdk/test/SdkBomVerifier.java @@ -15,6 +15,7 @@ public class SdkBomVerifier extends DynamicBomVerifier { "boms/", // BOM test modules themselves "examples/", // Example applications "tck/", // TCK test suite + "compat-0.3/tck/", // Compat 0.3 TCK (not yet enabled) "tests/", // Integration tests "test-utils-docker/" // Test utilities for Docker-based tests ); diff --git a/compat-0.3/client/base/pom.xml b/compat-0.3/client/base/pom.xml new file mode 100644 index 000000000..6fa0036ff --- /dev/null +++ b/compat-0.3/client/base/pom.xml @@ -0,0 +1,84 @@ + + + 4.0.0 + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-parent + 1.0.0.Beta2-SNAPSHOT + ../.. + + a2a-java-sdk-compat-0.3-client + + jar + + Java SDK A2A Compat 0.3 Client + Java SDK for the Agent2Agent Protocol (A2A) - Client + + + + ${project.groupId} + a2a-java-sdk-compat-0.3-http-client + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client-transport-spi + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client-transport-jsonrpc + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client-transport-grpc + test + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client-transport-rest + test + + + ${project.groupId} + a2a-java-sdk-common + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec-grpc + test + + + org.junit.jupiter + junit-jupiter-api + test + + + + org.mock-server + mockserver-netty + test + + + org.slf4j + slf4j-jdk14 + test + + + io.grpc + grpc-testing + test + + + io.grpc + grpc-inprocess + test + + + + \ No newline at end of file diff --git a/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/A2A_v0_3.java b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/A2A_v0_3.java new file mode 100644 index 000000000..2be60b7ad --- /dev/null +++ b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/A2A_v0_3.java @@ -0,0 +1,188 @@ +package org.a2aproject.sdk.compat03; + +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import org.a2aproject.sdk.compat03.client.http.A2ACardResolver_v0_3; +import org.a2aproject.sdk.compat03.client.http.A2AHttpClient_v0_3; +import org.a2aproject.sdk.compat03.client.http.JdkA2AHttpClient_v0_3; +import org.a2aproject.sdk.compat03.spec.A2AClientError_v0_3; +import org.a2aproject.sdk.compat03.spec.A2AClientJSONError_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentCard_v0_3; +import org.a2aproject.sdk.compat03.spec.Message_v0_3; +import org.a2aproject.sdk.compat03.spec.Part_v0_3; +import org.a2aproject.sdk.compat03.spec.TextPart_v0_3; + + +/** + * Constants and utility methods related to the A2A protocol. + */ +public class A2A_v0_3 { + + /** + * Convert the given text to a user message. + * + * @param text the message text + * @return the user message + */ + public static Message_v0_3 toUserMessage(String text) { + return toMessage(text, Message_v0_3.Role.USER, null); + } + + /** + * Convert the given text to a user message. + * + * @param text the message text + * @param messageId the message ID to use + * @return the user message + */ + public static Message_v0_3 toUserMessage(String text, String messageId) { + return toMessage(text, Message_v0_3.Role.USER, messageId); + } + + /** + * Convert the given text to an agent message. + * + * @param text the message text + * @return the agent message + */ + public static Message_v0_3 toAgentMessage(String text) { + return toMessage(text, Message_v0_3.Role.AGENT, null); + } + + /** + * Convert the given text to an agent message. + * + * @param text the message text + * @param messageId the message ID to use + * @return the agent message + */ + public static Message_v0_3 toAgentMessage(String text, String messageId) { + return toMessage(text, Message_v0_3.Role.AGENT, messageId); + } + + /** + * Create a user message with text content and optional context and task IDs. + * + * @param text the message text (required) + * @param contextId the context ID to use (optional) + * @param taskId the task ID to use (optional) + * @return the user message + */ + public static Message_v0_3 createUserTextMessage(String text, String contextId, String taskId) { + return toMessage(text, Message_v0_3.Role.USER, null, contextId, taskId); + } + + /** + * Create an agent message with text content and optional context and task IDs. + * + * @param text the message text (required) + * @param contextId the context ID to use (optional) + * @param taskId the task ID to use (optional) + * @return the agent message + */ + public static Message_v0_3 createAgentTextMessage(String text, String contextId, String taskId) { + return toMessage(text, Message_v0_3.Role.AGENT, null, contextId, taskId); + } + + /** + * Create an agent message with custom parts and optional context and task IDs. + * + * @param parts the message parts (required) + * @param contextId the context ID to use (optional) + * @param taskId the task ID to use (optional) + * @return the agent message + */ + public static Message_v0_3 createAgentPartsMessage(List> parts, String contextId, String taskId) { + if (parts == null || parts.isEmpty()) { + throw new IllegalArgumentException("Parts cannot be null or empty"); + } + return toMessage(parts, Message_v0_3.Role.AGENT, null, contextId, taskId); + } + + private static Message_v0_3 toMessage(String text, Message_v0_3.Role role, String messageId) { + return toMessage(text, role, messageId, null, null); + } + + private static Message_v0_3 toMessage(String text, Message_v0_3.Role role, String messageId, String contextId, String taskId) { + Message_v0_3.Builder messageBuilder = new Message_v0_3.Builder() + .role(role) + .parts(Collections.singletonList(new TextPart_v0_3(text))) + .contextId(contextId) + .taskId(taskId); + if (messageId != null) { + messageBuilder.messageId(messageId); + } + return messageBuilder.build(); + } + + private static Message_v0_3 toMessage(List> parts, Message_v0_3.Role role, String messageId, String contextId, String taskId) { + Message_v0_3.Builder messageBuilder = new Message_v0_3.Builder() + .role(role) + .parts(parts) + .contextId(contextId) + .taskId(taskId); + if (messageId != null) { + messageBuilder.messageId(messageId); + } + return messageBuilder.build(); + } + + /** + * Get the agent card for an A2A agent. + * + * @param agentUrl the base URL for the agent whose agent card we want to retrieve + * @return the agent card + * @throws A2AClientError_v0_3 If an HTTP error occurs fetching the card + * @throws A2AClientJSONError_v0_3 If the response body cannot be decoded as JSON or validated against the AgentCard schema + */ + public static AgentCard_v0_3 getAgentCard(String agentUrl) throws A2AClientError_v0_3, A2AClientJSONError_v0_3 { + return getAgentCard(new JdkA2AHttpClient_v0_3(), agentUrl); + } + + /** + * Get the agent card for an A2A agent. + * + * @param httpClient the http client to use + * @param agentUrl the base URL for the agent whose agent card we want to retrieve + * @return the agent card + * @throws A2AClientError_v0_3 If an HTTP error occurs fetching the card + * @throws A2AClientJSONError_v0_3 If the response body cannot be decoded as JSON or validated against the AgentCard schema + */ + public static AgentCard_v0_3 getAgentCard(A2AHttpClient_v0_3 httpClient, String agentUrl) throws A2AClientError_v0_3, A2AClientJSONError_v0_3 { + return getAgentCard(httpClient, agentUrl, null, null); + } + + /** + * Get the agent card for an A2A agent. + * + * @param agentUrl the base URL for the agent whose agent card we want to retrieve + * @param relativeCardPath optional path to the agent card endpoint relative to the base + * agent URL, defaults to ".well-known/agent-card.json" + * @param authHeaders the HTTP authentication headers to use + * @return the agent card + * @throws A2AClientError_v0_3 If an HTTP error occurs fetching the card + * @throws A2AClientJSONError_v0_3 If the response body cannot be decoded as JSON or validated against the AgentCard schema + */ + public static AgentCard_v0_3 getAgentCard(String agentUrl, String relativeCardPath, Map authHeaders) throws A2AClientError_v0_3, A2AClientJSONError_v0_3 { + return getAgentCard(new JdkA2AHttpClient_v0_3(), agentUrl, relativeCardPath, authHeaders); + } + + /** + * Get the agent card for an A2A agent. + * + * @param httpClient the http client to use + * @param agentUrl the base URL for the agent whose agent card we want to retrieve + * @param relativeCardPath optional path to the agent card endpoint relative to the base + * agent URL, defaults to ".well-known/agent-card.json" + * @param authHeaders the HTTP authentication headers to use + * @return the agent card + * @throws A2AClientError_v0_3 If an HTTP error occurs fetching the card + * @throws A2AClientJSONError_v0_3 If the response body cannot be decoded as JSON or validated against the AgentCard schema + */ + public static AgentCard_v0_3 getAgentCard(A2AHttpClient_v0_3 httpClient, String agentUrl, String relativeCardPath, Map authHeaders) throws A2AClientError_v0_3, A2AClientJSONError_v0_3 { + A2ACardResolver_v0_3 resolver = new A2ACardResolver_v0_3(httpClient, agentUrl, relativeCardPath, authHeaders); + return resolver.getAgentCard(); + } +} diff --git a/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/AbstractClient_v0_3.java b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/AbstractClient_v0_3.java new file mode 100644 index 000000000..d27372f69 --- /dev/null +++ b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/AbstractClient_v0_3.java @@ -0,0 +1,392 @@ +package org.a2aproject.sdk.compat03.client; + +import static org.a2aproject.sdk.util.Assert.checkNotNullParam; + +import java.util.List; +import java.util.Map; +import java.util.function.BiConsumer; +import java.util.function.Consumer; + +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.ClientCallContext_v0_3; +import org.a2aproject.sdk.compat03.spec.A2AClientException_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentCard_v0_3; +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigParams_v0_3; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigParams_v0_3; +import org.a2aproject.sdk.compat03.spec.ListTaskPushNotificationConfigParams_v0_3; +import org.a2aproject.sdk.compat03.spec.Message_v0_3; +import org.a2aproject.sdk.compat03.spec.PushNotificationConfig_v0_3; +import org.a2aproject.sdk.compat03.spec.Task_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskIdParams_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskQueryParams_v0_3; +import org.jspecify.annotations.NonNull; +import org.jspecify.annotations.Nullable; + +/** + * Abstract class representing an A2A client. Provides a standard set + * of methods for interacting with an A2A agent, regardless of the underlying + * transport protocol. It supports sending messages, managing tasks, and + * handling event streams. + */ +public abstract class AbstractClient_v0_3 { + + private final List> consumers; + private final @Nullable Consumer streamingErrorHandler; + + public AbstractClient_v0_3(List> consumers) { + this(consumers, null); + } + + public AbstractClient_v0_3(@NonNull List> consumers, @Nullable Consumer streamingErrorHandler) { + checkNotNullParam("consumers", consumers); + this.consumers = consumers; + this.streamingErrorHandler = streamingErrorHandler; + } + + /** + * Send a message to the remote agent. This method will automatically use + * the streaming or non-streaming approach as determined by the server's + * agent card and the client configuration. The configured client consumers + * will be used to handle messages, tasks, and update events received + * from the remote agent. The configured streaming error handler will be used + * if an error occurs during streaming. The configured client push notification + * configuration will get used for streaming. + * + * @param request the message + * @throws A2AClientException_v0_3 if sending the message fails for any reason + */ + public void sendMessage(Message_v0_3 request) throws A2AClientException_v0_3 { + sendMessage(request, null); + } + + /** + * Send a message to the remote agent. This method will automatically use + * the streaming or non-streaming approach as determined by the server's + * agent card and the client configuration. The configured client consumers + * will be used to handle messages, tasks, and update events received + * from the remote agent. The configured streaming error handler will be used + * if an error occurs during streaming. The configured client push notification + * configuration will get used for streaming. + * + * @param request the message + * @param context optional client call context for the request (may be {@code null}) + * @throws A2AClientException_v0_3 if sending the message fails for any reason + */ + public abstract void sendMessage(Message_v0_3 request, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3; + + /** + * Send a message to the remote agent. This method will automatically use + * the streaming or non-streaming approach as determined by the server's + * agent card and the client configuration. The specified client consumers + * will be used to handle messages, tasks, and update events received + * from the remote agent. The specified streaming error handler will be used + * if an error occurs during streaming. The configured client push notification + * configuration will get used for streaming. + * + * @param request the message + * @param consumers a list of consumers to pass responses from the remote agent to + * @param streamingErrorHandler an error handler that should be used for the streaming case if an error occurs + * @throws A2AClientException_v0_3 if sending the message fails for any reason + */ + public void sendMessage(Message_v0_3 request, + List> consumers, + Consumer streamingErrorHandler) throws A2AClientException_v0_3 { + sendMessage(request, consumers, streamingErrorHandler, null); + } + + /** + * Send a message to the remote agent. This method will automatically use + * the streaming or non-streaming approach as determined by the server's + * agent card and the client configuration. The specified client consumers + * will be used to handle messages, tasks, and update events received + * from the remote agent. The specified streaming error handler will be used + * if an error occurs during streaming. The configured client push notification + * configuration will get used for streaming. + * + * @param request the message + * @param consumers a list of consumers to pass responses from the remote agent to + * @param streamingErrorHandler an error handler that should be used for the streaming case if an error occurs + * @param context optional client call context for the request (may be {@code null}) + * @throws A2AClientException_v0_3 if sending the message fails for any reason + */ + public abstract void sendMessage(Message_v0_3 request, + List> consumers, + Consumer streamingErrorHandler, + @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3; + + /** + * Send a message to the remote agent. This method will automatically use + * the streaming or non-streaming approach as determined by the server's + * agent card and the client configuration. The configured client consumers + * will be used to handle messages, tasks, and update events received from + * the remote agent. The configured streaming error handler will be used + * if an error occurs during streaming. + * + * @param request the message + * @param pushNotificationConfiguration the push notification configuration that should be + * used if the streaming approach is used + * @param metadata the optional metadata to include when sending the message + * @throws A2AClientException_v0_3 if sending the message fails for any reason + */ + public void sendMessage(Message_v0_3 request, PushNotificationConfig_v0_3 pushNotificationConfiguration, + Map metadata) throws A2AClientException_v0_3 { + sendMessage(request, pushNotificationConfiguration, metadata, null); + } + + /** + * Send a message to the remote agent. This method will automatically use + * the streaming or non-streaming approach as determined by the server's + * agent card and the client configuration. The configured client consumers + * will be used to handle messages, tasks, and update events received from + * the remote agent. The configured streaming error handler will be used + * if an error occurs during streaming. + * + * @param request the message + * @param pushNotificationConfiguration the push notification configuration that should be + * used if the streaming approach is used + * @param metadata the optional metadata to include when sending the message + * @param context optional client call context for the request (may be {@code null}) + * @throws A2AClientException_v0_3 if sending the message fails for any reason + */ + public abstract void sendMessage(Message_v0_3 request, PushNotificationConfig_v0_3 pushNotificationConfiguration, + Map metadata, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3; + + /** + * Retrieve the current state and history of a specific task. + * + * @param request the task query parameters specifying which task to retrieve + * @return the task + * @throws A2AClientException_v0_3 if retrieving the task fails for any reason + */ + public Task_v0_3 getTask(TaskQueryParams_v0_3 request) throws A2AClientException_v0_3 { + return getTask(request, null); + } + + /** + * Retrieve the current state and history of a specific task. + * + * @param request the task query parameters specifying which task to retrieve + * @param context optional client call context for the request (may be {@code null}) + * @return the task + * @throws A2AClientException_v0_3 if retrieving the task fails for any reason + */ + public abstract Task_v0_3 getTask(TaskQueryParams_v0_3 request, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3; + + /** + * Request the agent to cancel a specific task. + * + * @param request the task ID parameters specifying which task to cancel + * @return the cancelled task + * @throws A2AClientException_v0_3 if cancelling the task fails for any reason + */ + public Task_v0_3 cancelTask(TaskIdParams_v0_3 request) throws A2AClientException_v0_3 { + return cancelTask(request, null); + } + + /** + * Request the agent to cancel a specific task. + * + * @param request the task ID parameters specifying which task to cancel + * @param context optional client call context for the request (may be {@code null}) + * @return the cancelled task + * @throws A2AClientException_v0_3 if cancelling the task fails for any reason + */ + public abstract Task_v0_3 cancelTask(TaskIdParams_v0_3 request, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3; + + /** + * Set or update the push notification configuration for a specific task. + * + * @param request the push notification configuration to set for the task + * @return the configured TaskPushNotificationConfig + * @throws A2AClientException_v0_3 if setting the task push notification configuration fails for any reason + */ + public TaskPushNotificationConfig_v0_3 setTaskPushNotificationConfiguration( + TaskPushNotificationConfig_v0_3 request) throws A2AClientException_v0_3 { + return setTaskPushNotificationConfiguration(request, null); + } + + /** + * Set or update the push notification configuration for a specific task. + * + * @param request the push notification configuration to set for the task + * @param context optional client call context for the request (may be {@code null}) + * @return the configured TaskPushNotificationConfig + * @throws A2AClientException_v0_3 if setting the task push notification configuration fails for any reason + */ + public abstract TaskPushNotificationConfig_v0_3 setTaskPushNotificationConfiguration( + TaskPushNotificationConfig_v0_3 request, + @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3; + + /** + * Retrieve the push notification configuration for a specific task. + * + * @param request the parameters specifying which task's notification config to retrieve + * @return the task push notification config + * @throws A2AClientException_v0_3 if getting the task push notification config fails for any reason + */ + public TaskPushNotificationConfig_v0_3 getTaskPushNotificationConfiguration( + GetTaskPushNotificationConfigParams_v0_3 request) throws A2AClientException_v0_3 { + return getTaskPushNotificationConfiguration(request, null); + } + + /** + * Retrieve the push notification configuration for a specific task. + * + * @param request the parameters specifying which task's notification config to retrieve + * @param context optional client call context for the request (may be {@code null}) + * @return the task push notification config + * @throws A2AClientException_v0_3 if getting the task push notification config fails for any reason + */ + public abstract TaskPushNotificationConfig_v0_3 getTaskPushNotificationConfiguration( + GetTaskPushNotificationConfigParams_v0_3 request, + @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3; + + /** + * Retrieve the list of push notification configurations for a specific task. + * + * @param request the parameters specifying which task's notification configs to retrieve + * @return the list of task push notification configs + * @throws A2AClientException_v0_3 if getting the task push notification configs fails for any reason + */ + public List listTaskPushNotificationConfigurations( + ListTaskPushNotificationConfigParams_v0_3 request) throws A2AClientException_v0_3 { + return listTaskPushNotificationConfigurations(request, null); + } + + /** + * Retrieve the list of push notification configurations for a specific task. + * + * @param request the parameters specifying which task's notification configs to retrieve + * @param context optional client call context for the request (may be {@code null}) + * @return the list of task push notification configs + * @throws A2AClientException_v0_3 if getting the task push notification configs fails for any reason + */ + public abstract List listTaskPushNotificationConfigurations( + ListTaskPushNotificationConfigParams_v0_3 request, + @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3; + + /** + * Delete the list of push notification configurations for a specific task. + * + * @param request the parameters specifying which task's notification configs to delete + * @throws A2AClientException_v0_3 if deleting the task push notification configs fails for any reason + */ + public void deleteTaskPushNotificationConfigurations( + DeleteTaskPushNotificationConfigParams_v0_3 request) throws A2AClientException_v0_3 { + deleteTaskPushNotificationConfigurations(request, null); + } + + /** + * Delete the list of push notification configurations for a specific task. + * + * @param request the parameters specifying which task's notification configs to delete + * @param context optional client call context for the request (may be {@code null}) + * @throws A2AClientException_v0_3 if deleting the task push notification configs fails for any reason + */ + public abstract void deleteTaskPushNotificationConfigurations( + DeleteTaskPushNotificationConfigParams_v0_3 request, + @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3; + + /** + * Resubscribe to a task's event stream. + * This is only available if both the client and server support streaming. + * The configured client consumers will be used to handle messages, tasks, + * and update events received from the remote agent. The configured streaming + * error handler will be used if an error occurs during streaming. + * + * @param request the parameters specifying which task's notification configs to delete + * @throws A2AClientException_v0_3 if resubscribing fails for any reason + */ + public void resubscribe(TaskIdParams_v0_3 request) throws A2AClientException_v0_3 { + resubscribe(request, null); + } + + /** + * Resubscribe to a task's event stream. + * This is only available if both the client and server support streaming. + * The configured client consumers will be used to handle messages, tasks, + * and update events received from the remote agent. The configured streaming + * error handler will be used if an error occurs during streaming. + * + * @param request the parameters specifying which task's notification configs to delete + * @param context optional client call context for the request (may be {@code null}) + * @throws A2AClientException_v0_3 if resubscribing fails for any reason + */ + public abstract void resubscribe(TaskIdParams_v0_3 request, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3; + + /** + * Resubscribe to a task's event stream. + * This is only available if both the client and server support streaming. + * The specified client consumers will be used to handle messages, tasks, and + * update events received from the remote agent. The specified streaming error + * handler will be used if an error occurs during streaming. + * + * @param request the parameters specifying which task's notification configs to delete + * @param consumers a list of consumers to pass responses from the remote agent to + * @param streamingErrorHandler an error handler that should be used for the streaming case if an error occurs + * @throws A2AClientException_v0_3 if resubscribing fails for any reason + */ + public void resubscribe(TaskIdParams_v0_3 request, List> consumers, + Consumer streamingErrorHandler) throws A2AClientException_v0_3 { + resubscribe(request, consumers, streamingErrorHandler, null); + } + + /** + * Resubscribe to a task's event stream. + * This is only available if both the client and server support streaming. + * The specified client consumers will be used to handle messages, tasks, and + * update events received from the remote agent. The specified streaming error + * handler will be used if an error occurs during streaming. + * + * @param request the parameters specifying which task's notification configs to delete + * @param consumers a list of consumers to pass responses from the remote agent to + * @param streamingErrorHandler an error handler that should be used for the streaming case if an error occurs + * @param context optional client call context for the request (may be {@code null}) + * @throws A2AClientException_v0_3 if resubscribing fails for any reason + */ + public abstract void resubscribe(TaskIdParams_v0_3 request, List> consumers, + Consumer streamingErrorHandler, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3; + + /** + * Retrieve the AgentCard. + * + * @return the AgentCard + * @throws A2AClientException_v0_3 if retrieving the agent card fails for any reason + */ + public AgentCard_v0_3 getAgentCard() throws A2AClientException_v0_3 { + return getAgentCard(null); + } + + /** + * Retrieve the AgentCard. + * + * @param context optional client call context for the request (may be {@code null}) + * @return the AgentCard + * @throws A2AClientException_v0_3 if retrieving the agent card fails for any reason + */ + public abstract AgentCard_v0_3 getAgentCard(@Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3; + + /** + * Close the transport and release any associated resources. + */ + public abstract void close(); + + /** + * Process the event using all configured consumers. + */ + void consume(ClientEvent_v0_3 clientEventOrMessage, AgentCard_v0_3 agentCard) { + for (BiConsumer consumer : consumers) { + consumer.accept(clientEventOrMessage, agentCard); + } + } + + /** + * Get the error handler that should be used during streaming. + * + * @return the streaming error handler + */ + public @Nullable Consumer getStreamingErrorHandler() { + return streamingErrorHandler; + } + +} \ No newline at end of file diff --git a/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/ClientBuilder_v0_3.java b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/ClientBuilder_v0_3.java new file mode 100644 index 000000000..b2fe661c2 --- /dev/null +++ b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/ClientBuilder_v0_3.java @@ -0,0 +1,169 @@ +package org.a2aproject.sdk.compat03.client; + +import org.a2aproject.sdk.compat03.client.config.ClientConfig_v0_3; +import org.a2aproject.sdk.compat03.client.transport.spi.ClientTransport_v0_3; +import org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportConfig_v0_3; +import org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportConfigBuilder_v0_3; +import org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportProvider_v0_3; +import org.a2aproject.sdk.compat03.spec.A2AClientException_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentCard_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentInterface_v0_3; +import org.a2aproject.sdk.compat03.spec.TransportProtocol_v0_3; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.ServiceLoader; +import java.util.function.BiConsumer; +import java.util.function.Consumer; +import org.jspecify.annotations.NonNull; +import org.jspecify.annotations.Nullable; + +public class ClientBuilder_v0_3 { + + private static final Map>> transportProviderRegistry = new HashMap<>(); + private static final Map, String> transportProtocolMapping = new HashMap<>(); + + static { + ServiceLoader loader = ServiceLoader.load(ClientTransportProvider_v0_3.class); + for (ClientTransportProvider_v0_3 transport : loader) { + transportProviderRegistry.put(transport.getTransportProtocol(), transport); + transportProtocolMapping.put(transport.getTransportProtocolClass(), transport.getTransportProtocol()); + } + } + + private final AgentCard_v0_3 agentCard; + + private final List> consumers = new ArrayList<>(); + private @Nullable Consumer streamErrorHandler; + private ClientConfig_v0_3 clientConfig = new ClientConfig_v0_3.Builder().build(); + + private final Map, ClientTransportConfig_v0_3> clientTransports = new LinkedHashMap<>(); + + ClientBuilder_v0_3(@NonNull AgentCard_v0_3 agentCard) { + this.agentCard = agentCard; + } + + public ClientBuilder_v0_3 withTransport(Class clazz, ClientTransportConfigBuilder_v0_3, ?> configBuilder) { + return withTransport(clazz, configBuilder.build()); + } + + public ClientBuilder_v0_3 withTransport(Class clazz, ClientTransportConfig_v0_3 config) { + clientTransports.put(clazz, config); + + return this; + } + + public ClientBuilder_v0_3 addConsumer(BiConsumer consumer) { + this.consumers.add(consumer); + return this; + } + + public ClientBuilder_v0_3 addConsumers(List> consumers) { + this.consumers.addAll(consumers); + return this; + } + + public ClientBuilder_v0_3 streamingErrorHandler(Consumer streamErrorHandler) { + this.streamErrorHandler = streamErrorHandler; + return this; + } + + public ClientBuilder_v0_3 clientConfig(@NonNull ClientConfig_v0_3 clientConfig) { + this.clientConfig = clientConfig; + return this; + } + + public Client_v0_3 build() throws A2AClientException_v0_3 { + if (this.clientConfig == null) { + this.clientConfig = new ClientConfig_v0_3.Builder().build(); + } + + ClientTransport_v0_3 clientTransport = buildClientTransport(); + + return new Client_v0_3(agentCard, clientConfig, clientTransport, consumers, streamErrorHandler); + } + + @SuppressWarnings("unchecked") + private ClientTransport_v0_3 buildClientTransport() throws A2AClientException_v0_3 { + // Get the preferred transport + AgentInterface_v0_3 agentInterface = findBestClientTransport(); + + // Get the transport provider associated with the protocol + ClientTransportProvider_v0_3 clientTransportProvider = transportProviderRegistry.get(agentInterface.transport()); + if (clientTransportProvider == null) { + throw new A2AClientException_v0_3("No client available for " + agentInterface.transport()); + } + Class transportProtocolClass = clientTransportProvider.getTransportProtocolClass(); + + // Retrieve the configuration associated with the preferred transport + ClientTransportConfig_v0_3 clientTransportConfig = clientTransports.get(transportProtocolClass); + + if (clientTransportConfig == null) { + throw new A2AClientException_v0_3("Missing required TransportConfig for " + agentInterface.transport()); + } + + return clientTransportProvider.create(clientTransportConfig, agentCard, agentInterface.url()); + } + + private Map getServerPreferredTransports() { + Map serverPreferredTransports = new LinkedHashMap<>(); + serverPreferredTransports.put(agentCard.preferredTransport(), agentCard.url()); + if (agentCard.additionalInterfaces() != null) { + for (AgentInterface_v0_3 agentInterface : agentCard.additionalInterfaces()) { + serverPreferredTransports.putIfAbsent(agentInterface.transport(), agentInterface.url()); + } + } + return serverPreferredTransports; + } + + private List getClientPreferredTransports() { + List supportedClientTransports = new ArrayList<>(); + + if (clientTransports.isEmpty()) { + // default to JSONRPC if not specified + supportedClientTransports.add(TransportProtocol_v0_3.JSONRPC.asString()); + } else { + clientTransports.forEach((aClass, clientTransportConfig) -> supportedClientTransports.add(transportProtocolMapping.get(aClass))); + } + return supportedClientTransports; + } + + private AgentInterface_v0_3 findBestClientTransport() throws A2AClientException_v0_3 { + // Retrieve transport supported by the A2A server + Map serverPreferredTransports = getServerPreferredTransports(); + + // Retrieve transport configured for this client (using withTransport methods) + List clientPreferredTransports = getClientPreferredTransports(); + + String transportProtocol = null; + String transportUrl = null; + if (clientConfig.isUseClientPreference()) { + for (String clientPreferredTransport : clientPreferredTransports) { + if (serverPreferredTransports.containsKey(clientPreferredTransport)) { + transportProtocol = clientPreferredTransport; + transportUrl = serverPreferredTransports.get(transportProtocol); + break; + } + } + } else { + for (Map.Entry transport : serverPreferredTransports.entrySet()) { + if (clientPreferredTransports.contains(transport.getKey())) { + transportProtocol = transport.getKey(); + transportUrl = transport.getValue(); + break; + } + } + } + if (transportProtocol == null || transportUrl == null) { + throw new A2AClientException_v0_3("No compatible transport found"); + } + if (! transportProviderRegistry.containsKey(transportProtocol)) { + throw new A2AClientException_v0_3("No client available for " + transportProtocol); + } + + return new AgentInterface_v0_3(transportProtocol, transportUrl); + } +} diff --git a/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/ClientEvent_v0_3.java b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/ClientEvent_v0_3.java new file mode 100644 index 000000000..498814a56 --- /dev/null +++ b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/ClientEvent_v0_3.java @@ -0,0 +1,4 @@ +package org.a2aproject.sdk.compat03.client; + +public sealed interface ClientEvent_v0_3 permits MessageEvent_v0_3, TaskEvent_v0_3, TaskUpdateEvent_v0_3 { +} diff --git a/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/ClientTaskManager_v0_3.java b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/ClientTaskManager_v0_3.java new file mode 100644 index 000000000..0a29a0aa6 --- /dev/null +++ b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/ClientTaskManager_v0_3.java @@ -0,0 +1,139 @@ +package org.a2aproject.sdk.compat03.client; + +import static org.a2aproject.sdk.compat03.util.Utils_v0_3.appendArtifactToTask; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.a2aproject.sdk.compat03.spec.A2AClientError_v0_3; +import org.a2aproject.sdk.compat03.spec.A2AClientInvalidArgsError_v0_3; +import org.a2aproject.sdk.compat03.spec.A2AClientInvalidStateError_v0_3; +import org.a2aproject.sdk.compat03.spec.Message_v0_3; +import org.a2aproject.sdk.compat03.spec.Task_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskArtifactUpdateEvent_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskState_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskStatus_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskStatusUpdateEvent_v0_3; +import org.jspecify.annotations.Nullable; + +/** + * Helps manage a task's lifecycle during the execution of a request. + * Responsible for retrieving, saving, and updating the task based on + * events received from the agent. + */ +public class ClientTaskManager_v0_3 { + + private @Nullable Task_v0_3 currentTask; + private @Nullable String taskId; + private @Nullable String contextId; + + public ClientTaskManager_v0_3() { + this.currentTask = null; + this.taskId = null; + this.contextId = null; + } + + public Task_v0_3 getCurrentTask() throws A2AClientInvalidStateError_v0_3 { + if (currentTask == null) { + throw new A2AClientInvalidStateError_v0_3("No current task"); + } + return currentTask; + } + + public Task_v0_3 saveTaskEvent(Task_v0_3 task) throws A2AClientInvalidArgsError_v0_3 { + if (currentTask != null) { + throw new A2AClientInvalidArgsError_v0_3("Task is already set, create new manager for new tasks."); + } + saveTask(task); + return task; + } + + public Task_v0_3 saveTaskEvent(TaskStatusUpdateEvent_v0_3 taskStatusUpdateEvent) throws A2AClientError_v0_3 { + if (taskId == null) { + taskId = taskStatusUpdateEvent.getTaskId(); + } + if (contextId == null) { + contextId = taskStatusUpdateEvent.getContextId(); + } + Task_v0_3 task = currentTask; + if (task == null) { + task = new Task_v0_3.Builder() + .status(new TaskStatus_v0_3(TaskState_v0_3.UNKNOWN)) + .id(taskId) + .contextId(contextId == null ? "" : contextId) + .build(); + } + + Task_v0_3.Builder taskBuilder = new Task_v0_3.Builder(task); + if (taskStatusUpdateEvent.getStatus().message() != null) { + if (task.getHistory() == null) { + taskBuilder.history(taskStatusUpdateEvent.getStatus().message()); + } else { + List history = new ArrayList<>(task.getHistory()); + history.add(taskStatusUpdateEvent.getStatus().message()); + taskBuilder.history(history); + } + } + if (taskStatusUpdateEvent.getMetadata() != null) { + Map newMetadata = task.getMetadata() != null ? new HashMap<>(task.getMetadata()) : new HashMap<>(); + newMetadata.putAll(taskStatusUpdateEvent.getMetadata()); + taskBuilder.metadata(newMetadata); + } + taskBuilder.status(taskStatusUpdateEvent.getStatus()); + currentTask = taskBuilder.build(); + return currentTask; + } + + public Task_v0_3 saveTaskEvent(TaskArtifactUpdateEvent_v0_3 taskArtifactUpdateEvent) { + if (taskId == null) { + taskId = taskArtifactUpdateEvent.getTaskId(); + } + if (contextId == null) { + contextId = taskArtifactUpdateEvent.getContextId(); + } + Task_v0_3 task = currentTask; + if (task == null) { + task = new Task_v0_3.Builder() + .status(new TaskStatus_v0_3(TaskState_v0_3.UNKNOWN)) + .id(taskId) + .contextId(contextId == null ? "" : contextId) + .build(); + } + currentTask = appendArtifactToTask(task, taskArtifactUpdateEvent, taskId); + return currentTask; + } + + /** + * Update a task by adding a message to its history. If the task has a message in its current status, + * that message is moved to the history first. + * + * @param message the new message to add to the history + * @param task the task to update + * @return the updated task + */ + public Task_v0_3 updateWithMessage(Message_v0_3 message, Task_v0_3 task) { + Task_v0_3.Builder taskBuilder = new Task_v0_3.Builder(task); + List history = task.getHistory(); + if (history == null) { + history = new ArrayList<>(); + } + if (task.getStatus().message() != null) { + history.add(task.getStatus().message()); + taskBuilder.status(new TaskStatus_v0_3(task.getStatus().state(), null, task.getStatus().timestamp())); + } + history.add(message); + taskBuilder.history(history); + currentTask = taskBuilder.build(); + return currentTask; + } + + private void saveTask(Task_v0_3 task) { + currentTask = task; + if (taskId == null) { + taskId = currentTask.getId(); + contextId = currentTask.getContextId(); + } + } +} \ No newline at end of file diff --git a/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/Client_v0_3.java b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/Client_v0_3.java new file mode 100644 index 000000000..d264326d2 --- /dev/null +++ b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/Client_v0_3.java @@ -0,0 +1,243 @@ +package org.a2aproject.sdk.compat03.client; + +import java.util.List; +import java.util.Map; +import java.util.function.BiConsumer; +import java.util.function.Consumer; + +import org.a2aproject.sdk.compat03.client.config.ClientConfig_v0_3; +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.ClientCallContext_v0_3; +import org.a2aproject.sdk.compat03.client.transport.spi.ClientTransport_v0_3; +import org.a2aproject.sdk.compat03.spec.A2AClientError_v0_3; +import org.a2aproject.sdk.compat03.spec.A2AClientException_v0_3; +import org.a2aproject.sdk.compat03.spec.A2AClientInvalidStateError_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentCard_v0_3; +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigParams_v0_3; +import org.a2aproject.sdk.compat03.spec.EventKind_v0_3; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigParams_v0_3; +import org.a2aproject.sdk.compat03.spec.ListTaskPushNotificationConfigParams_v0_3; +import org.a2aproject.sdk.compat03.spec.Message_v0_3; +import org.a2aproject.sdk.compat03.spec.MessageSendConfiguration_v0_3; +import org.a2aproject.sdk.compat03.spec.MessageSendParams_v0_3; +import org.a2aproject.sdk.compat03.spec.PushNotificationConfig_v0_3; +import org.a2aproject.sdk.compat03.spec.StreamingEventKind_v0_3; +import org.a2aproject.sdk.compat03.spec.Task_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskArtifactUpdateEvent_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskIdParams_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskQueryParams_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskStatusUpdateEvent_v0_3; + +import static org.a2aproject.sdk.util.Assert.checkNotNullParam; + +import org.jspecify.annotations.NonNull; +import org.jspecify.annotations.Nullable; + +public class Client_v0_3 extends AbstractClient_v0_3 { + + private final ClientConfig_v0_3 clientConfig; + private final ClientTransport_v0_3 clientTransport; + private AgentCard_v0_3 agentCard; + + Client_v0_3(AgentCard_v0_3 agentCard, ClientConfig_v0_3 clientConfig, ClientTransport_v0_3 clientTransport, + List> consumers, @Nullable Consumer streamingErrorHandler) { + super(consumers, streamingErrorHandler); + checkNotNullParam("agentCard", agentCard); + + this.agentCard = agentCard; + this.clientConfig = clientConfig; + this.clientTransport = clientTransport; + } + + public static ClientBuilder_v0_3 builder(AgentCard_v0_3 agentCard) { + return new ClientBuilder_v0_3(agentCard); + } + + @Override + public void sendMessage(Message_v0_3 request, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + MessageSendParams_v0_3 messageSendParams = getMessageSendParams(request, clientConfig); + sendMessage(messageSendParams, null, null, context); + } + + @Override + public void sendMessage(Message_v0_3 request, List> consumers, + Consumer streamingErrorHandler, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + MessageSendParams_v0_3 messageSendParams = getMessageSendParams(request, clientConfig); + sendMessage(messageSendParams, consumers, streamingErrorHandler, context); + } + + @Override + public void sendMessage(Message_v0_3 request, PushNotificationConfig_v0_3 pushNotificationConfiguration, + Map metatadata, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + MessageSendConfiguration_v0_3 messageSendConfiguration = createMessageSendConfiguration(pushNotificationConfiguration); + + MessageSendParams_v0_3 messageSendParams = new MessageSendParams_v0_3.Builder() + .message(request) + .configuration(messageSendConfiguration) + .metadata(metatadata) + .build(); + + sendMessage(messageSendParams, null, null, context); + } + + @Override + public Task_v0_3 getTask(TaskQueryParams_v0_3 request, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + return clientTransport.getTask(request, context); + } + + @Override + public Task_v0_3 cancelTask(TaskIdParams_v0_3 request, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + return clientTransport.cancelTask(request, context); + } + + @Override + public TaskPushNotificationConfig_v0_3 setTaskPushNotificationConfiguration( + TaskPushNotificationConfig_v0_3 request, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + return clientTransport.setTaskPushNotificationConfiguration(request, context); + } + + @Override + public TaskPushNotificationConfig_v0_3 getTaskPushNotificationConfiguration( + GetTaskPushNotificationConfigParams_v0_3 request, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + return clientTransport.getTaskPushNotificationConfiguration(request, context); + } + + @Override + public List listTaskPushNotificationConfigurations( + ListTaskPushNotificationConfigParams_v0_3 request, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + return clientTransport.listTaskPushNotificationConfigurations(request, context); + } + + @Override + public void deleteTaskPushNotificationConfigurations( + DeleteTaskPushNotificationConfigParams_v0_3 request, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + clientTransport.deleteTaskPushNotificationConfigurations(request, context); + } + + @Override + public void resubscribe(TaskIdParams_v0_3 request, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + resubscribeToTask(request, null, null, context); + } + + @Override + public void resubscribe(TaskIdParams_v0_3 request, @Nullable List> consumers, + @Nullable Consumer streamingErrorHandler, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + resubscribeToTask(request, consumers, streamingErrorHandler, context); + } + + @Override + public AgentCard_v0_3 getAgentCard(@Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + agentCard = clientTransport.getAgentCard(context); + return agentCard; + } + + @Override + public void close() { + clientTransport.close(); + } + + private ClientEvent_v0_3 getClientEvent(StreamingEventKind_v0_3 event, ClientTaskManager_v0_3 taskManager) throws A2AClientError_v0_3 { + if (event instanceof Message_v0_3 message) { + return new MessageEvent_v0_3(message); + } else if (event instanceof Task_v0_3 task) { + taskManager.saveTaskEvent(task); + return new TaskEvent_v0_3(taskManager.getCurrentTask()); + } else if (event instanceof TaskStatusUpdateEvent_v0_3 updateEvent) { + taskManager.saveTaskEvent(updateEvent); + return new TaskUpdateEvent_v0_3(taskManager.getCurrentTask(), updateEvent); + } else if (event instanceof TaskArtifactUpdateEvent_v0_3 updateEvent) { + taskManager.saveTaskEvent(updateEvent); + return new TaskUpdateEvent_v0_3(taskManager.getCurrentTask(), updateEvent); + } else { + throw new A2AClientInvalidStateError_v0_3("Invalid client event"); + } + } + + private MessageSendConfiguration_v0_3 createMessageSendConfiguration(@Nullable PushNotificationConfig_v0_3 pushNotificationConfig) { + return new MessageSendConfiguration_v0_3.Builder() + .acceptedOutputModes(clientConfig.getAcceptedOutputModes()) + .blocking(!clientConfig.isPolling()) + .historyLength(clientConfig.getHistoryLength()) + .pushNotificationConfig(pushNotificationConfig) + .build(); + } + + private void sendMessage(MessageSendParams_v0_3 messageSendParams, @Nullable List> consumers, + @Nullable Consumer errorHandler, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + if (! clientConfig.isStreaming() || ! agentCard.capabilities().streaming()) { + EventKind_v0_3 eventKind = clientTransport.sendMessage(messageSendParams, context); + ClientEvent_v0_3 clientEvent; + if (eventKind instanceof Task_v0_3 task) { + clientEvent = new TaskEvent_v0_3(task); + } else { + // must be a message + clientEvent = new MessageEvent_v0_3((Message_v0_3) eventKind); + } + consume(clientEvent, agentCard, consumers); + } else { + ClientTaskManager_v0_3 tracker = new ClientTaskManager_v0_3(); + Consumer overriddenErrorHandler = getOverriddenErrorHandler(errorHandler); + Consumer eventHandler = event -> { + try { + ClientEvent_v0_3 clientEvent = getClientEvent(event, tracker); + consume(clientEvent, agentCard, consumers); + } catch (A2AClientError_v0_3 e) { + overriddenErrorHandler.accept(e); + } + }; + clientTransport.sendMessageStreaming(messageSendParams, eventHandler, overriddenErrorHandler, context); + } + } + + private void resubscribeToTask(TaskIdParams_v0_3 request, @Nullable List> consumers, + @Nullable Consumer errorHandler, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + if (! clientConfig.isStreaming() || ! agentCard.capabilities().streaming()) { + throw new A2AClientException_v0_3("Client and/or server does not support resubscription"); + } + ClientTaskManager_v0_3 tracker = new ClientTaskManager_v0_3(); + Consumer overriddenErrorHandler = getOverriddenErrorHandler(errorHandler); + Consumer eventHandler = event -> { + try { + ClientEvent_v0_3 clientEvent = getClientEvent(event, tracker); + consume(clientEvent, agentCard, consumers); + } catch (A2AClientError_v0_3 e) { + overriddenErrorHandler.accept(e); + } + }; + clientTransport.resubscribe(request, eventHandler, overriddenErrorHandler, context); + } + + private @NonNull Consumer getOverriddenErrorHandler(@Nullable Consumer errorHandler) { + return e -> { + if (errorHandler != null) { + errorHandler.accept(e); + } else { + if (getStreamingErrorHandler() != null) { + getStreamingErrorHandler().accept(e); + } + } + }; + } + + private void consume(ClientEvent_v0_3 clientEvent, AgentCard_v0_3 agentCard, @Nullable List> consumers) { + if (consumers != null) { + // use specified consumers + for (BiConsumer consumer : consumers) { + consumer.accept(clientEvent, agentCard); + } + } else { + // use configured consumers + consume(clientEvent, agentCard); + } + } + + private MessageSendParams_v0_3 getMessageSendParams(Message_v0_3 request, ClientConfig_v0_3 clientConfig) { + MessageSendConfiguration_v0_3 messageSendConfiguration = createMessageSendConfiguration(clientConfig.getPushNotificationConfig()); + + return new MessageSendParams_v0_3.Builder() + .message(request) + .configuration(messageSendConfiguration) + .metadata(clientConfig.getMetadata()) + .build(); + } +} diff --git a/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/MessageEvent_v0_3.java b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/MessageEvent_v0_3.java new file mode 100644 index 000000000..2c321e0da --- /dev/null +++ b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/MessageEvent_v0_3.java @@ -0,0 +1,26 @@ +package org.a2aproject.sdk.compat03.client; + +import org.a2aproject.sdk.compat03.spec.Message_v0_3; + +/** + * A message event received by a client. + */ +public final class MessageEvent_v0_3 implements ClientEvent_v0_3 { + + private final Message_v0_3 message; + + /** + * A message event. + * + * @param message the message received + */ + public MessageEvent_v0_3(Message_v0_3 message) { + this.message = message; + } + + public Message_v0_3 getMessage() { + return message; + } +} + + diff --git a/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/TaskEvent_v0_3.java b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/TaskEvent_v0_3.java new file mode 100644 index 000000000..504fe8559 --- /dev/null +++ b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/TaskEvent_v0_3.java @@ -0,0 +1,27 @@ +package org.a2aproject.sdk.compat03.client; + +import static org.a2aproject.sdk.util.Assert.checkNotNullParam; + +import org.a2aproject.sdk.compat03.spec.Task_v0_3; + +/** + * A task event received by a client. + */ +public final class TaskEvent_v0_3 implements ClientEvent_v0_3 { + + private final Task_v0_3 task; + + /** + * A client task event. + * + * @param task the task received + */ + public TaskEvent_v0_3(Task_v0_3 task) { + checkNotNullParam("task", task); + this.task = task; + } + + public Task_v0_3 getTask() { + return task; + } +} diff --git a/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/TaskUpdateEvent_v0_3.java b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/TaskUpdateEvent_v0_3.java new file mode 100644 index 000000000..9459a2b04 --- /dev/null +++ b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/TaskUpdateEvent_v0_3.java @@ -0,0 +1,37 @@ +package org.a2aproject.sdk.compat03.client; + +import static org.a2aproject.sdk.util.Assert.checkNotNullParam; + +import org.a2aproject.sdk.compat03.spec.Task_v0_3; +import org.a2aproject.sdk.compat03.spec.UpdateEvent_v0_3; + +/** + * A task update event received by a client. + */ +public final class TaskUpdateEvent_v0_3 implements ClientEvent_v0_3 { + + private final Task_v0_3 task; + private final UpdateEvent_v0_3 updateEvent; + + /** + * A task update event. + * + * @param task the current task + * @param updateEvent the update event received for the current task + */ + public TaskUpdateEvent_v0_3(Task_v0_3 task, UpdateEvent_v0_3 updateEvent) { + checkNotNullParam("task", task); + checkNotNullParam("updateEvent", updateEvent); + this.task = task; + this.updateEvent = updateEvent; + } + + public Task_v0_3 getTask() { + return task; + } + + public UpdateEvent_v0_3 getUpdateEvent() { + return updateEvent; + } + +} diff --git a/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/config/ClientConfig_v0_3.java b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/config/ClientConfig_v0_3.java new file mode 100644 index 000000000..ca143a45e --- /dev/null +++ b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/config/ClientConfig_v0_3.java @@ -0,0 +1,114 @@ +package org.a2aproject.sdk.compat03.client.config; + +import java.util.List; +import java.util.Map; + +import org.a2aproject.sdk.compat03.spec.PushNotificationConfig_v0_3; +import java.util.ArrayList; +import java.util.HashMap; +import org.jspecify.annotations.Nullable; + +/** + * Configuration for the A2A client factory. + */ +public class ClientConfig_v0_3 { + + private final Boolean streaming; + private final Boolean polling; + private final Boolean useClientPreference; + private final List acceptedOutputModes; + private final @Nullable PushNotificationConfig_v0_3 pushNotificationConfig; + private final @Nullable Integer historyLength; + private final Map metadata; + + private ClientConfig_v0_3(Builder builder) { + this.streaming = builder.streaming == null ? true : builder.streaming; + this.polling = builder.polling == null ? false : builder.polling; + this.useClientPreference = builder.useClientPreference == null ? false : builder.useClientPreference; + this.acceptedOutputModes = builder.acceptedOutputModes; + this.pushNotificationConfig = builder.pushNotificationConfig; + this.historyLength = builder.historyLength; + this.metadata = builder.metadata; + } + + public boolean isStreaming() { + return streaming; + } + + public boolean isPolling() { + return polling; + } + + public boolean isUseClientPreference() { + return useClientPreference; + } + + public List getAcceptedOutputModes() { + return acceptedOutputModes; + } + + public @Nullable PushNotificationConfig_v0_3 getPushNotificationConfig() { + return pushNotificationConfig; + } + + public @Nullable Integer getHistoryLength() { + return historyLength; + } + + public Map getMetadata() { + return metadata; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private @Nullable Boolean streaming; + private @Nullable Boolean polling; + private @Nullable Boolean useClientPreference; + private List acceptedOutputModes = new ArrayList<>(); + private @Nullable PushNotificationConfig_v0_3 pushNotificationConfig; + private @Nullable Integer historyLength; + private Map metadata = new HashMap<>(); + + public Builder setStreaming(@Nullable Boolean streaming) { + this.streaming = streaming; + return this; + } + + public Builder setPolling(@Nullable Boolean polling) { + this.polling = polling; + return this; + } + + public Builder setUseClientPreference(@Nullable Boolean useClientPreference) { + this.useClientPreference = useClientPreference; + return this; + } + + public Builder setAcceptedOutputModes(List acceptedOutputModes) { + this.acceptedOutputModes = new ArrayList<>(acceptedOutputModes); + return this; + } + + public Builder setPushNotificationConfig(PushNotificationConfig_v0_3 pushNotificationConfig) { + this.pushNotificationConfig = pushNotificationConfig; + return this; + } + + public Builder setHistoryLength(Integer historyLength) { + this.historyLength = historyLength; + return this; + } + + public Builder setMetadata(Map metadata) { + this.metadata = metadata; + return this; + } + + public ClientConfig_v0_3 build() { + return new ClientConfig_v0_3(this); + } + } +} \ No newline at end of file diff --git a/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/config/package-info.java b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/config/package-info.java new file mode 100644 index 000000000..bfae93f4b --- /dev/null +++ b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/config/package-info.java @@ -0,0 +1,5 @@ +@NullMarked +package org.a2aproject.sdk.compat03.client.config; + +import org.jspecify.annotations.NullMarked; + diff --git a/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/package-info.java b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/package-info.java new file mode 100644 index 000000000..9bd22f637 --- /dev/null +++ b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/package-info.java @@ -0,0 +1,5 @@ +@NullMarked +package org.a2aproject.sdk.compat03.client; + +import org.jspecify.annotations.NullMarked; + diff --git a/compat-0.3/client/base/src/main/resources/META-INF/beans.xml b/compat-0.3/client/base/src/main/resources/META-INF/beans.xml new file mode 100644 index 000000000..e69de29bb diff --git a/compat-0.3/client/base/src/test/java/org/a2aproject/sdk/compat03/A2A_v0_3_Test.java b/compat-0.3/client/base/src/test/java/org/a2aproject/sdk/compat03/A2A_v0_3_Test.java new file mode 100644 index 000000000..1187518eb --- /dev/null +++ b/compat-0.3/client/base/src/test/java/org/a2aproject/sdk/compat03/A2A_v0_3_Test.java @@ -0,0 +1,147 @@ +package org.a2aproject.sdk.compat03; + +import org.a2aproject.sdk.compat03.spec.Message_v0_3; +import org.a2aproject.sdk.compat03.spec.Part_v0_3; +import org.a2aproject.sdk.compat03.spec.TextPart_v0_3; +import org.junit.jupiter.api.Test; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; + +public class A2A_v0_3_Test { + + @Test + public void testToUserMessage() { + String text = "Hello, world!"; + Message_v0_3 message = A2A_v0_3.toUserMessage(text); + + assertEquals(Message_v0_3.Role.USER, message.getRole()); + assertEquals(1, message.getParts().size()); + assertEquals(text, ((TextPart_v0_3) message.getParts().get(0)).getText()); + assertNotNull(message.getMessageId()); + assertNull(message.getContextId()); + assertNull(message.getTaskId()); + } + + @Test + public void testToUserMessageWithId() { + String text = "Hello, world!"; + String messageId = "test-message-id"; + Message_v0_3 message = A2A_v0_3.toUserMessage(text, messageId); + + assertEquals(Message_v0_3.Role.USER, message.getRole()); + assertEquals(messageId, message.getMessageId()); + } + + @Test + public void testToAgentMessage() { + String text = "Hello, I'm an agent!"; + Message_v0_3 message = A2A_v0_3.toAgentMessage(text); + + assertEquals(Message_v0_3.Role.AGENT, message.getRole()); + assertEquals(1, message.getParts().size()); + assertEquals(text, ((TextPart_v0_3) message.getParts().get(0)).getText()); + assertNotNull(message.getMessageId()); + } + + @Test + public void testToAgentMessageWithId() { + String text = "Hello, I'm an agent!"; + String messageId = "agent-message-id"; + Message_v0_3 message = A2A_v0_3.toAgentMessage(text, messageId); + + assertEquals(Message_v0_3.Role.AGENT, message.getRole()); + assertEquals(messageId, message.getMessageId()); + } + + @Test + public void testCreateUserTextMessage() { + String text = "User message with context"; + String contextId = "context-123"; + String taskId = "task-456"; + + Message_v0_3 message = A2A_v0_3.createUserTextMessage(text, contextId, taskId); + + assertEquals(Message_v0_3.Role.USER, message.getRole()); + assertEquals(contextId, message.getContextId()); + assertEquals(taskId, message.getTaskId()); + assertEquals(1, message.getParts().size()); + assertEquals(text, ((TextPart_v0_3) message.getParts().get(0)).getText()); + assertNotNull(message.getMessageId()); + assertNull(message.getMetadata()); + assertNull(message.getReferenceTaskIds()); + } + + @Test + public void testCreateUserTextMessageWithNullParams() { + String text = "Simple user message"; + + Message_v0_3 message = A2A_v0_3.createUserTextMessage(text, null, null); + + assertEquals(Message_v0_3.Role.USER, message.getRole()); + assertNull(message.getContextId()); + assertNull(message.getTaskId()); + assertEquals(1, message.getParts().size()); + assertEquals(text, ((TextPart_v0_3) message.getParts().get(0)).getText()); + } + + @Test + public void testCreateAgentTextMessage() { + String text = "Agent message with context"; + String contextId = "context-789"; + String taskId = "task-012"; + + Message_v0_3 message = A2A_v0_3.createAgentTextMessage(text, contextId, taskId); + + assertEquals(Message_v0_3.Role.AGENT, message.getRole()); + assertEquals(contextId, message.getContextId()); + assertEquals(taskId, message.getTaskId()); + assertEquals(1, message.getParts().size()); + assertEquals(text, ((TextPart_v0_3) message.getParts().get(0)).getText()); + assertNotNull(message.getMessageId()); + } + + @Test + public void testCreateAgentPartsMessage() { + List> parts = Arrays.asList( + new TextPart_v0_3("Part 1"), + new TextPart_v0_3("Part 2") + ); + String contextId = "context-parts"; + String taskId = "task-parts"; + + Message_v0_3 message = A2A_v0_3.createAgentPartsMessage(parts, contextId, taskId); + + assertEquals(Message_v0_3.Role.AGENT, message.getRole()); + assertEquals(contextId, message.getContextId()); + assertEquals(taskId, message.getTaskId()); + assertEquals(2, message.getParts().size()); + assertEquals("Part 1", ((TextPart_v0_3) message.getParts().get(0)).getText()); + assertEquals("Part 2", ((TextPart_v0_3) message.getParts().get(1)).getText()); + } + + @Test + public void testCreateAgentPartsMessageWithNullParts() { + try { + A2A_v0_3.createAgentPartsMessage(null, "context", "task"); + org.junit.jupiter.api.Assertions.fail("Expected IllegalArgumentException"); + } catch (IllegalArgumentException e) { + assertEquals("Parts cannot be null or empty", e.getMessage()); + } + } + + @Test + public void testCreateAgentPartsMessageWithEmptyParts() { + try { + A2A_v0_3.createAgentPartsMessage(Collections.emptyList(), "context", "task"); + org.junit.jupiter.api.Assertions.fail("Expected IllegalArgumentException"); + } catch (IllegalArgumentException e) { + assertEquals("Parts cannot be null or empty", e.getMessage()); + } + } +} \ No newline at end of file diff --git a/compat-0.3/client/base/src/test/java/org/a2aproject/sdk/compat03/client/AuthenticationAuthorization_v0_3_Test.java b/compat-0.3/client/base/src/test/java/org/a2aproject/sdk/compat03/client/AuthenticationAuthorization_v0_3_Test.java new file mode 100644 index 000000000..228a08c09 --- /dev/null +++ b/compat-0.3/client/base/src/test/java/org/a2aproject/sdk/compat03/client/AuthenticationAuthorization_v0_3_Test.java @@ -0,0 +1,380 @@ +package org.a2aproject.sdk.compat03.client; + +import org.a2aproject.sdk.compat03.client.config.ClientConfig_v0_3; +import org.a2aproject.sdk.compat03.client.transport.grpc.GrpcTransport_v0_3; +import org.a2aproject.sdk.compat03.client.transport.grpc.GrpcTransportConfigBuilder_v0_3; +import org.a2aproject.sdk.compat03.client.transport.jsonrpc.JSONRPCTransport_v0_3; +import org.a2aproject.sdk.compat03.client.transport.jsonrpc.JSONRPCTransportConfigBuilder_v0_3; +import org.a2aproject.sdk.compat03.client.transport.rest.RestTransport_v0_3; +import org.a2aproject.sdk.compat03.client.transport.rest.RestTransportConfigBuilder_v0_3; +import org.a2aproject.sdk.compat03.grpc.A2AServiceGrpc; +import org.a2aproject.sdk.compat03.grpc.SendMessageRequest; +import org.a2aproject.sdk.compat03.grpc.SendMessageResponse; +import org.a2aproject.sdk.compat03.grpc.StreamResponse; +import org.a2aproject.sdk.compat03.spec.A2AClientException_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentCapabilities_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentCard_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentInterface_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentSkill_v0_3; +import org.a2aproject.sdk.compat03.spec.Message_v0_3; +import org.a2aproject.sdk.compat03.spec.TextPart_v0_3; +import org.a2aproject.sdk.compat03.spec.TransportProtocol_v0_3; +import io.grpc.ManagedChannel; +import io.grpc.Server; +import io.grpc.Status; +import io.grpc.inprocess.InProcessChannelBuilder; +import io.grpc.inprocess.InProcessServerBuilder; +import io.grpc.stub.StreamObserver; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockserver.integration.ClientAndServer; + +import java.io.IOException; +import java.util.Collections; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Consumer; + +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockserver.model.HttpRequest.request; +import static org.mockserver.model.HttpResponse.response; + +/** + * Tests for handling HTTP 401 (Unauthorized) and 403 (Forbidden) responses + * when the client sends streaming and non-streaming messages. + * + * These tests verify that the client properly fails when the server returns + * authentication or authorization errors. + */ +public class AuthenticationAuthorization_v0_3_Test { + + private static final String AGENT_URL = "http://localhost:4001"; + private static final String AUTHENTICATION_FAILED_MESSAGE = "Authentication failed"; + private static final String AUTHORIZATION_FAILED_MESSAGE = "Authorization failed"; + + private ClientAndServer server; + private Message_v0_3 MESSAGE; + private AgentCard_v0_3 agentCard; + private Server grpcServer; + private ManagedChannel grpcChannel; + private String grpcServerName; + + @BeforeEach + public void setUp() { + server = new ClientAndServer(4001); + MESSAGE = new Message_v0_3.Builder() + .role(Message_v0_3.Role.USER) + .parts(Collections.singletonList(new TextPart_v0_3("test message"))) + .contextId("context-1234") + .messageId("message-1234") + .build(); + + grpcServerName = InProcessServerBuilder.generateName(); + + agentCard = new AgentCard_v0_3.Builder() + .name("Test Agent") + .description("Test agent for auth tests") + .url(AGENT_URL) + .version("1.0.0") + .capabilities(new AgentCapabilities_v0_3.Builder() + .streaming(true) // Support streaming for all tests + .build()) + .defaultInputModes(Collections.singletonList("text")) + .defaultOutputModes(Collections.singletonList("text")) + .skills(Collections.singletonList(new AgentSkill_v0_3.Builder() + .id("test_skill") + .name("Test skill") + .description("Test skill") + .tags(Collections.singletonList("test")) + .build())) + .protocolVersion("0.3.0") + .additionalInterfaces(java.util.Arrays.asList( + new AgentInterface_v0_3(TransportProtocol_v0_3.JSONRPC.asString(), AGENT_URL), + new AgentInterface_v0_3(TransportProtocol_v0_3.HTTP_JSON.asString(), AGENT_URL), + new AgentInterface_v0_3(TransportProtocol_v0_3.GRPC.asString(), grpcServerName))) + .build(); + } + + @AfterEach + public void tearDown() { + server.stop(); + if (grpcChannel != null) { + grpcChannel.shutdownNow(); + } + if (grpcServer != null) { + grpcServer.shutdownNow(); + } + } + + // ========== JSON-RPC Transport Tests ========== + + @Test + public void testJsonRpcNonStreamingUnauthenticated() throws A2AClientException_v0_3 { + // Mock server to return 401 for non-streaming message + server.when( + request() + .withMethod("POST") + .withPath("/") + ).respond( + response() + .withStatusCode(401) + ); + + Client_v0_3 client = getJSONRPCClientBuilder(false).build(); + + A2AClientException_v0_3 exception = assertThrows(A2AClientException_v0_3.class, () -> { + client.sendMessage(MESSAGE); + }); + + assertTrue(exception.getMessage().contains(AUTHENTICATION_FAILED_MESSAGE)); + } + + @Test + public void testJsonRpcNonStreamingUnauthorized() throws A2AClientException_v0_3 { + // Mock server to return 403 for non-streaming message + server.when( + request() + .withMethod("POST") + .withPath("/") + ).respond( + response() + .withStatusCode(403) + ); + + Client_v0_3 client = getJSONRPCClientBuilder(false).build(); + + A2AClientException_v0_3 exception = assertThrows(A2AClientException_v0_3.class, () -> { + client.sendMessage(MESSAGE); + }); + + assertTrue(exception.getMessage().contains(AUTHORIZATION_FAILED_MESSAGE)); + } + + @Test + public void testJsonRpcStreamingUnauthenticated() throws Exception { + // Mock server to return 401 for streaming message + server.when( + request() + .withMethod("POST") + .withPath("/") + ).respond( + response() + .withStatusCode(401) + ); + + assertStreamingError( + getJSONRPCClientBuilder(true), + AUTHENTICATION_FAILED_MESSAGE); + } + + @Test + public void testJsonRpcStreamingUnauthorized() throws Exception { + // Mock server to return 403 for streaming message + server.when( + request() + .withMethod("POST") + .withPath("/") + ).respond( + response() + .withStatusCode(403) + ); + + assertStreamingError( + getJSONRPCClientBuilder(true), + AUTHORIZATION_FAILED_MESSAGE); + } + + // ========== REST Transport Tests ========== + + @Test + public void testRestNonStreamingUnauthenticated() throws A2AClientException_v0_3 { + // Mock server to return 401 for non-streaming message + server.when( + request() + .withMethod("POST") + .withPath("/v1/message:send") + ).respond( + response() + .withStatusCode(401) + ); + + Client_v0_3 client = getRestClientBuilder(false).build(); + + A2AClientException_v0_3 exception = assertThrows(A2AClientException_v0_3.class, () -> { + client.sendMessage(MESSAGE); + }); + + assertTrue(exception.getMessage().contains(AUTHENTICATION_FAILED_MESSAGE)); + } + + @Test + public void testRestNonStreamingUnauthorized() throws A2AClientException_v0_3 { + // Mock server to return 403 for non-streaming message + server.when( + request() + .withMethod("POST") + .withPath("/v1/message:send") + ).respond( + response() + .withStatusCode(403) + ); + + Client_v0_3 client = getRestClientBuilder(false).build(); + + A2AClientException_v0_3 exception = assertThrows(A2AClientException_v0_3.class, () -> { + client.sendMessage(MESSAGE); + }); + + assertTrue(exception.getMessage().contains(AUTHORIZATION_FAILED_MESSAGE)); + } + + @Test + public void testRestStreamingUnauthenticated() throws Exception { + // Mock server to return 401 for streaming message + server.when( + request() + .withMethod("POST") + .withPath("/v1/message:stream") + ).respond( + response() + .withStatusCode(401) + ); + + assertStreamingError( + getRestClientBuilder(true), + AUTHENTICATION_FAILED_MESSAGE); + } + + @Test + public void testRestStreamingUnauthorized() throws Exception { + // Mock server to return 403 for streaming message + server.when( + request() + .withMethod("POST") + .withPath("/v1/message:stream") + ).respond( + response() + .withStatusCode(403) + ); + + assertStreamingError( + getRestClientBuilder(true), + AUTHORIZATION_FAILED_MESSAGE); + } + + // ========== gRPC Transport Tests ========== + + @Test + public void testGrpcNonStreamingUnauthenticated() throws Exception { + setupGrpcServer(Status.UNAUTHENTICATED); + + Client_v0_3 client = getGrpcClientBuilder(false).build(); + + A2AClientException_v0_3 exception = assertThrows(A2AClientException_v0_3.class, () -> { + client.sendMessage(MESSAGE); + }); + + assertTrue(exception.getMessage().contains(AUTHENTICATION_FAILED_MESSAGE)); + } + + @Test + public void testGrpcNonStreamingUnauthorized() throws Exception { + setupGrpcServer(Status.PERMISSION_DENIED); + + Client_v0_3 client = getGrpcClientBuilder(false).build(); + + A2AClientException_v0_3 exception = assertThrows(A2AClientException_v0_3.class, () -> { + client.sendMessage(MESSAGE); + }); + + assertTrue(exception.getMessage().contains(AUTHORIZATION_FAILED_MESSAGE)); + } + + @Test + public void testGrpcStreamingUnauthenticated() throws Exception { + setupGrpcServer(Status.UNAUTHENTICATED); + + assertStreamingError( + getGrpcClientBuilder(true), + AUTHENTICATION_FAILED_MESSAGE); + } + + @Test + public void testGrpcStreamingUnauthorized() throws Exception { + setupGrpcServer(Status.PERMISSION_DENIED); + + assertStreamingError( + getGrpcClientBuilder(true), + AUTHORIZATION_FAILED_MESSAGE); + } + + private ClientBuilder_v0_3 getJSONRPCClientBuilder(boolean streaming) { + return Client_v0_3.builder(agentCard) + .clientConfig(new ClientConfig_v0_3.Builder().setStreaming(streaming).build()) + .withTransport(JSONRPCTransport_v0_3.class, new JSONRPCTransportConfigBuilder_v0_3()); + } + + private ClientBuilder_v0_3 getRestClientBuilder(boolean streaming) { + return Client_v0_3.builder(agentCard) + .clientConfig(new ClientConfig_v0_3.Builder().setStreaming(streaming).build()) + .withTransport(RestTransport_v0_3.class, new RestTransportConfigBuilder_v0_3()); + } + + private ClientBuilder_v0_3 getGrpcClientBuilder(boolean streaming) { + return Client_v0_3.builder(agentCard) + .clientConfig(new ClientConfig_v0_3.Builder().setStreaming(streaming).build()) + .withTransport(GrpcTransport_v0_3.class, new GrpcTransportConfigBuilder_v0_3() + .channelFactory(target -> grpcChannel)); + } + + private void assertStreamingError(ClientBuilder_v0_3 clientBuilder, String expectedErrorMessage) throws Exception { + AtomicReference errorRef = new AtomicReference<>(); + CountDownLatch errorLatch = new CountDownLatch(1); + + Consumer errorHandler = error -> { + errorRef.set(error); + errorLatch.countDown(); + }; + + Client_v0_3 client = clientBuilder.streamingErrorHandler(errorHandler).build(); + + try { + client.sendMessage(MESSAGE); + // If no immediate exception, wait for async error + assertTrue(errorLatch.await(5, TimeUnit.SECONDS), "Expected error handler to be called"); + Throwable error = errorRef.get(); + assertTrue(error.getMessage().contains(expectedErrorMessage), + "Expected error message to contain '" + expectedErrorMessage + "' but got: " + error.getMessage()); + } catch (Exception e) { + // Immediate exception is also acceptable + assertTrue(e.getMessage().contains(expectedErrorMessage), + "Expected error message to contain '" + expectedErrorMessage + "' but got: " + e.getMessage()); + } + } + + private void setupGrpcServer(Status status) throws IOException { + grpcServerName = InProcessServerBuilder.generateName(); + grpcServer = InProcessServerBuilder.forName(grpcServerName) + .directExecutor() + .addService(new A2AServiceGrpc.A2AServiceImplBase() { + @Override + public void sendMessage(SendMessageRequest request, StreamObserver responseObserver) { + responseObserver.onError(status.asRuntimeException()); + } + + @Override + public void sendStreamingMessage(SendMessageRequest request, StreamObserver responseObserver) { + responseObserver.onError(status.asRuntimeException()); + } + }) + .build() + .start(); + + grpcChannel = InProcessChannelBuilder.forName(grpcServerName) + .directExecutor() + .build(); + } +} \ No newline at end of file diff --git a/compat-0.3/client/base/src/test/java/org/a2aproject/sdk/compat03/client/ClientBuilder_v0_3_Test.java b/compat-0.3/client/base/src/test/java/org/a2aproject/sdk/compat03/client/ClientBuilder_v0_3_Test.java new file mode 100644 index 000000000..4b4e31d0b --- /dev/null +++ b/compat-0.3/client/base/src/test/java/org/a2aproject/sdk/compat03/client/ClientBuilder_v0_3_Test.java @@ -0,0 +1,96 @@ +package org.a2aproject.sdk.compat03.client; + +import org.a2aproject.sdk.compat03.client.config.ClientConfig_v0_3; +import org.a2aproject.sdk.compat03.client.http.JdkA2AHttpClient_v0_3; +import org.a2aproject.sdk.compat03.client.transport.grpc.GrpcTransport_v0_3; +import org.a2aproject.sdk.compat03.client.transport.grpc.GrpcTransportConfigBuilder_v0_3; +import org.a2aproject.sdk.compat03.client.transport.jsonrpc.JSONRPCTransport_v0_3; +import org.a2aproject.sdk.compat03.client.transport.jsonrpc.JSONRPCTransportConfig_v0_3; +import org.a2aproject.sdk.compat03.client.transport.jsonrpc.JSONRPCTransportConfigBuilder_v0_3; +import org.a2aproject.sdk.compat03.spec.A2AClientException_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentCapabilities_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentCard_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentInterface_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentSkill_v0_3; +import org.a2aproject.sdk.compat03.spec.TransportProtocol_v0_3; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import java.util.Collections; +import java.util.List; + +public class ClientBuilder_v0_3_Test { + + private AgentCard_v0_3 card = new AgentCard_v0_3.Builder() + .name("Hello World Agent") + .description("Just a hello world agent") + .url("http://localhost:9999") + .version("1.0.0") + .documentationUrl("http://example.com/docs") + .capabilities(new AgentCapabilities_v0_3.Builder() + .streaming(true) + .pushNotifications(true) + .stateTransitionHistory(true) + .build()) + .defaultInputModes(Collections.singletonList("text")) + .defaultOutputModes(Collections.singletonList("text")) + .skills(Collections.singletonList(new AgentSkill_v0_3.Builder() + .id("hello_world") + .name("Returns hello world") + .description("just returns hello world") + .tags(Collections.singletonList("hello world")) + .examples(List.of("hi", "hello world")) + .build())) + .protocolVersion("0.3.0") + .additionalInterfaces(List.of( + new AgentInterface_v0_3(TransportProtocol_v0_3.JSONRPC.asString(), "http://localhost:9999"))) + .build(); + + @Test + public void shouldNotFindCompatibleTransport() throws A2AClientException_v0_3 { + A2AClientException_v0_3 exception = Assertions.assertThrows(A2AClientException_v0_3.class, + () -> Client_v0_3 + .builder(card) + .clientConfig(new ClientConfig_v0_3.Builder().setUseClientPreference(true).build()) + .withTransport(GrpcTransport_v0_3.class, new GrpcTransportConfigBuilder_v0_3() + .channelFactory(s -> null)) + .build()); + + Assertions.assertTrue(exception.getMessage() != null && exception.getMessage().contains("No compatible transport found")); + } + + @Test + public void shouldNotFindConfigurationTransport() throws A2AClientException_v0_3 { + A2AClientException_v0_3 exception = Assertions.assertThrows(A2AClientException_v0_3.class, + () -> Client_v0_3 + .builder(card) + .clientConfig(new ClientConfig_v0_3.Builder().setUseClientPreference(true).build()) + .build()); + + Assertions.assertTrue(exception.getMessage() != null && exception.getMessage().startsWith("Missing required TransportConfig for")); + } + + @Test + public void shouldCreateJSONRPCClient() throws A2AClientException_v0_3 { + Client_v0_3 client = Client_v0_3 + .builder(card) + .clientConfig(new ClientConfig_v0_3.Builder().setUseClientPreference(true).build()) + .withTransport(JSONRPCTransport_v0_3.class, new JSONRPCTransportConfigBuilder_v0_3() + .addInterceptor(null) + .httpClient(null)) + .build(); + + Assertions.assertNotNull(client); + } + + @Test + public void shouldCreateClient_differentConfigurations() throws A2AClientException_v0_3 { + Client_v0_3 client = Client_v0_3 + .builder(card) + .withTransport(JSONRPCTransport_v0_3.class, new JSONRPCTransportConfigBuilder_v0_3()) + .withTransport(JSONRPCTransport_v0_3.class, new JSONRPCTransportConfig_v0_3(new JdkA2AHttpClient_v0_3())) + .build(); + + Assertions.assertNotNull(client); + } +} diff --git a/compat-0.3/client/transport/grpc/pom.xml b/compat-0.3/client/transport/grpc/pom.xml new file mode 100644 index 000000000..97c24e11a --- /dev/null +++ b/compat-0.3/client/transport/grpc/pom.xml @@ -0,0 +1,57 @@ + + + 4.0.0 + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-parent + 1.0.0.Beta2-SNAPSHOT + ../../.. + + a2a-java-sdk-compat-0.3-client-transport-grpc + jar + + Java SDK A2A Compat 0.3 Client Transport: gRPC + Java SDK for the Agent2Agent Protocol (A2A) - gRPC Client Transport + + + + ${project.groupId} + a2a-java-sdk-common + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec-grpc + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client-transport-spi + + + io.grpc + grpc-protobuf + + + io.grpc + grpc-stub + + + org.junit.jupiter + junit-jupiter-api + test + + + + org.mock-server + mockserver-netty + test + + + + \ No newline at end of file diff --git a/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/EventStreamObserver_v0_3.java b/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/EventStreamObserver_v0_3.java new file mode 100644 index 000000000..4f353748c --- /dev/null +++ b/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/EventStreamObserver_v0_3.java @@ -0,0 +1,64 @@ +package org.a2aproject.sdk.compat03.client.transport.grpc; + + +import org.a2aproject.sdk.compat03.grpc.StreamResponse; +import org.a2aproject.sdk.compat03.spec.StreamingEventKind_v0_3; +import io.grpc.stub.StreamObserver; + +import java.util.function.Consumer; +import java.util.logging.Logger; + +import static org.a2aproject.sdk.compat03.grpc.utils.ProtoUtils_v0_3.FromProto; + +public class EventStreamObserver_v0_3 implements StreamObserver { + + private static final Logger log = Logger.getLogger(EventStreamObserver_v0_3.class.getName()); + private final Consumer eventHandler; + private final Consumer errorHandler; + + public EventStreamObserver_v0_3(Consumer eventHandler, Consumer errorHandler) { + this.eventHandler = eventHandler; + this.errorHandler = errorHandler; + } + + @Override + public void onNext(StreamResponse response) { + StreamingEventKind_v0_3 event; + switch (response.getPayloadCase()) { + case MSG: + event = FromProto.message(response.getMsg()); + break; + case TASK: + event = FromProto.task(response.getTask()); + break; + case STATUS_UPDATE: + event = FromProto.taskStatusUpdateEvent(response.getStatusUpdate()); + break; + case ARTIFACT_UPDATE: + event = FromProto.taskArtifactUpdateEvent(response.getArtifactUpdate()); + break; + default: + log.warning("Invalid stream response " + response.getPayloadCase()); + errorHandler.accept(new IllegalStateException("Invalid stream response from server: " + response.getPayloadCase())); + return; + } + eventHandler.accept(event); + } + + @Override + public void onError(Throwable t) { + if (errorHandler != null) { + // Map gRPC errors to proper A2A exceptions + if (t instanceof io.grpc.StatusRuntimeException) { + errorHandler.accept(GrpcErrorMapper_v0_3.mapGrpcError((io.grpc.StatusRuntimeException) t)); + } else { + errorHandler.accept(t); + } + } + } + + @Override + public void onCompleted() { + // done + } +} diff --git a/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/GrpcErrorMapper_v0_3.java b/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/GrpcErrorMapper_v0_3.java new file mode 100644 index 000000000..a66bbf610 --- /dev/null +++ b/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/GrpcErrorMapper_v0_3.java @@ -0,0 +1,102 @@ +package org.a2aproject.sdk.compat03.client.transport.grpc; + +import org.a2aproject.sdk.common.A2AErrorMessages; +import org.a2aproject.sdk.compat03.spec.A2AClientException_v0_3; +import org.a2aproject.sdk.compat03.spec.ContentTypeNotSupportedError_v0_3; +import org.a2aproject.sdk.compat03.spec.InternalError_v0_3; +import org.a2aproject.sdk.compat03.spec.InvalidAgentResponseError_v0_3; +import org.a2aproject.sdk.compat03.spec.InvalidParamsError_v0_3; +import org.a2aproject.sdk.compat03.spec.InvalidRequestError_v0_3; +import org.a2aproject.sdk.compat03.spec.JSONParseError_v0_3; +import org.a2aproject.sdk.compat03.spec.MethodNotFoundError_v0_3; +import org.a2aproject.sdk.compat03.spec.PushNotificationNotSupportedError_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskNotCancelableError_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskNotFoundError_v0_3; +import org.a2aproject.sdk.compat03.spec.UnsupportedOperationError_v0_3; +import io.grpc.Status; +import io.grpc.StatusException; +import io.grpc.StatusRuntimeException; + +/** + * Utility class to map gRPC StatusRuntimeException to appropriate A2A error types + */ +public class GrpcErrorMapper_v0_3 { + + // Overload for StatusRuntimeException (original 0.3.x signature) + public static A2AClientException_v0_3 mapGrpcError(StatusRuntimeException e) { + return mapGrpcError(e, "gRPC error: "); + } + + public static A2AClientException_v0_3 mapGrpcError(StatusRuntimeException e, String errorPrefix) { + return mapGrpcErrorInternal(e.getStatus().getCode(), e.getStatus().getDescription(), e, errorPrefix); + } + + // Overload for StatusException (gRPC 1.77+ compatibility) + public static A2AClientException_v0_3 mapGrpcError(StatusException e) { + return mapGrpcError(e, "gRPC error: "); + } + + public static A2AClientException_v0_3 mapGrpcError(StatusException e, String errorPrefix) { + return mapGrpcErrorInternal(e.getStatus().getCode(), e.getStatus().getDescription(), e, errorPrefix); + } + + // Dispatcher for multi-catch (StatusRuntimeException | StatusException) + public static A2AClientException_v0_3 mapGrpcError(Exception e, String errorPrefix) { + if (e instanceof StatusRuntimeException) { + return mapGrpcError((StatusRuntimeException) e, errorPrefix); + } else if (e instanceof StatusException) { + return mapGrpcError((StatusException) e, errorPrefix); + } else { + return new A2AClientException_v0_3(errorPrefix + e.getMessage(), e); + } + } + + private static A2AClientException_v0_3 mapGrpcErrorInternal(Status.Code code, @org.jspecify.annotations.Nullable String description, @org.jspecify.annotations.Nullable Throwable cause, String errorPrefix) { + + // Extract the actual error type from the description if possible + // (using description because the same code can map to multiple errors - + // see GrpcHandler#handleError) + if (description != null) { + if (description.contains("TaskNotFoundError")) { + return new A2AClientException_v0_3(errorPrefix + description, new TaskNotFoundError_v0_3()); + } else if (description.contains("UnsupportedOperationError")) { + return new A2AClientException_v0_3(errorPrefix + description, new UnsupportedOperationError_v0_3()); + } else if (description.contains("InvalidParamsError")) { + return new A2AClientException_v0_3(errorPrefix + description, new InvalidParamsError_v0_3()); + } else if (description.contains("InvalidRequestError")) { + return new A2AClientException_v0_3(errorPrefix + description, new InvalidRequestError_v0_3()); + } else if (description.contains("MethodNotFoundError")) { + return new A2AClientException_v0_3(errorPrefix + description, new MethodNotFoundError_v0_3()); + } else if (description.contains("TaskNotCancelableError")) { + return new A2AClientException_v0_3(errorPrefix + description, new TaskNotCancelableError_v0_3()); + } else if (description.contains("PushNotificationNotSupportedError")) { + return new A2AClientException_v0_3(errorPrefix + description, new PushNotificationNotSupportedError_v0_3()); + } else if (description.contains("JSONParseError")) { + return new A2AClientException_v0_3(errorPrefix + description, new JSONParseError_v0_3()); + } else if (description.contains("ContentTypeNotSupportedError")) { + return new A2AClientException_v0_3(errorPrefix + description, new ContentTypeNotSupportedError_v0_3(null, description, null)); + } else if (description.contains("InvalidAgentResponseError")) { + return new A2AClientException_v0_3(errorPrefix + description, new InvalidAgentResponseError_v0_3(null, description, null)); + } + } + + // Fall back to mapping based on status code + String message = description != null ? description : (cause != null ? cause.getMessage() : "Unknown error"); + switch (code) { + case NOT_FOUND: + return new A2AClientException_v0_3(errorPrefix + message, new TaskNotFoundError_v0_3()); + case UNIMPLEMENTED: + return new A2AClientException_v0_3(errorPrefix + message, new UnsupportedOperationError_v0_3()); + case INVALID_ARGUMENT: + return new A2AClientException_v0_3(errorPrefix + message, new InvalidParamsError_v0_3()); + case INTERNAL: + return new A2AClientException_v0_3(errorPrefix + message, new InternalError_v0_3(null, message, null)); + case UNAUTHENTICATED: + return new A2AClientException_v0_3(errorPrefix + A2AErrorMessages.AUTHENTICATION_FAILED); + case PERMISSION_DENIED: + return new A2AClientException_v0_3(errorPrefix + A2AErrorMessages.AUTHORIZATION_FAILED); + default: + return new A2AClientException_v0_3(errorPrefix + message, cause); + } + } +} diff --git a/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/GrpcTransportConfigBuilder_v0_3.java b/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/GrpcTransportConfigBuilder_v0_3.java new file mode 100644 index 000000000..cfc3b97c6 --- /dev/null +++ b/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/GrpcTransportConfigBuilder_v0_3.java @@ -0,0 +1,32 @@ +package org.a2aproject.sdk.compat03.client.transport.grpc; + +import org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportConfigBuilder_v0_3; +import org.a2aproject.sdk.util.Assert; +import io.grpc.Channel; + +import java.util.function.Function; + +import org.jspecify.annotations.Nullable; + +public class GrpcTransportConfigBuilder_v0_3 extends ClientTransportConfigBuilder_v0_3 { + + private @Nullable Function channelFactory; + + public GrpcTransportConfigBuilder_v0_3 channelFactory(Function channelFactory) { + Assert.checkNotNullParam("channelFactory", channelFactory); + + this.channelFactory = channelFactory; + + return this; + } + + @Override + public GrpcTransportConfig_v0_3 build() { + if (channelFactory == null) { + throw new IllegalStateException("channelFactory must be set"); + } + GrpcTransportConfig_v0_3 config = new GrpcTransportConfig_v0_3(channelFactory); + config.setInterceptors(interceptors); + return config; + } +} \ No newline at end of file diff --git a/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/GrpcTransportConfig_v0_3.java b/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/GrpcTransportConfig_v0_3.java new file mode 100644 index 000000000..34122cc53 --- /dev/null +++ b/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/GrpcTransportConfig_v0_3.java @@ -0,0 +1,21 @@ +package org.a2aproject.sdk.compat03.client.transport.grpc; + +import org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportConfig_v0_3; +import org.a2aproject.sdk.util.Assert; +import io.grpc.Channel; + +import java.util.function.Function; + +public class GrpcTransportConfig_v0_3 extends ClientTransportConfig_v0_3 { + + private final Function channelFactory; + + public GrpcTransportConfig_v0_3(Function channelFactory) { + Assert.checkNotNullParam("channelFactory", channelFactory); + this.channelFactory = channelFactory; + } + + public Function getChannelFactory() { + return this.channelFactory; + } +} \ No newline at end of file diff --git a/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/GrpcTransportProvider_v0_3.java b/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/GrpcTransportProvider_v0_3.java new file mode 100644 index 000000000..1faac044a --- /dev/null +++ b/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/GrpcTransportProvider_v0_3.java @@ -0,0 +1,35 @@ +package org.a2aproject.sdk.compat03.client.transport.grpc; + +import org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportProvider_v0_3; +import org.a2aproject.sdk.compat03.spec.A2AClientException_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentCard_v0_3; +import org.a2aproject.sdk.compat03.spec.TransportProtocol_v0_3; +import io.grpc.Channel; + +/** + * Provider for gRPC transport implementation. + */ +public class GrpcTransportProvider_v0_3 implements ClientTransportProvider_v0_3 { + + @Override + public GrpcTransport_v0_3 create(GrpcTransportConfig_v0_3 grpcTransportConfig, AgentCard_v0_3 agentCard, String agentUrl) throws A2AClientException_v0_3 { + // not making use of the interceptors for gRPC for now + + Channel channel = grpcTransportConfig.getChannelFactory().apply(agentUrl); + if (channel != null) { + return new GrpcTransport_v0_3(channel, agentCard, grpcTransportConfig.getInterceptors()); + } + + throw new A2AClientException_v0_3("Missing required GrpcTransportConfig"); + } + + @Override + public String getTransportProtocol() { + return TransportProtocol_v0_3.GRPC.asString(); + } + + @Override + public Class getTransportProtocolClass() { + return GrpcTransport_v0_3.class; + } +} diff --git a/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/GrpcTransport_v0_3.java b/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/GrpcTransport_v0_3.java new file mode 100644 index 000000000..50f73e641 --- /dev/null +++ b/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/GrpcTransport_v0_3.java @@ -0,0 +1,389 @@ +package org.a2aproject.sdk.compat03.client.transport.grpc; + +import static org.a2aproject.sdk.util.Assert.checkNotNullParam; + +import java.util.List; +import java.util.Map; +import java.util.function.Consumer; +import java.util.stream.Collectors; + +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.ClientCallContext_v0_3; +import org.a2aproject.sdk.compat03.client.transport.spi.ClientTransport_v0_3; +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.ClientCallInterceptor_v0_3; +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.PayloadAndHeaders_v0_3; +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.auth.AuthInterceptor_v0_3; +import org.a2aproject.sdk.compat03.grpc.A2AServiceGrpc; +import org.a2aproject.sdk.compat03.grpc.A2AServiceGrpc.A2AServiceBlockingV2Stub; +import org.a2aproject.sdk.compat03.grpc.A2AServiceGrpc.A2AServiceStub; +import org.a2aproject.sdk.compat03.grpc.CancelTaskRequest; +import org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest; +import org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest; +import org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest; +import org.a2aproject.sdk.compat03.grpc.GetTaskRequest; +import org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest; +import org.a2aproject.sdk.compat03.grpc.SendMessageRequest; +import org.a2aproject.sdk.compat03.grpc.SendMessageResponse; +import org.a2aproject.sdk.compat03.grpc.StreamResponse; +import org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest; +import org.a2aproject.sdk.compat03.grpc.utils.ProtoUtils_v0_3.FromProto; +import org.a2aproject.sdk.compat03.grpc.utils.ProtoUtils_v0_3.ToProto; +import io.grpc.StatusException; +import org.a2aproject.sdk.compat03.spec.A2AClientException_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentCard_v0_3; +import org.a2aproject.sdk.compat03.spec.CancelTaskRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigParams_v0_3; +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.EventKind_v0_3; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigParams_v0_3; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.GetTaskRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.ListTaskPushNotificationConfigParams_v0_3; +import org.a2aproject.sdk.compat03.spec.ListTaskPushNotificationConfigRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.MessageSendParams_v0_3; +import org.a2aproject.sdk.compat03.spec.SendMessageRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.SendStreamingMessageRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.SetTaskPushNotificationConfigRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.StreamingEventKind_v0_3; +import org.a2aproject.sdk.compat03.spec.Task_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskIdParams_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskQueryParams_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskResubscriptionRequest_v0_3; +import io.grpc.Channel; +import io.grpc.Metadata; +import io.grpc.StatusRuntimeException; +import io.grpc.stub.MetadataUtils; +import io.grpc.stub.StreamObserver; +import org.jspecify.annotations.Nullable; + +public class GrpcTransport_v0_3 implements ClientTransport_v0_3 { + + private static final Metadata.Key AUTHORIZATION_METADATA_KEY = Metadata.Key.of( + AuthInterceptor_v0_3.AUTHORIZATION, + Metadata.ASCII_STRING_MARSHALLER); + private static final Metadata.Key EXTENSIONS_KEY = Metadata.Key.of( + "X-A2A-Extensions", + Metadata.ASCII_STRING_MARSHALLER); + private final A2AServiceBlockingV2Stub blockingStub; + private final A2AServiceStub asyncStub; + private final @Nullable List interceptors; + private AgentCard_v0_3 agentCard; + + public GrpcTransport_v0_3(Channel channel, AgentCard_v0_3 agentCard) { + this(channel, agentCard, null); + } + + public GrpcTransport_v0_3(Channel channel, AgentCard_v0_3 agentCard, @Nullable List interceptors) { + checkNotNullParam("channel", channel); + checkNotNullParam("agentCard", agentCard); + this.asyncStub = A2AServiceGrpc.newStub(channel); + this.blockingStub = A2AServiceGrpc.newBlockingV2Stub(channel); + this.agentCard = agentCard; + this.interceptors = interceptors; + } + + @Override + public EventKind_v0_3 sendMessage(MessageSendParams_v0_3 request, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + checkNotNullParam("request", request); + + SendMessageRequest sendMessageRequest = createGrpcSendMessageRequest(request, context); + PayloadAndHeaders_v0_3 payloadAndHeaders = applyInterceptors(SendMessageRequest_v0_3.METHOD, sendMessageRequest, + agentCard, context); + + try { + A2AServiceBlockingV2Stub stubWithMetadata = createBlockingStubWithMetadata(context, payloadAndHeaders); + SendMessageResponse response = stubWithMetadata.sendMessage(sendMessageRequest); + if (response.hasMsg()) { + return FromProto.message(response.getMsg()); + } else if (response.hasTask()) { + return FromProto.task(response.getTask()); + } else { + throw new A2AClientException_v0_3("Server response did not contain a message or task"); + } + } catch (StatusRuntimeException | StatusException e) { + throw GrpcErrorMapper_v0_3.mapGrpcError(e, "Failed to send message: "); + } + } + + @Override + public void sendMessageStreaming(MessageSendParams_v0_3 request, Consumer eventConsumer, + Consumer errorConsumer, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + checkNotNullParam("request", request); + checkNotNullParam("eventConsumer", eventConsumer); + SendMessageRequest grpcRequest = createGrpcSendMessageRequest(request, context); + PayloadAndHeaders_v0_3 payloadAndHeaders = applyInterceptors(SendStreamingMessageRequest_v0_3.METHOD, + grpcRequest, agentCard, context); + StreamObserver streamObserver = new EventStreamObserver_v0_3(eventConsumer, errorConsumer); + + try { + A2AServiceStub stubWithMetadata = createAsyncStubWithMetadata(context, payloadAndHeaders); + stubWithMetadata.sendStreamingMessage(grpcRequest, streamObserver); + } catch (StatusRuntimeException e) { + throw GrpcErrorMapper_v0_3.mapGrpcError(e, "Failed to send streaming message request: "); + } + } + + @Override + public Task_v0_3 getTask(TaskQueryParams_v0_3 request, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + checkNotNullParam("request", request); + + GetTaskRequest.Builder requestBuilder = GetTaskRequest.newBuilder(); + requestBuilder.setName("tasks/" + request.id()); + requestBuilder.setHistoryLength(request.historyLength()); + GetTaskRequest getTaskRequest = requestBuilder.build(); + PayloadAndHeaders_v0_3 payloadAndHeaders = applyInterceptors(GetTaskRequest_v0_3.METHOD, getTaskRequest, + agentCard, context); + + try { + A2AServiceBlockingV2Stub stubWithMetadata = createBlockingStubWithMetadata(context, payloadAndHeaders); + return FromProto.task(stubWithMetadata.getTask(getTaskRequest)); + } catch (StatusRuntimeException | StatusException e) { + throw GrpcErrorMapper_v0_3.mapGrpcError(e, "Failed to get task: "); + } + } + + @Override + public Task_v0_3 cancelTask(TaskIdParams_v0_3 request, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + checkNotNullParam("request", request); + + CancelTaskRequest cancelTaskRequest = CancelTaskRequest.newBuilder() + .setName("tasks/" + request.id()) + .build(); + PayloadAndHeaders_v0_3 payloadAndHeaders = applyInterceptors(CancelTaskRequest_v0_3.METHOD, cancelTaskRequest, + agentCard, context); + + try { + A2AServiceBlockingV2Stub stubWithMetadata = createBlockingStubWithMetadata(context, payloadAndHeaders); + return FromProto.task(stubWithMetadata.cancelTask(cancelTaskRequest)); + } catch (StatusRuntimeException | StatusException e) { + throw GrpcErrorMapper_v0_3.mapGrpcError(e, "Failed to cancel task: "); + } + } + + @Override + public TaskPushNotificationConfig_v0_3 setTaskPushNotificationConfiguration(TaskPushNotificationConfig_v0_3 request, + @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + checkNotNullParam("request", request); + + String configId = request.pushNotificationConfig().id(); + CreateTaskPushNotificationConfigRequest grpcRequest = CreateTaskPushNotificationConfigRequest.newBuilder() + .setParent("tasks/" + request.taskId()) + .setConfig(ToProto.taskPushNotificationConfig(request)) + .setConfigId(configId != null ? configId : request.taskId()) + .build(); + PayloadAndHeaders_v0_3 payloadAndHeaders = applyInterceptors(SetTaskPushNotificationConfigRequest_v0_3.METHOD, + grpcRequest, agentCard, context); + + try { + A2AServiceBlockingV2Stub stubWithMetadata = createBlockingStubWithMetadata(context, payloadAndHeaders); + return FromProto.taskPushNotificationConfig(stubWithMetadata.createTaskPushNotificationConfig(grpcRequest)); + } catch (StatusRuntimeException | StatusException e) { + throw GrpcErrorMapper_v0_3.mapGrpcError(e, "Failed to create task push notification config: "); + } + } + + @Override + public TaskPushNotificationConfig_v0_3 getTaskPushNotificationConfiguration( + GetTaskPushNotificationConfigParams_v0_3 request, + @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + checkNotNullParam("request", request); + + GetTaskPushNotificationConfigRequest grpcRequest = GetTaskPushNotificationConfigRequest.newBuilder() + .setName(getTaskPushNotificationConfigName(request)) + .build(); + PayloadAndHeaders_v0_3 payloadAndHeaders = applyInterceptors(GetTaskPushNotificationConfigRequest_v0_3.METHOD, + grpcRequest, agentCard, context); + + try { + A2AServiceBlockingV2Stub stubWithMetadata = createBlockingStubWithMetadata(context, payloadAndHeaders); + return FromProto.taskPushNotificationConfig(stubWithMetadata.getTaskPushNotificationConfig(grpcRequest)); + } catch (StatusRuntimeException | StatusException e) { + throw GrpcErrorMapper_v0_3.mapGrpcError(e, "Failed to get task push notification config: "); + } + } + + @Override + public List listTaskPushNotificationConfigurations( + ListTaskPushNotificationConfigParams_v0_3 request, + @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + checkNotNullParam("request", request); + + ListTaskPushNotificationConfigRequest grpcRequest = ListTaskPushNotificationConfigRequest.newBuilder() + .setParent("tasks/" + request.id()) + .build(); + PayloadAndHeaders_v0_3 payloadAndHeaders = applyInterceptors(ListTaskPushNotificationConfigRequest_v0_3.METHOD, + grpcRequest, agentCard, context); + + try { + A2AServiceBlockingV2Stub stubWithMetadata = createBlockingStubWithMetadata(context, payloadAndHeaders); + return stubWithMetadata.listTaskPushNotificationConfig(grpcRequest).getConfigsList().stream() + .map(FromProto::taskPushNotificationConfig) + .collect(Collectors.toList()); + } catch (StatusRuntimeException | StatusException e) { + throw GrpcErrorMapper_v0_3.mapGrpcError(e, "Failed to list task push notification config: "); + } + } + + @Override + public void deleteTaskPushNotificationConfigurations(DeleteTaskPushNotificationConfigParams_v0_3 request, + @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + checkNotNullParam("request", request); + + DeleteTaskPushNotificationConfigRequest grpcRequest = DeleteTaskPushNotificationConfigRequest.newBuilder() + .setName(getTaskPushNotificationConfigName(request.id(), request.pushNotificationConfigId())) + .build(); + PayloadAndHeaders_v0_3 payloadAndHeaders = applyInterceptors(DeleteTaskPushNotificationConfigRequest_v0_3.METHOD, + grpcRequest, agentCard, context); + + try { + A2AServiceBlockingV2Stub stubWithMetadata = createBlockingStubWithMetadata(context, payloadAndHeaders); + stubWithMetadata.deleteTaskPushNotificationConfig(grpcRequest); + } catch (StatusRuntimeException | StatusException e) { + throw GrpcErrorMapper_v0_3.mapGrpcError(e, "Failed to delete task push notification config: "); + } + } + + @Override + public void resubscribe(TaskIdParams_v0_3 request, Consumer eventConsumer, + Consumer errorConsumer, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + checkNotNullParam("request", request); + checkNotNullParam("eventConsumer", eventConsumer); + + TaskSubscriptionRequest grpcRequest = TaskSubscriptionRequest.newBuilder() + .setName("tasks/" + request.id()) + .build(); + PayloadAndHeaders_v0_3 payloadAndHeaders = applyInterceptors(TaskResubscriptionRequest_v0_3.METHOD, + grpcRequest, agentCard, context); + + StreamObserver streamObserver = new EventStreamObserver_v0_3(eventConsumer, errorConsumer); + + try { + A2AServiceStub stubWithMetadata = createAsyncStubWithMetadata(context, payloadAndHeaders); + stubWithMetadata.taskSubscription(grpcRequest, streamObserver); + } catch (StatusRuntimeException e) { + throw GrpcErrorMapper_v0_3.mapGrpcError(e, "Failed to resubscribe task push notification config: "); + } + } + + @Override + public AgentCard_v0_3 getAgentCard(@Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + // TODO: Determine how to handle retrieving the authenticated extended agent card + return agentCard; + } + + @Override + public void close() { + } + + private SendMessageRequest createGrpcSendMessageRequest(MessageSendParams_v0_3 messageSendParams, @Nullable ClientCallContext_v0_3 context) { + SendMessageRequest.Builder builder = SendMessageRequest.newBuilder(); + builder.setRequest(ToProto.message(messageSendParams.message())); + if (messageSendParams.configuration() != null) { + builder.setConfiguration(ToProto.messageSendConfiguration(messageSendParams.configuration())); + } + if (messageSendParams.metadata() != null) { + builder.setMetadata(ToProto.struct(messageSendParams.metadata())); + } + return builder.build(); + } + + /** + * Creates gRPC metadata from ClientCallContext headers. + * Extracts headers like X-A2A-Extensions and sets them as gRPC metadata. + * @param context the client call context containing headers, may be null + * @param payloadAndHeaders the payload and headers wrapper, may be null + * @return the gRPC metadata + */ + private Metadata createGrpcMetadata(@Nullable ClientCallContext_v0_3 context, @Nullable PayloadAndHeaders_v0_3 payloadAndHeaders) { + Metadata metadata = new Metadata(); + + if (context != null && context.getHeaders() != null) { + // Set X-A2A-Extensions header if present + String extensionsHeader = context.getHeaders().get("X-A2A-Extensions"); + if (extensionsHeader != null) { + metadata.put(EXTENSIONS_KEY, extensionsHeader); + } + + // Add other headers as needed in the future + // For now, we only handle X-A2A-Extensions + } + if (payloadAndHeaders != null && payloadAndHeaders.getHeaders() != null) { + // Handle all headers from interceptors (including auth headers) + for (Map.Entry headerEntry : payloadAndHeaders.getHeaders().entrySet()) { + String headerName = headerEntry.getKey(); + String headerValue = headerEntry.getValue(); + + if (headerValue != null) { + // Use static key for common Authorization header, create dynamic keys for others + if (AuthInterceptor_v0_3.AUTHORIZATION.equals(headerName)) { + metadata.put(AUTHORIZATION_METADATA_KEY, headerValue); + } else { + // Create a metadata key dynamically for API keys and other custom headers + Metadata.Key metadataKey = Metadata.Key.of(headerName, Metadata.ASCII_STRING_MARSHALLER); + metadata.put(metadataKey, headerValue); + } + } + } + } + + return metadata; + } + + /** + * Creates a blocking stub with metadata attached from the ClientCallContext. + * + * @param context the client call context + * @param payloadAndHeaders the payloadAndHeaders after applying any interceptors + * @return blocking stub with metadata interceptor + */ + private A2AServiceBlockingV2Stub createBlockingStubWithMetadata(@Nullable ClientCallContext_v0_3 context, + PayloadAndHeaders_v0_3 payloadAndHeaders) { + Metadata metadata = createGrpcMetadata(context, payloadAndHeaders); + return blockingStub.withInterceptors(MetadataUtils.newAttachHeadersInterceptor(metadata)); + } + + /** + * Creates an async stub with metadata attached from the ClientCallContext. + * + * @param context the client call context + * @param payloadAndHeaders the payloadAndHeaders after applying any interceptors + * @return async stub with metadata interceptor + */ + private A2AServiceStub createAsyncStubWithMetadata(@Nullable ClientCallContext_v0_3 context, + PayloadAndHeaders_v0_3 payloadAndHeaders) { + Metadata metadata = createGrpcMetadata(context, payloadAndHeaders); + return asyncStub.withInterceptors(MetadataUtils.newAttachHeadersInterceptor(metadata)); + } + + private String getTaskPushNotificationConfigName(GetTaskPushNotificationConfigParams_v0_3 params) { + return getTaskPushNotificationConfigName(params.id(), params.pushNotificationConfigId()); + } + + private String getTaskPushNotificationConfigName(String taskId, @Nullable String pushNotificationConfigId) { + StringBuilder name = new StringBuilder(); + name.append("tasks/"); + name.append(taskId); + if (pushNotificationConfigId != null) { + name.append("/pushNotificationConfigs/"); + name.append(pushNotificationConfigId); + } + //name.append("/pushNotificationConfigs/"); + // Use taskId as default config ID if none provided + //name.append(pushNotificationConfigId != null ? pushNotificationConfigId : taskId); + return name.toString(); + } + + private PayloadAndHeaders_v0_3 applyInterceptors(String methodName, Object payload, + AgentCard_v0_3 agentCard, @Nullable ClientCallContext_v0_3 clientCallContext) { + PayloadAndHeaders_v0_3 payloadAndHeaders = new PayloadAndHeaders_v0_3(payload, + clientCallContext != null ? clientCallContext.getHeaders() : null); + if (interceptors != null && ! interceptors.isEmpty()) { + for (ClientCallInterceptor_v0_3 interceptor : interceptors) { + payloadAndHeaders = interceptor.intercept(methodName, payloadAndHeaders.getPayload(), + payloadAndHeaders.getHeaders(), agentCard, clientCallContext); + } + } + return payloadAndHeaders; + } + +} \ No newline at end of file diff --git a/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/package-info.java b/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/package-info.java new file mode 100644 index 000000000..71bb5c883 --- /dev/null +++ b/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/package-info.java @@ -0,0 +1,4 @@ +@NullMarked +package org.a2aproject.sdk.compat03.client.transport.grpc; + +import org.jspecify.annotations.NullMarked; \ No newline at end of file diff --git a/compat-0.3/client/transport/grpc/src/main/resources/META-INF/services/org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportProvider_v0_3 b/compat-0.3/client/transport/grpc/src/main/resources/META-INF/services/org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportProvider_v0_3 new file mode 100644 index 000000000..613914e98 --- /dev/null +++ b/compat-0.3/client/transport/grpc/src/main/resources/META-INF/services/org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportProvider_v0_3 @@ -0,0 +1 @@ +org.a2aproject.sdk.compat03.client.transport.grpc.GrpcTransportProvider_v0_3 \ No newline at end of file diff --git a/compat-0.3/client/transport/grpc/src/test/java/org/a2aproject/sdk/compat03/client/transport/grpc/GrpcErrorMapper_v0_3_Test.java b/compat-0.3/client/transport/grpc/src/test/java/org/a2aproject/sdk/compat03/client/transport/grpc/GrpcErrorMapper_v0_3_Test.java new file mode 100644 index 000000000..b2e402f03 --- /dev/null +++ b/compat-0.3/client/transport/grpc/src/test/java/org/a2aproject/sdk/compat03/client/transport/grpc/GrpcErrorMapper_v0_3_Test.java @@ -0,0 +1,293 @@ +package org.a2aproject.sdk.compat03.client.transport.grpc; + +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.a2aproject.sdk.compat03.spec.A2AClientException_v0_3; +import org.a2aproject.sdk.compat03.spec.ContentTypeNotSupportedError_v0_3; +import org.a2aproject.sdk.compat03.spec.InternalError_v0_3; +import org.a2aproject.sdk.compat03.spec.InvalidAgentResponseError_v0_3; +import org.a2aproject.sdk.compat03.spec.InvalidParamsError_v0_3; +import org.a2aproject.sdk.compat03.spec.InvalidRequestError_v0_3; +import org.a2aproject.sdk.compat03.spec.JSONParseError_v0_3; +import org.a2aproject.sdk.compat03.spec.MethodNotFoundError_v0_3; +import org.a2aproject.sdk.compat03.spec.PushNotificationNotSupportedError_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskNotCancelableError_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskNotFoundError_v0_3; +import org.a2aproject.sdk.compat03.spec.UnsupportedOperationError_v0_3; +import io.grpc.Status; +import io.grpc.StatusRuntimeException; +import org.junit.jupiter.api.Test; + +/** + * Tests for GrpcErrorMapper - verifies correct mapping of gRPC StatusRuntimeException + * to v0.3 A2A error types based on description string matching and status codes. + */ +public class GrpcErrorMapper_v0_3_Test { + + @Test + public void testTaskNotFoundErrorByDescription() { + String errorMessage = "TaskNotFoundError: Task task-123 not found"; + StatusRuntimeException grpcException = Status.NOT_FOUND + .withDescription(errorMessage) + .asRuntimeException(); + + A2AClientException_v0_3 result = GrpcErrorMapper_v0_3.mapGrpcError(grpcException); + + assertNotNull(result); + assertNotNull(result.getCause()); + assertInstanceOf(TaskNotFoundError_v0_3.class, result.getCause()); + assertTrue(result.getMessage().contains(errorMessage)); + } + + @Test + public void testTaskNotFoundErrorByStatusCode() { + // Test fallback to status code mapping when description doesn't contain error type + StatusRuntimeException grpcException = Status.NOT_FOUND + .withDescription("Generic not found error") + .asRuntimeException(); + + A2AClientException_v0_3 result = GrpcErrorMapper_v0_3.mapGrpcError(grpcException); + + assertNotNull(result); + assertNotNull(result.getCause()); + assertInstanceOf(TaskNotFoundError_v0_3.class, result.getCause()); + } + + @Test + public void testUnsupportedOperationErrorByDescription() { + String errorMessage = "UnsupportedOperationError: Operation not supported"; + StatusRuntimeException grpcException = Status.UNIMPLEMENTED + .withDescription(errorMessage) + .asRuntimeException(); + + A2AClientException_v0_3 result = GrpcErrorMapper_v0_3.mapGrpcError(grpcException); + + assertNotNull(result); + assertNotNull(result.getCause()); + assertInstanceOf(UnsupportedOperationError_v0_3.class, result.getCause()); + } + + @Test + public void testUnsupportedOperationErrorByStatusCode() { + StatusRuntimeException grpcException = Status.UNIMPLEMENTED + .withDescription("Generic unimplemented error") + .asRuntimeException(); + + A2AClientException_v0_3 result = GrpcErrorMapper_v0_3.mapGrpcError(grpcException); + + assertNotNull(result); + assertNotNull(result.getCause()); + assertInstanceOf(UnsupportedOperationError_v0_3.class, result.getCause()); + } + + @Test + public void testInvalidParamsErrorByDescription() { + String errorMessage = "InvalidParamsError: Invalid parameters provided"; + StatusRuntimeException grpcException = Status.INVALID_ARGUMENT + .withDescription(errorMessage) + .asRuntimeException(); + + A2AClientException_v0_3 result = GrpcErrorMapper_v0_3.mapGrpcError(grpcException); + + assertNotNull(result); + assertNotNull(result.getCause()); + assertInstanceOf(InvalidParamsError_v0_3.class, result.getCause()); + } + + @Test + public void testInvalidParamsErrorByStatusCode() { + StatusRuntimeException grpcException = Status.INVALID_ARGUMENT + .withDescription("Generic invalid argument") + .asRuntimeException(); + + A2AClientException_v0_3 result = GrpcErrorMapper_v0_3.mapGrpcError(grpcException); + + assertNotNull(result); + assertNotNull(result.getCause()); + assertInstanceOf(InvalidParamsError_v0_3.class, result.getCause()); + } + + @Test + public void testInvalidRequestError() { + String errorMessage = "InvalidRequestError: Request is malformed"; + StatusRuntimeException grpcException = Status.INVALID_ARGUMENT + .withDescription(errorMessage) + .asRuntimeException(); + + A2AClientException_v0_3 result = GrpcErrorMapper_v0_3.mapGrpcError(grpcException); + + assertNotNull(result); + assertNotNull(result.getCause()); + assertInstanceOf(InvalidRequestError_v0_3.class, result.getCause()); + } + + @Test + public void testMethodNotFoundError() { + String errorMessage = "MethodNotFoundError: Method does not exist"; + StatusRuntimeException grpcException = Status.NOT_FOUND + .withDescription(errorMessage) + .asRuntimeException(); + + A2AClientException_v0_3 result = GrpcErrorMapper_v0_3.mapGrpcError(grpcException); + + assertNotNull(result); + assertNotNull(result.getCause()); + assertInstanceOf(MethodNotFoundError_v0_3.class, result.getCause()); + } + + @Test + public void testTaskNotCancelableError() { + String errorMessage = "TaskNotCancelableError: Task cannot be cancelled"; + StatusRuntimeException grpcException = Status.UNIMPLEMENTED + .withDescription(errorMessage) + .asRuntimeException(); + + A2AClientException_v0_3 result = GrpcErrorMapper_v0_3.mapGrpcError(grpcException); + + assertNotNull(result); + assertNotNull(result.getCause()); + assertInstanceOf(TaskNotCancelableError_v0_3.class, result.getCause()); + } + + @Test + public void testPushNotificationNotSupportedError() { + String errorMessage = "PushNotificationNotSupportedError: Push notifications not supported"; + StatusRuntimeException grpcException = Status.UNIMPLEMENTED + .withDescription(errorMessage) + .asRuntimeException(); + + A2AClientException_v0_3 result = GrpcErrorMapper_v0_3.mapGrpcError(grpcException); + + assertNotNull(result); + assertNotNull(result.getCause()); + assertInstanceOf(PushNotificationNotSupportedError_v0_3.class, result.getCause()); + } + + @Test + public void testJSONParseError() { + String errorMessage = "JSONParseError: Failed to parse JSON"; + StatusRuntimeException grpcException = Status.INTERNAL + .withDescription(errorMessage) + .asRuntimeException(); + + A2AClientException_v0_3 result = GrpcErrorMapper_v0_3.mapGrpcError(grpcException); + + assertNotNull(result); + assertNotNull(result.getCause()); + assertInstanceOf(JSONParseError_v0_3.class, result.getCause()); + } + + @Test + public void testContentTypeNotSupportedError() { + String errorMessage = "ContentTypeNotSupportedError: Content type application/xml not supported"; + StatusRuntimeException grpcException = Status.INVALID_ARGUMENT + .withDescription(errorMessage) + .asRuntimeException(); + + A2AClientException_v0_3 result = GrpcErrorMapper_v0_3.mapGrpcError(grpcException); + + assertNotNull(result); + assertNotNull(result.getCause()); + assertInstanceOf(ContentTypeNotSupportedError_v0_3.class, result.getCause()); + + ContentTypeNotSupportedError_v0_3 contentTypeError = (ContentTypeNotSupportedError_v0_3) result.getCause(); + assertNotNull(contentTypeError.getMessage()); + assertTrue(contentTypeError.getMessage().contains("Content type application/xml not supported")); + } + + @Test + public void testInvalidAgentResponseError() { + String errorMessage = "InvalidAgentResponseError: Agent response is invalid"; + StatusRuntimeException grpcException = Status.INTERNAL + .withDescription(errorMessage) + .asRuntimeException(); + + A2AClientException_v0_3 result = GrpcErrorMapper_v0_3.mapGrpcError(grpcException); + + assertNotNull(result); + assertNotNull(result.getCause()); + assertInstanceOf(InvalidAgentResponseError_v0_3.class, result.getCause()); + + InvalidAgentResponseError_v0_3 agentResponseError = (InvalidAgentResponseError_v0_3) result.getCause(); + assertNotNull(agentResponseError.getMessage()); + assertTrue(agentResponseError.getMessage().contains("Agent response is invalid")); + } + + @Test + public void testInternalErrorByStatusCode() { + StatusRuntimeException grpcException = Status.INTERNAL + .withDescription("Internal server error") + .asRuntimeException(); + + A2AClientException_v0_3 result = GrpcErrorMapper_v0_3.mapGrpcError(grpcException); + + assertNotNull(result); + assertNotNull(result.getCause()); + assertInstanceOf(InternalError_v0_3.class, result.getCause()); + } + + @Test + public void testCustomErrorPrefix() { + String errorMessage = "TaskNotFoundError: Task not found"; + StatusRuntimeException grpcException = Status.NOT_FOUND + .withDescription(errorMessage) + .asRuntimeException(); + + String customPrefix = "Custom Error: "; + A2AClientException_v0_3 result = GrpcErrorMapper_v0_3.mapGrpcError(grpcException, customPrefix); + + assertNotNull(result); + assertTrue(result.getMessage().startsWith(customPrefix)); + assertInstanceOf(TaskNotFoundError_v0_3.class, result.getCause()); + } + + @Test + public void testAuthenticationFailed() { + StatusRuntimeException grpcException = Status.UNAUTHENTICATED + .withDescription("Authentication failed") + .asRuntimeException(); + + A2AClientException_v0_3 result = GrpcErrorMapper_v0_3.mapGrpcError(grpcException); + + assertNotNull(result); + assertTrue(result.getMessage().contains("Authentication failed")); + } + + @Test + public void testAuthorizationFailed() { + StatusRuntimeException grpcException = Status.PERMISSION_DENIED + .withDescription("Permission denied") + .asRuntimeException(); + + A2AClientException_v0_3 result = GrpcErrorMapper_v0_3.mapGrpcError(grpcException); + + assertNotNull(result); + assertTrue(result.getMessage().contains("Authorization failed")); + } + + @Test + public void testUnknownStatusCode() { + StatusRuntimeException grpcException = Status.DEADLINE_EXCEEDED + .withDescription("Request timeout") + .asRuntimeException(); + + A2AClientException_v0_3 result = GrpcErrorMapper_v0_3.mapGrpcError(grpcException); + + assertNotNull(result); + assertTrue(result.getMessage().contains("Request timeout")); + } + + @Test + public void testNullDescription() { + StatusRuntimeException grpcException = Status.NOT_FOUND + .asRuntimeException(); + + A2AClientException_v0_3 result = GrpcErrorMapper_v0_3.mapGrpcError(grpcException); + + assertNotNull(result); + assertNotNull(result.getCause()); + assertInstanceOf(TaskNotFoundError_v0_3.class, result.getCause()); + } +} diff --git a/compat-0.3/client/transport/jsonrpc/pom.xml b/compat-0.3/client/transport/jsonrpc/pom.xml new file mode 100644 index 000000000..fd099d2d0 --- /dev/null +++ b/compat-0.3/client/transport/jsonrpc/pom.xml @@ -0,0 +1,49 @@ + + + 4.0.0 + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-parent + 1.0.0.Beta2-SNAPSHOT + ../../.. + + a2a-java-sdk-compat-0.3-client-transport-jsonrpc + jar + + Java SDK A2A Compat 0.3 Client Transport: JSONRPC + Java SDK for the Agent2Agent Protocol (A2A) - JSONRPC Client Transport + + + + ${project.groupId} + a2a-java-sdk-compat-0.3-http-client + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client-transport-spi + + + ${project.groupId} + a2a-java-sdk-common + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec + + + org.junit.jupiter + junit-jupiter-api + test + + + + org.mock-server + mockserver-netty + test + + + + \ No newline at end of file diff --git a/compat-0.3/client/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JSONRPCTransportConfigBuilder_v0_3.java b/compat-0.3/client/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JSONRPCTransportConfigBuilder_v0_3.java new file mode 100644 index 000000000..be9d95608 --- /dev/null +++ b/compat-0.3/client/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JSONRPCTransportConfigBuilder_v0_3.java @@ -0,0 +1,28 @@ +package org.a2aproject.sdk.compat03.client.transport.jsonrpc; + +import org.a2aproject.sdk.compat03.client.http.A2AHttpClient_v0_3; +import org.a2aproject.sdk.compat03.client.http.JdkA2AHttpClient_v0_3; +import org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportConfigBuilder_v0_3; + +public class JSONRPCTransportConfigBuilder_v0_3 extends ClientTransportConfigBuilder_v0_3 { + + private A2AHttpClient_v0_3 httpClient; + + public JSONRPCTransportConfigBuilder_v0_3 httpClient(A2AHttpClient_v0_3 httpClient) { + this.httpClient = httpClient; + + return this; + } + + @Override + public JSONRPCTransportConfig_v0_3 build() { + // No HTTP client provided, fallback to the default one (JDK-based implementation) + if (httpClient == null) { + httpClient = new JdkA2AHttpClient_v0_3(); + } + + JSONRPCTransportConfig_v0_3 config = new JSONRPCTransportConfig_v0_3(httpClient); + config.setInterceptors(this.interceptors); + return config; + } +} \ No newline at end of file diff --git a/compat-0.3/client/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JSONRPCTransportConfig_v0_3.java b/compat-0.3/client/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JSONRPCTransportConfig_v0_3.java new file mode 100644 index 000000000..7e01e3e56 --- /dev/null +++ b/compat-0.3/client/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JSONRPCTransportConfig_v0_3.java @@ -0,0 +1,21 @@ +package org.a2aproject.sdk.compat03.client.transport.jsonrpc; + +import org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportConfig_v0_3; +import org.a2aproject.sdk.compat03.client.http.A2AHttpClient_v0_3; + +public class JSONRPCTransportConfig_v0_3 extends ClientTransportConfig_v0_3 { + + private final A2AHttpClient_v0_3 httpClient; + + public JSONRPCTransportConfig_v0_3() { + this.httpClient = null; + } + + public JSONRPCTransportConfig_v0_3(A2AHttpClient_v0_3 httpClient) { + this.httpClient = httpClient; + } + + public A2AHttpClient_v0_3 getHttpClient() { + return httpClient; + } +} \ No newline at end of file diff --git a/compat-0.3/client/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JSONRPCTransportProvider_v0_3.java b/compat-0.3/client/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JSONRPCTransportProvider_v0_3.java new file mode 100644 index 000000000..afe66dadf --- /dev/null +++ b/compat-0.3/client/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JSONRPCTransportProvider_v0_3.java @@ -0,0 +1,29 @@ +package org.a2aproject.sdk.compat03.client.transport.jsonrpc; + +import org.a2aproject.sdk.compat03.client.http.JdkA2AHttpClient_v0_3; +import org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportProvider_v0_3; +import org.a2aproject.sdk.compat03.spec.A2AClientException_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentCard_v0_3; +import org.a2aproject.sdk.compat03.spec.TransportProtocol_v0_3; + +public class JSONRPCTransportProvider_v0_3 implements ClientTransportProvider_v0_3 { + + @Override + public JSONRPCTransport_v0_3 create(JSONRPCTransportConfig_v0_3 clientTransportConfig, AgentCard_v0_3 agentCard, String agentUrl) throws A2AClientException_v0_3 { + if (clientTransportConfig == null) { + clientTransportConfig = new JSONRPCTransportConfig_v0_3(new JdkA2AHttpClient_v0_3()); + } + + return new JSONRPCTransport_v0_3(clientTransportConfig.getHttpClient(), agentCard, agentUrl, clientTransportConfig.getInterceptors()); + } + + @Override + public String getTransportProtocol() { + return TransportProtocol_v0_3.JSONRPC.asString(); + } + + @Override + public Class getTransportProtocolClass() { + return JSONRPCTransport_v0_3.class; + } +} diff --git a/compat-0.3/client/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JSONRPCTransport_v0_3.java b/compat-0.3/client/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JSONRPCTransport_v0_3.java new file mode 100644 index 000000000..d379277cd --- /dev/null +++ b/compat-0.3/client/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JSONRPCTransport_v0_3.java @@ -0,0 +1,424 @@ +package org.a2aproject.sdk.compat03.client.transport.jsonrpc; + +import static org.a2aproject.sdk.util.Assert.checkNotNullParam; + +import java.io.IOException; +import java.util.List; +import java.util.Map; +import java.util.function.Consumer; + +import org.a2aproject.sdk.compat03.json.JsonProcessingException_v0_3; +import org.a2aproject.sdk.compat03.json.JsonUtil_v0_3; + +import org.a2aproject.sdk.compat03.client.http.A2ACardResolver_v0_3; +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.ClientCallContext_v0_3; +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.ClientCallInterceptor_v0_3; +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.PayloadAndHeaders_v0_3; +import org.a2aproject.sdk.compat03.client.http.A2AHttpClient_v0_3; +import org.a2aproject.sdk.compat03.client.http.A2AHttpResponse_v0_3; +import org.a2aproject.sdk.compat03.client.http.JdkA2AHttpClient_v0_3; +import org.a2aproject.sdk.compat03.client.transport.spi.ClientTransport_v0_3; +import org.a2aproject.sdk.compat03.spec.A2AClientError_v0_3; +import org.a2aproject.sdk.compat03.spec.A2AClientException_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentCard_v0_3; +import org.a2aproject.sdk.compat03.spec.CancelTaskRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.CancelTaskResponse_v0_3; + +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigParams_v0_3; +import org.a2aproject.sdk.compat03.spec.EventKind_v0_3; +import org.a2aproject.sdk.compat03.spec.GetAuthenticatedExtendedCardRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.GetAuthenticatedExtendedCardResponse_v0_3; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigParams_v0_3; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigResponse_v0_3; +import org.a2aproject.sdk.compat03.spec.GetTaskRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.GetTaskResponse_v0_3; +import org.a2aproject.sdk.compat03.spec.JSONRPCError_v0_3; +import org.a2aproject.sdk.compat03.spec.JSONRPCMessage_v0_3; +import org.a2aproject.sdk.compat03.spec.JSONRPCResponse_v0_3; + +import org.a2aproject.sdk.compat03.spec.ListTaskPushNotificationConfigParams_v0_3; +import org.a2aproject.sdk.compat03.spec.ListTaskPushNotificationConfigRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.ListTaskPushNotificationConfigResponse_v0_3; +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigResponse_v0_3; +import org.a2aproject.sdk.compat03.spec.MessageSendParams_v0_3; +import org.a2aproject.sdk.compat03.spec.SendMessageRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.SendMessageResponse_v0_3; +import org.a2aproject.sdk.compat03.spec.SendStreamingMessageRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.SetTaskPushNotificationConfigRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.SetTaskPushNotificationConfigResponse_v0_3; +import org.a2aproject.sdk.compat03.spec.StreamingEventKind_v0_3; +import org.a2aproject.sdk.compat03.spec.Task_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskIdParams_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskQueryParams_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskResubscriptionRequest_v0_3; +import org.a2aproject.sdk.compat03.client.transport.jsonrpc.sse.SSEEventListener_v0_3; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.atomic.AtomicReference; + +public class JSONRPCTransport_v0_3 implements ClientTransport_v0_3 { + + private static final Class SEND_MESSAGE_RESPONSE_REFERENCE = SendMessageResponse_v0_3.class; + private static final Class GET_TASK_RESPONSE_REFERENCE = GetTaskResponse_v0_3.class; + private static final Class CANCEL_TASK_RESPONSE_REFERENCE = CancelTaskResponse_v0_3.class; + private static final Class GET_TASK_PUSH_NOTIFICATION_CONFIG_RESPONSE_REFERENCE = GetTaskPushNotificationConfigResponse_v0_3.class; + private static final Class SET_TASK_PUSH_NOTIFICATION_CONFIG_RESPONSE_REFERENCE = SetTaskPushNotificationConfigResponse_v0_3.class; + private static final Class LIST_TASK_PUSH_NOTIFICATION_CONFIG_RESPONSE_REFERENCE = ListTaskPushNotificationConfigResponse_v0_3.class; + private static final Class DELETE_TASK_PUSH_NOTIFICATION_CONFIG_RESPONSE_REFERENCE = DeleteTaskPushNotificationConfigResponse_v0_3.class; + private static final Class GET_AUTHENTICATED_EXTENDED_CARD_RESPONSE_REFERENCE = GetAuthenticatedExtendedCardResponse_v0_3.class; + + private final A2AHttpClient_v0_3 httpClient; + private final String agentUrl; + private final List interceptors; + private AgentCard_v0_3 agentCard; + private boolean needsExtendedCard = false; + + public JSONRPCTransport_v0_3(String agentUrl) { + this(null, null, agentUrl, null); + } + + public JSONRPCTransport_v0_3(AgentCard_v0_3 agentCard) { + this(null, agentCard, agentCard.url(), null); + } + + public JSONRPCTransport_v0_3(A2AHttpClient_v0_3 httpClient, AgentCard_v0_3 agentCard, + String agentUrl, List interceptors) { + this.httpClient = httpClient == null ? new JdkA2AHttpClient_v0_3() : httpClient; + this.agentCard = agentCard; + this.agentUrl = agentUrl; + this.interceptors = interceptors; + this.needsExtendedCard = agentCard == null || agentCard.supportsAuthenticatedExtendedCard(); + } + + @Override + public EventKind_v0_3 sendMessage(MessageSendParams_v0_3 request, ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + checkNotNullParam("request", request); + SendMessageRequest_v0_3 sendMessageRequest = new SendMessageRequest_v0_3.Builder() + .jsonrpc(JSONRPCMessage_v0_3.JSONRPC_VERSION) + .method(SendMessageRequest_v0_3.METHOD) + .params(request) + .build(); // id will be randomly generated + + PayloadAndHeaders_v0_3 payloadAndHeaders = applyInterceptors(SendMessageRequest_v0_3.METHOD, sendMessageRequest, + agentCard, context); + + try { + String httpResponseBody = sendPostRequest(payloadAndHeaders); + SendMessageResponse_v0_3 response = unmarshalResponse(httpResponseBody, SEND_MESSAGE_RESPONSE_REFERENCE); + return response.getResult(); + } catch (A2AClientException_v0_3 e) { + throw e; + } catch (IOException | InterruptedException | JsonProcessingException_v0_3 e) { + throw new A2AClientException_v0_3("Failed to send message: " + e, e); + } + } + + @Override + public void sendMessageStreaming(MessageSendParams_v0_3 request, Consumer eventConsumer, + Consumer errorConsumer, ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + checkNotNullParam("request", request); + checkNotNullParam("eventConsumer", eventConsumer); + SendStreamingMessageRequest_v0_3 sendStreamingMessageRequest = new SendStreamingMessageRequest_v0_3.Builder() + .jsonrpc(JSONRPCMessage_v0_3.JSONRPC_VERSION) + .method(SendStreamingMessageRequest_v0_3.METHOD) + .params(request) + .build(); // id will be randomly generated + + PayloadAndHeaders_v0_3 payloadAndHeaders = applyInterceptors(SendStreamingMessageRequest_v0_3.METHOD, + sendStreamingMessageRequest, agentCard, context); + + AtomicReference> ref = new AtomicReference<>(); + SSEEventListener_v0_3 sseEventListener = new SSEEventListener_v0_3(eventConsumer, errorConsumer); + + try { + A2AHttpClient_v0_3.PostBuilder builder = createPostBuilder(payloadAndHeaders); + ref.set(builder.postAsyncSSE( + msg -> sseEventListener.onMessage(msg, ref.get()), + throwable -> sseEventListener.onError(throwable, ref.get()), + () -> { + // Signal normal stream completion to error handler (null error means success) + sseEventListener.onComplete(); + })); + } catch (IOException e) { + throw new A2AClientException_v0_3("Failed to send streaming message request: " + e, e); + } catch (InterruptedException e) { + throw new A2AClientException_v0_3("Send streaming message request timed out: " + e, e); + } catch (JsonProcessingException_v0_3 e) { + throw new A2AClientException_v0_3("Failed to process JSON for streaming message request: " + e, e); + } + } + + @Override + public Task_v0_3 getTask(TaskQueryParams_v0_3 request, ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + checkNotNullParam("request", request); + GetTaskRequest_v0_3 getTaskRequest = new GetTaskRequest_v0_3.Builder() + .jsonrpc(JSONRPCMessage_v0_3.JSONRPC_VERSION) + .method(GetTaskRequest_v0_3.METHOD) + .params(request) + .build(); // id will be randomly generated + + PayloadAndHeaders_v0_3 payloadAndHeaders = applyInterceptors(GetTaskRequest_v0_3.METHOD, getTaskRequest, + agentCard, context); + + try { + String httpResponseBody = sendPostRequest(payloadAndHeaders); + GetTaskResponse_v0_3 response = unmarshalResponse(httpResponseBody, GET_TASK_RESPONSE_REFERENCE); + return response.getResult(); + } catch (A2AClientException_v0_3 e) { + throw e; + } catch (IOException | InterruptedException | JsonProcessingException_v0_3 e) { + throw new A2AClientException_v0_3("Failed to get task: " + e, e); + } + } + + @Override + public Task_v0_3 cancelTask(TaskIdParams_v0_3 request, ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + checkNotNullParam("request", request); + CancelTaskRequest_v0_3 cancelTaskRequest = new CancelTaskRequest_v0_3.Builder() + .jsonrpc(JSONRPCMessage_v0_3.JSONRPC_VERSION) + .method(CancelTaskRequest_v0_3.METHOD) + .params(request) + .build(); // id will be randomly generated + + PayloadAndHeaders_v0_3 payloadAndHeaders = applyInterceptors(CancelTaskRequest_v0_3.METHOD, cancelTaskRequest, + agentCard, context); + + try { + String httpResponseBody = sendPostRequest(payloadAndHeaders); + CancelTaskResponse_v0_3 response = unmarshalResponse(httpResponseBody, CANCEL_TASK_RESPONSE_REFERENCE); + return response.getResult(); + } catch (A2AClientException_v0_3 e) { + throw e; + } catch (IOException | InterruptedException | JsonProcessingException_v0_3 e) { + throw new A2AClientException_v0_3("Failed to cancel task: " + e, e); + } + } + + @Override + public TaskPushNotificationConfig_v0_3 setTaskPushNotificationConfiguration(TaskPushNotificationConfig_v0_3 request, + ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + checkNotNullParam("request", request); + SetTaskPushNotificationConfigRequest_v0_3 setTaskPushNotificationRequest = new SetTaskPushNotificationConfigRequest_v0_3.Builder() + .jsonrpc(JSONRPCMessage_v0_3.JSONRPC_VERSION) + .method(SetTaskPushNotificationConfigRequest_v0_3.METHOD) + .params(request) + .build(); // id will be randomly generated + + PayloadAndHeaders_v0_3 payloadAndHeaders = applyInterceptors(SetTaskPushNotificationConfigRequest_v0_3.METHOD, + setTaskPushNotificationRequest, agentCard, context); + + try { + String httpResponseBody = sendPostRequest(payloadAndHeaders); + SetTaskPushNotificationConfigResponse_v0_3 response = unmarshalResponse(httpResponseBody, + SET_TASK_PUSH_NOTIFICATION_CONFIG_RESPONSE_REFERENCE); + return response.getResult(); + } catch (A2AClientException_v0_3 e) { + throw e; + } catch (IOException | InterruptedException | JsonProcessingException_v0_3 e) { + throw new A2AClientException_v0_3("Failed to set task push notification config: " + e, e); + } + } + + @Override + public TaskPushNotificationConfig_v0_3 getTaskPushNotificationConfiguration(GetTaskPushNotificationConfigParams_v0_3 request, + ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + checkNotNullParam("request", request); + GetTaskPushNotificationConfigRequest_v0_3 getTaskPushNotificationRequest = new GetTaskPushNotificationConfigRequest_v0_3.Builder() + .jsonrpc(JSONRPCMessage_v0_3.JSONRPC_VERSION) + .method(GetTaskPushNotificationConfigRequest_v0_3.METHOD) + .params(request) + .build(); // id will be randomly generated + + PayloadAndHeaders_v0_3 payloadAndHeaders = applyInterceptors(GetTaskPushNotificationConfigRequest_v0_3.METHOD, + getTaskPushNotificationRequest, agentCard, context); + + try { + String httpResponseBody = sendPostRequest(payloadAndHeaders); + GetTaskPushNotificationConfigResponse_v0_3 response = unmarshalResponse(httpResponseBody, + GET_TASK_PUSH_NOTIFICATION_CONFIG_RESPONSE_REFERENCE); + return response.getResult(); + } catch (A2AClientException_v0_3 e) { + throw e; + } catch (IOException | InterruptedException | JsonProcessingException_v0_3 e) { + throw new A2AClientException_v0_3("Failed to get task push notification config: " + e, e); + } + } + + @Override + public List listTaskPushNotificationConfigurations( + ListTaskPushNotificationConfigParams_v0_3 request, + ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + checkNotNullParam("request", request); + ListTaskPushNotificationConfigRequest_v0_3 listTaskPushNotificationRequest = new ListTaskPushNotificationConfigRequest_v0_3.Builder() + .jsonrpc(JSONRPCMessage_v0_3.JSONRPC_VERSION) + .method(ListTaskPushNotificationConfigRequest_v0_3.METHOD) + .params(request) + .build(); // id will be randomly generated + + PayloadAndHeaders_v0_3 payloadAndHeaders = applyInterceptors(ListTaskPushNotificationConfigRequest_v0_3.METHOD, + listTaskPushNotificationRequest, agentCard, context); + + try { + String httpResponseBody = sendPostRequest(payloadAndHeaders); + ListTaskPushNotificationConfigResponse_v0_3 response = unmarshalResponse(httpResponseBody, + LIST_TASK_PUSH_NOTIFICATION_CONFIG_RESPONSE_REFERENCE); + return response.getResult(); + } catch (A2AClientException_v0_3 e) { + throw e; + } catch (IOException | InterruptedException | JsonProcessingException_v0_3 e) { + throw new A2AClientException_v0_3("Failed to list task push notification configs: " + e, e); + } + } + + @Override + public void deleteTaskPushNotificationConfigurations(DeleteTaskPushNotificationConfigParams_v0_3 request, + ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + checkNotNullParam("request", request); + DeleteTaskPushNotificationConfigRequest_v0_3 deleteTaskPushNotificationRequest = new DeleteTaskPushNotificationConfigRequest_v0_3.Builder() + .jsonrpc(JSONRPCMessage_v0_3.JSONRPC_VERSION) + .method(DeleteTaskPushNotificationConfigRequest_v0_3.METHOD) + .params(request) + .build(); // id will be randomly generated + + PayloadAndHeaders_v0_3 payloadAndHeaders = applyInterceptors(DeleteTaskPushNotificationConfigRequest_v0_3.METHOD, + deleteTaskPushNotificationRequest, agentCard, context); + + try { + String httpResponseBody = sendPostRequest(payloadAndHeaders); + unmarshalResponse(httpResponseBody, DELETE_TASK_PUSH_NOTIFICATION_CONFIG_RESPONSE_REFERENCE); + } catch (A2AClientException_v0_3 e) { + throw e; + } catch (IOException | InterruptedException | JsonProcessingException_v0_3 e) { + throw new A2AClientException_v0_3("Failed to delete task push notification configs: " + e, e); + } + } + + @Override + public void resubscribe(TaskIdParams_v0_3 request, Consumer eventConsumer, + Consumer errorConsumer, ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + checkNotNullParam("request", request); + checkNotNullParam("eventConsumer", eventConsumer); + checkNotNullParam("errorConsumer", errorConsumer); + TaskResubscriptionRequest_v0_3 taskResubscriptionRequest = new TaskResubscriptionRequest_v0_3.Builder() + .jsonrpc(JSONRPCMessage_v0_3.JSONRPC_VERSION) + .method(TaskResubscriptionRequest_v0_3.METHOD) + .params(request) + .build(); // id will be randomly generated + + PayloadAndHeaders_v0_3 payloadAndHeaders = applyInterceptors(TaskResubscriptionRequest_v0_3.METHOD, + taskResubscriptionRequest, agentCard, context); + + AtomicReference> ref = new AtomicReference<>(); + SSEEventListener_v0_3 sseEventListener = new SSEEventListener_v0_3(eventConsumer, errorConsumer); + + try { + A2AHttpClient_v0_3.PostBuilder builder = createPostBuilder(payloadAndHeaders); + ref.set(builder.postAsyncSSE( + msg -> sseEventListener.onMessage(msg, ref.get()), + throwable -> sseEventListener.onError(throwable, ref.get()), + () -> { + // Signal normal stream completion to error handler (null error means success) + sseEventListener.onComplete(); + })); + } catch (IOException e) { + throw new A2AClientException_v0_3("Failed to send task resubscription request: " + e, e); + } catch (InterruptedException e) { + throw new A2AClientException_v0_3("Task resubscription request timed out: " + e, e); + } catch (JsonProcessingException_v0_3 e) { + throw new A2AClientException_v0_3("Failed to process JSON for task resubscription request: " + e, e); + } + } + + @Override + public AgentCard_v0_3 getAgentCard(ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + A2ACardResolver_v0_3 resolver; + try { + if (agentCard == null) { + resolver = new A2ACardResolver_v0_3(httpClient, agentUrl, null, getHttpHeaders(context)); + agentCard = resolver.getAgentCard(); + needsExtendedCard = agentCard.supportsAuthenticatedExtendedCard(); + } + if (!needsExtendedCard) { + return agentCard; + } + + GetAuthenticatedExtendedCardRequest_v0_3 getExtendedAgentCardRequest = new GetAuthenticatedExtendedCardRequest_v0_3.Builder() + .jsonrpc(JSONRPCMessage_v0_3.JSONRPC_VERSION) + .method(GetAuthenticatedExtendedCardRequest_v0_3.METHOD) + .build(); // id will be randomly generated + + PayloadAndHeaders_v0_3 payloadAndHeaders = applyInterceptors(GetAuthenticatedExtendedCardRequest_v0_3.METHOD, + getExtendedAgentCardRequest, agentCard, context); + + try { + String httpResponseBody = sendPostRequest(payloadAndHeaders); + GetAuthenticatedExtendedCardResponse_v0_3 response = unmarshalResponse(httpResponseBody, + GET_AUTHENTICATED_EXTENDED_CARD_RESPONSE_REFERENCE); + agentCard = response.getResult(); + needsExtendedCard = false; + return agentCard; + } catch (IOException | InterruptedException | JsonProcessingException_v0_3 e) { + throw new A2AClientException_v0_3("Failed to get authenticated extended agent card: " + e, e); + } + } catch(A2AClientError_v0_3 e){ + throw new A2AClientException_v0_3("Failed to get agent card: " + e, e); + } + } + + @Override + public void close() { + // no-op + } + + private PayloadAndHeaders_v0_3 applyInterceptors(String methodName, Object payload, + AgentCard_v0_3 agentCard, ClientCallContext_v0_3 clientCallContext) { + PayloadAndHeaders_v0_3 payloadAndHeaders = new PayloadAndHeaders_v0_3(payload, getHttpHeaders(clientCallContext)); + if (interceptors != null && ! interceptors.isEmpty()) { + for (ClientCallInterceptor_v0_3 interceptor : interceptors) { + payloadAndHeaders = interceptor.intercept(methodName, payloadAndHeaders.getPayload(), + payloadAndHeaders.getHeaders(), agentCard, clientCallContext); + } + } + return payloadAndHeaders; + } + + private String sendPostRequest(PayloadAndHeaders_v0_3 payloadAndHeaders) throws IOException, InterruptedException, JsonProcessingException_v0_3 { + A2AHttpClient_v0_3.PostBuilder builder = createPostBuilder(payloadAndHeaders); + A2AHttpResponse_v0_3 response = builder.post(); + if (!response.success()) { + throw new IOException("Request failed " + response.status()); + } + return response.body(); + } + + private A2AHttpClient_v0_3.PostBuilder createPostBuilder(PayloadAndHeaders_v0_3 payloadAndHeaders) throws JsonProcessingException_v0_3 { + A2AHttpClient_v0_3.PostBuilder postBuilder = httpClient.createPost() + .url(agentUrl) + .addHeader("Content-Type", "application/json") + .body(JsonUtil_v0_3.toJson(payloadAndHeaders.getPayload())); + + if (payloadAndHeaders.getHeaders() != null) { + for (Map.Entry entry : payloadAndHeaders.getHeaders().entrySet()) { + postBuilder.addHeader(entry.getKey(), entry.getValue()); + } + } + + return postBuilder; + } + + private > T unmarshalResponse(String response, Class responseClass) + throws A2AClientException_v0_3, JsonProcessingException_v0_3 { + T value = JsonUtil_v0_3.fromJson(response, responseClass); + JSONRPCError_v0_3 error = value.getError(); + if (error != null) { + throw new A2AClientException_v0_3(error.getMessage() + (error.getData() != null ? ": " + error.getData() : ""), error); + } + return value; + } + + private Map getHttpHeaders(ClientCallContext_v0_3 context) { + return context != null ? context.getHeaders() : null; + } +} \ No newline at end of file diff --git a/compat-0.3/client/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/sse/SSEEventListener_v0_3.java b/compat-0.3/client/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/sse/SSEEventListener_v0_3.java new file mode 100644 index 000000000..6ae5a944c --- /dev/null +++ b/compat-0.3/client/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/sse/SSEEventListener_v0_3.java @@ -0,0 +1,88 @@ +package org.a2aproject.sdk.compat03.client.transport.jsonrpc.sse; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import com.google.gson.JsonSyntaxException; +import org.a2aproject.sdk.compat03.json.JsonProcessingException_v0_3; +import org.a2aproject.sdk.compat03.json.JsonUtil_v0_3; +import org.a2aproject.sdk.compat03.spec.JSONRPCError_v0_3; +import org.a2aproject.sdk.compat03.spec.StreamingEventKind_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskStatusUpdateEvent_v0_3; + +import java.util.concurrent.Future; +import java.util.function.Consumer; +import java.util.logging.Logger; + +public class SSEEventListener_v0_3 { + private static final Logger log = Logger.getLogger(SSEEventListener_v0_3.class.getName()); + private final Consumer eventHandler; + private final Consumer errorHandler; + private volatile boolean completed = false; + + public SSEEventListener_v0_3(Consumer eventHandler, + Consumer errorHandler) { + this.eventHandler = eventHandler; + this.errorHandler = errorHandler; + } + + public void onMessage(String message, Future completableFuture) { + try { + handleMessage(JsonParser.parseString(message).getAsJsonObject(), completableFuture); + } catch (JsonSyntaxException e) { + log.warning("Failed to parse JSON message: " + message); + } catch (JsonProcessingException_v0_3 e) { + log.warning("Failed to process JSON message: " + message); + } catch (IllegalArgumentException e) { + log.warning("Invalid message format: " + message); + if (errorHandler != null) { + errorHandler.accept(e); + } + completableFuture.cancel(true); // close SSE channel + } + } + + public void onError(Throwable throwable, Future future) { + if (errorHandler != null) { + errorHandler.accept(throwable); + } + future.cancel(true); // close SSE channel + } + + public void onComplete() { + // Idempotent: only signal completion once, even if called multiple times + if (completed) { + log.fine("SSEEventListener.onComplete() called again - ignoring (already completed)"); + return; + } + completed = true; + + // Signal normal stream completion (null error means successful completion) + log.fine("SSEEventListener.onComplete() called - signaling successful stream completion"); + if (errorHandler != null) { + log.fine("Calling errorHandler.accept(null) to signal successful completion"); + errorHandler.accept(null); + } else { + log.warning("errorHandler is null, cannot signal completion"); + } + } + + private void handleMessage(JsonObject jsonObject, Future future) throws JsonProcessingException_v0_3 { + if (jsonObject.has("error")) { + JSONRPCError_v0_3 error = JsonUtil_v0_3.fromJson(jsonObject.get("error").toString(), JSONRPCError_v0_3.class); + if (errorHandler != null) { + errorHandler.accept(error); + } + } else if (jsonObject.has("result")) { + // result can be a Task, Message, TaskStatusUpdateEvent, or TaskArtifactUpdateEvent + String resultJson = jsonObject.get("result").toString(); + StreamingEventKind_v0_3 event = JsonUtil_v0_3.fromJson(resultJson, StreamingEventKind_v0_3.class); + eventHandler.accept(event); + if (event instanceof TaskStatusUpdateEvent_v0_3 && ((TaskStatusUpdateEvent_v0_3) event).isFinal()) { + future.cancel(true); // close SSE channel + } + } else { + throw new IllegalArgumentException("Unknown message type"); + } + } + +} diff --git a/compat-0.3/client/transport/jsonrpc/src/main/resources/META-INF/services/org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportProvider_v0_3 b/compat-0.3/client/transport/jsonrpc/src/main/resources/META-INF/services/org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportProvider_v0_3 new file mode 100644 index 000000000..baf961ea6 --- /dev/null +++ b/compat-0.3/client/transport/jsonrpc/src/main/resources/META-INF/services/org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportProvider_v0_3 @@ -0,0 +1 @@ +org.a2aproject.sdk.compat03.client.transport.jsonrpc.JSONRPCTransportProvider_v0_3 \ No newline at end of file diff --git a/compat-0.3/client/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JSONRPCTransportStreaming_v0_3_Test.java b/compat-0.3/client/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JSONRPCTransportStreaming_v0_3_Test.java new file mode 100644 index 000000000..914b92078 --- /dev/null +++ b/compat-0.3/client/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JSONRPCTransportStreaming_v0_3_Test.java @@ -0,0 +1,174 @@ +package org.a2aproject.sdk.compat03.client.transport.jsonrpc; + +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonStreamingMessages_v0_3.SEND_MESSAGE_STREAMING_TEST_REQUEST; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonStreamingMessages_v0_3.SEND_MESSAGE_STREAMING_TEST_RESPONSE; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonStreamingMessages_v0_3.TASK_RESUBSCRIPTION_REQUEST_TEST_RESPONSE; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonStreamingMessages_v0_3.TASK_RESUBSCRIPTION_TEST_REQUEST; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockserver.model.HttpRequest.request; +import static org.mockserver.model.HttpResponse.response; + +import java.util.Collections; +import java.util.List; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Consumer; + +import org.a2aproject.sdk.compat03.spec.Artifact_v0_3; +import org.a2aproject.sdk.compat03.spec.Message_v0_3; +import org.a2aproject.sdk.compat03.spec.MessageSendConfiguration_v0_3; +import org.a2aproject.sdk.compat03.spec.MessageSendParams_v0_3; +import org.a2aproject.sdk.compat03.spec.Part_v0_3; +import org.a2aproject.sdk.compat03.spec.StreamingEventKind_v0_3; +import org.a2aproject.sdk.compat03.spec.Task_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskIdParams_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskState_v0_3; +import org.a2aproject.sdk.compat03.spec.TextPart_v0_3; + +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockserver.integration.ClientAndServer; +import org.mockserver.matchers.MatchType; +import org.mockserver.model.JsonBody; + +public class JSONRPCTransportStreaming_v0_3_Test { + + private ClientAndServer server; + + @BeforeEach + public void setUp() { + server = new ClientAndServer(4001); + } + + @AfterEach + public void tearDown() { + server.stop(); + } + + @Test + public void testSendStreamingMessageParams() { + // The goal here is just to verify the correct parameters are being used + // This is a unit test of the parameter construction, not the streaming itself + Message_v0_3 message = new Message_v0_3.Builder() + .role(Message_v0_3.Role.USER) + .parts(Collections.singletonList(new TextPart_v0_3("test message"))) + .contextId("context-test") + .messageId("message-test") + .build(); + + MessageSendConfiguration_v0_3 configuration = new MessageSendConfiguration_v0_3.Builder() + .acceptedOutputModes(List.of("text")) + .blocking(false) + .build(); + + MessageSendParams_v0_3 params = new MessageSendParams_v0_3.Builder() + .message(message) + .configuration(configuration) + .build(); + + assertNotNull(params); + assertEquals(message, params.message()); + assertEquals(configuration, params.configuration()); + assertEquals(Message_v0_3.Role.USER, params.message().getRole()); + assertEquals("test message", ((TextPart_v0_3) params.message().getParts().get(0)).getText()); + } + + @Test + public void testA2AClientSendStreamingMessage() throws Exception { + this.server.when( + request() + .withMethod("POST") + .withPath("/") + .withBody(JsonBody.json(SEND_MESSAGE_STREAMING_TEST_REQUEST, MatchType.ONLY_MATCHING_FIELDS)) + + ) + .respond( + response() + .withStatusCode(200) + .withHeader("Content-Type", "text/event-stream") + .withBody(SEND_MESSAGE_STREAMING_TEST_RESPONSE) + ); + + JSONRPCTransport_v0_3 client = new JSONRPCTransport_v0_3("http://localhost:4001"); + Message_v0_3 message = new Message_v0_3.Builder() + .role(Message_v0_3.Role.USER) + .parts(Collections.singletonList(new TextPart_v0_3("tell me some jokes"))) + .contextId("context-1234") + .messageId("message-1234") + .build(); + MessageSendConfiguration_v0_3 configuration = new MessageSendConfiguration_v0_3.Builder() + .acceptedOutputModes(List.of("text")) + .blocking(false) + .build(); + MessageSendParams_v0_3 params = new MessageSendParams_v0_3.Builder() + .message(message) + .configuration(configuration) + .build(); + + AtomicReference receivedEvent = new AtomicReference<>(); + CountDownLatch latch = new CountDownLatch(1); + Consumer eventHandler = event -> { + receivedEvent.set(event); + latch.countDown(); + }; + Consumer errorHandler = error -> {}; + client.sendMessageStreaming(params, eventHandler, errorHandler, null); + + boolean eventReceived = latch.await(10, TimeUnit.SECONDS); + assertTrue(eventReceived); + assertNotNull(receivedEvent.get()); + } + + @Test + public void testA2AClientResubscribeToTask() throws Exception { + this.server.when( + request() + .withMethod("POST") + .withPath("/") + .withBody(JsonBody.json(TASK_RESUBSCRIPTION_TEST_REQUEST, MatchType.ONLY_MATCHING_FIELDS)) + + ) + .respond( + response() + .withStatusCode(200) + .withHeader("Content-Type", "text/event-stream") + .withBody(TASK_RESUBSCRIPTION_REQUEST_TEST_RESPONSE) + ); + + JSONRPCTransport_v0_3 client = new JSONRPCTransport_v0_3("http://localhost:4001"); + TaskIdParams_v0_3 taskIdParams = new TaskIdParams_v0_3("task-1234"); + + AtomicReference receivedEvent = new AtomicReference<>(); + CountDownLatch latch = new CountDownLatch(1); + Consumer eventHandler = event -> { + receivedEvent.set(event); + latch.countDown(); + }; + Consumer errorHandler = error -> {}; + client.resubscribe(taskIdParams, eventHandler, errorHandler, null); + + boolean eventReceived = latch.await(10, TimeUnit.SECONDS); + assertTrue(eventReceived); + + StreamingEventKind_v0_3 eventKind = receivedEvent.get();; + assertNotNull(eventKind); + assertInstanceOf(Task_v0_3.class, eventKind); + Task_v0_3 task = (Task_v0_3) eventKind; + assertEquals("2", task.getId()); + assertEquals("context-1234", task.getContextId()); + assertEquals(TaskState_v0_3.COMPLETED, task.getStatus().state()); + List artifacts = task.getArtifacts(); + assertEquals(1, artifacts.size()); + Artifact_v0_3 artifact = artifacts.get(0); + assertEquals("artifact-1", artifact.artifactId()); + assertEquals("joke", artifact.name()); + Part_v0_3 part = artifact.parts().get(0); + assertEquals(Part_v0_3.Kind.TEXT, part.getKind()); + assertEquals("Why did the chicken cross the road? To get to the other side!", ((TextPart_v0_3) part).getText()); + } +} \ No newline at end of file diff --git a/compat-0.3/client/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JSONRPCTransport_v0_3_Test.java b/compat-0.3/client/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JSONRPCTransport_v0_3_Test.java new file mode 100644 index 000000000..b3ca67f9e --- /dev/null +++ b/compat-0.3/client/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JSONRPCTransport_v0_3_Test.java @@ -0,0 +1,683 @@ +package org.a2aproject.sdk.compat03.client.transport.jsonrpc; + +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages_v0_3.AGENT_CARD; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages_v0_3.AGENT_CARD_SUPPORTS_EXTENDED; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages_v0_3.CANCEL_TASK_TEST_REQUEST; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages_v0_3.CANCEL_TASK_TEST_RESPONSE; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages_v0_3.GET_AUTHENTICATED_EXTENDED_AGENT_CARD_REQUEST; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages_v0_3.GET_AUTHENTICATED_EXTENDED_AGENT_CARD_RESPONSE; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages_v0_3.GET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_REQUEST; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages_v0_3.GET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_RESPONSE; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages_v0_3.GET_TASK_TEST_REQUEST; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages_v0_3.GET_TASK_TEST_RESPONSE; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages_v0_3.SEND_MESSAGE_ERROR_TEST_RESPONSE; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages_v0_3.SEND_MESSAGE_TEST_REQUEST; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages_v0_3.SEND_MESSAGE_TEST_REQUEST_WITH_MESSAGE_RESPONSE; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages_v0_3.SEND_MESSAGE_TEST_RESPONSE; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages_v0_3.SEND_MESSAGE_TEST_RESPONSE_WITH_MESSAGE_RESPONSE; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages_v0_3.SEND_MESSAGE_WITH_DATA_PART_TEST_REQUEST; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages_v0_3.SEND_MESSAGE_WITH_DATA_PART_TEST_RESPONSE; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages_v0_3.SEND_MESSAGE_WITH_ERROR_TEST_REQUEST; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages_v0_3.SEND_MESSAGE_WITH_FILE_PART_TEST_REQUEST; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages_v0_3.SEND_MESSAGE_WITH_FILE_PART_TEST_RESPONSE; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages_v0_3.SEND_MESSAGE_WITH_MIXED_PARTS_TEST_REQUEST; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages_v0_3.SEND_MESSAGE_WITH_MIXED_PARTS_TEST_RESPONSE; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages_v0_3.SET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_REQUEST; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages_v0_3.SET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_RESPONSE; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; +import static org.mockserver.model.HttpRequest.request; +import static org.mockserver.model.HttpResponse.response; + +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.a2aproject.sdk.compat03.spec.A2AClientException_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentCard_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentInterface_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentSkill_v0_3; +import org.a2aproject.sdk.compat03.spec.Artifact_v0_3; +import org.a2aproject.sdk.compat03.spec.DataPart_v0_3; +import org.a2aproject.sdk.compat03.spec.EventKind_v0_3; +import org.a2aproject.sdk.compat03.spec.FileContent_v0_3; +import org.a2aproject.sdk.compat03.spec.FilePart_v0_3; +import org.a2aproject.sdk.compat03.spec.FileWithBytes_v0_3; +import org.a2aproject.sdk.compat03.spec.FileWithUri_v0_3; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigParams_v0_3; +import org.a2aproject.sdk.compat03.spec.Message_v0_3; +import org.a2aproject.sdk.compat03.spec.MessageSendConfiguration_v0_3; +import org.a2aproject.sdk.compat03.spec.MessageSendParams_v0_3; +import org.a2aproject.sdk.compat03.spec.OpenIdConnectSecurityScheme_v0_3; +import org.a2aproject.sdk.compat03.spec.Part_v0_3; +import org.a2aproject.sdk.compat03.spec.PushNotificationAuthenticationInfo_v0_3; +import org.a2aproject.sdk.compat03.spec.PushNotificationConfig_v0_3; +import org.a2aproject.sdk.compat03.spec.SecurityScheme_v0_3; +import org.a2aproject.sdk.compat03.spec.Task_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskIdParams_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskQueryParams_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskState_v0_3; +import org.a2aproject.sdk.compat03.spec.TextPart_v0_3; +import org.a2aproject.sdk.compat03.spec.TransportProtocol_v0_3; + +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockserver.integration.ClientAndServer; +import org.mockserver.matchers.MatchType; +import org.mockserver.model.JsonBody; + +public class JSONRPCTransport_v0_3_Test { + + private ClientAndServer server; + + @BeforeEach + public void setUp() { + server = new ClientAndServer(4001); + } + + @AfterEach + public void tearDown() { + server.stop(); + } + + @Test + public void testA2AClientSendMessage() throws Exception { + this.server.when( + request() + .withMethod("POST") + .withPath("/") + .withBody(JsonBody.json(SEND_MESSAGE_TEST_REQUEST, MatchType.ONLY_MATCHING_FIELDS)) + + ) + .respond( + response() + .withStatusCode(200) + .withBody(SEND_MESSAGE_TEST_RESPONSE) + ); + + JSONRPCTransport_v0_3 client = new JSONRPCTransport_v0_3("http://localhost:4001"); + Message_v0_3 message = new Message_v0_3.Builder() + .role(Message_v0_3.Role.USER) + .parts(Collections.singletonList(new TextPart_v0_3("tell me a joke"))) + .contextId("context-1234") + .messageId("message-1234") + .build(); + MessageSendConfiguration_v0_3 configuration = new MessageSendConfiguration_v0_3.Builder() + .acceptedOutputModes(List.of("text")) + .blocking(true) + .build(); + MessageSendParams_v0_3 params = new MessageSendParams_v0_3.Builder() + .message(message) + .configuration(configuration) + .build(); + + EventKind_v0_3 result = client.sendMessage(params, null); + assertInstanceOf(Task_v0_3.class, result); + Task_v0_3 task = (Task_v0_3) result; + assertEquals("de38c76d-d54c-436c-8b9f-4c2703648d64", task.getId()); + assertNotNull(task.getContextId()); + assertEquals(TaskState_v0_3.COMPLETED,task.getStatus().state()); + assertEquals(1, task.getArtifacts().size()); + Artifact_v0_3 artifact = task.getArtifacts().get(0); + assertEquals("artifact-1", artifact.artifactId()); + assertEquals("joke", artifact.name()); + assertEquals(1, artifact.parts().size()); + Part_v0_3 part = artifact.parts().get(0); + assertEquals(Part_v0_3.Kind.TEXT, part.getKind()); + assertEquals("Why did the chicken cross the road? To get to the other side!", ((TextPart_v0_3) part).getText()); + assertTrue(task.getMetadata().isEmpty()); + } + + @Test + public void testA2AClientSendMessageWithMessageResponse() throws Exception { + this.server.when( + request() + .withMethod("POST") + .withPath("/") + .withBody(JsonBody.json(SEND_MESSAGE_TEST_REQUEST_WITH_MESSAGE_RESPONSE, MatchType.ONLY_MATCHING_FIELDS)) + + ) + .respond( + response() + .withStatusCode(200) + .withBody(SEND_MESSAGE_TEST_RESPONSE_WITH_MESSAGE_RESPONSE) + ); + + JSONRPCTransport_v0_3 client = new JSONRPCTransport_v0_3("http://localhost:4001"); + Message_v0_3 message = new Message_v0_3.Builder() + .role(Message_v0_3.Role.USER) + .parts(Collections.singletonList(new TextPart_v0_3("tell me a joke"))) + .contextId("context-1234") + .messageId("message-1234") + .build(); + MessageSendConfiguration_v0_3 configuration = new MessageSendConfiguration_v0_3.Builder() + .acceptedOutputModes(List.of("text")) + .blocking(true) + .build(); + MessageSendParams_v0_3 params = new MessageSendParams_v0_3.Builder() + .message(message) + .configuration(configuration) + .build(); + + EventKind_v0_3 result = client.sendMessage(params, null); + assertInstanceOf(Message_v0_3.class, result); + Message_v0_3 agentMessage = (Message_v0_3) result; + assertEquals(Message_v0_3.Role.AGENT, agentMessage.getRole()); + Part_v0_3 part = agentMessage.getParts().get(0); + assertEquals(Part_v0_3.Kind.TEXT, part.getKind()); + assertEquals("Why did the chicken cross the road? To get to the other side!", ((TextPart_v0_3) part).getText()); + assertEquals("msg-456", agentMessage.getMessageId()); + } + + + @Test + public void testA2AClientSendMessageWithError() throws Exception { + this.server.when( + request() + .withMethod("POST") + .withPath("/") + .withBody(JsonBody.json(SEND_MESSAGE_WITH_ERROR_TEST_REQUEST, MatchType.ONLY_MATCHING_FIELDS)) + + ) + .respond( + response() + .withStatusCode(200) + .withBody(SEND_MESSAGE_ERROR_TEST_RESPONSE) + ); + + JSONRPCTransport_v0_3 client = new JSONRPCTransport_v0_3("http://localhost:4001"); + Message_v0_3 message = new Message_v0_3.Builder() + .role(Message_v0_3.Role.USER) + .parts(Collections.singletonList(new TextPart_v0_3("tell me a joke"))) + .contextId("context-1234") + .messageId("message-1234") + .build(); + MessageSendConfiguration_v0_3 configuration = new MessageSendConfiguration_v0_3.Builder() + .acceptedOutputModes(List.of("text")) + .blocking(true) + .build(); + MessageSendParams_v0_3 params = new MessageSendParams_v0_3.Builder() + .message(message) + .configuration(configuration) + .build(); + + try { + client.sendMessage(params, null); + fail(); // should not reach here + } catch (A2AClientException_v0_3 e) { + assertTrue(e.getMessage().contains("Invalid parameters: Hello world")); + } + } + + @Test + public void testA2AClientGetTask() throws Exception { + this.server.when( + request() + .withMethod("POST") + .withPath("/") + .withBody(JsonBody.json(GET_TASK_TEST_REQUEST, MatchType.ONLY_MATCHING_FIELDS)) + + ) + .respond( + response() + .withStatusCode(200) + .withBody(GET_TASK_TEST_RESPONSE) + ); + + JSONRPCTransport_v0_3 client = new JSONRPCTransport_v0_3("http://localhost:4001"); + Task_v0_3 task = client.getTask(new TaskQueryParams_v0_3("de38c76d-d54c-436c-8b9f-4c2703648d64", + 10), null); + assertEquals("de38c76d-d54c-436c-8b9f-4c2703648d64", task.getId()); + assertEquals("c295ea44-7543-4f78-b524-7a38915ad6e4", task.getContextId()); + assertEquals(TaskState_v0_3.COMPLETED, task.getStatus().state()); + assertEquals(1, task.getArtifacts().size()); + Artifact_v0_3 artifact = task.getArtifacts().get(0); + assertEquals(1, artifact.parts().size()); + assertEquals("artifact-1", artifact.artifactId()); + Part_v0_3 part = artifact.parts().get(0); + assertEquals(Part_v0_3.Kind.TEXT, part.getKind()); + assertEquals("Why did the chicken cross the road? To get to the other side!", ((TextPart_v0_3) part).getText()); + assertTrue(task.getMetadata().isEmpty()); + List history = task.getHistory(); + assertNotNull(history); + assertEquals(1, history.size()); + Message_v0_3 message = history.get(0); + assertEquals(Message_v0_3.Role.USER, message.getRole()); + List> parts = message.getParts(); + assertNotNull(parts); + assertEquals(3, parts.size()); + part = parts.get(0); + assertEquals(Part_v0_3.Kind.TEXT, part.getKind()); + assertEquals("tell me a joke", ((TextPart_v0_3)part).getText()); + part = parts.get(1); + assertEquals(Part_v0_3.Kind.FILE, part.getKind()); + FileContent_v0_3 filePart = ((FilePart_v0_3) part).getFile(); + assertEquals("file:///path/to/file.txt", ((FileWithUri_v0_3) filePart).uri()); + assertEquals("text/plain", filePart.mimeType()); + part = parts.get(2); + assertEquals(Part_v0_3.Kind.FILE, part.getKind()); + filePart = ((FilePart_v0_3) part).getFile(); + assertEquals("aGVsbG8=", ((FileWithBytes_v0_3) filePart).bytes()); + assertEquals("hello.txt", filePart.name()); + assertTrue(task.getMetadata().isEmpty()); + } + + @Test + public void testA2AClientCancelTask() throws Exception { + this.server.when( + request() + .withMethod("POST") + .withPath("/") + .withBody(JsonBody.json(CANCEL_TASK_TEST_REQUEST, MatchType.ONLY_MATCHING_FIELDS)) + + ) + .respond( + response() + .withStatusCode(200) + .withBody(CANCEL_TASK_TEST_RESPONSE) + ); + + JSONRPCTransport_v0_3 client = new JSONRPCTransport_v0_3("http://localhost:4001"); + Task_v0_3 task = client.cancelTask(new TaskIdParams_v0_3("de38c76d-d54c-436c-8b9f-4c2703648d64", + new HashMap<>()), null); + assertEquals("de38c76d-d54c-436c-8b9f-4c2703648d64", task.getId()); + assertEquals("c295ea44-7543-4f78-b524-7a38915ad6e4", task.getContextId()); + assertEquals(TaskState_v0_3.CANCELED, task.getStatus().state()); + assertTrue(task.getMetadata().isEmpty()); + } + + @Test + public void testA2AClientGetTaskPushNotificationConfig() throws Exception { + this.server.when( + request() + .withMethod("POST") + .withPath("/") + .withBody(JsonBody.json(GET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_REQUEST, MatchType.ONLY_MATCHING_FIELDS)) + + ) + .respond( + response() + .withStatusCode(200) + .withBody(GET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_RESPONSE) + ); + + JSONRPCTransport_v0_3 client = new JSONRPCTransport_v0_3("http://localhost:4001"); + TaskPushNotificationConfig_v0_3 taskPushNotificationConfig = client.getTaskPushNotificationConfiguration( + new GetTaskPushNotificationConfigParams_v0_3("de38c76d-d54c-436c-8b9f-4c2703648d64", null, + new HashMap<>()), null); + PushNotificationConfig_v0_3 pushNotificationConfig = taskPushNotificationConfig.pushNotificationConfig(); + assertNotNull(pushNotificationConfig); + assertEquals("https://example.com/callback", pushNotificationConfig.url()); + PushNotificationAuthenticationInfo_v0_3 authenticationInfo = pushNotificationConfig.authentication(); + assertTrue(authenticationInfo.schemes().size() == 1); + assertEquals("jwt", authenticationInfo.schemes().get(0)); + } + + @Test + public void testA2AClientSetTaskPushNotificationConfig() throws Exception { + this.server.when( + request() + .withMethod("POST") + .withPath("/") + .withBody(JsonBody.json(SET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_REQUEST, MatchType.ONLY_MATCHING_FIELDS)) + + ) + .respond( + response() + .withStatusCode(200) + .withBody(SET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_RESPONSE) + ); + + JSONRPCTransport_v0_3 client = new JSONRPCTransport_v0_3("http://localhost:4001"); + TaskPushNotificationConfig_v0_3 taskPushNotificationConfig = client.setTaskPushNotificationConfiguration( + new TaskPushNotificationConfig_v0_3("de38c76d-d54c-436c-8b9f-4c2703648d64", + new PushNotificationConfig_v0_3.Builder() + .url("https://example.com/callback") + .authenticationInfo(new PushNotificationAuthenticationInfo_v0_3(Collections.singletonList("jwt"), + null)) + .build()), null); + PushNotificationConfig_v0_3 pushNotificationConfig = taskPushNotificationConfig.pushNotificationConfig(); + assertNotNull(pushNotificationConfig); + assertEquals("https://example.com/callback", pushNotificationConfig.url()); + PushNotificationAuthenticationInfo_v0_3 authenticationInfo = pushNotificationConfig.authentication(); + assertEquals(1, authenticationInfo.schemes().size()); + assertEquals("jwt", authenticationInfo.schemes().get(0)); + } + + + @Test + public void testA2AClientGetAgentCard() throws Exception { + this.server.when( + request() + .withMethod("GET") + .withPath("/.well-known/agent-card.json") + ) + .respond( + response() + .withStatusCode(200) + .withBody(AGENT_CARD) + ); + + JSONRPCTransport_v0_3 client = new JSONRPCTransport_v0_3("http://localhost:4001"); + AgentCard_v0_3 agentCard = client.getAgentCard(null); + assertEquals("GeoSpatial Route Planner Agent", agentCard.name()); + assertEquals("Provides advanced route planning, traffic analysis, and custom map generation services. This agent can calculate optimal routes, estimate travel times considering real-time traffic, and create personalized maps with points of interest.", agentCard.description()); + assertEquals("https://georoute-agent.example.com/a2a/v1", agentCard.url()); + assertEquals("Example Geo Services Inc.", agentCard.provider().organization()); + assertEquals("https://www.examplegeoservices.com", agentCard.provider().url()); + assertEquals("1.2.0", agentCard.version()); + assertEquals("https://docs.examplegeoservices.com/georoute-agent/api", agentCard.documentationUrl()); + assertTrue(agentCard.capabilities().streaming()); + assertTrue(agentCard.capabilities().pushNotifications()); + assertFalse(agentCard.capabilities().stateTransitionHistory()); + Map securitySchemes = agentCard.securitySchemes(); + assertNotNull(securitySchemes); + OpenIdConnectSecurityScheme_v0_3 google = (OpenIdConnectSecurityScheme_v0_3) securitySchemes.get("google"); + assertEquals("openIdConnect", google.getType()); + assertEquals("https://accounts.google.com/.well-known/openid-configuration", google.getOpenIdConnectUrl()); + List>> security = agentCard.security(); + assertEquals(1, security.size()); + Map> securityMap = security.get(0); + List scopes = securityMap.get("google"); + List expectedScopes = List.of("openid", "profile", "email"); + assertEquals(expectedScopes, scopes); + List defaultInputModes = List.of("application/json", "text/plain"); + assertEquals(defaultInputModes, agentCard.defaultInputModes()); + List defaultOutputModes = List.of("application/json", "image/png"); + assertEquals(defaultOutputModes, agentCard.defaultOutputModes()); + List skills = agentCard.skills(); + assertEquals("route-optimizer-traffic", skills.get(0).id()); + assertEquals("Traffic-Aware Route Optimizer", skills.get(0).name()); + assertEquals("Calculates the optimal driving route between two or more locations, taking into account real-time traffic conditions, road closures, and user preferences (e.g., avoid tolls, prefer highways).", skills.get(0).description()); + List tags = List.of("maps", "routing", "navigation", "directions", "traffic"); + assertEquals(tags, skills.get(0).tags()); + List examples = List.of("Plan a route from '1600 Amphitheatre Parkway, Mountain View, CA' to 'San Francisco International Airport' avoiding tolls.", + "{\"origin\": {\"lat\": 37.422, \"lng\": -122.084}, \"destination\": {\"lat\": 37.7749, \"lng\": -122.4194}, \"preferences\": [\"avoid_ferries\"]}"); + assertEquals(examples, skills.get(0).examples()); + assertEquals(defaultInputModes, skills.get(0).inputModes()); + List outputModes = List.of("application/json", "application/vnd.geo+json", "text/html"); + assertEquals(outputModes, skills.get(0).outputModes()); + assertEquals("custom-map-generator", skills.get(1).id()); + assertEquals("Personalized Map Generator", skills.get(1).name()); + assertEquals("Creates custom map images or interactive map views based on user-defined points of interest, routes, and style preferences. Can overlay data layers.", skills.get(1).description()); + tags = List.of("maps", "customization", "visualization", "cartography"); + assertEquals(tags, skills.get(1).tags()); + examples = List.of("Generate a map of my upcoming road trip with all planned stops highlighted.", + "Show me a map visualizing all coffee shops within a 1-mile radius of my current location."); + assertEquals(examples, skills.get(1).examples()); + List inputModes = List.of("application/json"); + assertEquals(inputModes, skills.get(1).inputModes()); + outputModes = List.of("image/png", "image/jpeg", "application/json", "text/html"); + assertEquals(outputModes, skills.get(1).outputModes()); + assertFalse(agentCard.supportsAuthenticatedExtendedCard()); + assertEquals("https://georoute-agent.example.com/icon.png", agentCard.iconUrl()); + assertEquals("0.2.9", agentCard.protocolVersion()); + assertEquals("JSONRPC", agentCard.preferredTransport()); + List additionalInterfaces = agentCard.additionalInterfaces(); + assertEquals(3, additionalInterfaces.size()); + AgentInterface_v0_3 jsonrpc = new AgentInterface_v0_3(TransportProtocol_v0_3.JSONRPC.asString(), "https://georoute-agent.example.com/a2a/v1"); + AgentInterface_v0_3 grpc = new AgentInterface_v0_3(TransportProtocol_v0_3.GRPC.asString(), "https://georoute-agent.example.com/a2a/grpc"); + AgentInterface_v0_3 httpJson = new AgentInterface_v0_3(TransportProtocol_v0_3.HTTP_JSON.asString(), "https://georoute-agent.example.com/a2a/json"); + assertEquals(jsonrpc, additionalInterfaces.get(0)); + assertEquals(grpc, additionalInterfaces.get(1)); + assertEquals(httpJson, additionalInterfaces.get(2)); + } + + @Test + public void testA2AClientGetAuthenticatedExtendedAgentCard() throws Exception { + this.server.when( + request() + .withMethod("GET") + .withPath("/.well-known/agent-card.json") + ) + .respond( + response() + .withStatusCode(200) + .withBody(AGENT_CARD_SUPPORTS_EXTENDED) + ); + this.server.when( + request() + .withMethod("POST") + .withPath("/") + .withBody(JsonBody.json(GET_AUTHENTICATED_EXTENDED_AGENT_CARD_REQUEST, MatchType.ONLY_MATCHING_FIELDS)) + ) + .respond( + response() + .withStatusCode(200) + .withBody(GET_AUTHENTICATED_EXTENDED_AGENT_CARD_RESPONSE) + ); + + JSONRPCTransport_v0_3 client = new JSONRPCTransport_v0_3("http://localhost:4001"); + AgentCard_v0_3 agentCard = client.getAgentCard(null); + assertEquals("GeoSpatial Route Planner Agent Extended", agentCard.name()); + assertEquals("Extended description", agentCard.description()); + assertEquals("https://georoute-agent.example.com/a2a/v1", agentCard.url()); + assertEquals("Example Geo Services Inc.", agentCard.provider().organization()); + assertEquals("https://www.examplegeoservices.com", agentCard.provider().url()); + assertEquals("1.2.0", agentCard.version()); + assertEquals("https://docs.examplegeoservices.com/georoute-agent/api", agentCard.documentationUrl()); + assertTrue(agentCard.capabilities().streaming()); + assertTrue(agentCard.capabilities().pushNotifications()); + assertFalse(agentCard.capabilities().stateTransitionHistory()); + Map securitySchemes = agentCard.securitySchemes(); + assertNotNull(securitySchemes); + OpenIdConnectSecurityScheme_v0_3 google = (OpenIdConnectSecurityScheme_v0_3) securitySchemes.get("google"); + assertEquals("openIdConnect", google.getType()); + assertEquals("https://accounts.google.com/.well-known/openid-configuration", google.getOpenIdConnectUrl()); + List>> security = agentCard.security(); + assertEquals(1, security.size()); + Map> securityMap = security.get(0); + List scopes = securityMap.get("google"); + List expectedScopes = List.of("openid", "profile", "email"); + assertEquals(expectedScopes, scopes); + List defaultInputModes = List.of("application/json", "text/plain"); + assertEquals(defaultInputModes, agentCard.defaultInputModes()); + List defaultOutputModes = List.of("application/json", "image/png"); + assertEquals(defaultOutputModes, agentCard.defaultOutputModes()); + List skills = agentCard.skills(); + assertEquals("route-optimizer-traffic", skills.get(0).id()); + assertEquals("Traffic-Aware Route Optimizer", skills.get(0).name()); + assertEquals("Calculates the optimal driving route between two or more locations, taking into account real-time traffic conditions, road closures, and user preferences (e.g., avoid tolls, prefer highways).", skills.get(0).description()); + List tags = List.of("maps", "routing", "navigation", "directions", "traffic"); + assertEquals(tags, skills.get(0).tags()); + List examples = List.of("Plan a route from '1600 Amphitheatre Parkway, Mountain View, CA' to 'San Francisco International Airport' avoiding tolls.", + "{\"origin\": {\"lat\": 37.422, \"lng\": -122.084}, \"destination\": {\"lat\": 37.7749, \"lng\": -122.4194}, \"preferences\": [\"avoid_ferries\"]}"); + assertEquals(examples, skills.get(0).examples()); + assertEquals(defaultInputModes, skills.get(0).inputModes()); + List outputModes = List.of("application/json", "application/vnd.geo+json", "text/html"); + assertEquals(outputModes, skills.get(0).outputModes()); + assertEquals("custom-map-generator", skills.get(1).id()); + assertEquals("Personalized Map Generator", skills.get(1).name()); + assertEquals("Creates custom map images or interactive map views based on user-defined points of interest, routes, and style preferences. Can overlay data layers.", skills.get(1).description()); + tags = List.of("maps", "customization", "visualization", "cartography"); + assertEquals(tags, skills.get(1).tags()); + examples = List.of("Generate a map of my upcoming road trip with all planned stops highlighted.", + "Show me a map visualizing all coffee shops within a 1-mile radius of my current location."); + assertEquals(examples, skills.get(1).examples()); + List inputModes = List.of("application/json"); + assertEquals(inputModes, skills.get(1).inputModes()); + outputModes = List.of("image/png", "image/jpeg", "application/json", "text/html"); + assertEquals(outputModes, skills.get(1).outputModes()); + assertEquals("skill-extended", skills.get(2).id()); + assertEquals("Extended Skill", skills.get(2).name()); + assertEquals("This is an extended skill.", skills.get(2).description()); + assertEquals(List.of("extended"), skills.get(2).tags()); + assertTrue(agentCard.supportsAuthenticatedExtendedCard()); + assertEquals("https://georoute-agent.example.com/icon.png", agentCard.iconUrl()); + assertEquals("0.2.5", agentCard.protocolVersion()); + } + + @Test + public void testA2AClientSendMessageWithFilePart() throws Exception { + this.server.when( + request() + .withMethod("POST") + .withPath("/") + .withBody(JsonBody.json(SEND_MESSAGE_WITH_FILE_PART_TEST_REQUEST, MatchType.ONLY_MATCHING_FIELDS)) + + ) + .respond( + response() + .withStatusCode(200) + .withBody(SEND_MESSAGE_WITH_FILE_PART_TEST_RESPONSE) + ); + + JSONRPCTransport_v0_3 client = new JSONRPCTransport_v0_3("http://localhost:4001"); + Message_v0_3 message = new Message_v0_3.Builder() + .role(Message_v0_3.Role.USER) + .parts(List.of( + new TextPart_v0_3("analyze this image"), + new FilePart_v0_3(new FileWithUri_v0_3("image/jpeg", null, "file:///path/to/image.jpg")) + )) + .contextId("context-1234") + .messageId("message-1234-with-file") + .build(); + MessageSendConfiguration_v0_3 configuration = new MessageSendConfiguration_v0_3.Builder() + .acceptedOutputModes(List.of("text")) + .blocking(true) + .build(); + MessageSendParams_v0_3 params = new MessageSendParams_v0_3.Builder() + .message(message) + .configuration(configuration) + .build(); + + EventKind_v0_3 result = client.sendMessage(params, null); + assertInstanceOf(Task_v0_3.class, result); + Task_v0_3 task = (Task_v0_3) result; + assertEquals("de38c76d-d54c-436c-8b9f-4c2703648d64", task.getId()); + assertNotNull(task.getContextId()); + assertEquals(TaskState_v0_3.COMPLETED, task.getStatus().state()); + assertEquals(1, task.getArtifacts().size()); + Artifact_v0_3 artifact = task.getArtifacts().get(0); + assertEquals("artifact-1", artifact.artifactId()); + assertEquals("image-analysis", artifact.name()); + assertEquals(1, artifact.parts().size()); + Part_v0_3 part = artifact.parts().get(0); + assertEquals(Part_v0_3.Kind.TEXT, part.getKind()); + assertEquals("This is an image of a cat sitting on a windowsill.", ((TextPart_v0_3) part).getText()); + assertTrue(task.getMetadata().isEmpty()); + } + + @Test + public void testA2AClientSendMessageWithDataPart() throws Exception { + this.server.when( + request() + .withMethod("POST") + .withPath("/") + .withBody(JsonBody.json(SEND_MESSAGE_WITH_DATA_PART_TEST_REQUEST, MatchType.ONLY_MATCHING_FIELDS)) + + ) + .respond( + response() + .withStatusCode(200) + .withBody(SEND_MESSAGE_WITH_DATA_PART_TEST_RESPONSE) + ); + + JSONRPCTransport_v0_3 client = new JSONRPCTransport_v0_3("http://localhost:4001"); + + Map data = new HashMap<>(); + data.put("temperature", 25.5); + data.put("humidity", 60.2); + data.put("location", "San Francisco"); + data.put("timestamp", "2024-01-15T10:30:00Z"); + + Message_v0_3 message = new Message_v0_3.Builder() + .role(Message_v0_3.Role.USER) + .parts(List.of( + new TextPart_v0_3("process this data"), + new DataPart_v0_3(data) + )) + .contextId("context-1234") + .messageId("message-1234-with-data") + .build(); + MessageSendConfiguration_v0_3 configuration = new MessageSendConfiguration_v0_3.Builder() + .acceptedOutputModes(List.of("text")) + .blocking(true) + .build(); + MessageSendParams_v0_3 params = new MessageSendParams_v0_3.Builder() + .message(message) + .configuration(configuration) + .build(); + + EventKind_v0_3 result = client.sendMessage(params, null); + assertInstanceOf(Task_v0_3.class, result); + Task_v0_3 task = (Task_v0_3) result; + assertEquals("de38c76d-d54c-436c-8b9f-4c2703648d64", task.getId()); + assertNotNull(task.getContextId()); + assertEquals(TaskState_v0_3.COMPLETED, task.getStatus().state()); + assertEquals(1, task.getArtifacts().size()); + Artifact_v0_3 artifact = task.getArtifacts().get(0); + assertEquals("artifact-1", artifact.artifactId()); + assertEquals("data-analysis", artifact.name()); + assertEquals(1, artifact.parts().size()); + Part_v0_3 part = artifact.parts().get(0); + assertEquals(Part_v0_3.Kind.TEXT, part.getKind()); + assertEquals("Processed weather data: Temperature is 25.5°C, humidity is 60.2% in San Francisco.", ((TextPart_v0_3) part).getText()); + assertTrue(task.getMetadata().isEmpty()); + } + + @Test + public void testA2AClientSendMessageWithMixedParts() throws Exception { + this.server.when( + request() + .withMethod("POST") + .withPath("/") + .withBody(JsonBody.json(SEND_MESSAGE_WITH_MIXED_PARTS_TEST_REQUEST, MatchType.ONLY_MATCHING_FIELDS)) + + ) + .respond( + response() + .withStatusCode(200) + .withBody(SEND_MESSAGE_WITH_MIXED_PARTS_TEST_RESPONSE) + ); + + JSONRPCTransport_v0_3 client = new JSONRPCTransport_v0_3("http://localhost:4001"); + + Map data = new HashMap<>(); + data.put("chartType", "bar"); + data.put("dataPoints", List.of(10, 20, 30, 40)); + data.put("labels", List.of("Q1", "Q2", "Q3", "Q4")); + + Message_v0_3 message = new Message_v0_3.Builder() + .role(Message_v0_3.Role.USER) + .parts(List.of( + new TextPart_v0_3("analyze this data and image"), + new FilePart_v0_3(new FileWithBytes_v0_3("image/png", "chart.png", "aGVsbG8=")), + new DataPart_v0_3(data) + )) + .contextId("context-1234") + .messageId("message-1234-with-mixed") + .build(); + MessageSendConfiguration_v0_3 configuration = new MessageSendConfiguration_v0_3.Builder() + .acceptedOutputModes(List.of("text")) + .blocking(true) + .build(); + MessageSendParams_v0_3 params = new MessageSendParams_v0_3.Builder() + .message(message) + .configuration(configuration) + .build(); + + EventKind_v0_3 result = client.sendMessage(params, null); + assertInstanceOf(Task_v0_3.class, result); + Task_v0_3 task = (Task_v0_3) result; + assertEquals("de38c76d-d54c-436c-8b9f-4c2703648d64", task.getId()); + assertNotNull(task.getContextId()); + assertEquals(TaskState_v0_3.COMPLETED, task.getStatus().state()); + assertEquals(1, task.getArtifacts().size()); + Artifact_v0_3 artifact = task.getArtifacts().get(0); + assertEquals("artifact-1", artifact.artifactId()); + assertEquals("mixed-analysis", artifact.name()); + assertEquals(1, artifact.parts().size()); + Part_v0_3 part = artifact.parts().get(0); + assertEquals(Part_v0_3.Kind.TEXT, part.getKind()); + assertEquals("Analyzed chart image and data: Bar chart showing quarterly data with values [10, 20, 30, 40].", ((TextPart_v0_3) part).getText()); + assertTrue(task.getMetadata().isEmpty()); + } +} \ No newline at end of file diff --git a/compat-0.3/client/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JsonMessages_v0_3.java b/compat-0.3/client/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JsonMessages_v0_3.java new file mode 100644 index 000000000..a23a4b5e6 --- /dev/null +++ b/compat-0.3/client/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JsonMessages_v0_3.java @@ -0,0 +1,769 @@ +package org.a2aproject.sdk.compat03.client.transport.jsonrpc; + +/** + * Request and response messages used by the tests. These have been created following examples from + * the A2A sample messages. + */ +public class JsonMessages_v0_3 { + + static final String AGENT_CARD = """ + { + "protocolVersion": "0.2.9", + "name": "GeoSpatial Route Planner Agent", + "description": "Provides advanced route planning, traffic analysis, and custom map generation services. This agent can calculate optimal routes, estimate travel times considering real-time traffic, and create personalized maps with points of interest.", + "url": "https://georoute-agent.example.com/a2a/v1", + "preferredTransport": "JSONRPC", + "additionalInterfaces" : [ + {"url": "https://georoute-agent.example.com/a2a/v1", "transport": "JSONRPC"}, + {"url": "https://georoute-agent.example.com/a2a/grpc", "transport": "GRPC"}, + {"url": "https://georoute-agent.example.com/a2a/json", "transport": "HTTP+JSON"} + ], + "provider": { + "organization": "Example Geo Services Inc.", + "url": "https://www.examplegeoservices.com" + }, + "iconUrl": "https://georoute-agent.example.com/icon.png", + "version": "1.2.0", + "documentationUrl": "https://docs.examplegeoservices.com/georoute-agent/api", + "capabilities": { + "streaming": true, + "pushNotifications": true, + "stateTransitionHistory": false + }, + "securitySchemes": { + "google": { + "type": "openIdConnect", + "openIdConnectUrl": "https://accounts.google.com/.well-known/openid-configuration" + } + }, + "security": [{ "google": ["openid", "profile", "email"] }], + "defaultInputModes": ["application/json", "text/plain"], + "defaultOutputModes": ["application/json", "image/png"], + "skills": [ + { + "id": "route-optimizer-traffic", + "name": "Traffic-Aware Route Optimizer", + "description": "Calculates the optimal driving route between two or more locations, taking into account real-time traffic conditions, road closures, and user preferences (e.g., avoid tolls, prefer highways).", + "tags": ["maps", "routing", "navigation", "directions", "traffic"], + "examples": [ + "Plan a route from '1600 Amphitheatre Parkway, Mountain View, CA' to 'San Francisco International Airport' avoiding tolls.", + "{\\"origin\\": {\\"lat\\": 37.422, \\"lng\\": -122.084}, \\"destination\\": {\\"lat\\": 37.7749, \\"lng\\": -122.4194}, \\"preferences\\": [\\"avoid_ferries\\"]}" + ], + "inputModes": ["application/json", "text/plain"], + "outputModes": [ + "application/json", + "application/vnd.geo+json", + "text/html" + ] + }, + { + "id": "custom-map-generator", + "name": "Personalized Map Generator", + "description": "Creates custom map images or interactive map views based on user-defined points of interest, routes, and style preferences. Can overlay data layers.", + "tags": ["maps", "customization", "visualization", "cartography"], + "examples": [ + "Generate a map of my upcoming road trip with all planned stops highlighted.", + "Show me a map visualizing all coffee shops within a 1-mile radius of my current location." + ], + "inputModes": ["application/json"], + "outputModes": [ + "image/png", + "image/jpeg", + "application/json", + "text/html" + ] + } + ], + "supportsAuthenticatedExtendedCard": false, + "signatures": [ + { + "protected": "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpPU0UiLCJraWQiOiJrZXktMSIsImprdSI6Imh0dHBzOi8vZXhhbXBsZS5jb20vYWdlbnQvandrcy5qc29uIn0", + "signature": "QFdkNLNszlGj3z3u0YQGt_T9LixY3qtdQpZmsTdDHDe3fXV9y9-B3m2-XgCpzuhiLt8E0tV6HXoZKHv4GtHgKQ" + } + ] + }"""; + + static final String AUTHENTICATION_EXTENDED_AGENT_CARD = """ + { + "name": "GeoSpatial Route Planner Agent Extended", + "description": "Extended description", + "url": "https://georoute-agent.example.com/a2a/v1", + "provider": { + "organization": "Example Geo Services Inc.", + "url": "https://www.examplegeoservices.com" + }, + "iconUrl": "https://georoute-agent.example.com/icon.png", + "version": "1.2.0", + "documentationUrl": "https://docs.examplegeoservices.com/georoute-agent/api", + "capabilities": { + "streaming": true, + "pushNotifications": true, + "stateTransitionHistory": false + }, + "securitySchemes": { + "google": { + "type": "openIdConnect", + "openIdConnectUrl": "https://accounts.google.com/.well-known/openid-configuration" + } + }, + "security": [{ "google": ["openid", "profile", "email"] }], + "defaultInputModes": ["application/json", "text/plain"], + "defaultOutputModes": ["application/json", "image/png"], + "skills": [ + { + "id": "route-optimizer-traffic", + "name": "Traffic-Aware Route Optimizer", + "description": "Calculates the optimal driving route between two or more locations, taking into account real-time traffic conditions, road closures, and user preferences (e.g., avoid tolls, prefer highways).", + "tags": ["maps", "routing", "navigation", "directions", "traffic"], + "examples": [ + "Plan a route from '1600 Amphitheatre Parkway, Mountain View, CA' to 'San Francisco International Airport' avoiding tolls.", + "{\\"origin\\": {\\"lat\\": 37.422, \\"lng\\": -122.084}, \\"destination\\": {\\"lat\\": 37.7749, \\"lng\\": -122.4194}, \\"preferences\\": [\\"avoid_ferries\\"]}" + ], + "inputModes": ["application/json", "text/plain"], + "outputModes": [ + "application/json", + "application/vnd.geo+json", + "text/html" + ] + }, + { + "id": "custom-map-generator", + "name": "Personalized Map Generator", + "description": "Creates custom map images or interactive map views based on user-defined points of interest, routes, and style preferences. Can overlay data layers.", + "tags": ["maps", "customization", "visualization", "cartography"], + "examples": [ + "Generate a map of my upcoming road trip with all planned stops highlighted.", + "Show me a map visualizing all coffee shops within a 1-mile radius of my current location." + ], + "inputModes": ["application/json"], + "outputModes": [ + "image/png", + "image/jpeg", + "application/json", + "text/html" + ] + }, + { + "id": "skill-extended", + "name": "Extended Skill", + "description": "This is an extended skill.", + "tags": ["extended"] + } + ], + "supportsAuthenticatedExtendedCard": true, + "protocolVersion": "0.2.9", + "signatures": [ + { + "protected": "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpPU0UiLCJraWQiOiJrZXktMSIsImprdSI6Imh0dHBzOi8vZXhhbXBsZS5jb20vYWdlbnQvandrcy5qc29uIn0", + "signature": "QFdkNLNszlGj3z3u0YQGt_T9LixY3qtdQpZmsTdDHDe3fXV9y9-B3m2-XgCpzuhiLt8E0tV6HXoZKHv4GtHgKQ" + } + ] + }"""; + + static final String SEND_MESSAGE_TEST_REQUEST = """ + { + "jsonrpc": "2.0", + "method": "message/send", + "params": { + "message": { + "role": "user", + "parts": [ + { + "kind": "text", + "text": "tell me a joke" + } + ], + "messageId": "message-1234", + "contextId": "context-1234", + "kind": "message" + }, + "configuration": { + "acceptedOutputModes": ["text"], + "blocking": true + }, + } + }"""; + + static final String SEND_MESSAGE_TEST_RESPONSE = """ + { + "jsonrpc": "2.0", + "result": { + "id": "de38c76d-d54c-436c-8b9f-4c2703648d64", + "contextId": "c295ea44-7543-4f78-b524-7a38915ad6e4", + "status": { + "state": "completed" + }, + "artifacts": [ + { + "artifactId": "artifact-1", + "name": "joke", + "parts": [ + { + "kind": "text", + "text": "Why did the chicken cross the road? To get to the other side!" + } + ] + } + ], + "metadata": {}, + "kind": "task" + } + }"""; + + static final String SEND_MESSAGE_TEST_REQUEST_WITH_MESSAGE_RESPONSE = """ + { + "jsonrpc": "2.0", + "method": "message/send", + "params": { + "message": { + "role": "user", + "parts": [ + { + "kind": "text", + "text": "tell me a joke" + } + ], + "messageId": "message-1234", + "contextId": "context-1234", + "kind": "message" + }, + "configuration": { + "acceptedOutputModes": ["text"], + "blocking": true + }, + } + }"""; + + + static final String SEND_MESSAGE_TEST_RESPONSE_WITH_MESSAGE_RESPONSE = """ + { + "jsonrpc": "2.0", + "id": 1, + "result": { + "role": "agent", + "parts": [ + { + "kind": "text", + "text": "Why did the chicken cross the road? To get to the other side!" + } + ], + "messageId": "msg-456", + "kind": "message" + } + }"""; + + static final String SEND_MESSAGE_WITH_ERROR_TEST_REQUEST = """ + { + "jsonrpc": "2.0", + "method": "message/send", + "params": { + "message": { + "role": "user", + "parts": [ + { + "kind": "text", + "text": "tell me a joke" + } + ], + "messageId": "message-1234", + "contextId": "context-1234", + "kind": "message" + }, + "configuration": { + "acceptedOutputModes": ["text"], + "blocking": true + }, + } + }"""; + + static final String SEND_MESSAGE_ERROR_TEST_RESPONSE = """ + { + "jsonrpc": "2.0", + "error": { + "code": -32702, + "message": "Invalid parameters", + "data": "Hello world" + } + }"""; + + static final String GET_TASK_TEST_REQUEST = """ + { + "jsonrpc": "2.0", + "method": "tasks/get", + "params": { + "id": "de38c76d-d54c-436c-8b9f-4c2703648d64", + "historyLength": 10 + } + } + """; + + static final String GET_TASK_TEST_RESPONSE = """ + { + "jsonrpc": "2.0", + "result": { + "id": "de38c76d-d54c-436c-8b9f-4c2703648d64", + "contextId": "c295ea44-7543-4f78-b524-7a38915ad6e4", + "status": { + "state": "completed" + }, + "artifacts": [ + { + "artifactId": "artifact-1", + "parts": [ + { + "kind": "text", + "text": "Why did the chicken cross the road? To get to the other side!" + } + ] + } + ], + "history": [ + { + "role": "user", + "parts": [ + { + "kind": "text", + "text": "tell me a joke" + }, + { + "kind": "file", + "file": { + "uri": "file:///path/to/file.txt", + "mimeType": "text/plain" + } + }, + { + "kind": "file", + "file": { + "bytes": "aGVsbG8=", + "name": "hello.txt" + } + } + ], + "messageId": "message-123", + "kind": "message" + } + ], + "metadata": {}, + "kind": "task" + } + } + """; + + static final String CANCEL_TASK_TEST_REQUEST = """ + { + "jsonrpc": "2.0", + "method": "tasks/cancel", + "params": { + "id": "de38c76d-d54c-436c-8b9f-4c2703648d64", + "metadata": {} + } + } + """; + + static final String CANCEL_TASK_TEST_RESPONSE = """ + { + "jsonrpc": "2.0", + "result": { + "id": "de38c76d-d54c-436c-8b9f-4c2703648d64", + "contextId": "c295ea44-7543-4f78-b524-7a38915ad6e4", + "status": { + "state": "canceled" + }, + "metadata": {}, + "kind" : "task" + } + } + """; + + static final String GET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_REQUEST = """ + { + "jsonrpc": "2.0", + "method": "tasks/pushNotificationConfig/get", + "params": { + "id": "de38c76d-d54c-436c-8b9f-4c2703648d64", + "metadata": {}, + } + } + """; + + static final String GET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_RESPONSE = """ + { + "jsonrpc": "2.0", + "result": { + "taskId": "de38c76d-d54c-436c-8b9f-4c2703648d64", + "pushNotificationConfig": { + "url": "https://example.com/callback", + "authentication": { + "schemes": ["jwt"] + } + } + } + } + """; + + static final String SET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_REQUEST = """ + { + "jsonrpc": "2.0", + "method": "tasks/pushNotificationConfig/set", + "params": { + "taskId": "de38c76d-d54c-436c-8b9f-4c2703648d64", + "pushNotificationConfig": { + "url": "https://example.com/callback", + "authentication": { + "schemes": ["jwt"] + } + } + } + }"""; + + static final String SET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_RESPONSE = """ + { + "jsonrpc": "2.0", + "result": { + "taskId": "de38c76d-d54c-436c-8b9f-4c2703648d64", + "pushNotificationConfig": { + "url": "https://example.com/callback", + "authentication": { + "schemes": ["jwt"] + } + } + } + } + """; + + static final String SEND_MESSAGE_WITH_FILE_PART_TEST_REQUEST = """ + { + "jsonrpc": "2.0", + "method": "message/send", + "params": { + "message": { + "role": "user", + "parts": [ + { + "kind": "text", + "text": "analyze this image" + }, + { + "kind": "file", + "file": { + "uri": "file:///path/to/image.jpg", + "mimeType": "image/jpeg" + } + } + ], + "messageId": "message-1234-with-file", + "contextId": "context-1234", + "kind": "message" + }, + "configuration": { + "acceptedOutputModes": ["text"], + "blocking": true + } + } + }"""; + + static final String SEND_MESSAGE_WITH_FILE_PART_TEST_RESPONSE = """ + { + "jsonrpc": "2.0", + "result": { + "id": "de38c76d-d54c-436c-8b9f-4c2703648d64", + "contextId": "c295ea44-7543-4f78-b524-7a38915ad6e4", + "status": { + "state": "completed" + }, + "artifacts": [ + { + "artifactId": "artifact-1", + "name": "image-analysis", + "parts": [ + { + "kind": "text", + "text": "This is an image of a cat sitting on a windowsill." + } + ] + } + ], + "metadata": {}, + "kind": "task" + } + }"""; + + static final String SEND_MESSAGE_WITH_DATA_PART_TEST_REQUEST = """ + { + "jsonrpc": "2.0", + "method": "message/send", + "params": { + "message": { + "role": "user", + "parts": [ + { + "kind": "text", + "text": "process this data" + }, + { + "kind": "data", + "data": { + "temperature": 25.5, + "humidity": 60.2, + "location": "San Francisco", + "timestamp": "2024-01-15T10:30:00Z" + } + } + ], + "messageId": "message-1234-with-data", + "contextId": "context-1234", + "kind": "message" + }, + "configuration": { + "acceptedOutputModes": ["text"], + "blocking": true + } + } + }"""; + + static final String SEND_MESSAGE_WITH_DATA_PART_TEST_RESPONSE = """ + { + "jsonrpc": "2.0", + "result": { + "id": "de38c76d-d54c-436c-8b9f-4c2703648d64", + "contextId": "c295ea44-7543-4f78-b524-7a38915ad6e4", + "status": { + "state": "completed" + }, + "artifacts": [ + { + "artifactId": "artifact-1", + "name": "data-analysis", + "parts": [ + { + "kind": "text", + "text": "Processed weather data: Temperature is 25.5°C, humidity is 60.2% in San Francisco." + } + ] + } + ], + "metadata": {}, + "kind": "task" + } + }"""; + + static final String SEND_MESSAGE_WITH_MIXED_PARTS_TEST_REQUEST = """ + { + "jsonrpc": "2.0", + "method": "message/send", + "params": { + "message": { + "role": "user", + "parts": [ + { + "kind": "text", + "text": "analyze this data and image" + }, + { + "kind": "file", + "file": { + "bytes": "aGVsbG8=", + "name": "chart.png", + "mimeType": "image/png" + } + }, + { + "kind": "data", + "data": { + "chartType": "bar", + "dataPoints": [10, 20, 30, 40], + "labels": ["Q1", "Q2", "Q3", "Q4"] + } + } + ], + "messageId": "message-1234-with-mixed", + "contextId": "context-1234", + "kind": "message" + }, + "configuration": { + "acceptedOutputModes": ["text"], + "blocking": true + } + } + }"""; + + static final String SEND_MESSAGE_WITH_MIXED_PARTS_TEST_RESPONSE = """ + { + "jsonrpc": "2.0", + "result": { + "id": "de38c76d-d54c-436c-8b9f-4c2703648d64", + "contextId": "c295ea44-7543-4f78-b524-7a38915ad6e4", + "status": { + "state": "completed" + }, + "artifacts": [ + { + "artifactId": "artifact-1", + "name": "mixed-analysis", + "parts": [ + { + "kind": "text", + "text": "Analyzed chart image and data: Bar chart showing quarterly data with values [10, 20, 30, 40]." + } + ] + } + ], + "metadata": {}, + "kind": "task" + } + }"""; + + static final String GET_AUTHENTICATED_EXTENDED_AGENT_CARD_REQUEST = """ + { + "jsonrpc": "2.0", + "method": "agent/getAuthenticatedExtendedCard" + } + """; + + static final String GET_AUTHENTICATED_EXTENDED_AGENT_CARD_RESPONSE = """ + { + "jsonrpc": "2.0", + "id": "1", + "result": { + "name": "GeoSpatial Route Planner Agent Extended", + "description": "Extended description", + "url": "https://georoute-agent.example.com/a2a/v1", + "provider": { + "organization": "Example Geo Services Inc.", + "url": "https://www.examplegeoservices.com" + }, + "iconUrl": "https://georoute-agent.example.com/icon.png", + "version": "1.2.0", + "documentationUrl": "https://docs.examplegeoservices.com/georoute-agent/api", + "capabilities": { + "streaming": true, + "pushNotifications": true, + "stateTransitionHistory": false + }, + "securitySchemes": { + "google": { + "type": "openIdConnect", + "openIdConnectUrl": "https://accounts.google.com/.well-known/openid-configuration" + } + }, + "security": [{ "google": ["openid", "profile", "email"] }], + "defaultInputModes": ["application/json", "text/plain"], + "defaultOutputModes": ["application/json", "image/png"], + "skills": [ + { + "id": "route-optimizer-traffic", + "name": "Traffic-Aware Route Optimizer", + "description": "Calculates the optimal driving route between two or more locations, taking into account real-time traffic conditions, road closures, and user preferences (e.g., avoid tolls, prefer highways).", + "tags": ["maps", "routing", "navigation", "directions", "traffic"], + "examples": [ + "Plan a route from '1600 Amphitheatre Parkway, Mountain View, CA' to 'San Francisco International Airport' avoiding tolls.", + "{\\"origin\\": {\\"lat\\": 37.422, \\"lng\\": -122.084}, \\"destination\\": {\\"lat\\": 37.7749, \\"lng\\": -122.4194}, \\"preferences\\": [\\"avoid_ferries\\"]}" + ], + "inputModes": ["application/json", "text/plain"], + "outputModes": [ + "application/json", + "application/vnd.geo+json", + "text/html" + ] + }, + { + "id": "custom-map-generator", + "name": "Personalized Map Generator", + "description": "Creates custom map images or interactive map views based on user-defined points of interest, routes, and style preferences. Can overlay data layers.", + "tags": ["maps", "customization", "visualization", "cartography"], + "examples": [ + "Generate a map of my upcoming road trip with all planned stops highlighted.", + "Show me a map visualizing all coffee shops within a 1-mile radius of my current location." + ], + "inputModes": ["application/json"], + "outputModes": [ + "image/png", + "image/jpeg", + "application/json", + "text/html" + ] + }, + { + "id": "skill-extended", + "name": "Extended Skill", + "description": "This is an extended skill.", + "tags": ["extended"] + } + ], + "supportsAuthenticatedExtendedCard": true, + "protocolVersion": "0.2.5", + "signatures": [ + { + "protected": "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpPU0UiLCJraWQiOiJrZXktMSIsImprdUI6Imh0dHBzOi8vZXhhbXBsZS5jb20vYWdlbnQvandrcy5qc29uIn0", + "signature": "QFdkNLNszlGj3z3u0YQGt_T9LixY3qtdQpZmsTdDHDe3fXV9y9-B3m2-XgCpzuhiLt8E0tV6HXoZKHv4GtHgKQ" + } + ] + } + }"""; + + static final String AGENT_CARD_SUPPORTS_EXTENDED = """ + { + "name": "GeoSpatial Route Planner Agent", + "description": "Provides advanced route planning, traffic analysis, and custom map generation services. This agent can calculate optimal routes, estimate travel times considering real-time traffic, and create personalized maps with points of interest.", + "url": "https://georoute-agent.example.com/a2a/v1", + "provider": { + "organization": "Example Geo Services Inc.", + "url": "https://www.examplegeoservices.com" + }, + "iconUrl": "https://georoute-agent.example.com/icon.png", + "version": "1.2.0", + "documentationUrl": "https://docs.examplegeoservices.com/georoute-agent/api", + "capabilities": { + "streaming": true, + "pushNotifications": true, + "stateTransitionHistory": false + }, + "securitySchemes": { + "google": { + "type": "openIdConnect", + "openIdConnectUrl": "https://accounts.google.com/.well-known/openid-configuration" + } + }, + "security": [{ "google": ["openid", "profile", "email"] }], + "defaultInputModes": ["application/json", "text/plain"], + "defaultOutputModes": ["application/json", "image/png"], + "skills": [ + { + "id": "route-optimizer-traffic", + "name": "Traffic-Aware Route Optimizer", + "description": "Calculates the optimal driving route between two or more locations, taking into account real-time traffic conditions, road closures, and user preferences (e.g., avoid tolls, prefer highways).", + "tags": ["maps", "routing", "navigation", "directions", "traffic"], + "examples": [ + "Plan a route from '1600 Amphitheatre Parkway, Mountain View, CA' to 'San Francisco International Airport' avoiding tolls.", + "{\\"origin\\": {\\"lat\\": 37.422, \\"lng\\": -122.084}, \\"destination\\": {\\"lat\\": 37.7749, \\"lng\\": -122.4194}, \\"preferences\\": [\\"avoid_ferries\\"]}" + ], + "inputModes": ["application/json", "text/plain"], + "outputModes": [ + "application/json", + "application/vnd.geo+json", + "text/html" + ] + }, + { + "id": "custom-map-generator", + "name": "Personalized Map Generator", + "description": "Creates custom map images or interactive map views based on user-defined points of interest, routes, and style preferences. Can overlay data layers.", + "tags": ["maps", "customization", "visualization", "cartography"], + "examples": [ + "Generate a map of my upcoming road trip with all planned stops highlighted.", + "Show me a map visualizing all coffee shops within a 1-mile radius of my current location." + ], + "inputModes": ["application/json"], + "outputModes": [ + "image/png", + "image/jpeg", + "application/json", + "text/html" + ] + } + ], + "supportsAuthenticatedExtendedCard": true, + "protocolVersion": "0.2.5" + }"""; +} diff --git a/compat-0.3/client/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JsonStreamingMessages_v0_3.java b/compat-0.3/client/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JsonStreamingMessages_v0_3.java new file mode 100644 index 000000000..feb12572a --- /dev/null +++ b/compat-0.3/client/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JsonStreamingMessages_v0_3.java @@ -0,0 +1,145 @@ +package org.a2aproject.sdk.compat03.client.transport.jsonrpc; + +/** + * Contains JSON strings for testing SSE streaming. + */ +public class JsonStreamingMessages_v0_3 { + + public static final String STREAMING_TASK_EVENT = """ + data: { + "jsonrpc": "2.0", + "id": "1234", + "result": { + "kind": "task", + "id": "task-123", + "contextId": "context-456", + "status": { + "state": "working" + } + } + } + """; + + + public static final String STREAMING_MESSAGE_EVENT = """ + data: { + "jsonrpc": "2.0", + "id": "1234", + "result": { + "kind": "message", + "role": "agent", + "messageId": "msg-123", + "contextId": "context-456", + "parts": [ + { + "kind": "text", + "text": "Hello, world!" + } + ] + } + }"""; + + public static final String STREAMING_STATUS_UPDATE_EVENT = """ + data: { + "jsonrpc": "2.0", + "id": "1234", + "result": { + "taskId": "1", + "contextId": "2", + "status": { + "state": "submitted" + }, + "final": false, + "kind": "status-update" + } + }"""; + + public static final String STREAMING_STATUS_UPDATE_EVENT_FINAL = """ + data: { + "jsonrpc": "2.0", + "id": "1234", + "result": { + "taskId": "1", + "contextId": "2", + "status": { + "state": "completed" + }, + "final": true, + "kind": "status-update" + } + }"""; + + public static final String STREAMING_ARTIFACT_UPDATE_EVENT = """ + data: { + "jsonrpc": "2.0", + "id": "1234", + "result": { + "kind": "artifact-update", + "taskId": "1", + "contextId": "2", + "append": false, + "lastChunk": true, + "artifact": { + "artifactId": "artifact-1", + "parts": [ + { + "kind": "text", + "text": "Why did the chicken cross the road? To get to the other side!" + } + ] + } + } + }"""; + + public static final String STREAMING_ERROR_EVENT = """ + data: { + "jsonrpc": "2.0", + "id": "1234", + "error": { + "code": -32602, + "message": "Invalid parameters", + "data": "Missing required field" + } + }"""; + + public static final String SEND_MESSAGE_STREAMING_TEST_REQUEST = """ + { + "jsonrpc": "2.0", + "method": "message/stream", + "params": { + "message": { + "role": "user", + "parts": [ + { + "kind": "text", + "text": "tell me some jokes" + } + ], + "messageId": "message-1234", + "contextId": "context-1234", + "kind": "message" + }, + "configuration": { + "acceptedOutputModes": ["text"], + "blocking": false + }, + } + }"""; + + static final String SEND_MESSAGE_STREAMING_TEST_RESPONSE = + "event: message\n" + + "data: {\"jsonrpc\":\"2.0\",\"id\":1,\"result\":{\"id\":\"2\",\"contextId\":\"context-1234\",\"status\":{\"state\":\"completed\"},\"artifacts\":[{\"artifactId\":\"artifact-1\",\"name\":\"joke\",\"parts\":[{\"kind\":\"text\",\"text\":\"Why did the chicken cross the road? To get to the other side!\"}]}],\"metadata\":{},\"kind\":\"task\"}}\n\n"; + + static final String TASK_RESUBSCRIPTION_REQUEST_TEST_RESPONSE = + "event: message\n" + + "data: {\"jsonrpc\":\"2.0\",\"id\":1,\"result\":{\"id\":\"2\",\"contextId\":\"context-1234\",\"status\":{\"state\":\"completed\"},\"artifacts\":[{\"artifactId\":\"artifact-1\",\"name\":\"joke\",\"parts\":[{\"kind\":\"text\",\"text\":\"Why did the chicken cross the road? To get to the other side!\"}]}],\"metadata\":{},\"kind\":\"task\"}}\n\n"; + + public static final String TASK_RESUBSCRIPTION_TEST_REQUEST = """ + { + "jsonrpc": "2.0", + "method": "tasks/resubscribe", + "params": { + "id": "task-1234" + } + }"""; +} \ No newline at end of file diff --git a/compat-0.3/client/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/sse/SSEEventListener_v0_3_Test.java b/compat-0.3/client/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/sse/SSEEventListener_v0_3_Test.java new file mode 100644 index 000000000..b968c59ee --- /dev/null +++ b/compat-0.3/client/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/sse/SSEEventListener_v0_3_Test.java @@ -0,0 +1,267 @@ +package org.a2aproject.sdk.compat03.client.transport.jsonrpc.sse; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicReference; + +import org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonStreamingMessages_v0_3; +import org.a2aproject.sdk.compat03.spec.Artifact_v0_3; +import org.a2aproject.sdk.compat03.spec.JSONRPCError_v0_3; +import org.a2aproject.sdk.compat03.spec.Message_v0_3; +import org.a2aproject.sdk.compat03.spec.Part_v0_3; +import org.a2aproject.sdk.compat03.spec.StreamingEventKind_v0_3; +import org.a2aproject.sdk.compat03.spec.Task_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskArtifactUpdateEvent_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskState_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskStatus_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskStatusUpdateEvent_v0_3; +import org.a2aproject.sdk.compat03.spec.TextPart_v0_3; +import org.junit.jupiter.api.Test; + +public class SSEEventListener_v0_3_Test { + + @Test + public void testOnEventWithTaskResult() throws Exception { + // Set up event handler + AtomicReference receivedEvent = new AtomicReference<>(); + SSEEventListener_v0_3 listener = new SSEEventListener_v0_3( + event -> receivedEvent.set(event), + error -> {} + ); + + // Parse the task event JSON + String eventData = JsonStreamingMessages_v0_3.STREAMING_TASK_EVENT.substring( + JsonStreamingMessages_v0_3.STREAMING_TASK_EVENT.indexOf("{")); + + // Call the onEvent method directly + listener.onMessage(eventData, null); + + // Verify the event was processed correctly + assertNotNull(receivedEvent.get()); + assertTrue(receivedEvent.get() instanceof Task_v0_3); + Task_v0_3 task = (Task_v0_3) receivedEvent.get(); + assertEquals("task-123", task.getId()); + assertEquals("context-456", task.getContextId()); + assertEquals(TaskState_v0_3.WORKING, task.getStatus().state()); + } + + @Test + public void testOnEventWithMessageResult() throws Exception { + // Set up event handler + AtomicReference receivedEvent = new AtomicReference<>(); + SSEEventListener_v0_3 listener = new SSEEventListener_v0_3( + event -> receivedEvent.set(event), + error -> {} + ); + + // Parse the message event JSON + String eventData = JsonStreamingMessages_v0_3.STREAMING_MESSAGE_EVENT.substring( + JsonStreamingMessages_v0_3.STREAMING_MESSAGE_EVENT.indexOf("{")); + + // Call onEvent method + listener.onMessage(eventData, null); + + // Verify the event was processed correctly + assertNotNull(receivedEvent.get()); + assertTrue(receivedEvent.get() instanceof Message_v0_3); + Message_v0_3 message = (Message_v0_3) receivedEvent.get(); + assertEquals(Message_v0_3.Role.AGENT, message.getRole()); + assertEquals("msg-123", message.getMessageId()); + assertEquals("context-456", message.getContextId()); + assertEquals(1, message.getParts().size()); + assertTrue(message.getParts().get(0) instanceof TextPart_v0_3); + assertEquals("Hello, world!", ((TextPart_v0_3) message.getParts().get(0)).getText()); + } + + @Test + public void testOnEventWithTaskStatusUpdateEventEvent() throws Exception { + // Set up event handler + AtomicReference receivedEvent = new AtomicReference<>(); + SSEEventListener_v0_3 listener = new SSEEventListener_v0_3( + event -> receivedEvent.set(event), + error -> {} + ); + + // Parse the message event JSON + String eventData = JsonStreamingMessages_v0_3.STREAMING_STATUS_UPDATE_EVENT.substring( + JsonStreamingMessages_v0_3.STREAMING_STATUS_UPDATE_EVENT.indexOf("{")); + + // Call onEvent method + listener.onMessage(eventData, null); + + // Verify the event was processed correctly + assertNotNull(receivedEvent.get()); + assertTrue(receivedEvent.get() instanceof TaskStatusUpdateEvent_v0_3); + TaskStatusUpdateEvent_v0_3 taskStatusUpdateEvent = (TaskStatusUpdateEvent_v0_3) receivedEvent.get(); + assertEquals("1", taskStatusUpdateEvent.getTaskId()); + assertEquals("2", taskStatusUpdateEvent.getContextId()); + assertFalse(taskStatusUpdateEvent.isFinal()); + assertEquals(TaskState_v0_3.SUBMITTED, taskStatusUpdateEvent.getStatus().state()); + } + + @Test + public void testOnEventWithTaskArtifactUpdateEventEvent() throws Exception { + // Set up event handler + AtomicReference receivedEvent = new AtomicReference<>(); + SSEEventListener_v0_3 listener = new SSEEventListener_v0_3( + event -> receivedEvent.set(event), + error -> {} + ); + + // Parse the message event JSON + String eventData = JsonStreamingMessages_v0_3.STREAMING_ARTIFACT_UPDATE_EVENT.substring( + JsonStreamingMessages_v0_3.STREAMING_ARTIFACT_UPDATE_EVENT.indexOf("{")); + + // Call onEvent method + listener.onMessage(eventData, null); + + // Verify the event was processed correctly + assertNotNull(receivedEvent.get()); + assertTrue(receivedEvent.get() instanceof TaskArtifactUpdateEvent_v0_3); + + TaskArtifactUpdateEvent_v0_3 taskArtifactUpdateEvent = (TaskArtifactUpdateEvent_v0_3) receivedEvent.get(); + assertEquals("1", taskArtifactUpdateEvent.getTaskId()); + assertEquals("2", taskArtifactUpdateEvent.getContextId()); + assertFalse(taskArtifactUpdateEvent.isAppend()); + assertTrue(taskArtifactUpdateEvent.isLastChunk()); + Artifact_v0_3 artifact = taskArtifactUpdateEvent.getArtifact(); + assertEquals("artifact-1", artifact.artifactId()); + assertEquals(1, artifact.parts().size()); + assertEquals(Part_v0_3.Kind.TEXT, artifact.parts().get(0).getKind()); + assertEquals("Why did the chicken cross the road? To get to the other side!", ((TextPart_v0_3) artifact.parts().get(0)).getText()); + } + + @Test + public void testOnEventWithError() throws Exception { + // Set up event handler + AtomicReference receivedError = new AtomicReference<>(); + SSEEventListener_v0_3 listener = new SSEEventListener_v0_3( + event -> {}, + error -> receivedError.set(error) + ); + + // Parse the error event JSON + String eventData = JsonStreamingMessages_v0_3.STREAMING_ERROR_EVENT.substring( + JsonStreamingMessages_v0_3.STREAMING_ERROR_EVENT.indexOf("{")); + + // Call onEvent method + listener.onMessage(eventData, null); + + // Verify the error was processed correctly + assertNotNull(receivedError.get()); + assertInstanceOf(JSONRPCError_v0_3.class, receivedError.get()); + JSONRPCError_v0_3 jsonrpcError = (JSONRPCError_v0_3) receivedError.get(); + assertEquals(-32602, jsonrpcError.getCode()); + assertEquals("Invalid parameters", jsonrpcError.getMessage()); + assertEquals("Missing required field", jsonrpcError.getData()); + } + + @Test + public void testOnFailure() { + AtomicBoolean failureHandlerCalled = new AtomicBoolean(false); + SSEEventListener_v0_3 listener = new SSEEventListener_v0_3( + event -> {}, + error -> failureHandlerCalled.set(true) + ); + + // Simulate a failure + CancelCapturingFuture future = new CancelCapturingFuture(); + listener.onError(new RuntimeException("Test exception"), future); + + // Verify the failure handler was called + assertTrue(failureHandlerCalled.get()); + // Verify it got cancelled + assertTrue(future.cancelHandlerCalled); + } + + @Test + public void testFinalTaskStatusUpdateEventCancels() { + TaskStatusUpdateEvent_v0_3 tsue = new TaskStatusUpdateEvent_v0_3.Builder() + .taskId("1234") + .contextId("xyz") + .status(new TaskStatus_v0_3(TaskState_v0_3.COMPLETED)) + .isFinal(true) + .build(); + + // Set up event handler + AtomicReference receivedEvent = new AtomicReference<>(); + SSEEventListener_v0_3 listener = new SSEEventListener_v0_3( + event -> receivedEvent.set(event), + error -> {} + ); + + + } + + @Test + public void testOnEventWithFinalTaskStatusUpdateEventEventCancels() throws Exception { + // Set up event handler + AtomicReference receivedEvent = new AtomicReference<>(); + SSEEventListener_v0_3 listener = new SSEEventListener_v0_3( + event -> receivedEvent.set(event), + error -> {} + ); + + // Parse the message event JSON + String eventData = JsonStreamingMessages_v0_3.STREAMING_STATUS_UPDATE_EVENT_FINAL.substring( + JsonStreamingMessages_v0_3.STREAMING_STATUS_UPDATE_EVENT_FINAL.indexOf("{")); + + // Call onEvent method + CancelCapturingFuture future = new CancelCapturingFuture(); + listener.onMessage(eventData, future); + + // Verify the event was processed correctly + assertNotNull(receivedEvent.get()); + assertTrue(receivedEvent.get() instanceof TaskStatusUpdateEvent_v0_3); + TaskStatusUpdateEvent_v0_3 taskStatusUpdateEvent = (TaskStatusUpdateEvent_v0_3) receivedEvent.get(); + assertEquals("1", taskStatusUpdateEvent.getTaskId()); + assertEquals("2", taskStatusUpdateEvent.getContextId()); + assertTrue(taskStatusUpdateEvent.isFinal()); + assertEquals(TaskState_v0_3.COMPLETED, taskStatusUpdateEvent.getStatus().state()); + + assertTrue(future.cancelHandlerCalled); + } + + + private static class CancelCapturingFuture implements Future { + private boolean cancelHandlerCalled; + + public CancelCapturingFuture() { + } + + @Override + public boolean cancel(boolean mayInterruptIfRunning) { + cancelHandlerCalled = true; + return true; + } + + @Override + public boolean isCancelled() { + return false; + } + + @Override + public boolean isDone() { + return false; + } + + @Override + public Void get() throws InterruptedException, ExecutionException { + return null; + } + + @Override + public Void get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { + return null; + } + } +} \ No newline at end of file diff --git a/compat-0.3/client/transport/rest/pom.xml b/compat-0.3/client/transport/rest/pom.xml new file mode 100644 index 000000000..2539152af --- /dev/null +++ b/compat-0.3/client/transport/rest/pom.xml @@ -0,0 +1,62 @@ + + + 4.0.0 + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-parent + 1.0.0.Beta2-SNAPSHOT + ../../.. + + a2a-java-sdk-compat-0.3-client-transport-rest + jar + + Java SDK A2A Compat 0.3 Client Transport: JSON+HTTP/REST + Java SDK for the Agent2Agent Protocol (A2A) - JSON+HTTP/REST Client Transport + + + + ${project.groupId} + a2a-java-sdk-common + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec-grpc + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client-transport-spi + + + ${project.groupId} + a2a-java-sdk-compat-0.3-http-client + + + com.google.protobuf + protobuf-java-util + + + org.junit.jupiter + junit-jupiter-api + test + + + + org.mock-server + mockserver-netty + test + + + org.slf4j + slf4j-jdk14 + test + + + + \ No newline at end of file diff --git a/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/RestErrorMapper_v0_3.java b/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/RestErrorMapper_v0_3.java new file mode 100644 index 000000000..8e77af39f --- /dev/null +++ b/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/RestErrorMapper_v0_3.java @@ -0,0 +1,64 @@ +package org.a2aproject.sdk.compat03.client.transport.rest; + +import com.google.gson.JsonObject; +import org.a2aproject.sdk.compat03.json.JsonProcessingException_v0_3; +import org.a2aproject.sdk.compat03.json.JsonUtil_v0_3; +import org.a2aproject.sdk.compat03.client.http.A2AHttpResponse_v0_3; +import org.a2aproject.sdk.compat03.spec.A2AClientException_v0_3; +import org.a2aproject.sdk.compat03.spec.AuthenticatedExtendedCardNotConfiguredError_v0_3; +import org.a2aproject.sdk.compat03.spec.ContentTypeNotSupportedError_v0_3; +import org.a2aproject.sdk.compat03.spec.InternalError_v0_3; +import org.a2aproject.sdk.compat03.spec.InvalidAgentResponseError_v0_3; +import org.a2aproject.sdk.compat03.spec.InvalidParamsError_v0_3; +import org.a2aproject.sdk.compat03.spec.InvalidRequestError_v0_3; +import org.a2aproject.sdk.compat03.spec.JSONParseError_v0_3; +import org.a2aproject.sdk.compat03.spec.MethodNotFoundError_v0_3; +import org.a2aproject.sdk.compat03.spec.PushNotificationNotSupportedError_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskNotCancelableError_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskNotFoundError_v0_3; +import org.a2aproject.sdk.compat03.spec.UnsupportedOperationError_v0_3; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * Utility class to A2AHttpResponse to appropriate A2A error types + */ +public class RestErrorMapper_v0_3 { + + public static A2AClientException_v0_3 mapRestError(A2AHttpResponse_v0_3 response) { + return RestErrorMapper_v0_3.mapRestError(response.body(), response.status()); + } + + public static A2AClientException_v0_3 mapRestError(String body, int code) { + try { + if (body != null && !body.isBlank()) { + JsonObject node = JsonUtil_v0_3.fromJson(body, JsonObject.class); + String className = node.has("error") ? node.get("error").getAsString() : ""; + String errorMessage = node.has("message") ? node.get("message").getAsString() : ""; + return mapRestError(className, errorMessage, code); + } + return mapRestError("", "", code); + } catch (JsonProcessingException_v0_3 ex) { + Logger.getLogger(RestErrorMapper_v0_3.class.getName()).log(Level.SEVERE, null, ex); + return new A2AClientException_v0_3("Failed to parse error response: " + ex.getMessage()); + } + } + + public static A2AClientException_v0_3 mapRestError(String className, String errorMessage, int code) { + return switch (className) { + case "org.a2aproject.sdk.compat03.spec.TaskNotFoundError_v0_3" -> new A2AClientException_v0_3(errorMessage, new TaskNotFoundError_v0_3()); + case "org.a2aproject.sdk.compat03.spec.AuthenticatedExtendedCardNotConfiguredError_v0_3" -> new A2AClientException_v0_3(errorMessage, new AuthenticatedExtendedCardNotConfiguredError_v0_3(null, errorMessage, null)); + case "org.a2aproject.sdk.compat03.spec.ContentTypeNotSupportedError_v0_3" -> new A2AClientException_v0_3(errorMessage, new ContentTypeNotSupportedError_v0_3(null, null, errorMessage)); + case "org.a2aproject.sdk.compat03.spec.InternalError_v0_3" -> new A2AClientException_v0_3(errorMessage, new InternalError_v0_3(errorMessage)); + case "org.a2aproject.sdk.compat03.spec.InvalidAgentResponseError_v0_3" -> new A2AClientException_v0_3(errorMessage, new InvalidAgentResponseError_v0_3(null, null, errorMessage)); + case "org.a2aproject.sdk.compat03.spec.InvalidParamsError_v0_3" -> new A2AClientException_v0_3(errorMessage, new InvalidParamsError_v0_3()); + case "org.a2aproject.sdk.compat03.spec.InvalidRequestError_v0_3" -> new A2AClientException_v0_3(errorMessage, new InvalidRequestError_v0_3()); + case "org.a2aproject.sdk.compat03.spec.JSONParseError_v0_3" -> new A2AClientException_v0_3(errorMessage, new JSONParseError_v0_3()); + case "org.a2aproject.sdk.compat03.spec.MethodNotFoundError_v0_3" -> new A2AClientException_v0_3(errorMessage, new MethodNotFoundError_v0_3()); + case "org.a2aproject.sdk.compat03.spec.PushNotificationNotSupportedError_v0_3" -> new A2AClientException_v0_3(errorMessage, new PushNotificationNotSupportedError_v0_3()); + case "org.a2aproject.sdk.compat03.spec.TaskNotCancelableError_v0_3" -> new A2AClientException_v0_3(errorMessage, new TaskNotCancelableError_v0_3()); + case "org.a2aproject.sdk.compat03.spec.UnsupportedOperationError_v0_3" -> new A2AClientException_v0_3(errorMessage, new UnsupportedOperationError_v0_3()); + default -> new A2AClientException_v0_3(errorMessage); + }; + } +} diff --git a/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/RestTransportConfigBuilder_v0_3.java b/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/RestTransportConfigBuilder_v0_3.java new file mode 100644 index 000000000..13794ee3f --- /dev/null +++ b/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/RestTransportConfigBuilder_v0_3.java @@ -0,0 +1,28 @@ +package org.a2aproject.sdk.compat03.client.transport.rest; + +import org.a2aproject.sdk.compat03.client.http.A2AHttpClient_v0_3; +import org.a2aproject.sdk.compat03.client.http.JdkA2AHttpClient_v0_3; +import org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportConfigBuilder_v0_3; +import org.jspecify.annotations.Nullable; + +public class RestTransportConfigBuilder_v0_3 extends ClientTransportConfigBuilder_v0_3 { + + private @Nullable A2AHttpClient_v0_3 httpClient; + + public RestTransportConfigBuilder_v0_3 httpClient(A2AHttpClient_v0_3 httpClient) { + this.httpClient = httpClient; + return this; + } + + @Override + public RestTransportConfig_v0_3 build() { + // No HTTP client provided, fallback to the default one (JDK-based implementation) + if (httpClient == null) { + httpClient = new JdkA2AHttpClient_v0_3(); + } + + RestTransportConfig_v0_3 config = new RestTransportConfig_v0_3(httpClient); + config.setInterceptors(this.interceptors); + return config; + } +} \ No newline at end of file diff --git a/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/RestTransportConfig_v0_3.java b/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/RestTransportConfig_v0_3.java new file mode 100644 index 000000000..0d6b1f859 --- /dev/null +++ b/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/RestTransportConfig_v0_3.java @@ -0,0 +1,22 @@ +package org.a2aproject.sdk.compat03.client.transport.rest; + +import org.a2aproject.sdk.compat03.client.http.A2AHttpClient_v0_3; +import org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportConfig_v0_3; +import org.jspecify.annotations.Nullable; + +public class RestTransportConfig_v0_3 extends ClientTransportConfig_v0_3 { + + private final @Nullable A2AHttpClient_v0_3 httpClient; + + public RestTransportConfig_v0_3() { + this.httpClient = null; + } + + public RestTransportConfig_v0_3(A2AHttpClient_v0_3 httpClient) { + this.httpClient = httpClient; + } + + public @Nullable A2AHttpClient_v0_3 getHttpClient() { + return httpClient; + } +} \ No newline at end of file diff --git a/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/RestTransportProvider_v0_3.java b/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/RestTransportProvider_v0_3.java new file mode 100644 index 000000000..87dcdf5ce --- /dev/null +++ b/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/RestTransportProvider_v0_3.java @@ -0,0 +1,29 @@ +package org.a2aproject.sdk.compat03.client.transport.rest; + +import org.a2aproject.sdk.compat03.client.http.JdkA2AHttpClient_v0_3; +import org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportProvider_v0_3; +import org.a2aproject.sdk.compat03.spec.A2AClientException_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentCard_v0_3; +import org.a2aproject.sdk.compat03.spec.TransportProtocol_v0_3; + +public class RestTransportProvider_v0_3 implements ClientTransportProvider_v0_3 { + + @Override + public String getTransportProtocol() { + return TransportProtocol_v0_3.HTTP_JSON.asString(); + } + + @Override + public RestTransport_v0_3 create(RestTransportConfig_v0_3 clientTransportConfig, AgentCard_v0_3 agentCard, String agentUrl) throws A2AClientException_v0_3 { + RestTransportConfig_v0_3 transportConfig = clientTransportConfig; + if (transportConfig == null) { + transportConfig = new RestTransportConfig_v0_3(new JdkA2AHttpClient_v0_3()); + } + return new RestTransport_v0_3(clientTransportConfig.getHttpClient(), agentCard, agentUrl, transportConfig.getInterceptors()); + } + + @Override + public Class getTransportProtocolClass() { + return RestTransport_v0_3.class; + } +} diff --git a/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/RestTransport_v0_3.java b/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/RestTransport_v0_3.java new file mode 100644 index 000000000..656da61ee --- /dev/null +++ b/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/RestTransport_v0_3.java @@ -0,0 +1,401 @@ +package org.a2aproject.sdk.compat03.client.transport.rest; + +import static org.a2aproject.sdk.util.Assert.checkNotNullParam; + +import org.a2aproject.sdk.compat03.json.JsonProcessingException_v0_3; +import com.google.protobuf.InvalidProtocolBufferException; +import com.google.protobuf.MessageOrBuilder; +import com.google.protobuf.util.JsonFormat; +import org.a2aproject.sdk.compat03.client.http.A2ACardResolver_v0_3; +import org.a2aproject.sdk.compat03.client.http.A2AHttpClient_v0_3; +import org.a2aproject.sdk.compat03.client.http.A2AHttpResponse_v0_3; +import org.a2aproject.sdk.compat03.client.http.JdkA2AHttpClient_v0_3; +import org.a2aproject.sdk.compat03.client.transport.rest.sse.RestSSEEventListener_v0_3; +import org.a2aproject.sdk.compat03.client.transport.spi.ClientTransport_v0_3; +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.ClientCallContext_v0_3; +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.ClientCallInterceptor_v0_3; +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.PayloadAndHeaders_v0_3; +import org.a2aproject.sdk.compat03.grpc.CancelTaskRequest; +import org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest; +import org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest; +import org.a2aproject.sdk.compat03.grpc.GetTaskRequest; +import org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest; +import org.a2aproject.sdk.compat03.spec.CancelTaskRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.GetTaskRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.ListTaskPushNotificationConfigRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.SendMessageRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig_v0_3; +import org.a2aproject.sdk.compat03.spec.A2AClientException_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentCard_v0_3; +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigParams_v0_3; +import org.a2aproject.sdk.compat03.spec.EventKind_v0_3; +import org.a2aproject.sdk.compat03.spec.GetAuthenticatedExtendedCardRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigParams_v0_3; +import org.a2aproject.sdk.compat03.spec.ListTaskPushNotificationConfigParams_v0_3; +import org.a2aproject.sdk.compat03.spec.MessageSendParams_v0_3; +import org.a2aproject.sdk.compat03.spec.StreamingEventKind_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskResubscriptionRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.Task_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskIdParams_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskQueryParams_v0_3; +import org.a2aproject.sdk.compat03.grpc.utils.ProtoUtils_v0_3; +import org.a2aproject.sdk.compat03.spec.A2AClientError_v0_3; +import org.a2aproject.sdk.compat03.spec.SendStreamingMessageRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.SetTaskPushNotificationConfigRequest_v0_3; +import org.a2aproject.sdk.compat03.json.JsonUtil_v0_3; +import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.logging.Logger; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Consumer; +import org.jspecify.annotations.Nullable; + +public class RestTransport_v0_3 implements ClientTransport_v0_3 { + + private static final Logger log = Logger.getLogger(RestTransport_v0_3.class.getName()); + private final A2AHttpClient_v0_3 httpClient; + private final String agentUrl; + private @Nullable final List interceptors; + private AgentCard_v0_3 agentCard; + private boolean needsExtendedCard = false; + + public RestTransport_v0_3(AgentCard_v0_3 agentCard) { + this(null, agentCard, agentCard.url(), null); + } + + public RestTransport_v0_3(@Nullable A2AHttpClient_v0_3 httpClient, AgentCard_v0_3 agentCard, + String agentUrl, @Nullable List interceptors) { + this.httpClient = httpClient == null ? new JdkA2AHttpClient_v0_3() : httpClient; + this.agentCard = agentCard; + this.agentUrl = agentUrl.endsWith("/") ? agentUrl.substring(0, agentUrl.length() - 1) : agentUrl; + this.interceptors = interceptors; + } + + @Override + public EventKind_v0_3 sendMessage(MessageSendParams_v0_3 messageSendParams, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + checkNotNullParam("messageSendParams", messageSendParams); + org.a2aproject.sdk.compat03.grpc.SendMessageRequest.Builder builder = org.a2aproject.sdk.compat03.grpc.SendMessageRequest.newBuilder(ProtoUtils_v0_3.ToProto.sendMessageRequest(messageSendParams)); + PayloadAndHeaders_v0_3 payloadAndHeaders = applyInterceptors(SendMessageRequest_v0_3.METHOD, builder, agentCard, context); + try { + String httpResponseBody = sendPostRequest(agentUrl + "/v1/message:send", payloadAndHeaders); + org.a2aproject.sdk.compat03.grpc.SendMessageResponse.Builder responseBuilder = org.a2aproject.sdk.compat03.grpc.SendMessageResponse.newBuilder(); + JsonFormat.parser().merge(httpResponseBody, responseBuilder); + if (responseBuilder.hasMsg()) { + return ProtoUtils_v0_3.FromProto.message(responseBuilder.getMsg()); + } + if (responseBuilder.hasTask()) { + return ProtoUtils_v0_3.FromProto.task(responseBuilder.getTask()); + } + throw new A2AClientException_v0_3("Failed to send message, wrong response:" + httpResponseBody); + } catch (A2AClientException_v0_3 e) { + throw e; + } catch (IOException | InterruptedException | JsonProcessingException_v0_3 e) { + throw new A2AClientException_v0_3("Failed to send message: " + e, e); + } + } + + @Override + public void sendMessageStreaming(MessageSendParams_v0_3 messageSendParams, Consumer eventConsumer, Consumer errorConsumer, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + checkNotNullParam("request", messageSendParams); + checkNotNullParam("eventConsumer", eventConsumer); + checkNotNullParam("messageSendParams", messageSendParams); + org.a2aproject.sdk.compat03.grpc.SendMessageRequest.Builder builder = org.a2aproject.sdk.compat03.grpc.SendMessageRequest.newBuilder(ProtoUtils_v0_3.ToProto.sendMessageRequest(messageSendParams)); + PayloadAndHeaders_v0_3 payloadAndHeaders = applyInterceptors(SendStreamingMessageRequest_v0_3.METHOD, + builder, agentCard, context); + AtomicReference> ref = new AtomicReference<>(); + RestSSEEventListener_v0_3 sseEventListener = new RestSSEEventListener_v0_3(eventConsumer, errorConsumer); + try { + A2AHttpClient_v0_3.PostBuilder postBuilder = createPostBuilder(agentUrl + "/v1/message:stream", payloadAndHeaders); + ref.set(postBuilder.postAsyncSSE( + msg -> sseEventListener.onMessage(msg, ref.get()), + throwable -> sseEventListener.onError(throwable, ref.get()), + () -> { + // We don't need to do anything special on completion + })); + } catch (IOException e) { + throw new A2AClientException_v0_3("Failed to send streaming message request: " + e, e); + } catch (InterruptedException e) { + throw new A2AClientException_v0_3("Send streaming message request timed out: " + e, e); + } catch (JsonProcessingException_v0_3 e) { + throw new A2AClientException_v0_3("Failed to process JSON for streaming message request: " + e, e); + } + } + + @Override + public Task_v0_3 getTask(TaskQueryParams_v0_3 taskQueryParams, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + checkNotNullParam("taskQueryParams", taskQueryParams); + GetTaskRequest.Builder builder = GetTaskRequest.newBuilder(); + builder.setName("tasks/" + taskQueryParams.id()); + PayloadAndHeaders_v0_3 payloadAndHeaders = applyInterceptors(GetTaskRequest_v0_3.METHOD, builder, + agentCard, context); + try { + String url; + if (taskQueryParams.historyLength() > 0) { + url = agentUrl + String.format("/v1/tasks/%1s?historyLength=%2d", taskQueryParams.id(), taskQueryParams.historyLength()); + } else { + url = agentUrl + String.format("/v1/tasks/%1s", taskQueryParams.id()); + } + A2AHttpClient_v0_3.GetBuilder getBuilder = httpClient.createGet().url(url); + if (payloadAndHeaders.getHeaders() != null) { + for (Map.Entry entry : payloadAndHeaders.getHeaders().entrySet()) { + getBuilder.addHeader(entry.getKey(), entry.getValue()); + } + } + A2AHttpResponse_v0_3 response = getBuilder.get(); + if (!response.success()) { + throw RestErrorMapper_v0_3.mapRestError(response); + } + String httpResponseBody = response.body(); + org.a2aproject.sdk.compat03.grpc.Task.Builder responseBuilder = org.a2aproject.sdk.compat03.grpc.Task.newBuilder(); + JsonFormat.parser().merge(httpResponseBody, responseBuilder); + return ProtoUtils_v0_3.FromProto.task(responseBuilder); + } catch (A2AClientException_v0_3 e) { + throw e; + } catch (IOException | InterruptedException e) { + throw new A2AClientException_v0_3("Failed to get task: " + e, e); + } + } + + @Override + public Task_v0_3 cancelTask(TaskIdParams_v0_3 taskIdParams, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + checkNotNullParam("taskIdParams", taskIdParams); + CancelTaskRequest.Builder builder = CancelTaskRequest.newBuilder(); + builder.setName("tasks/" + taskIdParams.id()); + PayloadAndHeaders_v0_3 payloadAndHeaders = applyInterceptors(CancelTaskRequest_v0_3.METHOD, builder, + agentCard, context); + try { + String httpResponseBody = sendPostRequest(agentUrl + String.format("/v1/tasks/%1s:cancel", taskIdParams.id()), payloadAndHeaders); + org.a2aproject.sdk.compat03.grpc.Task.Builder responseBuilder = org.a2aproject.sdk.compat03.grpc.Task.newBuilder(); + JsonFormat.parser().merge(httpResponseBody, responseBuilder); + return ProtoUtils_v0_3.FromProto.task(responseBuilder); + } catch (A2AClientException_v0_3 e) { + throw e; + } catch (IOException | InterruptedException | JsonProcessingException_v0_3 e) { + throw new A2AClientException_v0_3("Failed to cancel task: " + e, e); + } + } + + @Override + public TaskPushNotificationConfig_v0_3 setTaskPushNotificationConfiguration(TaskPushNotificationConfig_v0_3 request, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + checkNotNullParam("request", request); + CreateTaskPushNotificationConfigRequest.Builder builder = CreateTaskPushNotificationConfigRequest.newBuilder(); + builder.setConfig(ProtoUtils_v0_3.ToProto.taskPushNotificationConfig(request)) + .setParent("tasks/" + request.taskId()); + if (request.pushNotificationConfig().id() != null) { + builder.setConfigId(request.pushNotificationConfig().id()); + } + PayloadAndHeaders_v0_3 payloadAndHeaders = applyInterceptors(SetTaskPushNotificationConfigRequest_v0_3.METHOD, builder, agentCard, context); + try { + String httpResponseBody = sendPostRequest(agentUrl + String.format("/v1/tasks/%1s/pushNotificationConfigs", request.taskId()), payloadAndHeaders); + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.Builder responseBuilder = org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.newBuilder(); + JsonFormat.parser().merge(httpResponseBody, responseBuilder); + return ProtoUtils_v0_3.FromProto.taskPushNotificationConfig(responseBuilder); + } catch (A2AClientException_v0_3 e) { + throw e; + } catch (IOException | InterruptedException | JsonProcessingException_v0_3 e) { + throw new A2AClientException_v0_3("Failed to set task push notification config: " + e, e); + } + } + + @Override + public TaskPushNotificationConfig_v0_3 getTaskPushNotificationConfiguration(GetTaskPushNotificationConfigParams_v0_3 request, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + checkNotNullParam("request", request); + // When configId is not specified, use taskId as the default configId + String configId = request.pushNotificationConfigId() != null ? request.pushNotificationConfigId() : request.id(); + GetTaskPushNotificationConfigRequest.Builder builder = GetTaskPushNotificationConfigRequest.newBuilder(); + builder.setName(String.format("/tasks/%1s/pushNotificationConfigs/%2s", request.id(), configId)); + PayloadAndHeaders_v0_3 payloadAndHeaders = applyInterceptors(GetTaskPushNotificationConfigRequest_v0_3.METHOD, builder, + agentCard, context); + try { + String url = agentUrl + String.format("/v1/tasks/%1s/pushNotificationConfigs/%2s", request.id(), configId); + A2AHttpClient_v0_3.GetBuilder getBuilder = httpClient.createGet().url(url); + if (payloadAndHeaders.getHeaders() != null) { + for (Map.Entry entry : payloadAndHeaders.getHeaders().entrySet()) { + getBuilder.addHeader(entry.getKey(), entry.getValue()); + } + } + A2AHttpResponse_v0_3 response = getBuilder.get(); + if (!response.success()) { + throw RestErrorMapper_v0_3.mapRestError(response); + } + String httpResponseBody = response.body(); + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.Builder responseBuilder = org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.newBuilder(); + JsonFormat.parser().merge(httpResponseBody, responseBuilder); + return ProtoUtils_v0_3.FromProto.taskPushNotificationConfig(responseBuilder); + } catch (A2AClientException_v0_3 e) { + throw e; + } catch (IOException | InterruptedException e) { + throw new A2AClientException_v0_3("Failed to get push notifications: " + e, e); + } + } + + @Override + public List listTaskPushNotificationConfigurations(ListTaskPushNotificationConfigParams_v0_3 request, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + checkNotNullParam("request", request); + ListTaskPushNotificationConfigRequest.Builder builder = ListTaskPushNotificationConfigRequest.newBuilder(); + builder.setParent(String.format("/tasks/%1s/pushNotificationConfigs", request.id())); + PayloadAndHeaders_v0_3 payloadAndHeaders = applyInterceptors(ListTaskPushNotificationConfigRequest_v0_3.METHOD, builder, + agentCard, context); + try { + String url = agentUrl + String.format("/v1/tasks/%1s/pushNotificationConfigs", request.id()); + A2AHttpClient_v0_3.GetBuilder getBuilder = httpClient.createGet().url(url); + if (payloadAndHeaders.getHeaders() != null) { + for (Map.Entry entry : payloadAndHeaders.getHeaders().entrySet()) { + getBuilder.addHeader(entry.getKey(), entry.getValue()); + } + } + A2AHttpResponse_v0_3 response = getBuilder.get(); + if (!response.success()) { + throw RestErrorMapper_v0_3.mapRestError(response); + } + String httpResponseBody = response.body(); + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse.Builder responseBuilder = org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse.newBuilder(); + JsonFormat.parser().merge(httpResponseBody, responseBuilder); + return ProtoUtils_v0_3.FromProto.listTaskPushNotificationConfigParams(responseBuilder); + } catch (A2AClientException_v0_3 e) { + throw e; + } catch (IOException | InterruptedException e) { + throw new A2AClientException_v0_3("Failed to list push notifications: " + e, e); + } + } + + @Override + public void deleteTaskPushNotificationConfigurations(DeleteTaskPushNotificationConfigParams_v0_3 request, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + checkNotNullParam("request", request); + org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequestOrBuilder builder = org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest.newBuilder(); + PayloadAndHeaders_v0_3 payloadAndHeaders = applyInterceptors(DeleteTaskPushNotificationConfigRequest_v0_3.METHOD, builder, + agentCard, context); + try { + String url = agentUrl + String.format("/v1/tasks/%1s/pushNotificationConfigs/%2s", request.id(), request.pushNotificationConfigId()); + A2AHttpClient_v0_3.DeleteBuilder deleteBuilder = httpClient.createDelete().url(url); + if (payloadAndHeaders.getHeaders() != null) { + for (Map.Entry entry : payloadAndHeaders.getHeaders().entrySet()) { + deleteBuilder.addHeader(entry.getKey(), entry.getValue()); + } + } + A2AHttpResponse_v0_3 response = deleteBuilder.delete(); + if (!response.success()) { + throw RestErrorMapper_v0_3.mapRestError(response); + } + } catch (A2AClientException_v0_3 e) { + throw e; + } catch (IOException | InterruptedException e) { + throw new A2AClientException_v0_3("Failed to delete push notification config: " + e, e); + } + } + + @Override + public void resubscribe(TaskIdParams_v0_3 request, Consumer eventConsumer, + Consumer errorConsumer, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + checkNotNullParam("request", request); + org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest.Builder builder = org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest.newBuilder(); + builder.setName("tasks/" + request.id()); + PayloadAndHeaders_v0_3 payloadAndHeaders = applyInterceptors(TaskResubscriptionRequest_v0_3.METHOD, builder, + agentCard, context); + AtomicReference> ref = new AtomicReference<>(); + RestSSEEventListener_v0_3 sseEventListener = new RestSSEEventListener_v0_3(eventConsumer, errorConsumer); + try { + String url = agentUrl + String.format("/v1/tasks/%1s:subscribe", request.id()); + A2AHttpClient_v0_3.PostBuilder postBuilder = createPostBuilder(url, payloadAndHeaders); + ref.set(postBuilder.postAsyncSSE( + msg -> sseEventListener.onMessage(msg, ref.get()), + throwable -> sseEventListener.onError(throwable, ref.get()), + () -> { + // We don't need to do anything special on completion + })); + } catch (IOException e) { + throw new A2AClientException_v0_3("Failed to send streaming message request: " + e, e); + } catch (InterruptedException e) { + throw new A2AClientException_v0_3("Send streaming message request timed out: " + e, e); + } catch (JsonProcessingException_v0_3 e) { + throw new A2AClientException_v0_3("Failed to process JSON for streaming message request: " + e, e); + } + } + + @Override + public AgentCard_v0_3 getAgentCard(@Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 { + A2ACardResolver_v0_3 resolver; + try { + if (agentCard == null) { + resolver = new A2ACardResolver_v0_3(httpClient, agentUrl, null, getHttpHeaders(context)); + agentCard = resolver.getAgentCard(); + needsExtendedCard = agentCard.supportsAuthenticatedExtendedCard(); + } + if (!needsExtendedCard) { + return agentCard; + } + PayloadAndHeaders_v0_3 payloadAndHeaders = applyInterceptors(GetAuthenticatedExtendedCardRequest_v0_3.METHOD, null, + agentCard, context); + String url = agentUrl + String.format("/v1/card"); + A2AHttpClient_v0_3.GetBuilder getBuilder = httpClient.createGet().url(url); + if (payloadAndHeaders.getHeaders() != null) { + for (Map.Entry entry : payloadAndHeaders.getHeaders().entrySet()) { + getBuilder.addHeader(entry.getKey(), entry.getValue()); + } + } + A2AHttpResponse_v0_3 response = getBuilder.get(); + if (!response.success()) { + throw RestErrorMapper_v0_3.mapRestError(response); + } + String httpResponseBody = response.body(); + agentCard = JsonUtil_v0_3.fromJson(httpResponseBody, AgentCard_v0_3.class); + needsExtendedCard = false; + return agentCard; + } catch (IOException | InterruptedException | JsonProcessingException_v0_3 e) { + throw new A2AClientException_v0_3("Failed to get authenticated extended agent card: " + e, e); + } catch (A2AClientError_v0_3 e) { + throw new A2AClientException_v0_3("Failed to get agent card: " + e, e); + } + } + + @Override + public void close() { + // no-op + } + + private PayloadAndHeaders_v0_3 applyInterceptors(String methodName, @Nullable MessageOrBuilder payload, + AgentCard_v0_3 agentCard, @Nullable ClientCallContext_v0_3 clientCallContext) { + PayloadAndHeaders_v0_3 payloadAndHeaders = new PayloadAndHeaders_v0_3(payload, getHttpHeaders(clientCallContext)); + if (interceptors != null && !interceptors.isEmpty()) { + for (ClientCallInterceptor_v0_3 interceptor : interceptors) { + payloadAndHeaders = interceptor.intercept(methodName, payloadAndHeaders.getPayload(), + payloadAndHeaders.getHeaders(), agentCard, clientCallContext); + } + } + return payloadAndHeaders; + } + + private String sendPostRequest(String url, PayloadAndHeaders_v0_3 payloadAndHeaders) throws IOException, InterruptedException, JsonProcessingException_v0_3 { + A2AHttpClient_v0_3.PostBuilder builder = createPostBuilder(url, payloadAndHeaders); + A2AHttpResponse_v0_3 response = builder.post(); + if (!response.success()) { + log.fine("Error on POST processing " + JsonFormat.printer().print((MessageOrBuilder) payloadAndHeaders.getPayload())); + throw RestErrorMapper_v0_3.mapRestError(response); + } + return response.body(); + } + + private A2AHttpClient_v0_3.PostBuilder createPostBuilder(String url, PayloadAndHeaders_v0_3 payloadAndHeaders) throws JsonProcessingException_v0_3, InvalidProtocolBufferException { + log.fine(JsonFormat.printer().print((MessageOrBuilder) payloadAndHeaders.getPayload())); + A2AHttpClient_v0_3.PostBuilder postBuilder = httpClient.createPost() + .url(url) + .addHeader("Content-Type", "application/json") + .body(JsonFormat.printer().print((MessageOrBuilder) payloadAndHeaders.getPayload())); + + if (payloadAndHeaders.getHeaders() != null) { + for (Map.Entry entry : payloadAndHeaders.getHeaders().entrySet()) { + postBuilder.addHeader(entry.getKey(), entry.getValue()); + } + } + return postBuilder; + } + + private Map getHttpHeaders(@Nullable ClientCallContext_v0_3 context) { + return context != null ? context.getHeaders() : Collections.emptyMap(); + } +} diff --git a/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/package-info.java b/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/package-info.java new file mode 100644 index 000000000..746922520 --- /dev/null +++ b/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/package-info.java @@ -0,0 +1,5 @@ +@NullMarked +package org.a2aproject.sdk.compat03.client.transport.rest; + +import org.jspecify.annotations.NullMarked; + diff --git a/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/sse/RestSSEEventListener_v0_3.java b/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/sse/RestSSEEventListener_v0_3.java new file mode 100644 index 000000000..e7f96c539 --- /dev/null +++ b/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/sse/RestSSEEventListener_v0_3.java @@ -0,0 +1,67 @@ +package org.a2aproject.sdk.compat03.client.transport.rest.sse; + +import java.util.concurrent.Future; +import java.util.function.Consumer; +import java.util.logging.Logger; + +import com.google.protobuf.InvalidProtocolBufferException; +import com.google.protobuf.util.JsonFormat; +import org.a2aproject.sdk.compat03.client.transport.rest.RestErrorMapper_v0_3; +import org.a2aproject.sdk.compat03.grpc.StreamResponse; +import org.a2aproject.sdk.compat03.grpc.utils.ProtoUtils_v0_3; +import org.a2aproject.sdk.compat03.spec.StreamingEventKind_v0_3; +import org.jspecify.annotations.Nullable; + +public class RestSSEEventListener_v0_3 { + + private static final Logger log = Logger.getLogger(RestSSEEventListener_v0_3.class.getName()); + private final Consumer eventHandler; + private final Consumer errorHandler; + + public RestSSEEventListener_v0_3(Consumer eventHandler, + Consumer errorHandler) { + this.eventHandler = eventHandler; + this.errorHandler = errorHandler; + } + + public void onMessage(String message, @Nullable Future completableFuture) { + try { + log.fine("Streaming message received: " + message); + org.a2aproject.sdk.compat03.grpc.StreamResponse.Builder builder = org.a2aproject.sdk.compat03.grpc.StreamResponse.newBuilder(); + JsonFormat.parser().merge(message, builder); + handleMessage(builder.build()); + } catch (InvalidProtocolBufferException e) { + errorHandler.accept(RestErrorMapper_v0_3.mapRestError(message, 500)); + } + } + + public void onError(Throwable throwable, @Nullable Future future) { + if (errorHandler != null) { + errorHandler.accept(throwable); + } + if (future != null) { + future.cancel(true); // close SSE channel + } + } + + private void handleMessage(StreamResponse response) { + StreamingEventKind_v0_3 event; + switch (response.getPayloadCase()) { + case MSG -> + event = ProtoUtils_v0_3.FromProto.message(response.getMsg()); + case TASK -> + event = ProtoUtils_v0_3.FromProto.task(response.getTask()); + case STATUS_UPDATE -> + event = ProtoUtils_v0_3.FromProto.taskStatusUpdateEvent(response.getStatusUpdate()); + case ARTIFACT_UPDATE -> + event = ProtoUtils_v0_3.FromProto.taskArtifactUpdateEvent(response.getArtifactUpdate()); + default -> { + log.warning("Invalid stream response " + response.getPayloadCase()); + errorHandler.accept(new IllegalStateException("Invalid stream response from server: " + response.getPayloadCase())); + return; + } + } + eventHandler.accept(event); + } + +} diff --git a/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/sse/package-info.java b/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/sse/package-info.java new file mode 100644 index 000000000..38dfbf147 --- /dev/null +++ b/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/sse/package-info.java @@ -0,0 +1,5 @@ +@NullMarked +package org.a2aproject.sdk.compat03.client.transport.rest.sse; + +import org.jspecify.annotations.NullMarked; + diff --git a/compat-0.3/client/transport/rest/src/main/resources/META-INF/services/org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportProvider_v0_3 b/compat-0.3/client/transport/rest/src/main/resources/META-INF/services/org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportProvider_v0_3 new file mode 100644 index 000000000..53dac6e73 --- /dev/null +++ b/compat-0.3/client/transport/rest/src/main/resources/META-INF/services/org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportProvider_v0_3 @@ -0,0 +1 @@ +org.a2aproject.sdk.compat03.client.transport.rest.RestTransportProvider_v0_3 \ No newline at end of file diff --git a/compat-0.3/client/transport/rest/src/test/java/org/a2aproject/sdk/compat03/client/transport/rest/JsonRestMessages_v0_3.java b/compat-0.3/client/transport/rest/src/test/java/org/a2aproject/sdk/compat03/client/transport/rest/JsonRestMessages_v0_3.java new file mode 100644 index 000000000..5fec20d23 --- /dev/null +++ b/compat-0.3/client/transport/rest/src/test/java/org/a2aproject/sdk/compat03/client/transport/rest/JsonRestMessages_v0_3.java @@ -0,0 +1,654 @@ +package org.a2aproject.sdk.compat03.client.transport.rest; + +/** + * Request and response messages used by the tests. These have been created following examples from + * the A2A sample messages. + */ +public class JsonRestMessages_v0_3 { + + static final String SEND_MESSAGE_TEST_REQUEST = """ + { + "message": + { + "messageId": "message-1234", + "contextId": "context-1234", + "role": "ROLE_USER", + "content": [{ + "text": "tell me a joke" + }], + "metadata": { + } + } + }"""; + + static final String SEND_MESSAGE_TEST_RESPONSE = """ + { + "task": { + "id": "9b511af4-b27c-47fa-aecf-2a93c08a44f8", + "contextId": "context-1234", + "status": { + "state": "TASK_STATE_SUBMITTED" + }, + "history": [ + { + "messageId": "message-1234", + "contextId": "context-1234", + "taskId": "9b511af4-b27c-47fa-aecf-2a93c08a44f8", + "role": "ROLE_USER", + "content": [ + { + "text": "tell me a joke" + } + ], + "metadata": {} + } + ] + } + }"""; + + static final String CANCEL_TASK_TEST_REQUEST = """ + { + "name": "tasks/de38c76d-d54c-436c-8b9f-4c2703648d64" + }"""; + + static final String CANCEL_TASK_TEST_RESPONSE = """ + { + "id": "de38c76d-d54c-436c-8b9f-4c2703648d64", + "contextId": "c295ea44-7543-4f78-b524-7a38915ad6e4", + "status": { + "state": "TASK_STATE_CANCELLED" + }, + "metadata": {} + }"""; + + static final String GET_TASK_TEST_RESPONSE = """ + { + "id": "de38c76d-d54c-436c-8b9f-4c2703648d64", + "contextId": "c295ea44-7543-4f78-b524-7a38915ad6e4", + "status": { + "state": "TASK_STATE_COMPLETED" + }, + "artifacts": [ + { + "artifactId": "artifact-1", + "parts": [ + { + "text": "Why did the chicken cross the road? To get to the other side!" + } + ] + } + ], + "history": [ + { + "role": "ROLE_USER", + "content": [ + { + "text": "tell me a joke" + }, + { + "file": { + "file_with_uri": "file:///path/to/file.txt", + "mimeType": "text/plain" + } + }, + { + "file": { + "file_with_bytes": "aGVsbG8=", + "mimeType": "text/plain" + } + } + ], + "messageId": "message-123" + } + ], + "metadata": {} + } + """; + + static final String AGENT_CARD = """ + { + "name": "GeoSpatial Route Planner Agent", + "description": "Provides advanced route planning, traffic analysis, and custom map generation services. This agent can calculate optimal routes, estimate travel times considering real-time traffic, and create personalized maps with points of interest.", + "url": "https://georoute-agent.example.com/a2a/v1", + "provider": { + "organization": "Example Geo Services Inc.", + "url": "https://www.examplegeoservices.com" + }, + "iconUrl": "https://georoute-agent.example.com/icon.png", + "version": "1.2.0", + "documentationUrl": "https://docs.examplegeoservices.com/georoute-agent/api", + "capabilities": { + "streaming": true, + "pushNotifications": true, + "stateTransitionHistory": false + }, + "securitySchemes": { + "google": { + "type": "openIdConnect", + "openIdConnectUrl": "https://accounts.google.com/.well-known/openid-configuration" + } + }, + "security": [{ "google": ["openid", "profile", "email"] }], + "defaultInputModes": ["application/json", "text/plain"], + "defaultOutputModes": ["application/json", "image/png"], + "skills": [ + { + "id": "route-optimizer-traffic", + "name": "Traffic-Aware Route Optimizer", + "description": "Calculates the optimal driving route between two or more locations, taking into account real-time traffic conditions, road closures, and user preferences (e.g., avoid tolls, prefer highways).", + "tags": ["maps", "routing", "navigation", "directions", "traffic"], + "examples": [ + "Plan a route from '1600 Amphitheatre Parkway, Mountain View, CA' to 'San Francisco International Airport' avoiding tolls.", + "{\\"origin\\": {\\"lat\\": 37.422, \\"lng\\": -122.084}, \\"destination\\": {\\"lat\\": 37.7749, \\"lng\\": -122.4194}, \\"preferences\\": [\\"avoid_ferries\\"]}" + ], + "inputModes": ["application/json", "text/plain"], + "outputModes": [ + "application/json", + "application/vnd.geo+json", + "text/html" + ] + }, + { + "id": "custom-map-generator", + "name": "Personalized Map Generator", + "description": "Creates custom map images or interactive map views based on user-defined points of interest, routes, and style preferences. Can overlay data layers.", + "tags": ["maps", "customization", "visualization", "cartography"], + "examples": [ + "Generate a map of my upcoming road trip with all planned stops highlighted.", + "Show me a map visualizing all coffee shops within a 1-mile radius of my current location." + ], + "inputModes": ["application/json"], + "outputModes": [ + "image/png", + "image/jpeg", + "application/json", + "text/html" + ] + } + ], + "supportsAuthenticatedExtendedCard": false, + "protocolVersion": "0.2.5" + }"""; + + static final String AGENT_CARD_SUPPORTS_EXTENDED = """ + { + "name": "GeoSpatial Route Planner Agent", + "description": "Provides advanced route planning, traffic analysis, and custom map generation services. This agent can calculate optimal routes, estimate travel times considering real-time traffic, and create personalized maps with points of interest.", + "url": "https://georoute-agent.example.com/a2a/v1", + "provider": { + "organization": "Example Geo Services Inc.", + "url": "https://www.examplegeoservices.com" + }, + "iconUrl": "https://georoute-agent.example.com/icon.png", + "version": "1.2.0", + "documentationUrl": "https://docs.examplegeoservices.com/georoute-agent/api", + "capabilities": { + "streaming": true, + "pushNotifications": true, + "stateTransitionHistory": false + }, + "securitySchemes": { + "google": { + "type": "openIdConnect", + "openIdConnectUrl": "https://accounts.google.com/.well-known/openid-configuration" + } + }, + "security": [{ "google": ["openid", "profile", "email"] }], + "defaultInputModes": ["application/json", "text/plain"], + "defaultOutputModes": ["application/json", "image/png"], + "skills": [ + { + "id": "route-optimizer-traffic", + "name": "Traffic-Aware Route Optimizer", + "description": "Calculates the optimal driving route between two or more locations, taking into account real-time traffic conditions, road closures, and user preferences (e.g., avoid tolls, prefer highways).", + "tags": ["maps", "routing", "navigation", "directions", "traffic"], + "examples": [ + "Plan a route from '1600 Amphitheatre Parkway, Mountain View, CA' to 'San Francisco International Airport' avoiding tolls.", + "{\\"origin\\": {\\"lat\\": 37.422, \\"lng\\": -122.084}, \\"destination\\": {\\"lat\\": 37.7749, \\"lng\\": -122.4194}, \\"preferences\\": [\\"avoid_ferries\\"]}" + ], + "inputModes": ["application/json", "text/plain"], + "outputModes": [ + "application/json", + "application/vnd.geo+json", + "text/html" + ] + }, + { + "id": "custom-map-generator", + "name": "Personalized Map Generator", + "description": "Creates custom map images or interactive map views based on user-defined points of interest, routes, and style preferences. Can overlay data layers.", + "tags": ["maps", "customization", "visualization", "cartography"], + "examples": [ + "Generate a map of my upcoming road trip with all planned stops highlighted.", + "Show me a map visualizing all coffee shops within a 1-mile radius of my current location." + ], + "inputModes": ["application/json"], + "outputModes": [ + "image/png", + "image/jpeg", + "application/json", + "text/html" + ] + } + ], + "supportsAuthenticatedExtendedCard": true, + "protocolVersion": "0.2.5" + }"""; + + static final String AUTHENTICATION_EXTENDED_AGENT_CARD = """ + { + "name": "GeoSpatial Route Planner Agent Extended", + "description": "Extended description", + "url": "https://georoute-agent.example.com/a2a/v1", + "provider": { + "organization": "Example Geo Services Inc.", + "url": "https://www.examplegeoservices.com" + }, + "iconUrl": "https://georoute-agent.example.com/icon.png", + "version": "1.2.0", + "documentationUrl": "https://docs.examplegeoservices.com/georoute-agent/api", + "capabilities": { + "streaming": true, + "pushNotifications": true, + "stateTransitionHistory": false + }, + "securitySchemes": { + "google": { + "type": "openIdConnect", + "openIdConnectUrl": "https://accounts.google.com/.well-known/openid-configuration" + } + }, + "security": [{ "google": ["openid", "profile", "email"] }], + "defaultInputModes": ["application/json", "text/plain"], + "defaultOutputModes": ["application/json", "image/png"], + "skills": [ + { + "id": "route-optimizer-traffic", + "name": "Traffic-Aware Route Optimizer", + "description": "Calculates the optimal driving route between two or more locations, taking into account real-time traffic conditions, road closures, and user preferences (e.g., avoid tolls, prefer highways).", + "tags": ["maps", "routing", "navigation", "directions", "traffic"], + "examples": [ + "Plan a route from '1600 Amphitheatre Parkway, Mountain View, CA' to 'San Francisco International Airport' avoiding tolls.", + "{\\"origin\\": {\\"lat\\": 37.422, \\"lng\\": -122.084}, \\"destination\\": {\\"lat\\": 37.7749, \\"lng\\": -122.4194}, \\"preferences\\": [\\"avoid_ferries\\"]}" + ], + "inputModes": ["application/json", "text/plain"], + "outputModes": [ + "application/json", + "application/vnd.geo+json", + "text/html" + ] + }, + { + "id": "custom-map-generator", + "name": "Personalized Map Generator", + "description": "Creates custom map images or interactive map views based on user-defined points of interest, routes, and style preferences. Can overlay data layers.", + "tags": ["maps", "customization", "visualization", "cartography"], + "examples": [ + "Generate a map of my upcoming road trip with all planned stops highlighted.", + "Show me a map visualizing all coffee shops within a 1-mile radius of my current location." + ], + "inputModes": ["application/json"], + "outputModes": [ + "image/png", + "image/jpeg", + "application/json", + "text/html" + ] + }, + { + "id": "skill-extended", + "name": "Extended Skill", + "description": "This is an extended skill.", + "tags": ["extended"] + } + ], + "supportsAuthenticatedExtendedCard": true, + "protocolVersion": "0.2.5" + }"""; + + static final String SEND_MESSAGE_TEST_REQUEST_WITH_MESSAGE_RESPONSE = """ + { + "jsonrpc": "2.0", + "method": "message/send", + "params": { + "message": { + "role": "user", + "parts": [ + { + "kind": "text", + "text": "tell me a joke" + } + ], + "messageId": "message-1234", + "contextId": "context-1234", + "kind": "message" + }, + "configuration": { + "acceptedOutputModes": ["text"], + "blocking": true + }, + } + }"""; + + static final String SEND_MESSAGE_TEST_RESPONSE_WITH_MESSAGE_RESPONSE = """ + { + "jsonrpc": "2.0", + "id": 1, + "result": { + "role": "agent", + "parts": [ + { + "kind": "text", + "text": "Why did the chicken cross the road? To get to the other side!" + } + ], + "messageId": "msg-456", + "kind": "message" + } + }"""; + + static final String SEND_MESSAGE_WITH_ERROR_TEST_REQUEST = """ + { + "jsonrpc": "2.0", + "method": "message/send", + "params": { + "message": { + "role": "user", + "parts": [ + { + "kind": "text", + "text": "tell me a joke" + } + ], + "messageId": "message-1234", + "contextId": "context-1234", + "kind": "message" + }, + "configuration": { + "acceptedOutputModes": ["text"], + "blocking": true + }, + } + }"""; + + static final String SEND_MESSAGE_ERROR_TEST_RESPONSE = """ + { + "jsonrpc": "2.0", + "error": { + "code": -32702, + "message": "Invalid parameters", + "data": "Hello world" + } + }"""; + + static final String GET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_RESPONSE = """ + { + "name": "tasks/de38c76d-d54c-436c-8b9f-4c2703648d64/pushNotificationConfigs/10", + "pushNotificationConfig": { + "url": "https://example.com/callback", + "authentication": { + "schemes": ["jwt"] + } + } + }"""; + static final String LIST_TASK_PUSH_NOTIFICATION_CONFIG_TEST_RESPONSE = """ + { + "configs":[ + { + "name": "tasks/de38c76d-d54c-436c-8b9f-4c2703648d64/pushNotificationConfigs/10", + "pushNotificationConfig": { + "url": "https://example.com/callback", + "authentication": { + "schemes": ["jwt"] + } + } + }, + { + "name": "tasks/de38c76d-d54c-436c-8b9f-4c2703648d64/pushNotificationConfigs/5", + "pushNotificationConfig": { + "url": "https://test.com/callback" + } + } + ] + }"""; + + + static final String SET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_REQUEST = """ + { + "parent": "tasks/de38c76d-d54c-436c-8b9f-4c2703648d64", + "config": { + "name": "tasks/de38c76d-d54c-436c-8b9f-4c2703648d64/pushNotificationConfigs", + "pushNotificationConfig": { + "url": "https://example.com/callback", + "authentication": { + "schemes": [ "jwt" ] + } + } + } + }"""; + + static final String SET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_RESPONSE = """ + { + "name": "tasks/de38c76d-d54c-436c-8b9f-4c2703648d64/pushNotificationConfigs/10", + "pushNotificationConfig": { + "url": "https://example.com/callback", + "authentication": { + "schemes": ["jwt"] + } + } + }"""; + + static final String SEND_MESSAGE_WITH_FILE_PART_TEST_REQUEST = """ + { + "jsonrpc": "2.0", + "method": "message/send", + "params": { + "message": { + "role": "user", + "parts": [ + { + "kind": "text", + "text": "analyze this image" + }, + { + "kind": "file", + "file": { + "uri": "file:///path/to/image.jpg", + "mimeType": "image/jpeg" + } + } + ], + "messageId": "message-1234-with-file", + "contextId": "context-1234", + "kind": "message" + }, + "configuration": { + "acceptedOutputModes": ["text"], + "blocking": true + } + } + }"""; + + static final String SEND_MESSAGE_WITH_FILE_PART_TEST_RESPONSE = """ + { + "jsonrpc": "2.0", + "result": { + "id": "de38c76d-d54c-436c-8b9f-4c2703648d64", + "contextId": "c295ea44-7543-4f78-b524-7a38915ad6e4", + "status": { + "state": "completed" + }, + "artifacts": [ + { + "artifactId": "artifact-1", + "name": "image-analysis", + "parts": [ + { + "kind": "text", + "text": "This is an image of a cat sitting on a windowsill." + } + ] + } + ], + "metadata": {}, + "kind": "task" + } + }"""; + + static final String SEND_MESSAGE_WITH_DATA_PART_TEST_REQUEST = """ + { + "jsonrpc": "2.0", + "method": "message/send", + "params": { + "message": { + "role": "user", + "parts": [ + { + "kind": "text", + "text": "process this data" + }, + { + "kind": "data", + "data": { + "temperature": 25.5, + "humidity": 60.2, + "location": "San Francisco", + "timestamp": "2024-01-15T10:30:00Z" + } + } + ], + "messageId": "message-1234-with-data", + "contextId": "context-1234", + "kind": "message" + }, + "configuration": { + "acceptedOutputModes": ["text"], + "blocking": true + } + } + }"""; + + static final String SEND_MESSAGE_WITH_DATA_PART_TEST_RESPONSE = """ + { + "jsonrpc": "2.0", + "result": { + "id": "de38c76d-d54c-436c-8b9f-4c2703648d64", + "contextId": "c295ea44-7543-4f78-b524-7a38915ad6e4", + "status": { + "state": "completed" + }, + "artifacts": [ + { + "artifactId": "artifact-1", + "name": "data-analysis", + "parts": [ + { + "kind": "text", + "text": "Processed weather data: Temperature is 25.5°C, humidity is 60.2% in San Francisco." + } + ] + } + ], + "metadata": {}, + "kind": "task" + } + }"""; + + static final String SEND_MESSAGE_WITH_MIXED_PARTS_TEST_REQUEST = """ + { + "jsonrpc": "2.0", + "method": "message/send", + "params": { + "message": { + "role": "user", + "parts": [ + { + "kind": "text", + "text": "analyze this data and image" + }, + { + "kind": "file", + "file": { + "bytes": "aGVsbG8=", + "name": "chart.png", + "mimeType": "image/png" + } + }, + { + "kind": "data", + "data": { + "chartType": "bar", + "dataPoints": [10, 20, 30, 40], + "labels": ["Q1", "Q2", "Q3", "Q4"] + } + } + ], + "messageId": "message-1234-with-mixed", + "contextId": "context-1234", + "kind": "message" + }, + "configuration": { + "acceptedOutputModes": ["text"], + "blocking": true + } + } + }"""; + + static final String SEND_MESSAGE_WITH_MIXED_PARTS_TEST_RESPONSE = """ + { + "jsonrpc": "2.0", + "result": { + "id": "de38c76d-d54c-436c-8b9f-4c2703648d64", + "contextId": "c295ea44-7543-4f78-b524-7a38915ad6e4", + "status": { + "state": "completed" + }, + "artifacts": [ + { + "artifactId": "artifact-1", + "name": "mixed-analysis", + "parts": [ + { + "kind": "text", + "text": "Analyzed chart image and data: Bar chart showing quarterly data with values [10, 20, 30, 40]." + } + ] + } + ], + "metadata": {}, + "kind": "task" + } + }"""; + + public static final String SEND_MESSAGE_STREAMING_TEST_REQUEST = """ + { + "message": { + "role": "ROLE_USER", + "content": [ + { + "text": "tell me some jokes" + } + ], + "messageId": "message-1234", + "contextId": "context-1234" + }, + "configuration": { + "acceptedOutputModes": ["text"] + } + }"""; + static final String SEND_MESSAGE_STREAMING_TEST_RESPONSE + = "event: message\n" + + "data: {\"task\":{\"id\":\"2\",\"contextId\":\"context-1234\",\"status\":{\"state\":\"TASK_STATE_SUBMITTED\"},\"artifacts\":[{\"artifactId\":\"artifact-1\",\"name\":\"joke\",\"parts\":[{\"text\":\"Why did the chicken cross the road? To get to the other side!\"}]}],\"metadata\":{}}}\n\n"; + + static final String TASK_RESUBSCRIPTION_REQUEST_TEST_RESPONSE + = "event: message\n" + + "data: {\"task\":{\"id\":\"2\",\"contextId\":\"context-1234\",\"status\":{\"state\":\"TASK_STATE_COMPLETED\"},\"artifacts\":[{\"artifactId\":\"artifact-1\",\"name\":\"joke\",\"parts\":[{\"text\":\"Why did the chicken cross the road? To get to the other side!\"}]}],\"metadata\":{}}}\n\n"; + public static final String TASK_RESUBSCRIPTION_TEST_REQUEST = """ + { + "jsonrpc": "2.0", + "method": "tasks/resubscribe", + "params": { + "id": "task-1234" + } + }"""; +} diff --git a/compat-0.3/client/transport/rest/src/test/java/org/a2aproject/sdk/compat03/client/transport/rest/RestTransport_v0_3_Test.java b/compat-0.3/client/transport/rest/src/test/java/org/a2aproject/sdk/compat03/client/transport/rest/RestTransport_v0_3_Test.java new file mode 100644 index 000000000..4d6b3b5c2 --- /dev/null +++ b/compat-0.3/client/transport/rest/src/test/java/org/a2aproject/sdk/compat03/client/transport/rest/RestTransport_v0_3_Test.java @@ -0,0 +1,452 @@ +package org.a2aproject.sdk.compat03.client.transport.rest; + + +import static org.a2aproject.sdk.compat03.client.transport.rest.JsonRestMessages_v0_3.CANCEL_TASK_TEST_REQUEST; +import static org.a2aproject.sdk.compat03.client.transport.rest.JsonRestMessages_v0_3.CANCEL_TASK_TEST_RESPONSE; +import static org.a2aproject.sdk.compat03.client.transport.rest.JsonRestMessages_v0_3.GET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_RESPONSE; +import static org.a2aproject.sdk.compat03.client.transport.rest.JsonRestMessages_v0_3.GET_TASK_TEST_RESPONSE; +import static org.a2aproject.sdk.compat03.client.transport.rest.JsonRestMessages_v0_3.LIST_TASK_PUSH_NOTIFICATION_CONFIG_TEST_RESPONSE; +import static org.a2aproject.sdk.compat03.client.transport.rest.JsonRestMessages_v0_3.SEND_MESSAGE_STREAMING_TEST_RESPONSE; +import static org.a2aproject.sdk.compat03.client.transport.rest.JsonRestMessages_v0_3.SEND_MESSAGE_TEST_REQUEST; +import static org.a2aproject.sdk.compat03.client.transport.rest.JsonRestMessages_v0_3.SEND_MESSAGE_TEST_RESPONSE; +import static org.a2aproject.sdk.compat03.client.transport.rest.JsonRestMessages_v0_3.SEND_MESSAGE_STREAMING_TEST_REQUEST; +import static org.a2aproject.sdk.compat03.client.transport.rest.JsonRestMessages_v0_3.SET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_REQUEST; +import static org.a2aproject.sdk.compat03.client.transport.rest.JsonRestMessages_v0_3.SET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_RESPONSE; +import static org.a2aproject.sdk.compat03.client.transport.rest.JsonRestMessages_v0_3.TASK_RESUBSCRIPTION_REQUEST_TEST_RESPONSE; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockserver.model.HttpRequest.request; +import static org.mockserver.model.HttpResponse.response; + +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.ClientCallContext_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentCapabilities_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentCard_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentSkill_v0_3; +import org.a2aproject.sdk.compat03.spec.Artifact_v0_3; +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigParams_v0_3; +import org.a2aproject.sdk.compat03.spec.EventKind_v0_3; +import org.a2aproject.sdk.compat03.spec.FilePart_v0_3; +import org.a2aproject.sdk.compat03.spec.FileWithBytes_v0_3; +import org.a2aproject.sdk.compat03.spec.FileWithUri_v0_3; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigParams_v0_3; +import org.a2aproject.sdk.compat03.spec.ListTaskPushNotificationConfigParams_v0_3; +import org.a2aproject.sdk.compat03.spec.Message_v0_3; +import org.a2aproject.sdk.compat03.spec.MessageSendConfiguration_v0_3; +import org.a2aproject.sdk.compat03.spec.MessageSendParams_v0_3; +import org.a2aproject.sdk.compat03.spec.Part_v0_3; +import org.a2aproject.sdk.compat03.spec.Part_v0_3.Kind; +import org.a2aproject.sdk.compat03.spec.PushNotificationAuthenticationInfo_v0_3; +import org.a2aproject.sdk.compat03.spec.PushNotificationConfig_v0_3; +import org.a2aproject.sdk.compat03.spec.StreamingEventKind_v0_3; +import org.a2aproject.sdk.compat03.spec.Task_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskIdParams_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskQueryParams_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskState_v0_3; +import org.a2aproject.sdk.compat03.spec.TextPart_v0_3; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Consumer; +import java.util.logging.Logger; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockserver.integration.ClientAndServer; +import org.mockserver.matchers.MatchType; +import org.mockserver.model.JsonBody; + +public class RestTransport_v0_3_Test { + + private static final Logger log = Logger.getLogger(RestTransport_v0_3_Test.class.getName()); + private ClientAndServer server; + private static final AgentCard_v0_3 CARD = new AgentCard_v0_3.Builder() + .name("Hello World Agent") + .description("Just a hello world agent") + .url("http://localhost:4001") + .version("1.0.0") + .documentationUrl("http://example.com/docs") + .capabilities(new AgentCapabilities_v0_3.Builder() + .streaming(true) + .pushNotifications(true) + .stateTransitionHistory(true) + .build()) + .defaultInputModes(Collections.singletonList("text")) + .defaultOutputModes(Collections.singletonList("text")) + .skills(Collections.singletonList(new AgentSkill_v0_3.Builder() + .id("hello_world") + .name("Returns hello world") + .description("just returns hello world") + .tags(Collections.singletonList("hello world")) + .examples(List.of("hi", "hello world")) + .build())) + .protocolVersion("0.3.0") + .build(); + + @BeforeEach + public void setUp() throws IOException { + server = new ClientAndServer(4001); + } + + @AfterEach + public void tearDown() { + server.stop(); + } + + public RestTransport_v0_3_Test() { + } + + /** + * Test of sendMessage method, of class JSONRestTransport. + */ + @Test + public void testSendMessage() throws Exception { + Message_v0_3 message = new Message_v0_3.Builder() + .role(Message_v0_3.Role.USER) + .parts(Collections.singletonList(new TextPart_v0_3("tell me a joke"))) + .contextId("context-1234") + .messageId("message-1234") + .taskId("") + .build(); + this.server.when( + request() + .withMethod("POST") + .withPath("/v1/message:send") + .withBody(JsonBody.json(SEND_MESSAGE_TEST_REQUEST, MatchType.ONLY_MATCHING_FIELDS)) + ) + .respond( + response() + .withStatusCode(200) + .withBody(SEND_MESSAGE_TEST_RESPONSE) + ); + MessageSendParams_v0_3 messageSendParams = new MessageSendParams_v0_3(message, null, null); + ClientCallContext_v0_3 context = null; + + RestTransport_v0_3 instance = new RestTransport_v0_3(CARD); + EventKind_v0_3 result = instance.sendMessage(messageSendParams, context); + assertEquals("task", result.getKind()); + Task_v0_3 task = (Task_v0_3) result; + assertEquals("9b511af4-b27c-47fa-aecf-2a93c08a44f8", task.getId()); + assertEquals("context-1234", task.getContextId()); + assertEquals(TaskState_v0_3.SUBMITTED, task.getStatus().state()); + assertNull(task.getStatus().message()); + assertNull(task.getMetadata()); + assertEquals(true, task.getArtifacts().isEmpty()); + assertEquals(1, task.getHistory().size()); + Message_v0_3 history = task.getHistory().get(0); + assertEquals("message", history.getKind()); + assertEquals(Message_v0_3.Role.USER, history.getRole()); + assertEquals("context-1234", history.getContextId()); + assertEquals("message-1234", history.getMessageId()); + assertEquals("9b511af4-b27c-47fa-aecf-2a93c08a44f8", history.getTaskId()); + assertEquals(1, history.getParts().size()); + assertEquals(Kind.TEXT, history.getParts().get(0).getKind()); + assertEquals("tell me a joke", ((TextPart_v0_3) history.getParts().get(0)).getText()); + assertNull(history.getMetadata()); + assertNull(history.getReferenceTaskIds()); + } + + /** + * Test of cancelTask method, of class JSONRestTransport. + */ + @Test + public void testCancelTask() throws Exception { + this.server.when( + request() + .withMethod("POST") + .withPath("/v1/tasks/de38c76d-d54c-436c-8b9f-4c2703648d64:cancel") + .withBody(JsonBody.json(CANCEL_TASK_TEST_REQUEST, MatchType.ONLY_MATCHING_FIELDS)) + ) + .respond( + response() + .withStatusCode(200) + .withBody(CANCEL_TASK_TEST_RESPONSE) + ); + ClientCallContext_v0_3 context = null; + RestTransport_v0_3 instance = new RestTransport_v0_3(CARD); + Task_v0_3 task = instance.cancelTask(new TaskIdParams_v0_3("de38c76d-d54c-436c-8b9f-4c2703648d64", + new HashMap<>()), context); + assertEquals("de38c76d-d54c-436c-8b9f-4c2703648d64", task.getId()); + assertEquals(TaskState_v0_3.CANCELED, task.getStatus().state()); + assertNull(task.getStatus().message()); + assertNull(task.getMetadata()); + } + + /** + * Test of getTask method, of class JSONRestTransport. + */ + @Test + public void testGetTask() throws Exception { + this.server.when( + request() + .withMethod("GET") + .withPath("/v1/tasks/de38c76d-d54c-436c-8b9f-4c2703648d64") + ) + .respond( + response() + .withStatusCode(200) + .withBody(GET_TASK_TEST_RESPONSE) + ); + ClientCallContext_v0_3 context = null; + TaskQueryParams_v0_3 request = new TaskQueryParams_v0_3("de38c76d-d54c-436c-8b9f-4c2703648d64", 10); + RestTransport_v0_3 instance = new RestTransport_v0_3(CARD); + Task_v0_3 task = instance.getTask(request, context); + assertEquals("de38c76d-d54c-436c-8b9f-4c2703648d64", task.getId()); + assertEquals(TaskState_v0_3.COMPLETED, task.getStatus().state()); + assertNull(task.getStatus().message()); + assertNull(task.getMetadata()); + assertEquals(false, task.getArtifacts().isEmpty()); + assertEquals(1, task.getArtifacts().size()); + Artifact_v0_3 artifact = task.getArtifacts().get(0); + assertEquals("artifact-1", artifact.artifactId()); + assertEquals("", artifact.name()); + assertEquals(false, artifact.parts().isEmpty()); + assertEquals(Kind.TEXT, artifact.parts().get(0).getKind()); + assertEquals("Why did the chicken cross the road? To get to the other side!", ((TextPart_v0_3) artifact.parts().get(0)).getText()); + assertEquals(1, task.getHistory().size()); + Message_v0_3 history = task.getHistory().get(0); + assertEquals("message", history.getKind()); + assertEquals(Message_v0_3.Role.USER, history.getRole()); + assertEquals("message-123", history.getMessageId()); + assertEquals(3, history.getParts().size()); + assertEquals(Kind.TEXT, history.getParts().get(0).getKind()); + assertEquals("tell me a joke", ((TextPart_v0_3) history.getParts().get(0)).getText()); + assertEquals(Kind.FILE, history.getParts().get(1).getKind()); + FilePart_v0_3 part = (FilePart_v0_3) history.getParts().get(1); + assertEquals("text/plain", part.getFile().mimeType()); + assertEquals("file:///path/to/file.txt", ((FileWithUri_v0_3) part.getFile()).uri()); + part = (FilePart_v0_3) history.getParts().get(2); + assertEquals(Kind.FILE, part.getKind()); + assertEquals("text/plain", part.getFile().mimeType()); + assertEquals("hello", ((FileWithBytes_v0_3) part.getFile()).bytes()); + assertNull(history.getMetadata()); + assertNull(history.getReferenceTaskIds()); + } + + /** + * Test of sendMessageStreaming method, of class JSONRestTransport. + */ + @Test + public void testSendMessageStreaming() throws Exception { + this.server.when( + request() + .withMethod("POST") + .withPath("/v1/message:stream") + .withBody(JsonBody.json(SEND_MESSAGE_STREAMING_TEST_REQUEST, MatchType.ONLY_MATCHING_FIELDS)) + ) + .respond( + response() + .withStatusCode(200) + .withHeader("Content-Type", "text/event-stream") + .withBody(SEND_MESSAGE_STREAMING_TEST_RESPONSE) + ); + + RestTransport_v0_3 client = new RestTransport_v0_3(CARD); + Message_v0_3 message = new Message_v0_3.Builder() + .role(Message_v0_3.Role.USER) + .parts(Collections.singletonList(new TextPart_v0_3("tell me some jokes"))) + .contextId("context-1234") + .messageId("message-1234") + .build(); + MessageSendConfiguration_v0_3 configuration = new MessageSendConfiguration_v0_3.Builder() + .acceptedOutputModes(List.of("text")) + .blocking(false) + .build(); + MessageSendParams_v0_3 params = new MessageSendParams_v0_3.Builder() + .message(message) + .configuration(configuration) + .build(); + AtomicReference receivedEvent = new AtomicReference<>(); + CountDownLatch latch = new CountDownLatch(1); + Consumer eventHandler = event -> { + receivedEvent.set(event); + latch.countDown(); + }; + Consumer errorHandler = error -> { + }; + client.sendMessageStreaming(params, eventHandler, errorHandler, null); + + boolean eventReceived = latch.await(10, TimeUnit.SECONDS); + assertTrue(eventReceived); + assertNotNull(receivedEvent.get()); + assertEquals("task", receivedEvent.get().getKind()); + Task_v0_3 task = (Task_v0_3) receivedEvent.get(); + assertEquals("2", task.getId()); + } + + /** + * Test of setTaskPushNotificationConfiguration method, of class JSONRestTransport. + */ + @Test + public void testSetTaskPushNotificationConfiguration() throws Exception { + log.info("Testing setTaskPushNotificationConfiguration"); + this.server.when( + request() + .withMethod("POST") + .withPath("/v1/tasks/de38c76d-d54c-436c-8b9f-4c2703648d64/pushNotificationConfigs") + .withBody(JsonBody.json(SET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_REQUEST, MatchType.ONLY_MATCHING_FIELDS)) + ) + .respond( + response() + .withStatusCode(200) + .withBody(SET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_RESPONSE) + ); + RestTransport_v0_3 client = new RestTransport_v0_3(CARD); + TaskPushNotificationConfig_v0_3 pushedConfig = new TaskPushNotificationConfig_v0_3( + "de38c76d-d54c-436c-8b9f-4c2703648d64", + new PushNotificationConfig_v0_3.Builder() + .url("https://example.com/callback") + .authenticationInfo( + new PushNotificationAuthenticationInfo_v0_3(Collections.singletonList("jwt"), null)) + .build()); + TaskPushNotificationConfig_v0_3 taskPushNotificationConfig = client.setTaskPushNotificationConfiguration(pushedConfig, null); + PushNotificationConfig_v0_3 pushNotificationConfig = taskPushNotificationConfig.pushNotificationConfig(); + assertNotNull(pushNotificationConfig); + assertEquals("https://example.com/callback", pushNotificationConfig.url()); + PushNotificationAuthenticationInfo_v0_3 authenticationInfo = pushNotificationConfig.authentication(); + assertEquals(1, authenticationInfo.schemes().size()); + assertEquals("jwt", authenticationInfo.schemes().get(0)); + } + + /** + * Test of getTaskPushNotificationConfiguration method, of class JSONRestTransport. + */ + @Test + public void testGetTaskPushNotificationConfiguration() throws Exception { + this.server.when( + request() + .withMethod("GET") + .withPath("/v1/tasks/de38c76d-d54c-436c-8b9f-4c2703648d64/pushNotificationConfigs/10") + ) + .respond( + response() + .withStatusCode(200) + .withBody(GET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_RESPONSE) + ); + + RestTransport_v0_3 client = new RestTransport_v0_3(CARD); + TaskPushNotificationConfig_v0_3 taskPushNotificationConfig = client.getTaskPushNotificationConfiguration( + new GetTaskPushNotificationConfigParams_v0_3("de38c76d-d54c-436c-8b9f-4c2703648d64", "10", + new HashMap<>()), null); + PushNotificationConfig_v0_3 pushNotificationConfig = taskPushNotificationConfig.pushNotificationConfig(); + assertNotNull(pushNotificationConfig); + assertEquals("https://example.com/callback", pushNotificationConfig.url()); + PushNotificationAuthenticationInfo_v0_3 authenticationInfo = pushNotificationConfig.authentication(); + assertTrue(authenticationInfo.schemes().size() == 1); + assertEquals("jwt", authenticationInfo.schemes().get(0)); + } + + /** + * Test of listTaskPushNotificationConfigurations method, of class JSONRestTransport. + */ + @Test + public void testListTaskPushNotificationConfigurations() throws Exception { + this.server.when( + request() + .withMethod("GET") + .withPath("/v1/tasks/de38c76d-d54c-436c-8b9f-4c2703648d64/pushNotificationConfigs") + ) + .respond( + response() + .withStatusCode(200) + .withBody(LIST_TASK_PUSH_NOTIFICATION_CONFIG_TEST_RESPONSE) + ); + + RestTransport_v0_3 client = new RestTransport_v0_3(CARD); + List taskPushNotificationConfigs = client.listTaskPushNotificationConfigurations( + new ListTaskPushNotificationConfigParams_v0_3("de38c76d-d54c-436c-8b9f-4c2703648d64", new HashMap<>()), null); + assertEquals(2, taskPushNotificationConfigs.size()); + PushNotificationConfig_v0_3 pushNotificationConfig = taskPushNotificationConfigs.get(0).pushNotificationConfig(); + assertNotNull(pushNotificationConfig); + assertEquals("https://example.com/callback", pushNotificationConfig.url()); + assertEquals("10", pushNotificationConfig.id()); + PushNotificationAuthenticationInfo_v0_3 authenticationInfo = pushNotificationConfig.authentication(); + assertTrue(authenticationInfo.schemes().size() == 1); + assertEquals("jwt", authenticationInfo.schemes().get(0)); + assertEquals("", authenticationInfo.credentials()); + pushNotificationConfig = taskPushNotificationConfigs.get(1).pushNotificationConfig(); + assertNotNull(pushNotificationConfig); + assertEquals("https://test.com/callback", pushNotificationConfig.url()); + assertEquals("5", pushNotificationConfig.id()); + authenticationInfo = pushNotificationConfig.authentication(); + assertNull(authenticationInfo); + } + + /** + * Test of deleteTaskPushNotificationConfigurations method, of class JSONRestTransport. + */ + @Test + public void testDeleteTaskPushNotificationConfigurations() throws Exception { + log.info("Testing deleteTaskPushNotificationConfigurations"); + this.server.when( + request() + .withMethod("DELETE") + .withPath("/v1/tasks/de38c76d-d54c-436c-8b9f-4c2703648d64/pushNotificationConfigs/10") + ) + .respond( + response() + .withStatusCode(200) + ); + ClientCallContext_v0_3 context = null; + RestTransport_v0_3 instance = new RestTransport_v0_3(CARD); + instance.deleteTaskPushNotificationConfigurations(new DeleteTaskPushNotificationConfigParams_v0_3("de38c76d-d54c-436c-8b9f-4c2703648d64", "10"), context); + } + + /** + * Test of resubscribe method, of class JSONRestTransport. + */ + @Test + public void testResubscribe() throws Exception { + log.info("Testing resubscribe"); + + this.server.when( + request() + .withMethod("POST") + .withPath("/v1/tasks/task-1234:subscribe") + ) + .respond( + response() + .withStatusCode(200) + .withHeader("Content-Type", "text/event-stream") + .withBody(TASK_RESUBSCRIPTION_REQUEST_TEST_RESPONSE) + ); + + RestTransport_v0_3 client = new RestTransport_v0_3(CARD); + TaskIdParams_v0_3 taskIdParams = new TaskIdParams_v0_3("task-1234"); + + AtomicReference receivedEvent = new AtomicReference<>(); + CountDownLatch latch = new CountDownLatch(1); + Consumer eventHandler = event -> { + receivedEvent.set(event); + latch.countDown(); + }; + Consumer errorHandler = error -> {}; + client.resubscribe(taskIdParams, eventHandler, errorHandler, null); + + boolean eventReceived = latch.await(10, TimeUnit.SECONDS); + assertTrue(eventReceived); + + StreamingEventKind_v0_3 eventKind = receivedEvent.get();; + assertNotNull(eventKind); + assertInstanceOf(Task_v0_3.class, eventKind); + Task_v0_3 task = (Task_v0_3) eventKind; + assertEquals("2", task.getId()); + assertEquals("context-1234", task.getContextId()); + assertEquals(TaskState_v0_3.COMPLETED, task.getStatus().state()); + List artifacts = task.getArtifacts(); + assertEquals(1, artifacts.size()); + Artifact_v0_3 artifact = artifacts.get(0); + assertEquals("artifact-1", artifact.artifactId()); + assertEquals("joke", artifact.name()); + Part_v0_3 part = artifact.parts().get(0); + assertEquals(Part_v0_3.Kind.TEXT, part.getKind()); + assertEquals("Why did the chicken cross the road? To get to the other side!", ((TextPart_v0_3) part).getText()); + } +} diff --git a/compat-0.3/client/transport/spi/pom.xml b/compat-0.3/client/transport/spi/pom.xml new file mode 100644 index 000000000..b8e8d1730 --- /dev/null +++ b/compat-0.3/client/transport/spi/pom.xml @@ -0,0 +1,36 @@ + + + 4.0.0 + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-parent + 1.0.0.Beta2-SNAPSHOT + ../../.. + + a2a-java-sdk-compat-0.3-client-transport-spi + jar + + Java SDK A2A Compat 0.3 Client Transport: SPI + Java SDK for the Agent2Agent Protocol (A2A) - Client Transport SPI + + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec + + + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-params + test + + + + diff --git a/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/ClientTransportConfigBuilder_v0_3.java b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/ClientTransportConfigBuilder_v0_3.java new file mode 100644 index 000000000..645d2f209 --- /dev/null +++ b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/ClientTransportConfigBuilder_v0_3.java @@ -0,0 +1,22 @@ +package org.a2aproject.sdk.compat03.client.transport.spi; + +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.ClientCallInterceptor_v0_3; + +import java.util.ArrayList; +import java.util.List; + +public abstract class ClientTransportConfigBuilder_v0_3, + B extends ClientTransportConfigBuilder_v0_3> { + + protected List interceptors = new ArrayList<>(); + + public B addInterceptor(ClientCallInterceptor_v0_3 interceptor) { + if (interceptor != null) { + this.interceptors.add(interceptor); + } + + return (B) this; + } + + public abstract T build(); +} diff --git a/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/ClientTransportConfig_v0_3.java b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/ClientTransportConfig_v0_3.java new file mode 100644 index 000000000..f81011d1c --- /dev/null +++ b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/ClientTransportConfig_v0_3.java @@ -0,0 +1,22 @@ +package org.a2aproject.sdk.compat03.client.transport.spi; + +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.ClientCallInterceptor_v0_3; +import java.util.ArrayList; + +import java.util.List; + +/** + * Configuration for an A2A client transport. + */ +public abstract class ClientTransportConfig_v0_3 { + + protected List interceptors = new ArrayList<>(); + + public void setInterceptors(List interceptors) { + this.interceptors = new ArrayList<>(interceptors); + } + + public List getInterceptors() { + return interceptors; + } +} \ No newline at end of file diff --git a/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/ClientTransportProvider_v0_3.java b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/ClientTransportProvider_v0_3.java new file mode 100644 index 000000000..962825f40 --- /dev/null +++ b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/ClientTransportProvider_v0_3.java @@ -0,0 +1,30 @@ +package org.a2aproject.sdk.compat03.client.transport.spi; + +import org.a2aproject.sdk.compat03.spec.A2AClientException_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentCard_v0_3; + +/** + * Client transport provider interface. + */ +public interface ClientTransportProvider_v0_3> { + + /** + * Create a client transport. + * + * @param clientTransportConfig the client transport config to use + * @param agentCard the remote agent's agent card + * @param agentUrl the remote agent's URL + * @return the client transport + * @throws A2AClientException_v0_3 if an error occurs trying to create the client + */ + T create(C clientTransportConfig, AgentCard_v0_3 agentCard, + String agentUrl) throws A2AClientException_v0_3; + + /** + * Get the name of the client transport. + */ + String getTransportProtocol(); + + Class getTransportProtocolClass(); +} + diff --git a/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/ClientTransport_v0_3.java b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/ClientTransport_v0_3.java new file mode 100644 index 000000000..ddc0b920f --- /dev/null +++ b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/ClientTransport_v0_3.java @@ -0,0 +1,141 @@ +package org.a2aproject.sdk.compat03.client.transport.spi; + +import java.util.List; +import java.util.function.Consumer; + +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.ClientCallContext_v0_3; +import org.a2aproject.sdk.compat03.spec.A2AClientException_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentCard_v0_3; +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigParams_v0_3; +import org.a2aproject.sdk.compat03.spec.EventKind_v0_3; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigParams_v0_3; +import org.a2aproject.sdk.compat03.spec.ListTaskPushNotificationConfigParams_v0_3; +import org.a2aproject.sdk.compat03.spec.MessageSendParams_v0_3; +import org.a2aproject.sdk.compat03.spec.StreamingEventKind_v0_3; +import org.a2aproject.sdk.compat03.spec.Task_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskIdParams_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskQueryParams_v0_3; +import org.jspecify.annotations.Nullable; + +/** + * Interface for a client transport. + */ +public interface ClientTransport_v0_3 { + + /** + * Send a non-streaming message request to the agent. + * + * @param request the message send parameters + * @param context optional client call context for the request (may be {@code null}) + * @return the response, either a Task or Message + * @throws A2AClientException_v0_3 if sending the message fails for any reason + */ + EventKind_v0_3 sendMessage(MessageSendParams_v0_3 request, @Nullable ClientCallContext_v0_3 context) + throws A2AClientException_v0_3; + + /** + * Send a streaming message request to the agent and receive responses as they arrive. + * + * @param request the message send parameters + * @param eventConsumer consumer that will receive streaming events as they arrive + * @param errorConsumer consumer that will be called if an error occurs during streaming + * @param context optional client call context for the request (may be {@code null}) + * @throws A2AClientException_v0_3 if setting up the streaming connection fails + */ + void sendMessageStreaming(MessageSendParams_v0_3 request, Consumer eventConsumer, + Consumer errorConsumer, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3; + + /** + * Retrieve the current state and history of a specific task. + * + * @param request the task query parameters specifying which task to retrieve + * @param context optional client call context for the request (may be {@code null}) + * @return the task + * @throws A2AClientException_v0_3 if retrieving the task fails for any reason + */ + Task_v0_3 getTask(TaskQueryParams_v0_3 request, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3; + + /** + * Request the agent to cancel a specific task. + * + * @param request the task ID parameters specifying which task to cancel + * @param context optional client call context for the request (may be {@code null}) + * @return the cancelled task + * @throws A2AClientException_v0_3 if cancelling the task fails for any reason + */ + Task_v0_3 cancelTask(TaskIdParams_v0_3 request, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3; + + /** + * Set or update the push notification configuration for a specific task. + * + * @param request the push notification configuration to set for the task + * @param context optional client call context for the request (may be {@code null}) + * @return the configured TaskPushNotificationConfig + * @throws A2AClientException_v0_3 if setting the task push notification configuration fails for any reason + */ + TaskPushNotificationConfig_v0_3 setTaskPushNotificationConfiguration(TaskPushNotificationConfig_v0_3 request, + @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3; + + /** + * Retrieve the push notification configuration for a specific task. + * + * @param request the parameters specifying which task's notification config to retrieve + * @param context optional client call context for the request (may be {@code null}) + * @return the task push notification config + * @throws A2AClientException_v0_3 if getting the task push notification config fails for any reason + */ + TaskPushNotificationConfig_v0_3 getTaskPushNotificationConfiguration( + GetTaskPushNotificationConfigParams_v0_3 request, + @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3; + + /** + * Retrieve the list of push notification configurations for a specific task. + * + * @param request the parameters specifying which task's notification configs to retrieve + * @param context optional client call context for the request (may be {@code null}) + * @return the list of task push notification configs + * @throws A2AClientException_v0_3 if getting the task push notification configs fails for any reason + */ + List listTaskPushNotificationConfigurations( + ListTaskPushNotificationConfigParams_v0_3 request, + @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3; + + /** + * Delete the list of push notification configurations for a specific task. + * + * @param request the parameters specifying which task's notification configs to delete + * @param context optional client call context for the request (may be {@code null}) + * @throws A2AClientException_v0_3 if deleting the task push notification configs fails for any reason + */ + void deleteTaskPushNotificationConfigurations( + DeleteTaskPushNotificationConfigParams_v0_3 request, + @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3; + + /** + * Reconnect to get task updates for an existing task. + * + * @param request the task ID parameters specifying which task to resubscribe to + * @param eventConsumer consumer that will receive streaming events as they arrive + * @param errorConsumer consumer that will be called if an error occurs during streaming + * @param context optional client call context for the request (may be {@code null}) + * @throws A2AClientException_v0_3 if resubscribing to the task fails for any reason + */ + void resubscribe(TaskIdParams_v0_3 request, Consumer eventConsumer, + Consumer errorConsumer, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3; + + /** + * Retrieve the AgentCard. + * + * @param context optional client call context for the request (may be {@code null}) + * @return the AgentCard + * @throws A2AClientException_v0_3 if retrieving the agent card fails for any reason + */ + AgentCard_v0_3 getAgentCard(@Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3; + + /** + * Close the transport and release any associated resources. + */ + void close(); + +} diff --git a/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/ClientCallContext_v0_3.java b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/ClientCallContext_v0_3.java new file mode 100644 index 000000000..c6cbbcdc3 --- /dev/null +++ b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/ClientCallContext_v0_3.java @@ -0,0 +1,27 @@ +package org.a2aproject.sdk.compat03.client.transport.spi.interceptors; + +import java.util.Map; + +/** + * A context passed with each client call, allowing for call-specific. + * configuration and data passing. Such as authentication details or + * request deadlines. + */ +public class ClientCallContext_v0_3 { + + private final Map state; + private final Map headers; + + public ClientCallContext_v0_3(Map state, Map headers) { + this.state = state; + this.headers = headers; + } + + public Map getState() { + return state; + } + + public Map getHeaders() { + return headers; + } +} diff --git a/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/ClientCallInterceptor_v0_3.java b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/ClientCallInterceptor_v0_3.java new file mode 100644 index 000000000..fc0e76584 --- /dev/null +++ b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/ClientCallInterceptor_v0_3.java @@ -0,0 +1,27 @@ +package org.a2aproject.sdk.compat03.client.transport.spi.interceptors; + +import java.util.Map; + +import org.a2aproject.sdk.compat03.spec.AgentCard_v0_3; +import org.jspecify.annotations.Nullable; + +/** + * An abstract base class for client-side call interceptors. + * Interceptors can inspect and modify requests before they are sent, + * which is ideal for concerns like authentication, logging, or tracing. + */ +public abstract class ClientCallInterceptor_v0_3 { + + /** + * Intercept a client call before the request is sent. + * + * @param methodName the name of the protocol method (e.g., 'message/send') + * @param payload the request payload + * @param headers the headers to use + * @param agentCard the agent card (may be {@code null}) + * @param clientCallContext the {@code ClientCallContext} for this call (may be {@code null}) + * @return the potentially modified payload and headers + */ + public abstract PayloadAndHeaders_v0_3 intercept(String methodName, @Nullable Object payload, Map headers, + AgentCard_v0_3 agentCard, @Nullable ClientCallContext_v0_3 clientCallContext); +} diff --git a/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/PayloadAndHeaders_v0_3.java b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/PayloadAndHeaders_v0_3.java new file mode 100644 index 000000000..bc08d174c --- /dev/null +++ b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/PayloadAndHeaders_v0_3.java @@ -0,0 +1,25 @@ +package org.a2aproject.sdk.compat03.client.transport.spi.interceptors; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import org.jspecify.annotations.Nullable; + +public class PayloadAndHeaders_v0_3 { + + private final @Nullable Object payload; + private final Map headers; + + public PayloadAndHeaders_v0_3(@Nullable Object payload, @Nullable Map headers) { + this.payload = payload; + this.headers = headers == null ? Collections.emptyMap() : new HashMap<>(headers); + } + + public @Nullable Object getPayload() { + return payload; + } + + public Map getHeaders() { + return headers; + } +} diff --git a/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/auth/AuthInterceptor_v0_3.java b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/auth/AuthInterceptor_v0_3.java new file mode 100644 index 000000000..82d1f0739 --- /dev/null +++ b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/auth/AuthInterceptor_v0_3.java @@ -0,0 +1,71 @@ +package org.a2aproject.sdk.compat03.client.transport.spi.interceptors.auth; + +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; + +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.ClientCallContext_v0_3; +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.ClientCallInterceptor_v0_3; +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.PayloadAndHeaders_v0_3; +import org.a2aproject.sdk.compat03.spec.APIKeySecurityScheme_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentCard_v0_3; +import org.a2aproject.sdk.compat03.spec.HTTPAuthSecurityScheme_v0_3; +import org.a2aproject.sdk.compat03.spec.OAuth2SecurityScheme_v0_3; +import org.a2aproject.sdk.compat03.spec.OpenIdConnectSecurityScheme_v0_3; +import org.a2aproject.sdk.compat03.spec.SecurityScheme_v0_3; +import org.jspecify.annotations.Nullable; + +/** + * An interceptor that automatically adds authentication details to requests + * based on the agent's security schemes and the credentials available. + */ +public class AuthInterceptor_v0_3 extends ClientCallInterceptor_v0_3 { + + private static final String BEARER_SCHEME = "bearer"; + public static final String AUTHORIZATION = "Authorization"; + private static final String BEARER = "Bearer "; + private final CredentialService_v0_3 credentialService; + + public AuthInterceptor_v0_3(final CredentialService_v0_3 credentialService) { + this.credentialService = credentialService; + } + + @Override + public PayloadAndHeaders_v0_3 intercept(String methodName, @Nullable Object payload, Map headers, + AgentCard_v0_3 agentCard, @Nullable ClientCallContext_v0_3 clientCallContext) { + Map updatedHeaders = new HashMap<>(headers == null ? new HashMap<>() : headers); + if (agentCard == null || agentCard.security() == null || agentCard.securitySchemes() == null) { + return new PayloadAndHeaders_v0_3(payload, updatedHeaders); + } + for (Map> requirement : agentCard.security()) { + for (String securitySchemeName : requirement.keySet()) { + String credential = credentialService.getCredential(securitySchemeName, clientCallContext); + if (credential != null && agentCard.securitySchemes().containsKey(securitySchemeName)) { + SecurityScheme_v0_3 securityScheme = agentCard.securitySchemes().get(securitySchemeName); + if (securityScheme == null) { + continue; + } + if (securityScheme instanceof HTTPAuthSecurityScheme_v0_3 httpAuthSecurityScheme) { + if (httpAuthSecurityScheme.getScheme().toLowerCase(Locale.ROOT).equals(BEARER_SCHEME)) { + updatedHeaders.put(AUTHORIZATION, getBearerValue(credential)); + return new PayloadAndHeaders_v0_3(payload, updatedHeaders); + } + } else if (securityScheme instanceof OAuth2SecurityScheme_v0_3 + || securityScheme instanceof OpenIdConnectSecurityScheme_v0_3) { + updatedHeaders.put(AUTHORIZATION, getBearerValue(credential)); + return new PayloadAndHeaders_v0_3(payload, updatedHeaders); + } else if (securityScheme instanceof APIKeySecurityScheme_v0_3 apiKeySecurityScheme) { + updatedHeaders.put(apiKeySecurityScheme.getName(), credential); + return new PayloadAndHeaders_v0_3(payload, updatedHeaders); + } + } + } + } + return new PayloadAndHeaders_v0_3(payload, updatedHeaders); + } + + private static String getBearerValue(String credential) { + return BEARER + credential; + } +} diff --git a/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/auth/CredentialService_v0_3.java b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/auth/CredentialService_v0_3.java new file mode 100644 index 000000000..05a320eb4 --- /dev/null +++ b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/auth/CredentialService_v0_3.java @@ -0,0 +1,19 @@ +package org.a2aproject.sdk.compat03.client.transport.spi.interceptors.auth; + +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.ClientCallContext_v0_3; +import org.jspecify.annotations.Nullable; + +/** + * Used to retrieve credentials. + */ +public interface CredentialService_v0_3 { + + /** + * Retrieves a credential (e.g., token) for a security scheme. + * + * @param securitySchemeName the name of the security scheme + * @param clientCallContext the client call context, which may be {@code null}. + * @return the credential or {@code null} if the credential could not be retrieved + */ + @Nullable String getCredential(String securitySchemeName, @Nullable ClientCallContext_v0_3 clientCallContext); +} diff --git a/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/auth/InMemoryContextCredentialService_v0_3.java b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/auth/InMemoryContextCredentialService_v0_3.java new file mode 100644 index 000000000..21f77dcc8 --- /dev/null +++ b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/auth/InMemoryContextCredentialService_v0_3.java @@ -0,0 +1,55 @@ +package org.a2aproject.sdk.compat03.client.transport.spi.interceptors.auth; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; + +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.ClientCallContext_v0_3; +import org.jspecify.annotations.Nullable; + +/** + * A simple in-memory store for session-keyed credentials. + * This class uses the 'sessionId' from the {@code ClientCallContext} state to + * store and retrieve credentials + */ +public class InMemoryContextCredentialService_v0_3 implements CredentialService_v0_3 { + + private static final String SESSION_ID = "sessionId"; + + // maps a sessionId to a map of security scheme names to credentials + private final ConcurrentMap> credentialStore; + + public InMemoryContextCredentialService_v0_3() { + credentialStore = new ConcurrentHashMap<>(); + } + + @Override + public @Nullable String getCredential(String securitySchemeName, + @Nullable ClientCallContext_v0_3 clientCallContext) { + if (clientCallContext == null || !clientCallContext.getState().containsKey(SESSION_ID)) { + // no credential to retrieve + return null; + } + + Object sessionIdObj = clientCallContext.getState().get(SESSION_ID); + if (! (sessionIdObj instanceof String sessionId)) { + return null; + } + Map sessionCredentials = credentialStore.get(sessionId); + if (sessionCredentials == null) { + return null; + } + return sessionCredentials.get(securitySchemeName); + } + + /** + * Method to populate the in-memory credential service. + * + * @param sessionId the session ID + * @param securitySchemeName the name of the security scheme + * @param credential the credential string + */ + public void setCredential(String sessionId, String securitySchemeName, String credential) { + credentialStore.computeIfAbsent(sessionId, k -> new ConcurrentHashMap<>()).put(securitySchemeName, credential); + } +} diff --git a/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/auth/package-info.java b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/auth/package-info.java new file mode 100644 index 000000000..d9805799c --- /dev/null +++ b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/auth/package-info.java @@ -0,0 +1,5 @@ +@NullMarked +package org.a2aproject.sdk.compat03.client.transport.spi.interceptors.auth; + +import org.jspecify.annotations.NullMarked; + diff --git a/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/package-info.java b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/package-info.java new file mode 100644 index 000000000..bda43ec7b --- /dev/null +++ b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/package-info.java @@ -0,0 +1,5 @@ +@NullMarked +package org.a2aproject.sdk.compat03.client.transport.spi.interceptors; + +import org.jspecify.annotations.NullMarked; + diff --git a/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/package-info.java b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/package-info.java new file mode 100644 index 000000000..850736146 --- /dev/null +++ b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/package-info.java @@ -0,0 +1,5 @@ +@NullMarked +package org.a2aproject.sdk.compat03.client.transport.spi; + +import org.jspecify.annotations.NullMarked; + diff --git a/compat-0.3/client/transport/spi/src/test/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/auth/AuthInterceptor_v0_3_Test.java b/compat-0.3/client/transport/spi/src/test/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/auth/AuthInterceptor_v0_3_Test.java new file mode 100644 index 000000000..fda90973d --- /dev/null +++ b/compat-0.3/client/transport/spi/src/test/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/auth/AuthInterceptor_v0_3_Test.java @@ -0,0 +1,328 @@ +package org.a2aproject.sdk.compat03.client.transport.spi.interceptors.auth; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.ClientCallContext_v0_3; +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.ClientCallInterceptor_v0_3; +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.PayloadAndHeaders_v0_3; +import org.a2aproject.sdk.compat03.spec.APIKeySecurityScheme_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentCapabilities_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentCard_v0_3; +import org.a2aproject.sdk.compat03.spec.HTTPAuthSecurityScheme_v0_3; +import org.a2aproject.sdk.compat03.spec.OAuth2SecurityScheme_v0_3; +import org.a2aproject.sdk.compat03.spec.OAuthFlows_v0_3; +import org.a2aproject.sdk.compat03.spec.OpenIdConnectSecurityScheme_v0_3; +import org.a2aproject.sdk.compat03.spec.SecurityScheme_v0_3; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +public class AuthInterceptor_v0_3_Test { + + private InMemoryContextCredentialService_v0_3 credentialStore; + private AuthInterceptor_v0_3 authInterceptor; + + @BeforeEach + void setUp() { + credentialStore = new InMemoryContextCredentialService_v0_3(); + authInterceptor = new AuthInterceptor_v0_3(credentialStore); + } + + private static class HeaderInterceptor extends ClientCallInterceptor_v0_3 { + private final String headerName; + private final String headerValue; + + public HeaderInterceptor(String headerName, String headerValue) { + this.headerName = headerName; + this.headerValue = headerValue; + } + + @Override + public PayloadAndHeaders_v0_3 intercept(String methodName, Object payload, Map headers, + AgentCard_v0_3 agentCard, ClientCallContext_v0_3 clientCallContext) { + Map updatedHeaders = new HashMap<>(headers); + updatedHeaders.put(headerName, headerValue); + return new PayloadAndHeaders_v0_3(payload, updatedHeaders); + } + } + + private static class AuthTestCase { + final String url; + final String sessionId; + final String schemeName; + final String credential; + final SecurityScheme_v0_3 securityScheme; + final String expectedHeaderKey; + final String expectedHeaderValue; + + AuthTestCase(String url, String sessionId, String schemeName, String credential, + SecurityScheme_v0_3 securityScheme, String expectedHeaderKey, String expectedHeaderValue) { + this.url = url; + this.sessionId = sessionId; + this.schemeName = schemeName; + this.credential = credential; + this.securityScheme = securityScheme; + this.expectedHeaderKey = expectedHeaderKey; + this.expectedHeaderValue = expectedHeaderValue; + } + } + + @Test + public void testAPIKeySecurityScheme() { + AuthTestCase authTestCase = new AuthTestCase( + "http://agent.com/rpc", + "session-id", + APIKeySecurityScheme_v0_3.API_KEY, + "secret-api-key", + new APIKeySecurityScheme_v0_3("header", "x-api-key", "API Key authentication"), + "x-api-key", + "secret-api-key" + ); + testSecurityScheme(authTestCase); + } + + @Test + public void testOAuth2SecurityScheme() { + AuthTestCase authTestCase = new AuthTestCase( + "http://agent.com/rpc", + "session-id", + OAuth2SecurityScheme_v0_3.OAUTH2, + "secret-oauth-access-token", + new OAuth2SecurityScheme_v0_3(new OAuthFlows_v0_3.Builder().build(), "OAuth2 authentication", null), + "Authorization", + "Bearer secret-oauth-access-token" + ); + testSecurityScheme(authTestCase); + } + + @Test + public void testOidcSecurityScheme() { + AuthTestCase authTestCase = new AuthTestCase( + "http://agent.com/rpc", + "session-id", + OpenIdConnectSecurityScheme_v0_3.OPENID_CONNECT, + "secret-oidc-id-token", + new OpenIdConnectSecurityScheme_v0_3("http://provider.com/.well-known/openid-configuration", "OIDC authentication"), + "Authorization", + "Bearer secret-oidc-id-token" + ); + testSecurityScheme(authTestCase); + } + + @Test + public void testBearerSecurityScheme() { + AuthTestCase authTestCase = new AuthTestCase( + "http://agent.com/rpc", + "session-id", + "bearer", + "bearer-token-123", + new HTTPAuthSecurityScheme_v0_3(null, "bearer", "Bearer token authentication"), + "Authorization", + "Bearer bearer-token-123" + ); + testSecurityScheme(authTestCase); + } + + private void testSecurityScheme(AuthTestCase authTestCase) { + credentialStore.setCredential(authTestCase.sessionId, authTestCase.schemeName, authTestCase.credential); + + AgentCard_v0_3 agentCard = createAgentCard(authTestCase.schemeName, authTestCase.securityScheme); + Map requestPayload = Map.of("test", "payload"); + Map headers = Map.of(); + ClientCallContext_v0_3 context = new ClientCallContext_v0_3(Map.of("sessionId", authTestCase.sessionId), Map.of()); + + PayloadAndHeaders_v0_3 result = authInterceptor.intercept( + "message/send", + requestPayload, + headers, + agentCard, + context + ); + + assertEquals(requestPayload, result.getPayload()); + assertEquals(authTestCase.expectedHeaderValue, result.getHeaders().get(authTestCase.expectedHeaderKey)); + } + + @Test + void testAuthInterceptorWithoutAgentCard() { + Map requestPayload = Map.of("foo", "bar"); + Map headers = Map.of("foo", "bar"); + + PayloadAndHeaders_v0_3 result = authInterceptor.intercept( + "message/send", + requestPayload, + headers, + null, // no agent card + new ClientCallContext_v0_3(Map.of(), Map.of()) + ); + + // should be unchanged + assertEquals(requestPayload, result.getPayload()); + assertEquals(headers, result.getHeaders()); + } + + @Test + void testInMemoryContextCredentialStore() { + String sessionId = "session-id"; + String schemeName = "test-scheme"; + String credential = "test-token"; + + credentialStore.setCredential(sessionId, schemeName, credential); + ClientCallContext_v0_3 context = new ClientCallContext_v0_3(Map.of("sessionId", sessionId), Map.of()); + String retrievedCredential = credentialStore.getCredential(schemeName, context); + assertEquals(credential, retrievedCredential); + + // wrong session ID + ClientCallContext_v0_3 wrongContext = new ClientCallContext_v0_3(Map.of("sessionId", "wrong-session"), Map.of()); + retrievedCredential = credentialStore.getCredential(schemeName, wrongContext); + assertNull(retrievedCredential); + + retrievedCredential = credentialStore.getCredential(schemeName, null); + assertNull(retrievedCredential); + + // no session ID in context + ClientCallContext_v0_3 emptyContext = new ClientCallContext_v0_3(Map.of(), Map.of()); + retrievedCredential = credentialStore.getCredential(schemeName, emptyContext); + assertNull(retrievedCredential); + + String newCredential = "new-token"; + credentialStore.setCredential(sessionId, schemeName, newCredential); + retrievedCredential = credentialStore.getCredential(schemeName, context); + assertEquals(newCredential, retrievedCredential); + } + + @Test + void testCustomInterceptor() { + String headerName = "X-Test-Header"; + String headerValue = "Test-Value-123"; + HeaderInterceptor interceptor = new HeaderInterceptor(headerName, headerValue); + + Map payload = Map.of("test", "payload"); + Map headers = Map.of(); + + PayloadAndHeaders_v0_3 result = interceptor.intercept( + "message/send", + payload, + headers, + null, + null + ); + + assertEquals(payload, result.getPayload()); + assertEquals(headerValue, result.getHeaders().get(headerName)); + } + + @Test + void testAvailableSecuritySchemeNotInAgentCardSecuritySchemes() { + String schemeName = "missing"; + String sessionId = "session-id"; + String credential = "dummy-token"; + + credentialStore.setCredential(sessionId, schemeName, credential); + + // Create agent card with security requirement but no scheme definition + AgentCard_v0_3 agentCard = new AgentCard_v0_3.Builder() + .name("missing") + .description("Uses missing scheme definition") + .url("http://agent.com/rpc") + .version("1.0") + .capabilities(new AgentCapabilities_v0_3.Builder().build()) + .defaultInputModes(List.of("text")) + .defaultOutputModes(List.of("text")) + .skills(List.of()) + .security(List.of(Map.of(schemeName, List.of()))) + .securitySchemes(Map.of()) // no security schemes + .build(); + + Map requestPayload = Map.of("foo", "bar"); + Map headers = Map.of("fizz", "buzz"); + ClientCallContext_v0_3 context = new ClientCallContext_v0_3(Map.of("sessionId", sessionId), Map.of()); + + PayloadAndHeaders_v0_3 result = authInterceptor.intercept( + "message/send", + requestPayload, + headers, + agentCard, + context + ); + + assertEquals(requestPayload, result.getPayload()); + assertEquals(headers, result.getHeaders()); + } + + @Test + void testNoCredentialAvailable() { + String schemeName = "apikey"; + SecurityScheme_v0_3 securityScheme = new APIKeySecurityScheme_v0_3("header", "X-API-Key", "API Key authentication"); + AgentCard_v0_3 agentCard = createAgentCard(schemeName, securityScheme); + + Map requestPayload = Map.of("test", "payload"); + Map headers = Map.of(); + ClientCallContext_v0_3 context = new ClientCallContext_v0_3(Map.of("sessionId", "session-id"), Map.of()); + + PayloadAndHeaders_v0_3 result = authInterceptor.intercept( + "message/send", + requestPayload, + headers, + agentCard, + context + ); + + assertEquals(requestPayload, result.getPayload()); + assertEquals(headers, result.getHeaders()); // headers should be unchanged + } + + @Test + void testNoAgentCardSecuritySpecified() { + // Arrange + AgentCard_v0_3 agentCard = new AgentCard_v0_3.Builder() + .name("nosecuritybot") + .description("A bot with no security requirements") + .url("http://agent.com/rpc") + .version("1.0") + .capabilities(new AgentCapabilities_v0_3.Builder().build()) + .defaultInputModes(List.of("text")) + .defaultOutputModes(List.of("text")) + .skills(List.of()) + .security(null) // no security info + .build(); + + Map requestPayload = Map.of("test", "payload"); + Map headers = Map.of(); + ClientCallContext_v0_3 context = new ClientCallContext_v0_3(Map.of("sessionId", "session-id"), Map.of()); + + PayloadAndHeaders_v0_3 result = authInterceptor.intercept( + "message/send", + requestPayload, + headers, + agentCard, + context + ); + + assertEquals(requestPayload, result.getPayload()); + assertEquals(headers, result.getHeaders()); + } + + /** + * Helper method to create an AgentCard with specified security scheme. + */ + private AgentCard_v0_3 createAgentCard(String schemeName, SecurityScheme_v0_3 securityScheme) { + return new AgentCard_v0_3.Builder() + .name(schemeName + "bot") + .description("A bot that uses " + schemeName) + .url("http://agent.com/rpc") + .version("1.0") + .capabilities(new AgentCapabilities_v0_3.Builder().build()) + .defaultInputModes(List.of("text")) + .defaultOutputModes(List.of("text")) + .skills(List.of()) + .security(List.of(Map.of(schemeName, List.of()))) + .securitySchemes(Map.of(schemeName, securityScheme)) + .build(); + } +} diff --git a/compat-0.3/http-client/pom.xml b/compat-0.3/http-client/pom.xml new file mode 100644 index 000000000..61fb8bd3a --- /dev/null +++ b/compat-0.3/http-client/pom.xml @@ -0,0 +1,39 @@ + + + 4.0.0 + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-parent + 1.0.0.Beta2-SNAPSHOT + .. + + a2a-java-sdk-compat-0.3-http-client + + jar + + Java SDK A2A Compat 0.3 HTTP Client + Java SDK for the Agent2Agent Protocol (A2A) - HTTP Client (0.3 compat) + + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec + + + + org.junit.jupiter + junit-jupiter-api + test + + + + org.mock-server + mockserver-netty + test + + + + diff --git a/compat-0.3/http-client/src/main/java/org/a2aproject/sdk/compat03/client/http/A2ACardResolver_v0_3.java b/compat-0.3/http-client/src/main/java/org/a2aproject/sdk/compat03/client/http/A2ACardResolver_v0_3.java new file mode 100644 index 000000000..af554f978 --- /dev/null +++ b/compat-0.3/http-client/src/main/java/org/a2aproject/sdk/compat03/client/http/A2ACardResolver_v0_3.java @@ -0,0 +1,113 @@ +package org.a2aproject.sdk.compat03.client.http; + +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Map; + +import org.a2aproject.sdk.compat03.json.JsonProcessingException_v0_3; +import org.a2aproject.sdk.compat03.json.JsonUtil_v0_3; +import org.a2aproject.sdk.compat03.spec.A2AClientError_v0_3; +import org.a2aproject.sdk.compat03.spec.A2AClientJSONError_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentCard_v0_3; +import org.jspecify.annotations.Nullable; + +public class A2ACardResolver_v0_3 { + private final A2AHttpClient_v0_3 httpClient; + private final String url; + private final @Nullable Map authHeaders; + + private static final String DEFAULT_AGENT_CARD_PATH = "/.well-known/agent-card.json"; + + /** + * Get the agent card for an A2A agent. + * The {@code JdkA2AHttpClient} will be used to fetch the agent card. + * + * @param baseUrl the base URL for the agent whose agent card we want to retrieve + * @throws A2AClientError_v0_3 if the URL for the agent is invalid + */ + public A2ACardResolver_v0_3(String baseUrl) throws A2AClientError_v0_3 { + this(new JdkA2AHttpClient_v0_3(), baseUrl, null, null); + } + + /** + * Constructs an A2ACardResolver with a specific HTTP client and base URL. + * + * @param httpClient the http client to use + * @param baseUrl the base URL for the agent whose agent card we want to retrieve + * @throws A2AClientError_v0_3 if the URL for the agent is invalid + */ + public A2ACardResolver_v0_3(A2AHttpClient_v0_3 httpClient, String baseUrl) throws A2AClientError_v0_3 { + this(httpClient, baseUrl, null, null); + } + + /** + * @param httpClient the http client to use + * @param baseUrl the base URL for the agent whose agent card we want to retrieve + * @param agentCardPath optional path to the agent card endpoint relative to the base + * agent URL, defaults to ".well-known/agent-card.json" + * @throws A2AClientError_v0_3 if the URL for the agent is invalid + */ + public A2ACardResolver_v0_3(A2AHttpClient_v0_3 httpClient, String baseUrl, String agentCardPath) throws A2AClientError_v0_3 { + this(httpClient, baseUrl, agentCardPath, null); + } + + /** + * @param httpClient the http client to use + * @param baseUrl the base URL for the agent whose agent card we want to retrieve + * @param agentCardPath optional path to the agent card endpoint relative to the base + * agent URL, defaults to ".well-known/agent-card.json" + * @param authHeaders the HTTP authentication headers to use. May be {@code null} + * @throws A2AClientError_v0_3 if the URL for the agent is invalid + */ + public A2ACardResolver_v0_3(A2AHttpClient_v0_3 httpClient, String baseUrl, @Nullable String agentCardPath, + @Nullable Map authHeaders) throws A2AClientError_v0_3 { + this.httpClient = httpClient; + String effectiveAgentCardPath = agentCardPath == null || agentCardPath.isEmpty() ? DEFAULT_AGENT_CARD_PATH : agentCardPath; + try { + this.url = new URI(baseUrl).resolve(effectiveAgentCardPath).toString(); + } catch (URISyntaxException e) { + throw new A2AClientError_v0_3("Invalid agent URL", e); + } + this.authHeaders = authHeaders; + } + + /** + * Get the agent card for the configured A2A agent. + * + * @return the agent card + * @throws A2AClientError_v0_3 If an HTTP error occurs fetching the card + * @throws A2AClientJSONError_v0_3 If the response body cannot be decoded as JSON or validated against the AgentCard schema + */ + public AgentCard_v0_3 getAgentCard() throws A2AClientError_v0_3, A2AClientJSONError_v0_3 { + A2AHttpClient_v0_3.GetBuilder builder = httpClient.createGet() + .url(url) + .addHeader("Content-Type", "application/json"); + + if (authHeaders != null) { + for (Map.Entry entry : authHeaders.entrySet()) { + builder.addHeader(entry.getKey(), entry.getValue()); + } + } + + String body; + try { + A2AHttpResponse_v0_3 response = builder.get(); + if (!response.success()) { + throw new A2AClientError_v0_3("Failed to obtain agent card: " + response.status()); + } + body = response.body(); + } catch (IOException | InterruptedException e) { + throw new A2AClientError_v0_3("Failed to obtain agent card", e); + } + + try { + return JsonUtil_v0_3.fromJson(body, AgentCard_v0_3.class); + } catch (JsonProcessingException_v0_3 e) { + throw new A2AClientJSONError_v0_3("Could not unmarshal agent card response", e); + } + + } + + +} diff --git a/compat-0.3/http-client/src/main/java/org/a2aproject/sdk/compat03/client/http/A2AHttpClient_v0_3.java b/compat-0.3/http-client/src/main/java/org/a2aproject/sdk/compat03/client/http/A2AHttpClient_v0_3.java new file mode 100644 index 000000000..2387e725e --- /dev/null +++ b/compat-0.3/http-client/src/main/java/org/a2aproject/sdk/compat03/client/http/A2AHttpClient_v0_3.java @@ -0,0 +1,42 @@ +package org.a2aproject.sdk.compat03.client.http; + +import java.io.IOException; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import java.util.function.Consumer; + +public interface A2AHttpClient_v0_3 { + + GetBuilder createGet(); + + PostBuilder createPost(); + + DeleteBuilder createDelete(); + + interface Builder> { + T url(String s); + T addHeaders(Map headers); + T addHeader(String name, String value); + } + + interface GetBuilder extends Builder { + A2AHttpResponse_v0_3 get() throws IOException, InterruptedException; + CompletableFuture getAsyncSSE( + Consumer messageConsumer, + Consumer errorConsumer, + Runnable completeRunnable) throws IOException, InterruptedException; + } + + interface PostBuilder extends Builder { + PostBuilder body(String body); + A2AHttpResponse_v0_3 post() throws IOException, InterruptedException; + CompletableFuture postAsyncSSE( + Consumer messageConsumer, + Consumer errorConsumer, + Runnable completeRunnable) throws IOException, InterruptedException; + } + + interface DeleteBuilder extends Builder { + A2AHttpResponse_v0_3 delete() throws IOException, InterruptedException; + } +} diff --git a/compat-0.3/http-client/src/main/java/org/a2aproject/sdk/compat03/client/http/A2AHttpResponse_v0_3.java b/compat-0.3/http-client/src/main/java/org/a2aproject/sdk/compat03/client/http/A2AHttpResponse_v0_3.java new file mode 100644 index 000000000..fe082648d --- /dev/null +++ b/compat-0.3/http-client/src/main/java/org/a2aproject/sdk/compat03/client/http/A2AHttpResponse_v0_3.java @@ -0,0 +1,9 @@ +package org.a2aproject.sdk.compat03.client.http; + +public interface A2AHttpResponse_v0_3 { + int status(); + + boolean success(); + + String body(); +} diff --git a/compat-0.3/http-client/src/main/java/org/a2aproject/sdk/compat03/client/http/JdkA2AHttpClient_v0_3.java b/compat-0.3/http-client/src/main/java/org/a2aproject/sdk/compat03/client/http/JdkA2AHttpClient_v0_3.java new file mode 100644 index 000000000..1a968059b --- /dev/null +++ b/compat-0.3/http-client/src/main/java/org/a2aproject/sdk/compat03/client/http/JdkA2AHttpClient_v0_3.java @@ -0,0 +1,316 @@ +package org.a2aproject.sdk.compat03.client.http; + +import static java.net.HttpURLConnection.HTTP_FORBIDDEN; +import static java.net.HttpURLConnection.HTTP_MULT_CHOICE; +import static java.net.HttpURLConnection.HTTP_OK; +import static java.net.HttpURLConnection.HTTP_UNAUTHORIZED; + +import java.io.IOException; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.net.http.HttpResponse.BodyHandler; +import java.net.http.HttpResponse.BodyHandlers; +import java.net.http.HttpResponse.BodySubscribers; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Flow; +import java.util.function.Consumer; +import org.jspecify.annotations.Nullable; + +import org.a2aproject.sdk.common.A2AErrorMessages; + +public class JdkA2AHttpClient_v0_3 implements A2AHttpClient_v0_3 { + + private final HttpClient httpClient; + + public JdkA2AHttpClient_v0_3() { + httpClient = HttpClient.newBuilder() + .version(HttpClient.Version.HTTP_2) + .followRedirects(HttpClient.Redirect.NORMAL) + .build(); + } + + @Override + public GetBuilder createGet() { + return new JdkGetBuilder(); + } + + @Override + public PostBuilder createPost() { + return new JdkPostBuilder(); + } + + @Override + public DeleteBuilder createDelete() { + return new JdkDeleteBuilder(); + } + + private abstract class JdkBuilder> implements Builder { + private String url = ""; + private Map headers = new HashMap<>(); + + @Override + public T url(String url) { + this.url = url; + return self(); + } + + @Override + public T addHeader(String name, String value) { + headers.put(name, value); + return self(); + } + + @Override + public T addHeaders(Map headers) { + if(headers != null && ! headers.isEmpty()) { + for (Map.Entry entry : headers.entrySet()) { + addHeader(entry.getKey(), entry.getValue()); + } + } + return self(); + } + + @SuppressWarnings("unchecked") + T self() { + return (T) this; + } + + protected HttpRequest.Builder createRequestBuilder() throws IOException { + HttpRequest.Builder builder = HttpRequest.newBuilder() + .uri(URI.create(url)); + for (Map.Entry headerEntry : headers.entrySet()) { + builder.header(headerEntry.getKey(), headerEntry.getValue()); + } + return builder; + } + + protected CompletableFuture asyncRequest( + HttpRequest request, + Consumer messageConsumer, + Consumer errorConsumer, + Runnable completeRunnable + ) { + Flow.Subscriber subscriber = new Flow.Subscriber() { + private Flow.@Nullable Subscription subscription; + private volatile boolean errorRaised = false; + + @Override + public void onSubscribe(Flow.Subscription subscription) { + this.subscription = subscription; + this.subscription.request(1); + } + + @Override + public void onNext(String item) { + // SSE messages sometimes start with "data:". Strip that off + if (item != null && item.startsWith("data:")) { + item = item.substring(5).trim(); + if (!item.isEmpty()) { + messageConsumer.accept(item); + } + } + if (subscription != null) { + subscription.request(1); + } + } + + @Override + public void onError(Throwable throwable) { + if (!errorRaised) { + errorRaised = true; + errorConsumer.accept(throwable); + } + if (subscription != null) { + subscription.cancel(); + } + } + + @Override + public void onComplete() { + if (!errorRaised) { + completeRunnable.run(); + } + if (subscription != null) { + subscription.cancel(); + } + } + }; + + // Create a custom body handler that checks status before processing body + BodyHandler bodyHandler = responseInfo -> { + // Check for authentication/authorization errors only + if (responseInfo.statusCode() == HTTP_UNAUTHORIZED || responseInfo.statusCode() == HTTP_FORBIDDEN) { + final String errorMessage; + if (responseInfo.statusCode() == HTTP_UNAUTHORIZED) { + errorMessage = A2AErrorMessages.AUTHENTICATION_FAILED; + } else { + errorMessage = A2AErrorMessages.AUTHORIZATION_FAILED; + } + // Return a body subscriber that immediately signals error + return BodySubscribers.fromSubscriber(new Flow.Subscriber>() { + @Override + public void onSubscribe(Flow.Subscription subscription) { + subscriber.onError(new IOException(errorMessage)); + } + + @Override + public void onNext(List item) { + // Should not be called + } + + @Override + public void onError(Throwable throwable) { + // Should not be called + } + + @Override + public void onComplete() { + // Should not be called + } + }); + } else { + // For all other status codes (including other errors), proceed with normal line subscriber + return BodyHandlers.fromLineSubscriber(subscriber).apply(responseInfo); + } + }; + + // Send the response async, and let the subscriber handle the lines. + return httpClient.sendAsync(request, bodyHandler) + .thenAccept(response -> { + // Handle non-authentication/non-authorization errors here + if (!isSuccessStatus(response.statusCode()) && + response.statusCode() != HTTP_UNAUTHORIZED && + response.statusCode() != HTTP_FORBIDDEN) { + subscriber.onError(new IOException("Request failed with status " + response.statusCode() + ":" + response.body())); + } + }) + .exceptionally(throwable -> { + // Handle network errors (timeouts, connection failures, etc.) + subscriber.onError(throwable); + return null; + }); + } + } + + private class JdkGetBuilder extends JdkBuilder implements A2AHttpClient_v0_3.GetBuilder { + + private HttpRequest.Builder createRequestBuilder(boolean SSE) throws IOException { + HttpRequest.Builder builder = super.createRequestBuilder().GET(); + if (SSE) { + builder.header("Accept", "text/event-stream"); + } + return builder; + } + + @Override + public A2AHttpResponse_v0_3 get() throws IOException, InterruptedException { + HttpRequest request = createRequestBuilder(false) + .build(); + HttpResponse response = + httpClient.send(request, BodyHandlers.ofString(StandardCharsets.UTF_8)); + return new JdkHttpResponse(response); + } + + @Override + public CompletableFuture getAsyncSSE( + Consumer messageConsumer, + Consumer errorConsumer, + Runnable completeRunnable) throws IOException, InterruptedException { + HttpRequest request = createRequestBuilder(true) + .build(); + return super.asyncRequest(request, messageConsumer, errorConsumer, completeRunnable); + } + + } + + private class JdkDeleteBuilder extends JdkBuilder implements A2AHttpClient_v0_3.DeleteBuilder { + + @Override + public A2AHttpResponse_v0_3 delete() throws IOException, InterruptedException { + HttpRequest request = super.createRequestBuilder().DELETE().build(); + HttpResponse response = + httpClient.send(request, BodyHandlers.ofString(StandardCharsets.UTF_8)); + return new JdkHttpResponse(response); + } + + } + + private class JdkPostBuilder extends JdkBuilder implements A2AHttpClient_v0_3.PostBuilder { + String body = ""; + + @Override + public PostBuilder body(String body) { + this.body = body; + return self(); + } + + private HttpRequest.Builder createRequestBuilder(boolean SSE) throws IOException { + HttpRequest.Builder builder = super.createRequestBuilder() + .POST(HttpRequest.BodyPublishers.ofString(body, StandardCharsets.UTF_8)); + if (SSE) { + builder.header("Accept", "text/event-stream"); + } + return builder; + } + + @Override + public A2AHttpResponse_v0_3 post() throws IOException, InterruptedException { + HttpRequest request = createRequestBuilder(false) + .POST(HttpRequest.BodyPublishers.ofString(body, StandardCharsets.UTF_8)) + .build(); + HttpResponse response = + httpClient.send(request, BodyHandlers.ofString(StandardCharsets.UTF_8)); + + if (response.statusCode() == HTTP_UNAUTHORIZED) { + throw new IOException(A2AErrorMessages.AUTHENTICATION_FAILED); + } else if (response.statusCode() == HTTP_FORBIDDEN) { + throw new IOException(A2AErrorMessages.AUTHORIZATION_FAILED); + } + + return new JdkHttpResponse(response); + } + + @Override + public CompletableFuture postAsyncSSE( + Consumer messageConsumer, + Consumer errorConsumer, + Runnable completeRunnable) throws IOException, InterruptedException { + HttpRequest request = createRequestBuilder(true) + .build(); + return super.asyncRequest(request, messageConsumer, errorConsumer, completeRunnable); + } + } + + private record JdkHttpResponse(HttpResponse response) implements A2AHttpResponse_v0_3 { + + @Override + public int status() { + return response.statusCode(); + } + + @Override + public boolean success() {// Send the request and get the response + return success(response); + } + + static boolean success(HttpResponse response) { + return response.statusCode() >= HTTP_OK && response.statusCode() < HTTP_MULT_CHOICE; + } + + @Override + public String body() { + return response.body(); + } + } + + private static boolean isSuccessStatus(int statusCode) { + return statusCode >= HTTP_OK && statusCode < HTTP_MULT_CHOICE; + } +} diff --git a/compat-0.3/http-client/src/main/java/org/a2aproject/sdk/compat03/client/http/package-info.java b/compat-0.3/http-client/src/main/java/org/a2aproject/sdk/compat03/client/http/package-info.java new file mode 100644 index 000000000..035bf5a62 --- /dev/null +++ b/compat-0.3/http-client/src/main/java/org/a2aproject/sdk/compat03/client/http/package-info.java @@ -0,0 +1,5 @@ +@NullMarked +package org.a2aproject.sdk.compat03.client.http; + +import org.jspecify.annotations.NullMarked; + diff --git a/compat-0.3/http-client/src/test/java/org/a2aproject/sdk/compat03/client/http/A2ACardResolver_v0_3_Test.java b/compat-0.3/http-client/src/test/java/org/a2aproject/sdk/compat03/client/http/A2ACardResolver_v0_3_Test.java new file mode 100644 index 000000000..f632d3e22 --- /dev/null +++ b/compat-0.3/http-client/src/test/java/org/a2aproject/sdk/compat03/client/http/A2ACardResolver_v0_3_Test.java @@ -0,0 +1,177 @@ +package org.a2aproject.sdk.compat03.client.http; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import java.util.function.Consumer; + +import org.a2aproject.sdk.compat03.json.JsonUtil_v0_3; +import org.a2aproject.sdk.compat03.spec.A2AClientError_v0_3; +import org.a2aproject.sdk.compat03.spec.A2AClientJSONError_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentCard_v0_3; +import java.util.Map; +import org.junit.jupiter.api.Test; + +public class A2ACardResolver_v0_3_Test { + + private static final String AGENT_CARD_PATH = "/.well-known/agent-card.json"; + + @Test + public void testConstructorStripsSlashes() throws Exception { + TestHttpClient client = new TestHttpClient(); + client.body = JsonMessages_v0_3.AGENT_CARD; + + A2ACardResolver_v0_3 resolver = new A2ACardResolver_v0_3(client, "http://example.com/"); + AgentCard_v0_3 card = resolver.getAgentCard(); + + assertEquals("http://example.com" + AGENT_CARD_PATH, client.url); + + + resolver = new A2ACardResolver_v0_3(client, "http://example.com"); + card = resolver.getAgentCard(); + + assertEquals("http://example.com" + AGENT_CARD_PATH, client.url); + + // baseUrl with trailing slash, agentCardParth with leading slash + resolver = new A2ACardResolver_v0_3(client, "http://example.com/", AGENT_CARD_PATH); + card = resolver.getAgentCard(); + + assertEquals("http://example.com" + AGENT_CARD_PATH, client.url); + + // baseUrl without trailing slash, agentCardPath with leading slash + resolver = new A2ACardResolver_v0_3(client, "http://example.com", AGENT_CARD_PATH); + card = resolver.getAgentCard(); + + assertEquals("http://example.com" + AGENT_CARD_PATH, client.url); + + // baseUrl with trailing slash, agentCardPath without leading slash + resolver = new A2ACardResolver_v0_3(client, "http://example.com/", AGENT_CARD_PATH.substring(1)); + card = resolver.getAgentCard(); + + assertEquals("http://example.com" + AGENT_CARD_PATH, client.url); + + // baseUrl without trailing slash, agentCardPath without leading slash + resolver = new A2ACardResolver_v0_3(client, "http://example.com", AGENT_CARD_PATH.substring(1)); + card = resolver.getAgentCard(); + + assertEquals("http://example.com" + AGENT_CARD_PATH, client.url); + } + + + @Test + public void testGetAgentCardSuccess() throws Exception { + TestHttpClient client = new TestHttpClient(); + client.body = JsonMessages_v0_3.AGENT_CARD; + + A2ACardResolver_v0_3 resolver = new A2ACardResolver_v0_3(client, "http://example.com/"); + AgentCard_v0_3 card = resolver.getAgentCard(); + + AgentCard_v0_3 expectedCard = JsonUtil_v0_3.fromJson(JsonMessages_v0_3.AGENT_CARD, AgentCard_v0_3.class); + String expected = JsonUtil_v0_3.toJson(expectedCard); + + String requestCardString = JsonUtil_v0_3.toJson(card); + assertEquals(expected, requestCardString); + } + + @Test + public void testGetAgentCardJsonDecodeError() throws Exception { + TestHttpClient client = new TestHttpClient(); + client.body = "X" + JsonMessages_v0_3.AGENT_CARD; + + A2ACardResolver_v0_3 resolver = new A2ACardResolver_v0_3(client, "http://example.com/"); + + boolean success = false; + try { + AgentCard_v0_3 card = resolver.getAgentCard(); + success = true; + } catch (A2AClientJSONError_v0_3 expected) { + } + assertFalse(success); + } + + + @Test + public void testGetAgentCardRequestError() throws Exception { + TestHttpClient client = new TestHttpClient(); + client.status = 503; + + A2ACardResolver_v0_3 resolver = new A2ACardResolver_v0_3(client, "http://example.com/"); + + String msg = null; + try { + AgentCard_v0_3 card = resolver.getAgentCard(); + } catch (A2AClientError_v0_3 expected) { + msg = expected.getMessage(); + } + assertTrue(msg.contains("503")); + } + + private static class TestHttpClient implements A2AHttpClient_v0_3 { + int status = 200; + String body; + String url; + + @Override + public GetBuilder createGet() { + return new TestGetBuilder(); + } + + @Override + public PostBuilder createPost() { + return null; + } + + @Override + public DeleteBuilder createDelete() { + return null; + } + + class TestGetBuilder implements A2AHttpClient_v0_3.GetBuilder { + + @Override + public A2AHttpResponse_v0_3 get() throws IOException, InterruptedException { + return new A2AHttpResponse_v0_3() { + @Override + public int status() { + return status; + } + + @Override + public boolean success() { + return status == 200; + } + + @Override + public String body() { + return body; + } + }; + } + + @Override + public CompletableFuture getAsyncSSE(Consumer messageConsumer, Consumer errorConsumer, Runnable completeRunnable) throws IOException, InterruptedException { + return null; + } + + @Override + public GetBuilder url(String s) { + url = s; + return this; + } + + @Override + public GetBuilder addHeader(String name, String value) { + return this; + } + + @Override + public GetBuilder addHeaders(Map headers) { + return this; + } + } + } + +} diff --git a/compat-0.3/http-client/src/test/java/org/a2aproject/sdk/compat03/client/http/JsonMessages_v0_3.java b/compat-0.3/http-client/src/test/java/org/a2aproject/sdk/compat03/client/http/JsonMessages_v0_3.java new file mode 100644 index 000000000..751dadf6c --- /dev/null +++ b/compat-0.3/http-client/src/test/java/org/a2aproject/sdk/compat03/client/http/JsonMessages_v0_3.java @@ -0,0 +1,164 @@ +package org.a2aproject.sdk.compat03.client.http; + +/** + * Request and response messages used by the tests. These have been created following examples from + * the A2A sample messages. + */ +public class JsonMessages_v0_3 { + + static final String AGENT_CARD = """ + { + "protocolVersion": "0.2.9", + "name": "GeoSpatial Route Planner Agent", + "description": "Provides advanced route planning, traffic analysis, and custom map generation services. This agent can calculate optimal routes, estimate travel times considering real-time traffic, and create personalized maps with points of interest.", + "url": "https://georoute-agent.example.com/a2a/v1", + "preferredTransport": "JSONRPC", + "additionalInterfaces" : [ + {"url": "https://georoute-agent.example.com/a2a/v1", "transport": "JSONRPC"}, + {"url": "https://georoute-agent.example.com/a2a/grpc", "transport": "GRPC"}, + {"url": "https://georoute-agent.example.com/a2a/json", "transport": "HTTP+JSON"} + ], + "provider": { + "organization": "Example Geo Services Inc.", + "url": "https://www.examplegeoservices.com" + }, + "iconUrl": "https://georoute-agent.example.com/icon.png", + "version": "1.2.0", + "documentationUrl": "https://docs.examplegeoservices.com/georoute-agent/api", + "capabilities": { + "streaming": true, + "pushNotifications": true, + "stateTransitionHistory": false + }, + "securitySchemes": { + "google": { + "type": "openIdConnect", + "openIdConnectUrl": "https://accounts.google.com/.well-known/openid-configuration" + } + }, + "security": [{ "google": ["openid", "profile", "email"] }], + "defaultInputModes": ["application/json", "text/plain"], + "defaultOutputModes": ["application/json", "image/png"], + "skills": [ + { + "id": "route-optimizer-traffic", + "name": "Traffic-Aware Route Optimizer", + "description": "Calculates the optimal driving route between two or more locations, taking into account real-time traffic conditions, road closures, and user preferences (e.g., avoid tolls, prefer highways).", + "tags": ["maps", "routing", "navigation", "directions", "traffic"], + "examples": [ + "Plan a route from '1600 Amphitheatre Parkway, Mountain View, CA' to 'San Francisco International Airport' avoiding tolls.", + "{\\"origin\\": {\\"lat\\": 37.422, \\"lng\\": -122.084}, \\"destination\\": {\\"lat\\": 37.7749, \\"lng\\": -122.4194}, \\"preferences\\": [\\"avoid_ferries\\"]}" + ], + "inputModes": ["application/json", "text/plain"], + "outputModes": [ + "application/json", + "application/vnd.geo+json", + "text/html" + ] + }, + { + "id": "custom-map-generator", + "name": "Personalized Map Generator", + "description": "Creates custom map images or interactive map views based on user-defined points of interest, routes, and style preferences. Can overlay data layers.", + "tags": ["maps", "customization", "visualization", "cartography"], + "examples": [ + "Generate a map of my upcoming road trip with all planned stops highlighted.", + "Show me a map visualizing all coffee shops within a 1-mile radius of my current location." + ], + "inputModes": ["application/json"], + "outputModes": [ + "image/png", + "image/jpeg", + "application/json", + "text/html" + ] + } + ], + "supportsAuthenticatedExtendedCard": true, + "signatures": [ + { + "protected": "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpPU0UiLCJraWQiOiJrZXktMSIsImprdSI6Imh0dHBzOi8vZXhhbXBsZS5jb20vYWdlbnQvandrcy5qc29uIn0", + "signature": "QFdkNLNszlGj3z3u0YQGt_T9LixY3qtdQpZmsTdDHDe3fXV9y9-B3m2-XgCpzuhiLt8E0tV6HXoZKHv4GtHgKQ" + } + ] + }"""; + + static final String AUTHENTICATION_EXTENDED_AGENT_CARD = """ + { + "name": "GeoSpatial Route Planner Agent Extended", + "description": "Extended description", + "url": "https://georoute-agent.example.com/a2a/v1", + "provider": { + "organization": "Example Geo Services Inc.", + "url": "https://www.examplegeoservices.com" + }, + "iconUrl": "https://georoute-agent.example.com/icon.png", + "version": "1.2.0", + "documentationUrl": "https://docs.examplegeoservices.com/georoute-agent/api", + "capabilities": { + "streaming": true, + "pushNotifications": true, + "stateTransitionHistory": false + }, + "securitySchemes": { + "google": { + "type": "openIdConnect", + "openIdConnectUrl": "https://accounts.google.com/.well-known/openid-configuration" + } + }, + "security": [{ "google": ["openid", "profile", "email"] }], + "defaultInputModes": ["application/json", "text/plain"], + "defaultOutputModes": ["application/json", "image/png"], + "skills": [ + { + "id": "route-optimizer-traffic", + "name": "Traffic-Aware Route Optimizer", + "description": "Calculates the optimal driving route between two or more locations, taking into account real-time traffic conditions, road closures, and user preferences (e.g., avoid tolls, prefer highways).", + "tags": ["maps", "routing", "navigation", "directions", "traffic"], + "examples": [ + "Plan a route from '1600 Amphitheatre Parkway, Mountain View, CA' to 'San Francisco International Airport' avoiding tolls.", + "{\\"origin\\": {\\"lat\\": 37.422, \\"lng\\": -122.084}, \\"destination\\": {\\"lat\\": 37.7749, \\"lng\\": -122.4194}, \\"preferences\\": [\\"avoid_ferries\\"]}" + ], + "inputModes": ["application/json", "text/plain"], + "outputModes": [ + "application/json", + "application/vnd.geo+json", + "text/html" + ] + }, + { + "id": "custom-map-generator", + "name": "Personalized Map Generator", + "description": "Creates custom map images or interactive map views based on user-defined points of interest, routes, and style preferences. Can overlay data layers.", + "tags": ["maps", "customization", "visualization", "cartography"], + "examples": [ + "Generate a map of my upcoming road trip with all planned stops highlighted.", + "Show me a map visualizing all coffee shops within a 1-mile radius of my current location." + ], + "inputModes": ["application/json"], + "outputModes": [ + "image/png", + "image/jpeg", + "application/json", + "text/html" + ] + }, + { + "id": "skill-extended", + "name": "Extended Skill", + "description": "This is an extended skill.", + "tags": ["extended"] + } + ], + "supportsAuthenticatedExtendedCard": true, + "protocolVersion": "0.2.9", + "signatures": [ + { + "protected": "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpPU0UiLCJraWQiOiJrZXktMSIsImprdSI6Imh0dHBzOi8vZXhhbXBsZS5jb20vYWdlbnQvandrcy5qc29uIn0", + "signature": "QFdkNLNszlGj3z3u0YQGt_T9LixY3qtdQpZmsTdDHDe3fXV9y9-B3m2-XgCpzuhiLt8E0tV6HXoZKHv4GtHgKQ" + } + ] + }"""; + + +} \ No newline at end of file diff --git a/compat-0.3/pom.xml b/compat-0.3/pom.xml new file mode 100644 index 000000000..9e7af13ae --- /dev/null +++ b/compat-0.3/pom.xml @@ -0,0 +1,148 @@ + + + 4.0.0 + + + org.a2aproject.sdk + a2a-java-sdk-parent + 1.0.0.Beta2-SNAPSHOT + + + a2a-java-sdk-compat-0.3-parent + pom + + Java SDK A2A Compat 0.3 Parent + A2A Protocol v0.3 backward compatibility layer for v1.0 SDK + + + + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec-grpc + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-http-client + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client-transport-spi + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client-transport-jsonrpc + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client-transport-grpc + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client-transport-rest + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-transport-jsonrpc + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-transport-grpc + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-transport-rest + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-reference-common + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-reference-jsonrpc + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-reference-grpc + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-reference-rest + ${project.version} + + + ${project.groupId} + a2a-compat-0.3-tck-server + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-server-conversion + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-server-conversion + test-jar + ${project.version} + + + + + + + spec + spec-grpc + + + http-client + + + server-conversion + + + client/base + client/transport/spi + client/transport/jsonrpc + client/transport/grpc + client/transport/rest + + + transport/jsonrpc + transport/grpc + transport/rest + + + reference/jsonrpc + reference/grpc + reference/rest + + + tck + + + diff --git a/compat-0.3/reference/grpc/pom.xml b/compat-0.3/reference/grpc/pom.xml new file mode 100644 index 000000000..356a1f0f8 --- /dev/null +++ b/compat-0.3/reference/grpc/pom.xml @@ -0,0 +1,114 @@ + + + 4.0.0 + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-parent + 1.0.0.Beta2-SNAPSHOT + ../../pom.xml + + + a2a-java-sdk-compat-0.3-reference-grpc + Java A2A Compat 0.3 Reference Server: gRPC + Java SDK for the Agent2Agent Protocol (A2A) - A2A gRPC Reference Server (based on Quarkus) + + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec-grpc + + + ${project.groupId} + a2a-java-sdk-common + + + ${project.groupId} + a2a-java-sdk-compat-0.3-transport-grpc + + + ${project.groupId} + a2a-java-sdk-server-common + + + ${project.groupId} + a2a-java-sdk-spec-grpc + + + + + + ${project.groupId} + a2a-java-sdk-compat-0.3-server-conversion + test-jar + test + + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client + test + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client-transport-grpc + test + + + + io.quarkus + quarkus-grpc + + + io.quarkus + quarkus-rest + test + + + io.quarkus + quarkus-junit5 + test + + + org.assertj + assertj-core + 3.25.3 + test + + + com.google.api.grpc + proto-google-common-protos + + + com.google.protobuf + protobuf-java + + + io.grpc + grpc-protobuf + + + io.grpc + grpc-stub + + + io.rest-assured + rest-assured + test + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + + \ No newline at end of file diff --git a/compat-0.3/reference/grpc/src/main/java/org/a2aproject/sdk/compat03/server/grpc/quarkus/A2AExtensionsInterceptor_v0_3.java b/compat-0.3/reference/grpc/src/main/java/org/a2aproject/sdk/compat03/server/grpc/quarkus/A2AExtensionsInterceptor_v0_3.java new file mode 100644 index 000000000..5d3ae805c --- /dev/null +++ b/compat-0.3/reference/grpc/src/main/java/org/a2aproject/sdk/compat03/server/grpc/quarkus/A2AExtensionsInterceptor_v0_3.java @@ -0,0 +1,70 @@ +package org.a2aproject.sdk.compat03.server.grpc.quarkus; + +import jakarta.enterprise.context.ApplicationScoped; +import io.grpc.Context; +import io.grpc.Contexts; +import io.grpc.Metadata; +import io.grpc.ServerCall; +import io.grpc.ServerCallHandler; +import io.grpc.ServerInterceptor; +import org.a2aproject.sdk.compat03.common.A2AHeaders_v0_3; +import org.a2aproject.sdk.compat03.transport.grpc.context.GrpcContextKeys_v0_3; + +/** + * gRPC server interceptor that captures request metadata and context information, + * providing equivalent functionality to Python's grpc.aio.ServicerContext. + * + * This interceptor: + * - Extracts A2A extension headers from incoming requests + * - Captures ServerCall and Metadata for rich context access + * - Stores context information in gRPC Context for service method access + * - Provides proper equivalence to Python's ServicerContext + */ +@ApplicationScoped +public class A2AExtensionsInterceptor_v0_3 implements ServerInterceptor { + + + @Override + public ServerCall.Listener interceptCall( + ServerCall serverCall, + Metadata metadata, + ServerCallHandler serverCallHandler) { + + // Extract A2A extensions header + Metadata.Key extensionsKey = + Metadata.Key.of(A2AHeaders_v0_3.X_A2A_EXTENSIONS, Metadata.ASCII_STRING_MARSHALLER); + String extensions = metadata.get(extensionsKey); + + // Create enhanced context with rich information (equivalent to Python's ServicerContext) + Context context = Context.current() + // Store complete metadata for full header access + .withValue(GrpcContextKeys_v0_3.METADATA_KEY, metadata) + // Store method name (equivalent to Python's context.method()) + .withValue(GrpcContextKeys_v0_3.METHOD_NAME_KEY, serverCall.getMethodDescriptor().getFullMethodName()) + // Store peer information for client connection details + .withValue(GrpcContextKeys_v0_3.PEER_INFO_KEY, getPeerInfo(serverCall)); + + // Store A2A extensions if present + if (extensions != null) { + context = context.withValue(GrpcContextKeys_v0_3.EXTENSIONS_HEADER_KEY, extensions); + } + + // Proceed with the call in the enhanced context + return Contexts.interceptCall(context, serverCall, metadata, serverCallHandler); + } + + /** + * Safely extracts peer information from the ServerCall. + * + * @param serverCall the gRPC ServerCall + * @return peer information string, or "unknown" if not available + */ + private String getPeerInfo(ServerCall serverCall) { + try { + Object remoteAddr = serverCall.getAttributes().get(io.grpc.Grpc.TRANSPORT_ATTR_REMOTE_ADDR); + return remoteAddr != null ? remoteAddr.toString() : "unknown"; + } catch (Exception e) { + return "unknown"; + } + } +} diff --git a/compat-0.3/reference/grpc/src/main/java/org/a2aproject/sdk/compat03/server/grpc/quarkus/QuarkusGrpcHandler_v0_3.java b/compat-0.3/reference/grpc/src/main/java/org/a2aproject/sdk/compat03/server/grpc/quarkus/QuarkusGrpcHandler_v0_3.java new file mode 100644 index 000000000..bd9c7b890 --- /dev/null +++ b/compat-0.3/reference/grpc/src/main/java/org/a2aproject/sdk/compat03/server/grpc/quarkus/QuarkusGrpcHandler_v0_3.java @@ -0,0 +1,52 @@ +package org.a2aproject.sdk.compat03.server.grpc.quarkus; + +import java.util.concurrent.Executor; + +import jakarta.enterprise.inject.Instance; +import jakarta.inject.Inject; + +import io.quarkus.grpc.GrpcService; +import io.quarkus.grpc.RegisterInterceptor; +import io.quarkus.security.Authenticated; +import org.a2aproject.sdk.compat03.conversion.Convert_v0_3_To10RequestHandler; +import org.a2aproject.sdk.compat03.spec.AgentCard_v0_3; +import org.a2aproject.sdk.compat03.transport.grpc.handler.CallContextFactory_v0_3; +import org.a2aproject.sdk.compat03.transport.grpc.handler.GrpcHandler_v0_3; +import org.a2aproject.sdk.server.PublicAgentCard; +import org.a2aproject.sdk.server.util.async.Internal; + +@GrpcService +@RegisterInterceptor(A2AExtensionsInterceptor_v0_3.class) +@Authenticated +public class QuarkusGrpcHandler_v0_3 extends GrpcHandler_v0_3 { + + private final AgentCard_v0_3 agentCard; + private final Instance callContextFactoryInstance; + private final Executor executor; + + @Inject + public QuarkusGrpcHandler_v0_3(@PublicAgentCard AgentCard_v0_3 agentCard, + Convert_v0_3_To10RequestHandler requestHandler, + Instance callContextFactoryInstance, + @Internal Executor executor) { + this.agentCard = agentCard; + this.callContextFactoryInstance = callContextFactoryInstance; + this.executor = executor; + setRequestHandler(requestHandler); + } + + @Override + protected AgentCard_v0_3 getAgentCard() { + return agentCard; + } + + @Override + protected CallContextFactory_v0_3 getCallContextFactory() { + return callContextFactoryInstance.isUnsatisfied() ? null : callContextFactoryInstance.get(); + } + + @Override + protected Executor getExecutor() { + return executor; + } +} diff --git a/compat-0.3/reference/grpc/src/main/java/org/a2aproject/sdk/compat03/server/grpc/quarkus/QuarkusGrpcTransportMetadata_v0_3.java b/compat-0.3/reference/grpc/src/main/java/org/a2aproject/sdk/compat03/server/grpc/quarkus/QuarkusGrpcTransportMetadata_v0_3.java new file mode 100644 index 000000000..5cb9d813a --- /dev/null +++ b/compat-0.3/reference/grpc/src/main/java/org/a2aproject/sdk/compat03/server/grpc/quarkus/QuarkusGrpcTransportMetadata_v0_3.java @@ -0,0 +1,11 @@ +package org.a2aproject.sdk.compat03.server.grpc.quarkus; + +import org.a2aproject.sdk.server.TransportMetadata; +import org.a2aproject.sdk.compat03.spec.TransportProtocol_v0_3; + +public class QuarkusGrpcTransportMetadata_v0_3 implements TransportMetadata { + @Override + public String getTransportProtocol() { + return TransportProtocol_v0_3.GRPC.asString(); + } +} diff --git a/compat-0.3/reference/grpc/src/main/resources/META-INF/beans.xml b/compat-0.3/reference/grpc/src/main/resources/META-INF/beans.xml new file mode 100644 index 000000000..e69de29bb diff --git a/compat-0.3/reference/grpc/src/main/resources/META-INF/services/org.a2aproject.sdk.server.TransportMetadata b/compat-0.3/reference/grpc/src/main/resources/META-INF/services/org.a2aproject.sdk.server.TransportMetadata new file mode 100644 index 000000000..751bdcfdb --- /dev/null +++ b/compat-0.3/reference/grpc/src/main/resources/META-INF/services/org.a2aproject.sdk.server.TransportMetadata @@ -0,0 +1 @@ +org.a2aproject.sdk.compat03.server.grpc.quarkus.QuarkusGrpcTransportMetadata_v0_3 diff --git a/compat-0.3/reference/grpc/src/test/java/org/a2aproject/sdk/compat03/server/grpc/quarkus/A2ATestResource_v0_3.java b/compat-0.3/reference/grpc/src/test/java/org/a2aproject/sdk/compat03/server/grpc/quarkus/A2ATestResource_v0_3.java new file mode 100644 index 000000000..971d09afe --- /dev/null +++ b/compat-0.3/reference/grpc/src/test/java/org/a2aproject/sdk/compat03/server/grpc/quarkus/A2ATestResource_v0_3.java @@ -0,0 +1,144 @@ +package org.a2aproject.sdk.compat03.server.grpc.quarkus; + +import static jakarta.ws.rs.core.MediaType.TEXT_PLAIN; + +import java.util.concurrent.atomic.AtomicInteger; + +import jakarta.annotation.PostConstruct; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.HttpHeaders; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; + +import org.a2aproject.sdk.compat03.conversion.TestUtilsBean_v0_3; +import org.a2aproject.sdk.jsonrpc.common.json.JsonUtil; +import org.a2aproject.sdk.spec.Task; +import org.a2aproject.sdk.spec.TaskArtifactUpdateEvent; +import org.a2aproject.sdk.spec.TaskPushNotificationConfig; +import org.a2aproject.sdk.spec.TaskStatusUpdateEvent; +import org.a2aproject.sdk.compat03.transport.grpc.handler.GrpcHandler_v0_3; + +/** + * Exposes the {@link TestUtilsBean_v0_3} via JAX-RS REST endpoints for testing the gRPC server. + * Uses JAX-RS instead of Reactive Routes because gRPC servers typically expose REST test utilities separately. + */ +@Path("/test") +@ApplicationScoped +public class A2ATestResource_v0_3 { + @Inject + TestUtilsBean_v0_3 testUtilsBean; + + private final AtomicInteger streamingSubscribedCount = new AtomicInteger(0); + + @PostConstruct + public void init() { + GrpcHandler_v0_3.setStreamingSubscribedRunnable(streamingSubscribedCount::incrementAndGet); + } + + + @POST + @Path("/task") + @Consumes(MediaType.APPLICATION_JSON) + public Response saveTask(String body) throws Exception { + Task task = JsonUtil.fromJson(body, Task.class); + testUtilsBean.saveTask(task); + return Response.ok().build(); + } + + @GET + @Path("/task/{taskId}") + public Response getTask(@PathParam("taskId") String taskId) throws Exception { + Task task = testUtilsBean.getTask(taskId); + if (task == null) { + return Response.status(404).build(); + } + return Response.ok() + .entity(JsonUtil.toJson(task)) + .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .build(); + } + + @DELETE + @Path("/task/{taskId}") + public Response deleteTask(@PathParam("taskId") String taskId) { + Task task = testUtilsBean.getTask(taskId); + if (task == null) { + return Response.status(404).build(); + } + testUtilsBean.deleteTask(taskId); + return Response.ok() + .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .build(); + } + + @POST + @Path("/queue/ensure/{taskId}") + public Response ensureQueue(@PathParam("taskId") String taskId) { + testUtilsBean.ensureQueue(taskId); + return Response.ok().build(); + } + + @POST + @Path("/queue/enqueueTaskStatusUpdateEvent/{taskId}") + public Response enqueueTaskStatusUpdateEvent(@PathParam("taskId") String taskId, String body) throws Exception { + TaskStatusUpdateEvent event = JsonUtil.fromJson(body, TaskStatusUpdateEvent.class); + testUtilsBean.enqueueEvent(taskId, event); + return Response.ok().build(); + } + + @POST + @Path("/queue/enqueueTaskArtifactUpdateEvent/{taskId}") + public Response enqueueTaskArtifactUpdateEvent(@PathParam("taskId") String taskId, String body) throws Exception { + TaskArtifactUpdateEvent event = JsonUtil.fromJson(body, TaskArtifactUpdateEvent.class); + testUtilsBean.enqueueEvent(taskId, event); + return Response.ok().build(); + } + + @GET + @Path("/streamingSubscribedCount") + @Produces(TEXT_PLAIN) + public Response getStreamingSubscribedCount() { + return Response.ok(String.valueOf(streamingSubscribedCount.get()), TEXT_PLAIN).build(); + } + + @GET + @Path("/queue/childCount/{taskId}") + @Produces(TEXT_PLAIN) + public Response getChildQueueCount(@PathParam("taskId") String taskId) { + int count = testUtilsBean.getChildQueueCount(taskId); + return Response.ok(String.valueOf(count), TEXT_PLAIN).build(); + } + + @DELETE + @Path("/task/{taskId}/config/{configId}") + public Response deleteTaskPushNotificationConfig(@PathParam("taskId") String taskId, @PathParam("configId") String configId) { + Task task = testUtilsBean.getTask(taskId); + if (task == null) { + return Response.status(404).build(); + } + testUtilsBean.deleteTaskPushNotificationConfig(taskId, configId); + return Response.ok() + .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .build(); + } + + @POST + @Path("/task/{taskId}") + @Consumes(MediaType.APPLICATION_JSON) + public Response savePushNotificationConfigInStore(@PathParam("taskId") String taskId, String body) throws Exception { + TaskPushNotificationConfig notificationConfig = JsonUtil.fromJson(body, TaskPushNotificationConfig.class); + if (notificationConfig == null) { + return Response.status(404).build(); + } + testUtilsBean.saveTaskPushNotificationConfig(taskId, notificationConfig); + return Response.ok().build(); + } +} diff --git a/compat-0.3/reference/grpc/src/test/java/org/a2aproject/sdk/compat03/server/grpc/quarkus/QuarkusA2AGrpc_v0_3_Test.java b/compat-0.3/reference/grpc/src/test/java/org/a2aproject/sdk/compat03/server/grpc/quarkus/QuarkusA2AGrpc_v0_3_Test.java new file mode 100644 index 000000000..c5e362c6b --- /dev/null +++ b/compat-0.3/reference/grpc/src/test/java/org/a2aproject/sdk/compat03/server/grpc/quarkus/QuarkusA2AGrpc_v0_3_Test.java @@ -0,0 +1,55 @@ +package org.a2aproject.sdk.compat03.server.grpc.quarkus; + +import java.util.concurrent.TimeUnit; + +import org.a2aproject.sdk.compat03.client.ClientBuilder_v0_3; +import org.a2aproject.sdk.compat03.client.transport.grpc.GrpcTransport_v0_3; +import org.a2aproject.sdk.compat03.client.transport.grpc.GrpcTransportConfigBuilder_v0_3; +import org.a2aproject.sdk.compat03.conversion.AbstractA2AServerServerTest_v0_3; +import org.a2aproject.sdk.compat03.spec.TransportProtocol_v0_3; +import io.grpc.ManagedChannel; +import io.grpc.ManagedChannelBuilder; +import io.quarkus.test.junit.QuarkusTest; + +import org.junit.jupiter.api.AfterAll; + +@QuarkusTest +public class QuarkusA2AGrpc_v0_3_Test extends AbstractA2AServerServerTest_v0_3 { + + private static ManagedChannel channel; + + public QuarkusA2AGrpc_v0_3_Test() { + super(8081); // HTTP server port for utility endpoints + } + + @Override + protected String getTransportProtocol() { + return TransportProtocol_v0_3.GRPC.asString(); + } + + @Override + protected String getTransportUrl() { + // gRPC server runs on port 8081, which is the same port as the main web server. + return "localhost:8081"; + } + + @Override + protected void configureTransport(ClientBuilder_v0_3 builder) { + builder.withTransport(GrpcTransport_v0_3.class, new GrpcTransportConfigBuilder_v0_3().channelFactory(target -> { + channel = ManagedChannelBuilder.forTarget(target).usePlaintext().build(); + return channel; + })); + } + + @AfterAll + public static void closeChannel() { + if (channel != null) { + channel.shutdownNow(); + try { + channel.awaitTermination(10, TimeUnit.SECONDS); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + } + } +} diff --git a/compat-0.3/reference/grpc/src/test/resources/application.properties b/compat-0.3/reference/grpc/src/test/resources/application.properties new file mode 100644 index 000000000..8ec9e2967 --- /dev/null +++ b/compat-0.3/reference/grpc/src/test/resources/application.properties @@ -0,0 +1,27 @@ +# gRPC server configuration - use main HTTP port (not separate port) +quarkus.grpc.server.use-separate-server=false + +# HTTP server port for tests +quarkus.http.port=8081 +quarkus.http.test-port=8081 + +# Index dependencies for CDI bean discovery +quarkus.index-dependency.server-conversion.group-id=org.a2aproject.sdk +quarkus.index-dependency.server-conversion.artifact-id=a2a-java-sdk-compat-0.3-server-conversion +quarkus.index-dependency.server-conversion.classifier=tests + +# Index v1.0 server-common for InMemoryTaskStore, DefaultRequestHandler, etc. +quarkus.index-dependency.server-common.group-id=org.a2aproject.sdk +quarkus.index-dependency.server-common.artifact-id=a2a-java-sdk-server-common + +# Index compat-0.3 transport-grpc for GrpcHandler +quarkus.index-dependency.transport-grpc.group-id=org.a2aproject.sdk +quarkus.index-dependency.transport-grpc.artifact-id=a2a-java-sdk-compat-0.3-transport-grpc + +# Use test HTTP client from v0.3 compat test infrastructure +quarkus.arc.selected-alternatives=org.a2aproject.sdk.compat03.conversion.TestHttpClient_v0_3 + +# Debug logging for event processing and request handling +quarkus.log.category."org.a2aproject.sdk.server.events".level=DEBUG +quarkus.log.category."org.a2aproject.sdk.server.requesthandlers".level=DEBUG +quarkus.log.category."org.a2aproject.sdk.server.tasks".level=DEBUG diff --git a/compat-0.3/reference/grpc/src/test/resources/compat-0.3-requesthandler-test.properties b/compat-0.3/reference/grpc/src/test/resources/compat-0.3-requesthandler-test.properties new file mode 100644 index 000000000..941770fb9 --- /dev/null +++ b/compat-0.3/reference/grpc/src/test/resources/compat-0.3-requesthandler-test.properties @@ -0,0 +1 @@ +preferred-transport=grpc diff --git a/compat-0.3/reference/jsonrpc/pom.xml b/compat-0.3/reference/jsonrpc/pom.xml new file mode 100644 index 000000000..4bbd63ef4 --- /dev/null +++ b/compat-0.3/reference/jsonrpc/pom.xml @@ -0,0 +1,107 @@ + + + 4.0.0 + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-parent + 1.0.0.Beta2-SNAPSHOT + ../../pom.xml + + a2a-java-sdk-compat-0.3-reference-jsonrpc + + jar + + Java A2A Compat 0.3 Reference Server: JSONRPC + Java SDK for the Agent2Agent Protocol (A2A) - A2A JSONRPC Reference Server (based on Quarkus) + + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec + + + ${project.groupId} + a2a-java-sdk-compat-0.3-transport-jsonrpc + + + ${project.groupId} + a2a-java-sdk-server-common + + + + ${project.groupId} + a2a-java-sdk-compat-0.3-server-conversion + test-jar + test + + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client + test + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client-transport-jsonrpc + test + + + io.quarkus + quarkus-reactive-routes + + + jakarta.enterprise + jakarta.enterprise.cdi-api + + + jakarta.inject + jakarta.inject-api + + + org.slf4j + slf4j-api + + + io.quarkus + quarkus-junit5 + test + + + io.quarkus + quarkus-rest-client-jackson + test + + + org.junit.jupiter + junit-jupiter-api + test + + + io.rest-assured + rest-assured + test + + + org.mockito + mockito-core + test + + + org.mockito + mockito-junit-jupiter + test + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + + diff --git a/compat-0.3/reference/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/server/apps/quarkus/A2AServerRoutes_v0_3.java b/compat-0.3/reference/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/server/apps/quarkus/A2AServerRoutes_v0_3.java new file mode 100644 index 000000000..e7fff4e8e --- /dev/null +++ b/compat-0.3/reference/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/server/apps/quarkus/A2AServerRoutes_v0_3.java @@ -0,0 +1,390 @@ +package org.a2aproject.sdk.compat03.server.apps.quarkus; + +import static io.vertx.core.http.HttpHeaders.CONTENT_TYPE; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.MediaType.SERVER_SENT_EVENTS; +import static org.a2aproject.sdk.compat03.transport.jsonrpc.context.JSONRPCContextKeys_v0_3.HEADERS_KEY; +import static org.a2aproject.sdk.compat03.transport.jsonrpc.context.JSONRPCContextKeys_v0_3.METHOD_NAME_KEY; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.Executor; +import java.util.concurrent.Flow; +import java.util.concurrent.atomic.AtomicLong; +import java.util.function.Function; + +import jakarta.enterprise.inject.Instance; +import jakarta.inject.Inject; +import jakarta.inject.Singleton; + +import com.google.gson.JsonParser; +import com.google.gson.JsonSyntaxException; +import io.quarkus.security.Authenticated; +import io.quarkus.vertx.web.Body; +import io.quarkus.vertx.web.ReactiveRoutes; +import io.quarkus.vertx.web.Route; +import io.smallrye.mutiny.Multi; +import io.vertx.core.AsyncResult; +import io.vertx.core.Handler; +import io.vertx.core.MultiMap; +import io.vertx.core.buffer.Buffer; +import io.vertx.core.http.HttpServerResponse; +import io.vertx.ext.web.RoutingContext; +import org.a2aproject.sdk.compat03.common.A2AHeaders_v0_3; +import org.a2aproject.sdk.compat03.json.JsonProcessingException_v0_3; +import org.a2aproject.sdk.compat03.json.JsonUtil_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentCard_v0_3; +import org.a2aproject.sdk.compat03.spec.CancelTaskRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.GetAuthenticatedExtendedCardRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.GetTaskRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.InternalError_v0_3; +import org.a2aproject.sdk.compat03.spec.InvalidParamsError_v0_3; +import org.a2aproject.sdk.compat03.spec.InvalidRequestError_v0_3; +import org.a2aproject.sdk.compat03.spec.JSONParseError_v0_3; +import org.a2aproject.sdk.compat03.spec.JSONRPCError_v0_3; +import org.a2aproject.sdk.compat03.spec.JSONRPCErrorResponse_v0_3; +import org.a2aproject.sdk.compat03.spec.JSONRPCMessage_v0_3; +import org.a2aproject.sdk.compat03.spec.JSONRPCRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.JSONRPCResponse_v0_3; +import org.a2aproject.sdk.compat03.spec.ListTaskPushNotificationConfigRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.MethodNotFoundError_v0_3; +import org.a2aproject.sdk.compat03.spec.NonStreamingJSONRPCRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.SendMessageRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.SendStreamingMessageRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.SetTaskPushNotificationConfigRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.StreamingJSONRPCRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskResubscriptionRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.UnsupportedOperationError_v0_3; +import org.a2aproject.sdk.compat03.transport.jsonrpc.handler.JSONRPCHandler_v0_3; +import org.a2aproject.sdk.compat03.util.Utils_v0_3; +import org.a2aproject.sdk.server.ServerCallContext; +import org.a2aproject.sdk.server.auth.UnauthenticatedUser; +import org.a2aproject.sdk.server.auth.User; +import org.a2aproject.sdk.server.extensions.A2AExtensions; +import org.a2aproject.sdk.server.util.async.Internal; + +@Singleton +public class A2AServerRoutes_v0_3 { + + @Inject + JSONRPCHandler_v0_3 jsonRpcHandler; + + // Hook so testing can wait until the MultiSseSupport is subscribed. + // Without this we get intermittent failures + private static volatile Runnable streamingMultiSseSupportSubscribedRunnable; + + @Inject + @Internal + Executor executor; + + @Inject + Instance callContextFactory; + + @Route(path = "/", methods = {Route.HttpMethod.POST}, consumes = {APPLICATION_JSON}, type = Route.HandlerType.BLOCKING) + @Authenticated + public void invokeJSONRPCHandler(@Body String body, RoutingContext rc) { + boolean streaming = false; + ServerCallContext context = createCallContext(rc); + JSONRPCResponse_v0_3 nonStreamingResponse = null; + Multi> streamingResponse = null; + JSONRPCErrorResponse_v0_3 error = null; + Object requestId = null; + try { + com.google.gson.JsonObject node; + try { + node = JsonParser.parseString(body).getAsJsonObject(); + } catch (Exception e) { + throw new JSONParseError_v0_3(e.getMessage()); + } + + // Extract id field early so error responses can include it + com.google.gson.JsonElement idElement = node.get("id"); + if (idElement != null && !idElement.isJsonNull() && !idElement.isJsonPrimitive()) { + throw new InvalidRequestError_v0_3("Invalid JSON-RPC request: 'id' must be a string, number, or null"); + } + if (idElement != null && !idElement.isJsonNull() && idElement.isJsonPrimitive()) { + com.google.gson.JsonPrimitive idPrimitive = idElement.getAsJsonPrimitive(); + requestId = idPrimitive.isNumber() ? idPrimitive.getAsLong() : idPrimitive.getAsString(); + } + + // Validate jsonrpc field + com.google.gson.JsonElement jsonrpcElement = node.get("jsonrpc"); + if (jsonrpcElement == null || !jsonrpcElement.isJsonPrimitive() + || !JSONRPCMessage_v0_3.JSONRPC_VERSION.equals(jsonrpcElement.getAsString())) { + throw new InvalidRequestError_v0_3("Invalid JSON-RPC request: missing or invalid 'jsonrpc' field"); + } + + // Validate method field + com.google.gson.JsonElement methodElement = node.get("method"); + if (methodElement == null || !methodElement.isJsonPrimitive()) { + throw new InvalidRequestError_v0_3("Invalid JSON-RPC request: missing or invalid 'method' field"); + } + + String methodName = methodElement.getAsString(); + context.getState().put(METHOD_NAME_KEY, methodName); + + streaming = SendStreamingMessageRequest_v0_3.METHOD.equals(methodName) + || TaskResubscriptionRequest_v0_3.METHOD.equals(methodName); + + if (streaming) { + StreamingJSONRPCRequest_v0_3 request = deserializeStreamingRequest(body, methodName); + streamingResponse = processStreamingRequest(request, context); + } else { + NonStreamingJSONRPCRequest_v0_3 request = deserializeNonStreamingRequest(body, methodName); + nonStreamingResponse = processNonStreamingRequest(request, context); + } + } catch (JSONRPCError_v0_3 e) { + error = new JSONRPCErrorResponse_v0_3(requestId, e); + } catch (JsonSyntaxException e) { + error = new JSONRPCErrorResponse_v0_3(requestId, new JSONParseError_v0_3(e.getMessage())); + } catch (Throwable t) { + error = new JSONRPCErrorResponse_v0_3(requestId, new InternalError_v0_3(t.getMessage())); + } finally { + if (error != null) { + rc.response() + .setStatusCode(200) + .putHeader(CONTENT_TYPE, APPLICATION_JSON) + .end(Utils_v0_3.toJsonString(error)); + } else if (streaming) { + final Multi> finalStreamingResponse = streamingResponse; + executor.execute(() -> { + MultiSseSupport.subscribeObject( + finalStreamingResponse.map(i -> (Object) i), rc); + }); + + } else { + rc.response() + .setStatusCode(200) + .putHeader(CONTENT_TYPE, APPLICATION_JSON) + .end(Utils_v0_3.toJsonString(nonStreamingResponse)); + } + } + } + + /** + * /** + * Handles incoming GET requests to the agent card endpoint. + * Returns the agent card in JSON format. + * + * @return the agent card + * @throws JsonProcessingException_v0_3 if serialization fails + */ + @Route(path = "/.well-known/agent-card.json", methods = Route.HttpMethod.GET, produces = APPLICATION_JSON) + public String getAgentCard() throws JsonProcessingException_v0_3 { + return JsonUtil_v0_3.toJson(jsonRpcHandler.getAgentCard()); + } + + private NonStreamingJSONRPCRequest_v0_3 deserializeNonStreamingRequest(String body, String methodName) { + try { + return switch (methodName) { + case GetTaskRequest_v0_3.METHOD -> JsonUtil_v0_3.fromJson(body, GetTaskRequest_v0_3.class); + case CancelTaskRequest_v0_3.METHOD -> JsonUtil_v0_3.fromJson(body, CancelTaskRequest_v0_3.class); + case SendMessageRequest_v0_3.METHOD -> JsonUtil_v0_3.fromJson(body, SendMessageRequest_v0_3.class); + case SetTaskPushNotificationConfigRequest_v0_3.METHOD -> JsonUtil_v0_3.fromJson(body, SetTaskPushNotificationConfigRequest_v0_3.class); + case GetTaskPushNotificationConfigRequest_v0_3.METHOD -> JsonUtil_v0_3.fromJson(body, GetTaskPushNotificationConfigRequest_v0_3.class); + case ListTaskPushNotificationConfigRequest_v0_3.METHOD -> JsonUtil_v0_3.fromJson(body, ListTaskPushNotificationConfigRequest_v0_3.class); + case DeleteTaskPushNotificationConfigRequest_v0_3.METHOD -> JsonUtil_v0_3.fromJson(body, DeleteTaskPushNotificationConfigRequest_v0_3.class); + case GetAuthenticatedExtendedCardRequest_v0_3.METHOD -> JsonUtil_v0_3.fromJson(body, GetAuthenticatedExtendedCardRequest_v0_3.class); + default -> throw new MethodNotFoundError_v0_3(); + }; + } catch (JSONRPCError_v0_3 e) { + throw e; + } catch (Exception e) { + throw new InvalidParamsError_v0_3(e.getMessage()); + } + } + + private StreamingJSONRPCRequest_v0_3 deserializeStreamingRequest(String body, String methodName) { + try { + return switch (methodName) { + case SendStreamingMessageRequest_v0_3.METHOD -> JsonUtil_v0_3.fromJson(body, SendStreamingMessageRequest_v0_3.class); + case TaskResubscriptionRequest_v0_3.METHOD -> JsonUtil_v0_3.fromJson(body, TaskResubscriptionRequest_v0_3.class); + default -> throw new MethodNotFoundError_v0_3(); + }; + } catch (JSONRPCError_v0_3 e) { + throw e; + } catch (Exception e) { + throw new InvalidParamsError_v0_3(e.getMessage()); + } + } + + private JSONRPCResponse_v0_3 processNonStreamingRequest( + NonStreamingJSONRPCRequest_v0_3 request, ServerCallContext context) { + if (request instanceof GetTaskRequest_v0_3 req) { + return jsonRpcHandler.onGetTask(req, context); + } else if (request instanceof CancelTaskRequest_v0_3 req) { + return jsonRpcHandler.onCancelTask(req, context); + } else if (request instanceof SetTaskPushNotificationConfigRequest_v0_3 req) { + return jsonRpcHandler.setPushNotificationConfig(req, context); + } else if (request instanceof GetTaskPushNotificationConfigRequest_v0_3 req) { + return jsonRpcHandler.getPushNotificationConfig(req, context); + } else if (request instanceof SendMessageRequest_v0_3 req) { + return jsonRpcHandler.onMessageSend(req, context); + } else if (request instanceof ListTaskPushNotificationConfigRequest_v0_3 req) { + return jsonRpcHandler.listPushNotificationConfig(req, context); + } else if (request instanceof DeleteTaskPushNotificationConfigRequest_v0_3 req) { + return jsonRpcHandler.deletePushNotificationConfig(req, context); + } else if (request instanceof GetAuthenticatedExtendedCardRequest_v0_3 req) { + return jsonRpcHandler.onGetAuthenticatedExtendedCardRequest(req, context); + } else { + return generateErrorResponse(request, new UnsupportedOperationError_v0_3()); + } + } + + private Multi> processStreamingRequest( + JSONRPCRequest_v0_3 request, ServerCallContext context) { + Flow.Publisher> publisher; + if (request instanceof SendStreamingMessageRequest_v0_3 req) { + publisher = jsonRpcHandler.onMessageSendStream(req, context); + } else if (request instanceof TaskResubscriptionRequest_v0_3 req) { + publisher = jsonRpcHandler.onResubscribeToTask(req, context); + } else { + return Multi.createFrom().item(generateErrorResponse(request, new UnsupportedOperationError_v0_3())); + } + return Multi.createFrom().publisher(publisher); + } + + private JSONRPCResponse_v0_3 generateErrorResponse(JSONRPCRequest_v0_3 request, JSONRPCError_v0_3 error) { + return new JSONRPCErrorResponse_v0_3(request.getId(), error); + } + + static void setStreamingMultiSseSupportSubscribedRunnable(Runnable runnable) { + streamingMultiSseSupportSubscribedRunnable = runnable; + } + + private ServerCallContext createCallContext(RoutingContext rc) { + + if (callContextFactory.isUnsatisfied()) { + User user; + if (rc.user() == null) { + user = UnauthenticatedUser.INSTANCE; + } else { + user = new User() { + @Override + public boolean isAuthenticated() { + return rc.userContext().authenticated(); + } + + @Override + public String getUsername() { + return rc.user().subject(); + } + }; + } + Map state = new HashMap<>(); + // TODO Python's impl has + // state['auth'] = request.auth + // in jsonrpc_app.py. Figure out what this maps to in what Vert.X gives us + + Map headers = new HashMap<>(); + Set headerNames = rc.request().headers().names(); + headerNames.forEach(name -> headers.put(name, rc.request().getHeader(name))); + state.put(HEADERS_KEY, headers); + + // Extract requested extensions from X-A2A-Extensions header + List extensionHeaderValues = rc.request().headers().getAll(A2AHeaders_v0_3.X_A2A_EXTENSIONS); + Set requestedExtensions = A2AExtensions.getRequestedExtensions(extensionHeaderValues); + + return new ServerCallContext(user, state, requestedExtensions); + } else { + CallContextFactory_v0_3 builder = callContextFactory.get(); + return builder.build(rc); + } + } + + // Port of import io.quarkus.vertx.web.runtime.MultiSseSupport, which is considered internal API + private static class MultiSseSupport { + + private MultiSseSupport() { + // Avoid direct instantiation. + } + + private static void initialize(HttpServerResponse response) { + if (response.bytesWritten() == 0) { + MultiMap headers = response.headers(); + if (headers.get(CONTENT_TYPE) == null) { + headers.set(CONTENT_TYPE, SERVER_SENT_EVENTS); + } + response.setChunked(true); + } + } + + private static void onWriteDone(Flow.Subscription subscription, AsyncResult ar, RoutingContext rc) { + if (ar.failed()) { + rc.fail(ar.cause()); + } else { + subscription.request(1); + } + } + + public static void write(Multi multi, RoutingContext rc) { + HttpServerResponse response = rc.response(); + multi.subscribe().withSubscriber(new Flow.Subscriber() { + Flow.Subscription upstream; + + @Override + public void onSubscribe(Flow.Subscription subscription) { + this.upstream = subscription; + this.upstream.request(1); + + // Notify tests that we are subscribed + Runnable runnable = streamingMultiSseSupportSubscribedRunnable; + if (runnable != null) { + runnable.run(); + } + } + + @Override + public void onNext(Buffer item) { + initialize(response); + response.write(item, new Handler>() { + @Override + public void handle(AsyncResult ar) { + onWriteDone(upstream, ar, rc); + } + }); + } + + @Override + public void onError(Throwable throwable) { + rc.fail(throwable); + } + + @Override + public void onComplete() { + endOfStream(response); + } + }); + } + + public static void subscribeObject(Multi multi, RoutingContext rc) { + AtomicLong count = new AtomicLong(); + write(multi.map(new Function() { + @Override + public Buffer apply(Object o) { + if (o instanceof ReactiveRoutes.ServerSentEvent) { + ReactiveRoutes.ServerSentEvent ev = (ReactiveRoutes.ServerSentEvent) o; + long id = ev.id() != -1 ? ev.id() : count.getAndIncrement(); + String e = ev.event() == null ? "" : "event: " + ev.event() + "\n"; + return Buffer.buffer(e + "data: " + Utils_v0_3.toJsonString(ev.data()) + "\nid: " + id + "\n\n"); + } + return Buffer.buffer("data: " + Utils_v0_3.toJsonString(o) + "\nid: " + count.getAndIncrement() + "\n\n"); + } + }), rc); + } + + private static void endOfStream(HttpServerResponse response) { + if (response.bytesWritten() == 0) { // No item + MultiMap headers = response.headers(); + if (headers.get(CONTENT_TYPE) == null) { + headers.set(CONTENT_TYPE, SERVER_SENT_EVENTS); + } + } + response.end(); + } + } +} diff --git a/compat-0.3/reference/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/server/apps/quarkus/CallContextFactory_v0_3.java b/compat-0.3/reference/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/server/apps/quarkus/CallContextFactory_v0_3.java new file mode 100644 index 000000000..f00bce4db --- /dev/null +++ b/compat-0.3/reference/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/server/apps/quarkus/CallContextFactory_v0_3.java @@ -0,0 +1,8 @@ +package org.a2aproject.sdk.compat03.server.apps.quarkus; + +import org.a2aproject.sdk.server.ServerCallContext; +import io.vertx.ext.web.RoutingContext; + +public interface CallContextFactory_v0_3 { + ServerCallContext build(RoutingContext rc); +} diff --git a/compat-0.3/reference/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/server/apps/quarkus/QuarkusJSONRPCTransportMetadata_v0_3.java b/compat-0.3/reference/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/server/apps/quarkus/QuarkusJSONRPCTransportMetadata_v0_3.java new file mode 100644 index 000000000..6b98db4b2 --- /dev/null +++ b/compat-0.3/reference/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/server/apps/quarkus/QuarkusJSONRPCTransportMetadata_v0_3.java @@ -0,0 +1,12 @@ +package org.a2aproject.sdk.compat03.server.apps.quarkus; + +import org.a2aproject.sdk.server.TransportMetadata; +import org.a2aproject.sdk.compat03.spec.TransportProtocol_v0_3; + +public class QuarkusJSONRPCTransportMetadata_v0_3 implements TransportMetadata { + + @Override + public String getTransportProtocol() { + return TransportProtocol_v0_3.JSONRPC.asString(); + } +} diff --git a/compat-0.3/reference/jsonrpc/src/main/resources/META-INF/beans.xml b/compat-0.3/reference/jsonrpc/src/main/resources/META-INF/beans.xml new file mode 100644 index 000000000..548d44b72 --- /dev/null +++ b/compat-0.3/reference/jsonrpc/src/main/resources/META-INF/beans.xml @@ -0,0 +1,6 @@ + + + diff --git a/compat-0.3/reference/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/server/apps/quarkus/A2ATestRoutes_v0_3.java b/compat-0.3/reference/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/server/apps/quarkus/A2ATestRoutes_v0_3.java new file mode 100644 index 000000000..96b30d362 --- /dev/null +++ b/compat-0.3/reference/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/server/apps/quarkus/A2ATestRoutes_v0_3.java @@ -0,0 +1,196 @@ +package org.a2aproject.sdk.compat03.server.apps.quarkus; + +import static io.vertx.core.http.HttpHeaders.CONTENT_TYPE; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.MediaType.TEXT_PLAIN; + +import java.util.concurrent.atomic.AtomicInteger; + +import jakarta.annotation.PostConstruct; +import jakarta.inject.Inject; +import jakarta.inject.Singleton; + +import org.a2aproject.sdk.compat03.conversion.TestUtilsBean_v0_3; +import org.a2aproject.sdk.jsonrpc.common.json.JsonUtil; +import org.a2aproject.sdk.spec.Task; +import org.a2aproject.sdk.spec.TaskArtifactUpdateEvent; +import org.a2aproject.sdk.spec.TaskPushNotificationConfig; +import org.a2aproject.sdk.spec.TaskStatusUpdateEvent; +import io.quarkus.vertx.web.Body; +import io.quarkus.vertx.web.Param; +import io.quarkus.vertx.web.Route; +import io.vertx.ext.web.RoutingContext; + +/** + * Exposes the {@link TestUtilsBean_v0_3} via REST using Quarkus Reactive Routes + */ +@Singleton +public class A2ATestRoutes_v0_3 { + @Inject + TestUtilsBean_v0_3 testUtilsBean; + + @Inject + A2AServerRoutes_v0_3 a2AServerRoutes; + + AtomicInteger streamingSubscribedCount = new AtomicInteger(0); + + @PostConstruct + public void init() { + A2AServerRoutes_v0_3.setStreamingMultiSseSupportSubscribedRunnable(() -> streamingSubscribedCount.incrementAndGet()); + } + + + @Route(path = "/test/task", methods = {Route.HttpMethod.POST}, consumes = {APPLICATION_JSON}, type = Route.HandlerType.BLOCKING) + public void saveTask(@Body String body, RoutingContext rc) { + try { + Task task = JsonUtil.fromJson(body, Task.class); + testUtilsBean.saveTask(task); + rc.response() + .setStatusCode(200) + .end(); + } catch (Throwable t) { + errorResponse(t, rc); + } + } + + @Route(path = "/test/task/:taskId", methods = {Route.HttpMethod.GET}, produces = {APPLICATION_JSON}, type = Route.HandlerType.BLOCKING) + public void getTask(@Param String taskId, RoutingContext rc) { + try { + Task task = testUtilsBean.getTask(taskId); + if (task == null) { + rc.response() + .setStatusCode(404) + .end(); + return; + } + rc.response() + .setStatusCode(200) + .putHeader(CONTENT_TYPE, APPLICATION_JSON) + .end(JsonUtil.toJson(task)); + + } catch (Throwable t) { + errorResponse(t, rc); + } + } + + @Route(path = "/test/task/:taskId", methods = {Route.HttpMethod.DELETE}, type = Route.HandlerType.BLOCKING) + public void deleteTask(@Param String taskId, RoutingContext rc) { + try { + Task task = testUtilsBean.getTask(taskId); + if (task == null) { + rc.response() + .setStatusCode(404) + .end(); + return; + } + testUtilsBean.deleteTask(taskId); + rc.response() + .setStatusCode(200) + .end(); + } catch (Throwable t) { + errorResponse(t, rc); + } + } + + @Route(path = "/test/queue/ensure/:taskId", methods = {Route.HttpMethod.POST}) + public void ensureTaskQueue(@Param String taskId, RoutingContext rc) { + try { + testUtilsBean.ensureQueue(taskId); + rc.response() + .setStatusCode(200) + .end(); + } catch (Throwable t) { + errorResponse(t, rc); + } + } + + @Route(path = "/test/queue/enqueueTaskStatusUpdateEvent/:taskId", methods = {Route.HttpMethod.POST}) + public void enqueueTaskStatusUpdateEvent(@Param String taskId, @Body String body, RoutingContext rc) { + + try { + TaskStatusUpdateEvent event = JsonUtil.fromJson(body, TaskStatusUpdateEvent.class); + testUtilsBean.enqueueEvent(taskId, event); + rc.response() + .setStatusCode(200) + .end(); + } catch (Throwable t) { + errorResponse(t, rc); + } + } + + @Route(path = "/test/queue/enqueueTaskArtifactUpdateEvent/:taskId", methods = {Route.HttpMethod.POST}) + public void enqueueTaskArtifactUpdateEvent(@Param String taskId, @Body String body, RoutingContext rc) { + + try { + TaskArtifactUpdateEvent event = JsonUtil.fromJson(body, TaskArtifactUpdateEvent.class); + testUtilsBean.enqueueEvent(taskId, event); + rc.response() + .setStatusCode(200) + .end(); + } catch (Throwable t) { + errorResponse(t, rc); + } + } + + @Route(path = "/test/streamingSubscribedCount", methods = {Route.HttpMethod.GET}, produces = {TEXT_PLAIN}) + public void getStreamingSubscribedCount(RoutingContext rc) { + rc.response() + .setStatusCode(200) + .end(String.valueOf(streamingSubscribedCount.get())); + } + + @Route(path = "/test/queue/childCount/:taskId", methods = {Route.HttpMethod.GET}, produces = {TEXT_PLAIN}) + public void getChildQueueCount(@Param String taskId, RoutingContext rc) { + int count = testUtilsBean.getChildQueueCount(taskId); + rc.response() + .setStatusCode(200) + .end(String.valueOf(count)); + } + + @Route(path = "/test/task/:taskId/config/:configId", methods = {Route.HttpMethod.DELETE}, type = Route.HandlerType.BLOCKING) + public void deleteTaskPushNotificationConfig(@Param String taskId, @Param String configId, RoutingContext rc) { + try { + Task task = testUtilsBean.getTask(taskId); + if (task == null) { + rc.response() + .setStatusCode(404) + .end(); + return; + } + testUtilsBean.deleteTaskPushNotificationConfig(taskId, configId); + rc.response() + .setStatusCode(200) + .end(); + } catch (Throwable t) { + errorResponse(t, rc); + } + } + + @Route(path = "/test/task/:taskId", methods = {Route.HttpMethod.POST}, type = Route.HandlerType.BLOCKING) + public void saveTaskPushNotificationConfig(@Param String taskId, @Body String body, RoutingContext rc) { + try { + TaskPushNotificationConfig notificationConfig = JsonUtil.fromJson(body, TaskPushNotificationConfig.class); + if (notificationConfig == null) { + rc.response() + .setStatusCode(404) + .end(); + return; + } + testUtilsBean.saveTaskPushNotificationConfig(taskId, notificationConfig); + rc.response() + .setStatusCode(200) + .end(); + } catch (Throwable t) { + errorResponse(t, rc); + } + } + + private void errorResponse(Throwable t, RoutingContext rc) { + t.printStackTrace(); + rc.response() + .setStatusCode(500) + .putHeader(CONTENT_TYPE, TEXT_PLAIN) + .end(); + } + +} diff --git a/compat-0.3/reference/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/server/apps/quarkus/QuarkusA2AJSONRPC_v0_3_Test.java b/compat-0.3/reference/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/server/apps/quarkus/QuarkusA2AJSONRPC_v0_3_Test.java new file mode 100644 index 000000000..65683ce9a --- /dev/null +++ b/compat-0.3/reference/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/server/apps/quarkus/QuarkusA2AJSONRPC_v0_3_Test.java @@ -0,0 +1,31 @@ +package org.a2aproject.sdk.compat03.server.apps.quarkus; + +import org.a2aproject.sdk.compat03.client.ClientBuilder_v0_3; +import org.a2aproject.sdk.compat03.client.transport.jsonrpc.JSONRPCTransport_v0_3; +import org.a2aproject.sdk.compat03.client.transport.jsonrpc.JSONRPCTransportConfigBuilder_v0_3; +import org.a2aproject.sdk.compat03.conversion.AbstractA2AServerServerTest_v0_3; +import org.a2aproject.sdk.compat03.spec.TransportProtocol_v0_3; +import io.quarkus.test.junit.QuarkusTest; + +@QuarkusTest +public class QuarkusA2AJSONRPC_v0_3_Test extends AbstractA2AServerServerTest_v0_3 { + + public QuarkusA2AJSONRPC_v0_3_Test() { + super(8081); + } + + @Override + protected String getTransportProtocol() { + return TransportProtocol_v0_3.JSONRPC.asString(); + } + + @Override + protected String getTransportUrl() { + return "http://localhost:8081"; + } + + @Override + protected void configureTransport(ClientBuilder_v0_3 builder) { + builder.withTransport(JSONRPCTransport_v0_3.class, new JSONRPCTransportConfigBuilder_v0_3()); + } +} diff --git a/compat-0.3/reference/jsonrpc/src/test/resources/application.properties b/compat-0.3/reference/jsonrpc/src/test/resources/application.properties new file mode 100644 index 000000000..f7b5a7d9f --- /dev/null +++ b/compat-0.3/reference/jsonrpc/src/test/resources/application.properties @@ -0,0 +1,12 @@ +# Index dependencies for CDI bean discovery +quarkus.index-dependency.server-conversion.group-id=org.a2aproject.sdk +quarkus.index-dependency.server-conversion.artifact-id=a2a-java-sdk-compat-0.3-server-conversion +quarkus.index-dependency.server-conversion.classifier=tests + +# Use test HTTP client from v0.3 compat test infrastructure +quarkus.arc.selected-alternatives=org.a2aproject.sdk.compat03.conversion.TestHttpClient_v0_3 + +# Debug logging for event processing and request handling +quarkus.log.category."org.a2aproject.sdk.server.events".level=DEBUG +quarkus.log.category."org.a2aproject.sdk.server.requesthandlers".level=DEBUG +quarkus.log.category."org.a2aproject.sdk.server.tasks".level=DEBUG diff --git a/compat-0.3/reference/jsonrpc/src/test/resources/compat-0.3-requesthandler-test.properties b/compat-0.3/reference/jsonrpc/src/test/resources/compat-0.3-requesthandler-test.properties new file mode 100644 index 000000000..2d94ad8ab --- /dev/null +++ b/compat-0.3/reference/jsonrpc/src/test/resources/compat-0.3-requesthandler-test.properties @@ -0,0 +1 @@ +preferred-transport=jsonrpc diff --git a/compat-0.3/reference/rest/pom.xml b/compat-0.3/reference/rest/pom.xml new file mode 100644 index 000000000..3677c6a51 --- /dev/null +++ b/compat-0.3/reference/rest/pom.xml @@ -0,0 +1,107 @@ + + + 4.0.0 + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-parent + 1.0.0.Beta2-SNAPSHOT + ../../pom.xml + + a2a-java-sdk-compat-0.3-reference-rest + + jar + + Java A2A Compat 0.3 Reference Server: JSON+HTTP/REST + Java SDK for the Agent2Agent Protocol (A2A) - A2A JSON+HTTP/REST Reference Server (based on Quarkus) + + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec + + + ${project.groupId} + a2a-java-sdk-compat-0.3-transport-rest + + + + ${project.groupId} + a2a-java-sdk-compat-0.3-server-conversion + test-jar + test + + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client + test + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client-transport-rest + test + + + com.google.protobuf + protobuf-java-util + test + + + io.quarkus + quarkus-reactive-routes + + + jakarta.enterprise + jakarta.enterprise.cdi-api + + + jakarta.inject + jakarta.inject-api + + + org.slf4j + slf4j-api + + + io.quarkus + quarkus-junit5 + test + + + io.quarkus + quarkus-rest-client-jackson + test + + + org.junit.jupiter + junit-jupiter-api + test + + + io.rest-assured + rest-assured + test + + + org.mockito + mockito-core + test + + + org.mockito + mockito-junit-jupiter + test + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + + diff --git a/compat-0.3/reference/rest/src/main/java/org/a2aproject/sdk/compat03/server/rest/quarkus/A2AServerRoutes_v0_3.java b/compat-0.3/reference/rest/src/main/java/org/a2aproject/sdk/compat03/server/rest/quarkus/A2AServerRoutes_v0_3.java new file mode 100644 index 000000000..7e424dcfa --- /dev/null +++ b/compat-0.3/reference/rest/src/main/java/org/a2aproject/sdk/compat03/server/rest/quarkus/A2AServerRoutes_v0_3.java @@ -0,0 +1,453 @@ +package org.a2aproject.sdk.compat03.server.rest.quarkus; + +import static org.a2aproject.sdk.compat03.transport.rest.context.RestContextKeys_v0_3.HEADERS_KEY; +import static org.a2aproject.sdk.compat03.transport.rest.context.RestContextKeys_v0_3.METHOD_NAME_KEY; +import static io.vertx.core.http.HttpHeaders.CONTENT_TYPE; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.MediaType.SERVER_SENT_EVENTS; + +import java.util.concurrent.Executor; +import java.util.concurrent.Flow; +import java.util.concurrent.atomic.AtomicLong; +import java.util.function.Function; + +import jakarta.annotation.security.PermitAll; +import jakarta.enterprise.inject.Instance; +import jakarta.inject.Inject; +import jakarta.inject.Singleton; + +import org.a2aproject.sdk.compat03.common.A2AHeaders_v0_3; +import org.a2aproject.sdk.server.ServerCallContext; +import org.a2aproject.sdk.server.auth.UnauthenticatedUser; +import org.a2aproject.sdk.server.auth.User; +import org.a2aproject.sdk.server.util.async.Internal; +import org.a2aproject.sdk.server.extensions.A2AExtensions; +import org.a2aproject.sdk.compat03.spec.InternalError_v0_3; +import org.a2aproject.sdk.compat03.spec.InvalidParamsError_v0_3; +import org.a2aproject.sdk.compat03.spec.JSONRPCError_v0_3; +import org.a2aproject.sdk.compat03.spec.MethodNotFoundError_v0_3; +import org.a2aproject.sdk.compat03.spec.CancelTaskRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.GetTaskRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.ListTaskPushNotificationConfigRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.SendMessageRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.SendStreamingMessageRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.SetTaskPushNotificationConfigRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskResubscriptionRequest_v0_3; +import org.a2aproject.sdk.compat03.transport.rest.handler.RestHandler_v0_3; +import org.a2aproject.sdk.compat03.transport.rest.handler.RestHandler_v0_3.HTTPRestResponse; +import org.a2aproject.sdk.compat03.transport.rest.handler.RestHandler_v0_3.HTTPRestStreamingResponse; +import io.quarkus.security.Authenticated; +import io.quarkus.vertx.web.Body; +import io.quarkus.vertx.web.ReactiveRoutes; +import io.quarkus.vertx.web.Route; +import io.smallrye.mutiny.Multi; +import io.vertx.core.AsyncResult; +import io.vertx.core.Handler; +import io.vertx.core.MultiMap; +import io.vertx.core.buffer.Buffer; +import io.vertx.core.http.HttpServerResponse; +import io.vertx.ext.web.RoutingContext; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import org.jspecify.annotations.Nullable; + +@Singleton +@Authenticated +public class A2AServerRoutes_v0_3 { + + @Inject + RestHandler_v0_3 jsonRestHandler; + + // Hook so testing can wait until the MultiSseSupport is subscribed. + // Without this we get intermittent failures + private static volatile @Nullable Runnable streamingMultiSseSupportSubscribedRunnable; + + @Inject + @Internal + Executor executor; + + @Inject + Instance callContextFactory; + + @Route(regex = "^/v1/message:send$", order = 1, methods = {Route.HttpMethod.POST}, consumes = {APPLICATION_JSON}, type = Route.HandlerType.BLOCKING) + public void sendMessage(@Body String body, RoutingContext rc) { + ServerCallContext context = createCallContext(rc, SendMessageRequest_v0_3.METHOD); + HTTPRestResponse response = null; + try { + response = jsonRestHandler.sendMessage(body, context); + } catch (Throwable t) { + response = jsonRestHandler.createErrorResponse(new InternalError_v0_3(t.getMessage())); + } finally { + sendResponse(rc, response); + } + } + + @Route(regex = "^/v1/message:stream$", order = 1, methods = {Route.HttpMethod.POST}, consumes = {APPLICATION_JSON}, type = Route.HandlerType.BLOCKING) + public void sendMessageStreaming(@Body String body, RoutingContext rc) { + ServerCallContext context = createCallContext(rc, SendStreamingMessageRequest_v0_3.METHOD); + HTTPRestStreamingResponse streamingResponse = null; + HTTPRestResponse error = null; + try { + HTTPRestResponse response = jsonRestHandler.sendStreamingMessage(body, context); + if (response instanceof HTTPRestStreamingResponse hTTPRestStreamingResponse) { + streamingResponse = hTTPRestStreamingResponse; + } else { + error = response; + } + } finally { + if (error != null) { + sendResponse(rc, error); + } else if (streamingResponse != null) { + Multi events = Multi.createFrom().publisher(streamingResponse.getPublisher()); + executor.execute(() -> { + MultiSseSupport.subscribeObject( + events.map(i -> (Object) i), rc); + }); + } + } + } + + @Route(path = "/v1/tasks/:id", order = 1, methods = {Route.HttpMethod.GET}, type = Route.HandlerType.BLOCKING) + public void getTask(RoutingContext rc) { + String taskId = rc.pathParam("id"); + ServerCallContext context = createCallContext(rc, GetTaskRequest_v0_3.METHOD); + HTTPRestResponse response = null; + try { + if (taskId == null || taskId.isEmpty()) { + response = jsonRestHandler.createErrorResponse(new InvalidParamsError_v0_3("bad task id")); + } else { + int historyLength = 0; + boolean hasHistoryLength = rc.request().params().contains("history_length"); + boolean hasHistoryLengthCamel = rc.request().params().contains("historyLength"); + + if (hasHistoryLength && hasHistoryLengthCamel) { + response = jsonRestHandler.createErrorResponse( + new InvalidParamsError_v0_3("Only one of 'history_length' or 'historyLength' may be specified")); + } else if (hasHistoryLength) { + historyLength = Integer.parseInt(rc.request().params().get("history_length")); + } else if (hasHistoryLengthCamel) { + historyLength = Integer.parseInt(rc.request().params().get("historyLength")); + } + + if (response == null) { + response = jsonRestHandler.getTask(taskId, historyLength, context); + } + } + } catch (NumberFormatException e) { + response = jsonRestHandler.createErrorResponse(new InvalidParamsError_v0_3("bad history_length or historyLength")); + } catch (Throwable t) { + response = jsonRestHandler.createErrorResponse(new InternalError_v0_3(t.getMessage())); + } finally { + sendResponse(rc, response); + } + } + + @Route(regex = "^/v1/tasks/([^/]+):cancel$", order = 1, methods = {Route.HttpMethod.POST}, type = Route.HandlerType.BLOCKING) + public void cancelTask(RoutingContext rc) { + String taskId = rc.pathParam("param0"); + ServerCallContext context = createCallContext(rc, CancelTaskRequest_v0_3.METHOD); + HTTPRestResponse response = null; + try { + if (taskId == null || taskId.isEmpty()) { + response = jsonRestHandler.createErrorResponse(new InvalidParamsError_v0_3("bad task id")); + } else { + response = jsonRestHandler.cancelTask(taskId, context); + } + } catch (Throwable t) { + if (t instanceof JSONRPCError_v0_3 error) { + response = jsonRestHandler.createErrorResponse(error); + } else { + response = jsonRestHandler.createErrorResponse(new InternalError_v0_3(t.getMessage())); + } + } finally { + sendResponse(rc, response); + } + } + + private void sendResponse(RoutingContext rc, @Nullable HTTPRestResponse response) { + if (response != null) { + rc.response() + .setStatusCode(response.getStatusCode()) + .putHeader(CONTENT_TYPE, response.getContentType()) + .end(response.getBody()); + } else { + rc.response().end(); + } + } + + @Route(regex = "^/v1/tasks/([^/]+):subscribe$", order = 1, methods = {Route.HttpMethod.POST}, type = Route.HandlerType.BLOCKING) + public void resubscribeTask(RoutingContext rc) { + String taskId = rc.pathParam("param0"); + ServerCallContext context = createCallContext(rc, TaskResubscriptionRequest_v0_3.METHOD); + HTTPRestStreamingResponse streamingResponse = null; + HTTPRestResponse error = null; + try { + if (taskId == null || taskId.isEmpty()) { + error = jsonRestHandler.createErrorResponse(new InvalidParamsError_v0_3("bad task id")); + } else { + HTTPRestResponse response = jsonRestHandler.resubscribeTask(taskId, context); + if (response instanceof HTTPRestStreamingResponse hTTPRestStreamingResponse) { + streamingResponse = hTTPRestStreamingResponse; + } else { + error = response; + } + } + } finally { + if (error != null) { + sendResponse(rc, error); + } else if (streamingResponse != null) { + Multi events = Multi.createFrom().publisher(streamingResponse.getPublisher()); + executor.execute(() -> { + MultiSseSupport.subscribeObject( + events.map(i -> (Object) i), rc); + }); + } + } + } + + @Route(path = "/v1/tasks/:id/pushNotificationConfigs", order = 1, methods = {Route.HttpMethod.POST}, consumes = {APPLICATION_JSON}, type = Route.HandlerType.BLOCKING) + public void setTaskPushNotificationConfiguration(@Body String body, RoutingContext rc) { + String taskId = rc.pathParam("id"); + ServerCallContext context = createCallContext(rc, SetTaskPushNotificationConfigRequest_v0_3.METHOD); + HTTPRestResponse response = null; + try { + if (taskId == null || taskId.isEmpty()) { + response = jsonRestHandler.createErrorResponse(new InvalidParamsError_v0_3("bad task id")); + } else { + response = jsonRestHandler.setTaskPushNotificationConfiguration(taskId, body, context); + } + } catch (Throwable t) { + response = jsonRestHandler.createErrorResponse(new InternalError_v0_3(t.getMessage())); + } finally { + sendResponse(rc, response); + } + } + + @Route(path = "/v1/tasks/:id/pushNotificationConfigs/:configId", order = 1, methods = {Route.HttpMethod.GET}, type = Route.HandlerType.BLOCKING) + public void getTaskPushNotificationConfiguration(RoutingContext rc) { + String taskId = rc.pathParam("id"); + String configId = rc.pathParam("configId"); + ServerCallContext context = createCallContext(rc, GetTaskPushNotificationConfigRequest_v0_3.METHOD); + HTTPRestResponse response = null; + try { + if (taskId == null || taskId.isEmpty()) { + response = jsonRestHandler.createErrorResponse(new InvalidParamsError_v0_3("bad task id")); + } else { + response = jsonRestHandler.getTaskPushNotificationConfiguration(taskId, configId, context); + } + } catch (Throwable t) { + response = jsonRestHandler.createErrorResponse(new InternalError_v0_3(t.getMessage())); + } finally { + sendResponse(rc, response); + } + } + + @Route(path = "/v1/tasks/:id/pushNotificationConfigs", order = 1, methods = {Route.HttpMethod.GET}, type = Route.HandlerType.BLOCKING) + public void listTaskPushNotificationConfigurations(RoutingContext rc) { + String taskId = rc.pathParam("id"); + ServerCallContext context = createCallContext(rc, ListTaskPushNotificationConfigRequest_v0_3.METHOD); + HTTPRestResponse response = null; + try { + if (taskId == null || taskId.isEmpty()) { + response = jsonRestHandler.createErrorResponse(new InvalidParamsError_v0_3("bad task id")); + } else { + response = jsonRestHandler.listTaskPushNotificationConfigurations(taskId, context); + } + } catch (Throwable t) { + response = jsonRestHandler.createErrorResponse(new InternalError_v0_3(t.getMessage())); + } finally { + sendResponse(rc, response); + } + } + + @Route(path = "/v1/tasks/:id/pushNotificationConfigs/:configId", order = 1, methods = {Route.HttpMethod.DELETE}, type = Route.HandlerType.BLOCKING) + public void deleteTaskPushNotificationConfiguration(RoutingContext rc) { + String taskId = rc.pathParam("id"); + String configId = rc.pathParam("configId"); + ServerCallContext context = createCallContext(rc, DeleteTaskPushNotificationConfigRequest_v0_3.METHOD); + HTTPRestResponse response = null; + try { + if (taskId == null || taskId.isEmpty()) { + response = jsonRestHandler.createErrorResponse(new InvalidParamsError_v0_3("bad task id")); + } else if (configId == null || configId.isEmpty()) { + response = jsonRestHandler.createErrorResponse(new InvalidParamsError_v0_3("bad config id")); + } else { + response = jsonRestHandler.deleteTaskPushNotificationConfiguration(taskId, configId, context); + } + } catch (Throwable t) { + response = jsonRestHandler.createErrorResponse(new InternalError_v0_3(t.getMessage())); + } finally { + sendResponse(rc, response); + } + } + + /** + * Handles incoming GET requests to the agent card endpoint. + * Returns the agent card in JSON format. + * + * @param rc the routing context + */ + @Route(path = "/.well-known/agent-card.json", order = 1, methods = Route.HttpMethod.GET, produces = APPLICATION_JSON) + @PermitAll + public void getAgentCard(RoutingContext rc) { + HTTPRestResponse response = jsonRestHandler.getAgentCard(); + sendResponse(rc, response); + } + + @Route(path = "/v1/card", order = 1, methods = Route.HttpMethod.GET, produces = APPLICATION_JSON) + public void getAuthenticatedExtendedCard(RoutingContext rc) { + HTTPRestResponse response = jsonRestHandler.getAuthenticatedExtendedCard(); + sendResponse(rc, response); + } + + @Route(path = "^/v1/.*", order = 100, methods = {Route.HttpMethod.DELETE, Route.HttpMethod.GET, Route.HttpMethod.HEAD, Route.HttpMethod.OPTIONS, Route.HttpMethod.POST, Route.HttpMethod.PUT}, produces = APPLICATION_JSON) + public void methodNotFoundMessage(RoutingContext rc) { + HTTPRestResponse response = jsonRestHandler.createErrorResponse(new MethodNotFoundError_v0_3()); + sendResponse(rc, response); + } + + static void setStreamingMultiSseSupportSubscribedRunnable(Runnable runnable) { + streamingMultiSseSupportSubscribedRunnable = runnable; + } + + private ServerCallContext createCallContext(RoutingContext rc, String jsonRpcMethodName) { + if (callContextFactory.isUnsatisfied()) { + User user; + if (rc.user() == null) { + user = UnauthenticatedUser.INSTANCE; + } else { + user = new User() { + @Override + public boolean isAuthenticated() { + if (rc.userContext() != null) { + return rc.userContext().authenticated(); + } + return false; + } + + @Override + public String getUsername() { + if (rc.user() != null) { + String subject = rc.user().subject(); + return subject != null ? subject : ""; + } + return ""; + } + }; + } + Map state = new HashMap<>(); + + Map headers = new HashMap<>(); + Set headerNames = rc.request().headers().names(); + headerNames.forEach(name -> headers.put(name, rc.request().getHeader(name))); + state.put(HEADERS_KEY, headers); + state.put(METHOD_NAME_KEY, jsonRpcMethodName); + + // Extract requested extensions from X-A2A-Extensions header (v0.3 header) + List extensionHeaderValues = rc.request().headers().getAll(A2AHeaders_v0_3.X_A2A_EXTENSIONS); + Set requestedExtensions = A2AExtensions.getRequestedExtensions(extensionHeaderValues); + + return new ServerCallContext(user, state, requestedExtensions); + } else { + CallContextFactory_v0_3 builder = callContextFactory.get(); + return builder.build(rc); + } + } + + // Port of import io.quarkus.vertx.web.runtime.MultiSseSupport, which is considered internal API + private static class MultiSseSupport { + + private MultiSseSupport() { + // Avoid direct instantiation. + } + + private static void initialize(HttpServerResponse response) { + if (response.bytesWritten() == 0) { + MultiMap headers = response.headers(); + if (headers.get(CONTENT_TYPE) == null) { + headers.set(CONTENT_TYPE, SERVER_SENT_EVENTS); + } + response.setChunked(true); + } + } + + private static void onWriteDone(Flow.@Nullable Subscription subscription, AsyncResult ar, RoutingContext rc) { + if (ar.failed()) { + rc.fail(ar.cause()); + } else if (subscription != null) { + subscription.request(1); + } + } + + private static void write(Multi multi, RoutingContext rc) { + HttpServerResponse response = rc.response(); + multi.subscribe().withSubscriber(new Flow.Subscriber() { + Flow.@Nullable Subscription upstream; + + @Override + public void onSubscribe(Flow.Subscription subscription) { + this.upstream = subscription; + this.upstream.request(1); + + // Notify tests that we are subscribed + Runnable runnable = streamingMultiSseSupportSubscribedRunnable; + if (runnable != null) { + runnable.run(); + } + } + + @Override + public void onNext(Buffer item) { + initialize(response); + response.write(item, new Handler>() { + @Override + public void handle(AsyncResult ar) { + onWriteDone(upstream, ar, rc); + } + }); + } + + @Override + public void onError(Throwable throwable) { + rc.fail(throwable); + } + + @Override + public void onComplete() { + endOfStream(response); + } + }); + } + + private static void subscribeObject(Multi multi, RoutingContext rc) { + AtomicLong count = new AtomicLong(); + write(multi.map(new Function() { + @Override + public Buffer apply(Object o) { + if (o instanceof ReactiveRoutes.ServerSentEvent) { + ReactiveRoutes.ServerSentEvent ev = (ReactiveRoutes.ServerSentEvent) o; + long id = ev.id() != -1 ? ev.id() : count.getAndIncrement(); + String e = ev.event() == null ? "" : "event: " + ev.event() + "\n"; + return Buffer.buffer(e + "data: " + ev.data() + "\nid: " + id + "\n\n"); + } else { + return Buffer.buffer("data: " + o + "\nid: " + count.getAndIncrement() + "\n\n"); + } + } + }), rc); + } + + private static void endOfStream(HttpServerResponse response) { + if (response.bytesWritten() == 0) { // No item + MultiMap headers = response.headers(); + if (headers.get(CONTENT_TYPE) == null) { + headers.set(CONTENT_TYPE, SERVER_SENT_EVENTS); + } + } + response.end(); + } + } +} diff --git a/compat-0.3/reference/rest/src/main/java/org/a2aproject/sdk/compat03/server/rest/quarkus/CallContextFactory_v0_3.java b/compat-0.3/reference/rest/src/main/java/org/a2aproject/sdk/compat03/server/rest/quarkus/CallContextFactory_v0_3.java new file mode 100644 index 000000000..a1f3922c2 --- /dev/null +++ b/compat-0.3/reference/rest/src/main/java/org/a2aproject/sdk/compat03/server/rest/quarkus/CallContextFactory_v0_3.java @@ -0,0 +1,8 @@ +package org.a2aproject.sdk.compat03.server.rest.quarkus; + +import org.a2aproject.sdk.server.ServerCallContext; +import io.vertx.ext.web.RoutingContext; + +public interface CallContextFactory_v0_3 { + ServerCallContext build(RoutingContext rc); +} diff --git a/compat-0.3/reference/rest/src/main/java/org/a2aproject/sdk/compat03/server/rest/quarkus/QuarkusRestTransportMetadata_v0_3.java b/compat-0.3/reference/rest/src/main/java/org/a2aproject/sdk/compat03/server/rest/quarkus/QuarkusRestTransportMetadata_v0_3.java new file mode 100644 index 000000000..ea463eba9 --- /dev/null +++ b/compat-0.3/reference/rest/src/main/java/org/a2aproject/sdk/compat03/server/rest/quarkus/QuarkusRestTransportMetadata_v0_3.java @@ -0,0 +1,10 @@ +package org.a2aproject.sdk.compat03.server.rest.quarkus; + +// TODO: Uncomment when server-common is ported +// See: /Users/kabir/sourcecontrol/AI/a2a-java-0.3.x/reference/rest/src/main/java/io/a2a/server/rest/quarkus/QuarkusRestTransportMetadata.java + +/** + * Placeholder stub - awaiting server-common port. + */ +public class QuarkusRestTransportMetadata_v0_3 { +} diff --git a/compat-0.3/reference/rest/src/main/java/org/a2aproject/sdk/compat03/server/rest/quarkus/package-info.java b/compat-0.3/reference/rest/src/main/java/org/a2aproject/sdk/compat03/server/rest/quarkus/package-info.java new file mode 100644 index 000000000..c662c2471 --- /dev/null +++ b/compat-0.3/reference/rest/src/main/java/org/a2aproject/sdk/compat03/server/rest/quarkus/package-info.java @@ -0,0 +1,4 @@ +@NullMarked +package org.a2aproject.sdk.compat03.server.rest.quarkus; + +import org.jspecify.annotations.NullMarked; diff --git a/compat-0.3/reference/rest/src/main/resources/META-INF/beans.xml b/compat-0.3/reference/rest/src/main/resources/META-INF/beans.xml new file mode 100644 index 000000000..548d44b72 --- /dev/null +++ b/compat-0.3/reference/rest/src/main/resources/META-INF/beans.xml @@ -0,0 +1,6 @@ + + + diff --git a/compat-0.3/reference/rest/src/test/java/org/a2aproject/sdk/compat03/server/rest/quarkus/A2ATestRoutes_v0_3.java b/compat-0.3/reference/rest/src/test/java/org/a2aproject/sdk/compat03/server/rest/quarkus/A2ATestRoutes_v0_3.java new file mode 100644 index 000000000..33f0586aa --- /dev/null +++ b/compat-0.3/reference/rest/src/test/java/org/a2aproject/sdk/compat03/server/rest/quarkus/A2ATestRoutes_v0_3.java @@ -0,0 +1,196 @@ +package org.a2aproject.sdk.compat03.server.rest.quarkus; + +import static io.vertx.core.http.HttpHeaders.CONTENT_TYPE; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.MediaType.TEXT_PLAIN; + +import java.util.concurrent.atomic.AtomicInteger; + +import jakarta.annotation.PostConstruct; +import jakarta.inject.Inject; +import jakarta.inject.Singleton; + +import org.a2aproject.sdk.compat03.conversion.TestUtilsBean_v0_3; +import org.a2aproject.sdk.jsonrpc.common.json.JsonUtil; +import org.a2aproject.sdk.spec.Task; +import org.a2aproject.sdk.spec.TaskArtifactUpdateEvent; +import org.a2aproject.sdk.spec.TaskPushNotificationConfig; +import org.a2aproject.sdk.spec.TaskStatusUpdateEvent; +import io.quarkus.vertx.web.Body; +import io.quarkus.vertx.web.Param; +import io.quarkus.vertx.web.Route; +import io.vertx.ext.web.RoutingContext; + +/** + * Exposes the {@link TestUtilsBean_v0_3} via REST using Quarkus Reactive Routes + */ +@Singleton +public class A2ATestRoutes_v0_3 { + @Inject + TestUtilsBean_v0_3 testUtilsBean; + + @Inject + A2AServerRoutes_v0_3 a2AServerRoutes; + + AtomicInteger streamingSubscribedCount = new AtomicInteger(0); + + @PostConstruct + public void init() { + A2AServerRoutes_v0_3.setStreamingMultiSseSupportSubscribedRunnable(() -> streamingSubscribedCount.incrementAndGet()); + } + + + @Route(path = "/test/task", methods = {Route.HttpMethod.POST}, consumes = {APPLICATION_JSON}, type = Route.HandlerType.BLOCKING) + public void saveTask(@Body String body, RoutingContext rc) { + try { + Task task = JsonUtil.fromJson(body, Task.class); + testUtilsBean.saveTask(task); + rc.response() + .setStatusCode(200) + .end(); + } catch (Throwable t) { + errorResponse(t, rc); + } + } + + @Route(path = "/test/task/:taskId", methods = {Route.HttpMethod.GET}, produces = {APPLICATION_JSON}, type = Route.HandlerType.BLOCKING) + public void getTask(@Param String taskId, RoutingContext rc) { + try { + Task task = testUtilsBean.getTask(taskId); + if (task == null) { + rc.response() + .setStatusCode(404) + .end(); + return; + } + rc.response() + .setStatusCode(200) + .putHeader(CONTENT_TYPE, APPLICATION_JSON) + .end(JsonUtil.toJson(task)); + + } catch (Throwable t) { + errorResponse(t, rc); + } + } + + @Route(path = "/test/task/:taskId", methods = {Route.HttpMethod.DELETE}, type = Route.HandlerType.BLOCKING) + public void deleteTask(@Param String taskId, RoutingContext rc) { + try { + Task task = testUtilsBean.getTask(taskId); + if (task == null) { + rc.response() + .setStatusCode(404) + .end(); + return; + } + testUtilsBean.deleteTask(taskId); + rc.response() + .setStatusCode(200) + .end(); + } catch (Throwable t) { + errorResponse(t, rc); + } + } + + @Route(path = "/test/queue/ensure/:taskId", methods = {Route.HttpMethod.POST}) + public void ensureTaskQueue(@Param String taskId, RoutingContext rc) { + try { + testUtilsBean.ensureQueue(taskId); + rc.response() + .setStatusCode(200) + .end(); + } catch (Throwable t) { + errorResponse(t, rc); + } + } + + @Route(path = "/test/queue/enqueueTaskStatusUpdateEvent/:taskId", methods = {Route.HttpMethod.POST}) + public void enqueueTaskStatusUpdateEvent(@Param String taskId, @Body String body, RoutingContext rc) { + + try { + TaskStatusUpdateEvent event = JsonUtil.fromJson(body, TaskStatusUpdateEvent.class); + testUtilsBean.enqueueEvent(taskId, event); + rc.response() + .setStatusCode(200) + .end(); + } catch (Throwable t) { + errorResponse(t, rc); + } + } + + @Route(path = "/test/queue/enqueueTaskArtifactUpdateEvent/:taskId", methods = {Route.HttpMethod.POST}) + public void enqueueTaskArtifactUpdateEvent(@Param String taskId, @Body String body, RoutingContext rc) { + + try { + TaskArtifactUpdateEvent event = JsonUtil.fromJson(body, TaskArtifactUpdateEvent.class); + testUtilsBean.enqueueEvent(taskId, event); + rc.response() + .setStatusCode(200) + .end(); + } catch (Throwable t) { + errorResponse(t, rc); + } + } + + @Route(path = "/test/streamingSubscribedCount", methods = {Route.HttpMethod.GET}, produces = {TEXT_PLAIN}) + public void getStreamingSubscribedCount(RoutingContext rc) { + rc.response() + .setStatusCode(200) + .end(String.valueOf(streamingSubscribedCount.get())); + } + + @Route(path = "/test/queue/childCount/:taskId", methods = {Route.HttpMethod.GET}, produces = {TEXT_PLAIN}) + public void getChildQueueCount(@Param String taskId, RoutingContext rc) { + int count = testUtilsBean.getChildQueueCount(taskId); + rc.response() + .setStatusCode(200) + .end(String.valueOf(count)); + } + + @Route(path = "/test/task/:taskId/config/:configId", methods = {Route.HttpMethod.DELETE}, type = Route.HandlerType.BLOCKING) + public void deleteTaskPushNotificationConfig(@Param String taskId, @Param String configId, RoutingContext rc) { + try { + Task task = testUtilsBean.getTask(taskId); + if (task == null) { + rc.response() + .setStatusCode(404) + .end(); + return; + } + testUtilsBean.deleteTaskPushNotificationConfig(taskId, configId); + rc.response() + .setStatusCode(200) + .end(); + } catch (Throwable t) { + errorResponse(t, rc); + } + } + + @Route(path = "/test/task/:taskId", methods = {Route.HttpMethod.POST}, type = Route.HandlerType.BLOCKING) + public void saveTaskPushNotificationConfig(@Param String taskId, @Body String body, RoutingContext rc) { + try { + TaskPushNotificationConfig notificationConfig = JsonUtil.fromJson(body, TaskPushNotificationConfig.class); + if (notificationConfig == null) { + rc.response() + .setStatusCode(404) + .end(); + return; + } + testUtilsBean.saveTaskPushNotificationConfig(taskId, notificationConfig); + rc.response() + .setStatusCode(200) + .end(); + } catch (Throwable t) { + errorResponse(t, rc); + } + } + + private void errorResponse(Throwable t, RoutingContext rc) { + t.printStackTrace(); + rc.response() + .setStatusCode(500) + .putHeader(CONTENT_TYPE, TEXT_PLAIN) + .end(); + } + +} diff --git a/compat-0.3/reference/rest/src/test/java/org/a2aproject/sdk/compat03/server/rest/quarkus/QuarkusA2ARest_v0_3_Test.java b/compat-0.3/reference/rest/src/test/java/org/a2aproject/sdk/compat03/server/rest/quarkus/QuarkusA2ARest_v0_3_Test.java new file mode 100644 index 000000000..c371eb538 --- /dev/null +++ b/compat-0.3/reference/rest/src/test/java/org/a2aproject/sdk/compat03/server/rest/quarkus/QuarkusA2ARest_v0_3_Test.java @@ -0,0 +1,60 @@ +package org.a2aproject.sdk.compat03.server.rest.quarkus; + +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; + +import org.a2aproject.sdk.compat03.client.ClientBuilder_v0_3; +import org.a2aproject.sdk.compat03.client.transport.rest.RestTransport_v0_3; +import org.a2aproject.sdk.compat03.client.transport.rest.RestTransportConfigBuilder_v0_3; +import org.a2aproject.sdk.compat03.conversion.AbstractA2AServerServerTest_v0_3; +import org.a2aproject.sdk.compat03.spec.TransportProtocol_v0_3; +import io.quarkus.test.junit.QuarkusTest; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +@QuarkusTest +public class QuarkusA2ARest_v0_3_Test extends AbstractA2AServerServerTest_v0_3 { + + public QuarkusA2ARest_v0_3_Test() { + super(8081); + } + + @Override + protected String getTransportProtocol() { + return TransportProtocol_v0_3.HTTP_JSON.asString(); + } + + @Override + protected String getTransportUrl() { + return "http://localhost:8081"; + } + + @Override + protected void configureTransport(ClientBuilder_v0_3 builder) { + builder.withTransport(RestTransport_v0_3.class, new RestTransportConfigBuilder_v0_3()); + } + + @Test + public void testMethodNotFound() throws Exception { + // Create the client + HttpClient client = HttpClient.newBuilder() + .version(HttpClient.Version.HTTP_2) + .build(); + // Create the request + HttpRequest.Builder builder = HttpRequest.newBuilder() + .uri(URI.create("http://localhost:" + serverPort + "/v1/message:send")) + .PUT(HttpRequest.BodyPublishers.ofString("test")) + .header("Content-Type", APPLICATION_JSON); + HttpResponse response = client.send(builder.build(), HttpResponse.BodyHandlers.ofString()); + assertEquals(405, response.statusCode()); + builder = HttpRequest.newBuilder() + .uri(URI.create("http://localhost:" + serverPort + "/v1/message:send")) + .DELETE() + .header("Content-Type", APPLICATION_JSON); + response = client.send(builder.build(), HttpResponse.BodyHandlers.ofString()); + assertEquals(405, response.statusCode()); + } +} diff --git a/compat-0.3/reference/rest/src/test/resources/application.properties b/compat-0.3/reference/rest/src/test/resources/application.properties new file mode 100644 index 000000000..3412ec5de --- /dev/null +++ b/compat-0.3/reference/rest/src/test/resources/application.properties @@ -0,0 +1,20 @@ +# HTTP server port for tests +quarkus.http.port=8081 +quarkus.http.test-port=8081 + +# Index dependencies for CDI bean discovery +quarkus.index-dependency.server-conversion.group-id=org.a2aproject.sdk +quarkus.index-dependency.server-conversion.artifact-id=a2a-java-sdk-compat-0.3-server-conversion +quarkus.index-dependency.server-conversion.classifier=tests + +# Index v1.0 server-common for InMemoryTaskStore, DefaultRequestHandler, etc. +quarkus.index-dependency.server-common.group-id=org.a2aproject.sdk +quarkus.index-dependency.server-common.artifact-id=a2a-java-sdk-server-common + +# Use test HTTP client from v0.3 compat test infrastructure +quarkus.arc.selected-alternatives=org.a2aproject.sdk.compat03.conversion.TestHttpClient_v0_3 + +# Debug logging for event processing and request handling +quarkus.log.category."org.a2aproject.sdk.server.events".level=DEBUG +quarkus.log.category."org.a2aproject.sdk.server.requesthandlers".level=DEBUG +quarkus.log.category."org.a2aproject.sdk.server.tasks".level=DEBUG diff --git a/compat-0.3/reference/rest/src/test/resources/compat-0.3-requesthandler-test.properties b/compat-0.3/reference/rest/src/test/resources/compat-0.3-requesthandler-test.properties new file mode 100644 index 000000000..5d8801bfe --- /dev/null +++ b/compat-0.3/reference/rest/src/test/resources/compat-0.3-requesthandler-test.properties @@ -0,0 +1 @@ +preferred-transport=rest diff --git a/compat-0.3/server-conversion/pom.xml b/compat-0.3/server-conversion/pom.xml new file mode 100644 index 000000000..9f5f3c174 --- /dev/null +++ b/compat-0.3/server-conversion/pom.xml @@ -0,0 +1,140 @@ + + + 4.0.0 + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-parent + 1.0.0.Beta2-SNAPSHOT + .. + + a2a-java-sdk-compat-0.3-server-conversion + + jar + + Java SDK A2A Compat 0.3 Server Conversion + Java SDK for the Agent2Agent Protocol (A2A) - 0.3 to 1.0 Type Conversion Layer + + + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec + + + + + ${project.groupId} + a2a-java-sdk-spec + + + + + ${project.groupId} + a2a-java-sdk-server-common + + + + + org.mapstruct + mapstruct + + + + + jakarta.enterprise + jakarta.enterprise.cdi-api + + + jakarta.inject + jakarta.inject-api + + + + + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-params + test + + + + + ${project.groupId} + a2a-java-sdk-http-client + test + + + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client + test + + + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client-transport-jsonrpc + test + + + + + ${project.groupId} + a2a-java-sdk-server-common + test-jar + test + + + + + ${project.groupId} + a2a-java-sdk-jsonrpc-common + test + + + + + io.quarkus + quarkus-arc + test + + + + + io.rest-assured + rest-assured + test + + + + + jakarta.ws.rs + jakarta.ws.rs-api + test + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + test-jar + + + + + + + diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/Convert_v0_3_To10RequestHandler.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/Convert_v0_3_To10RequestHandler.java new file mode 100644 index 000000000..39773edbb --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/Convert_v0_3_To10RequestHandler.java @@ -0,0 +1,385 @@ +package org.a2aproject.sdk.compat03.conversion; + +import java.util.List; +import java.util.concurrent.Flow; + +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; + +import org.a2aproject.sdk.compat03.conversion.mappers.domain.EventKindMapper_v0_3; +import org.a2aproject.sdk.compat03.conversion.mappers.domain.StreamingEventKindMapper_v0_3; +import org.a2aproject.sdk.compat03.conversion.mappers.domain.TaskMapper_v0_3; +import org.a2aproject.sdk.compat03.conversion.mappers.domain.TaskPushNotificationConfigMapper_v0_3; +import org.a2aproject.sdk.compat03.conversion.mappers.params.CancelTaskParamsMapper_v0_3; +import org.a2aproject.sdk.compat03.conversion.mappers.params.MessageSendParamsMapper_v0_3; +import org.a2aproject.sdk.compat03.conversion.mappers.params.TaskIdParamsMapper_v0_3; +import org.a2aproject.sdk.compat03.conversion.mappers.params.TaskQueryParamsMapper_v0_3; +import org.a2aproject.sdk.compat03.conversion.mappers.result.ListTaskPushNotificationConfigsResultMapper_v0_3; +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigParams_v0_3; +import org.a2aproject.sdk.compat03.spec.EventKind_v0_3; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigParams_v0_3; +import org.a2aproject.sdk.compat03.spec.ListTaskPushNotificationConfigParams_v0_3; +import org.a2aproject.sdk.compat03.spec.MessageSendParams_v0_3; +import org.a2aproject.sdk.compat03.spec.StreamingEventKind_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskIdParams_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskQueryParams_v0_3; +import org.a2aproject.sdk.compat03.spec.Task_v0_3; +import org.a2aproject.sdk.server.ServerCallContext; +import org.a2aproject.sdk.server.requesthandlers.RequestHandler; +import org.a2aproject.sdk.spec.A2AError; +import org.a2aproject.sdk.spec.CancelTaskParams; +import org.a2aproject.sdk.spec.DeleteTaskPushNotificationConfigParams; +import org.a2aproject.sdk.spec.EventKind; +import org.a2aproject.sdk.spec.GetTaskPushNotificationConfigParams; +import org.a2aproject.sdk.spec.ListTaskPushNotificationConfigsParams; +import org.a2aproject.sdk.spec.ListTaskPushNotificationConfigsResult; +import org.a2aproject.sdk.spec.MessageSendParams; +import org.a2aproject.sdk.spec.StreamingEventKind; +import org.a2aproject.sdk.spec.Task; +import org.a2aproject.sdk.spec.TaskIdParams; +import org.a2aproject.sdk.spec.TaskNotFoundError; +import org.a2aproject.sdk.spec.TaskPushNotificationConfig; +import org.a2aproject.sdk.spec.TaskQueryParams; + +/** + * Request handler that converts v0.3 protocol requests to v1.0 and delegates to the v1.0 {@link RequestHandler}. + *

+ * This class acts as an adapter layer between the v0.3 transport handlers and the v1.0 core request handler. + * It accepts v0.3 spec types, converts them to v1.0 types, delegates to the v1.0 DefaultRequestHandler, + * and converts the results back to v0.3 types. + *

+ * Key responsibilities: + *

    + *
  • Convert v0.3 params to v1.0 params using mappers
  • + *
  • Delegate to v1.0 RequestHandler
  • + *
  • Convert v1.0 results back to v0.3 results
  • + *
  • Handle streaming publishers with element-by-element conversion
  • + *
+ *

+ * Method naming differences between v0.3 and v1.0: + *

    + *
  • {@code onSetTaskPushNotificationConfig} (v0.3) → {@code onCreateTaskPushNotificationConfig} (v1.0)
  • + *
  • {@code onResubscribeToTask} (v0.3) → {@code onSubscribeToTask} (v1.0)
  • + *
  • {@code onListTaskPushNotificationConfig} (v0.3) → {@code onListTaskPushNotificationConfigs} (v1.0)
  • + *
+ */ +@ApplicationScoped +public class Convert_v0_3_To10RequestHandler { + + /** + * The v1.0 {@link RequestHandler} to which all converted requests are delegated. + */ + @Inject + public RequestHandler v10Handler; + + /** + * Gets a task by ID. + *

+ * v0.3 → v1.0: Converts TaskQueryParams and Task + * + * @param v03Params the v0.3 task query params + * @param context the server call context + * @return the v0.3 task + * @throws A2AError if an error occurs + */ + public Task_v0_3 onGetTask( + TaskQueryParams_v0_3 v03Params, + ServerCallContext context) throws A2AError { + + // Convert v0.3 params → v1.0 params + TaskQueryParams v10Params = TaskQueryParamsMapper_v0_3.INSTANCE.toV10(v03Params); + + // Call v1.0 handler + Task v10Result = v10Handler.onGetTask(v10Params, context); + + // Convert v1.0 result → v0.3 result + return TaskMapper_v0_3.INSTANCE.fromV10(v10Result); + } + + /** + * Cancels a task. + *

+ * v0.3 → v1.0: Converts TaskIdParams to CancelTaskParams and Task + * + * @param v03Params the v0.3 task ID params + * @param context the server call context + * @return the v0.3 task + * @throws A2AError if an error occurs + */ + public Task_v0_3 onCancelTask( + TaskIdParams_v0_3 v03Params, + ServerCallContext context) throws A2AError { + + // Convert v0.3 TaskIdParams → v1.0 CancelTaskParams + CancelTaskParams v10Params = CancelTaskParamsMapper_v0_3.INSTANCE.toV10(v03Params); + + // Call v1.0 handler + Task v10Result = v10Handler.onCancelTask(v10Params, context); + + // Convert v1.0 result → v0.3 result + return TaskMapper_v0_3.INSTANCE.fromV10(v10Result); + } + + /** + * Sends a message (blocking). + *

+ * v0.3 → v1.0: Converts MessageSendParams and EventKind + * + * @param v03Params the v0.3 message send params + * @param context the server call context + * @return the v0.3 event kind (Task or Message) + * @throws A2AError if an error occurs + */ + public EventKind_v0_3 onMessageSend( + MessageSendParams_v0_3 v03Params, + ServerCallContext context) throws A2AError { + + // Convert v0.3 params → v1.0 params + MessageSendParams v10Params = MessageSendParamsMapper_v0_3.INSTANCE.toV10(v03Params); + + // Enable v0.3 compatibility mode: disable strict context ID validation + // v0.3 allowed messages with both taskId and contextId even if they didn't match + context.getState().put(ServerCallContext.STRICT_CONTEXT_VALIDATION_KEY, false); + + // Call v1.0 handler + EventKind v10Result = v10Handler.onMessageSend(v10Params, context); + + // Convert v1.0 result → v0.3 result + return EventKindMapper_v0_3.INSTANCE.fromV10(v10Result); + } + + /** + * Sends a message (streaming). + *

+ * v0.3 → v1.0: Converts MessageSendParams and streams StreamingEventKind + * + * @param v03Params the v0.3 message send params + * @param context the server call context + * @return publisher of v0.3 streaming event kinds + * @throws A2AError if an error occurs + */ + public Flow.Publisher onMessageSendStream( + MessageSendParams_v0_3 v03Params, + ServerCallContext context) throws A2AError { + + // Convert v0.3 params → v1.0 params + MessageSendParams v10Params = MessageSendParamsMapper_v0_3.INSTANCE.toV10(v03Params); + + // Enable v0.3 compatibility mode: disable strict context ID validation + // v0.3 allowed messages with both taskId and contextId even if they didn't match + context.getState().put(ServerCallContext.STRICT_CONTEXT_VALIDATION_KEY, false); + + // Get v1.0 publisher + Flow.Publisher v10Publisher = + v10Handler.onMessageSendStream(v10Params, context); + + // Convert each event using a mapping processor + return convertPublisher(v10Publisher, StreamingEventKindMapper_v0_3.INSTANCE::fromV10); + } + + /** + * Sets (creates) a task push notification configuration. + *

+ * v0.3 method name: {@code onSetTaskPushNotificationConfig} + * v1.0 method name: {@code onCreateTaskPushNotificationConfig} + * + * @param v03Config the v0.3 task push notification config + * @param context the server call context + * @return the v0.3 task push notification config + * @throws A2AError if an error occurs + */ + public TaskPushNotificationConfig_v0_3 onSetTaskPushNotificationConfig( + TaskPushNotificationConfig_v0_3 v03Config, + ServerCallContext context) throws A2AError { + + // Convert v0.3 config → v1.0 config + TaskPushNotificationConfig v10Config = + TaskPushNotificationConfigMapper_v0_3.INSTANCE.toV10(v03Config); + + // Call v1.0 handler + TaskPushNotificationConfig v10Result = + v10Handler.onCreateTaskPushNotificationConfig(v10Config, context); + + // Convert v1.0 result → v0.3 result + return TaskPushNotificationConfigMapper_v0_3.INSTANCE.fromV10(v10Result); + } + + /** + * Gets a task push notification configuration. + *

+ * v0.3 → v1.0: Converts GetTaskPushNotificationConfigParams and TaskPushNotificationConfig + *

+ * v0.3 semantics: If a specific pushNotificationConfigId is provided but not found, + * fall back to returning the first config (lenient behavior). + * + * @param v03Params the v0.3 get params + * @param context the server call context + * @return the v0.3 task push notification config + * @throws A2AError if an error occurs + */ + public TaskPushNotificationConfig_v0_3 onGetTaskPushNotificationConfig( + GetTaskPushNotificationConfigParams_v0_3 v03Params, + ServerCallContext context) throws A2AError { + + // Convert v0.3 params → v1.0 params + // v0.3: id = taskId, pushNotificationConfigId = optional config id + // v1.0: taskId = taskId, id = config id (defaults to taskId if not specified) + String configId = v03Params.pushNotificationConfigId() != null + ? v03Params.pushNotificationConfigId() + : v03Params.id(); // Default to taskId when config id not specified + + GetTaskPushNotificationConfigParams v10Params = + new GetTaskPushNotificationConfigParams(v03Params.id(), configId); + + TaskPushNotificationConfig v10Result; + try { + // Call v1.0 handler + v10Result = v10Handler.onGetTaskPushNotificationConfig(v10Params, context); + } catch (TaskNotFoundError e) { + // v0.3 fallback behavior: if specific config ID not found, return first config + // This matches v0.3 DefaultRequestHandler.getPushNotificationConfig() behavior + if (v03Params.pushNotificationConfigId() != null) { + ListTaskPushNotificationConfigsParams listParams = + new ListTaskPushNotificationConfigsParams(v03Params.id()); + ListTaskPushNotificationConfigsResult listResult = + v10Handler.onListTaskPushNotificationConfigs(listParams, context); + + if (listResult.configs().isEmpty()) { + throw e; // Re-throw if no configs exist at all + } + // Return first config as fallback + v10Result = listResult.configs().get(0); + } else { + throw e; // Re-throw if no fallback is applicable + } + } + + // Convert v1.0 result → v0.3 result + return TaskPushNotificationConfigMapper_v0_3.INSTANCE.fromV10(v10Result); + } + + /** + * Resubscribes to task updates (streaming). + *

+ * v0.3 method name: {@code onResubscribeToTask} + * v1.0 method name: {@code onSubscribeToTask} + * + * @param v03Params the v0.3 task ID params + * @param context the server call context + * @return publisher of v0.3 streaming event kinds + * @throws A2AError if an error occurs + */ + public Flow.Publisher onResubscribeToTask( + TaskIdParams_v0_3 v03Params, + ServerCallContext context) throws A2AError { + + // Convert v0.3 params → v1.0 params + TaskIdParams v10Params = TaskIdParamsMapper_v0_3.INSTANCE.toV10(v03Params); + + // Get v1.0 publisher + Flow.Publisher v10Publisher = + v10Handler.onSubscribeToTask(v10Params, context); + + // Convert each event using a mapping processor + return convertPublisher(v10Publisher, StreamingEventKindMapper_v0_3.INSTANCE::fromV10); + } + + /** + * Lists task push notification configurations. + *

+ * v0.3 → v1.0: Converts params and result (List → ListTaskPushNotificationConfigsResult) + * + * @param v03Params the v0.3 list params + * @param context the server call context + * @return list of v0.3 task push notification configs + * @throws A2AError if an error occurs + */ + public List onListTaskPushNotificationConfig( + ListTaskPushNotificationConfigParams_v0_3 v03Params, + ServerCallContext context) throws A2AError { + + // Convert v0.3 params → v1.0 params + // ListTaskPushNotificationConfigParams has different structure - v0.3 has id, v1.0 has more fields + ListTaskPushNotificationConfigsParams v10Params = + new ListTaskPushNotificationConfigsParams( + v03Params.id(), + 0, // No pageSize in v0.3 - use 0 (will use default) + "", // No pageToken in v0.3 - use empty string + "" // Default tenant + ); + + // Call v1.0 handler + ListTaskPushNotificationConfigsResult v10Result = + v10Handler.onListTaskPushNotificationConfigs(v10Params, context); + + // Convert v1.0 result → v0.3 result (extract list from result wrapper) + return ListTaskPushNotificationConfigsResultMapper_v0_3.INSTANCE.fromV10(v10Result); + } + + /** + * Deletes a task push notification configuration. + *

+ * v0.3 → v1.0: Converts DeleteTaskPushNotificationConfigParams (adds tenant field) + * + * @param v03Params the v0.3 delete params + * @param context the server call context + * @throws A2AError if an error occurs + */ + public void onDeleteTaskPushNotificationConfig( + DeleteTaskPushNotificationConfigParams_v0_3 v03Params, + ServerCallContext context) throws A2AError { + + // Convert v0.3 params → v1.0 params (add tenant field) + DeleteTaskPushNotificationConfigParams v10Params = + new DeleteTaskPushNotificationConfigParams( + v03Params.id(), + v03Params.pushNotificationConfigId(), + "" // Default tenant + ); + + // Call v1.0 handler + v10Handler.onDeleteTaskPushNotificationConfig(v10Params, context); + } + + /** + * Converts a v1.0 publisher to a v0.3 publisher by applying a mapper to each element. + * + * @param v10Publisher the v1.0 publisher + * @param mapper function to convert each v1.0 element to v0.3 + * @param the v1.0 element type + * @param the v0.3 element type + * @return publisher of v0.3 elements + */ + private Flow.Publisher convertPublisher( + Flow.Publisher v10Publisher, + java.util.function.Function mapper) { + + return subscriber -> v10Publisher.subscribe(new Flow.Subscriber() { + @Override + public void onSubscribe(Flow.Subscription subscription) { + subscriber.onSubscribe(subscription); + } + + @Override + public void onNext(V10 v10Item) { + try { + V03 v03Item = mapper.apply(v10Item); + subscriber.onNext(v03Item); + } catch (Exception e) { + subscriber.onError(e); + } + } + + @Override + public void onError(Throwable throwable) { + subscriber.onError(throwable); + } + + @Override + public void onComplete() { + subscriber.onComplete(); + } + }); + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/ErrorConverter_v0_3.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/ErrorConverter_v0_3.java new file mode 100644 index 000000000..4e5c51a2c --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/ErrorConverter_v0_3.java @@ -0,0 +1,91 @@ +package org.a2aproject.sdk.compat03.conversion; + +import org.a2aproject.sdk.compat03.spec.AuthenticatedExtendedCardNotConfiguredError_v0_3; +import org.a2aproject.sdk.compat03.spec.ContentTypeNotSupportedError_v0_3; +import org.a2aproject.sdk.compat03.spec.InternalError_v0_3; +import org.a2aproject.sdk.compat03.spec.InvalidAgentResponseError_v0_3; +import org.a2aproject.sdk.compat03.spec.InvalidParamsError_v0_3; +import org.a2aproject.sdk.compat03.spec.InvalidRequestError_v0_3; +import org.a2aproject.sdk.compat03.spec.JSONParseError_v0_3; +import org.a2aproject.sdk.compat03.spec.JSONRPCError_v0_3; +import org.a2aproject.sdk.compat03.spec.MethodNotFoundError_v0_3; +import org.a2aproject.sdk.compat03.spec.PushNotificationNotSupportedError_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskNotCancelableError_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskNotFoundError_v0_3; +import org.a2aproject.sdk.compat03.spec.UnsupportedOperationError_v0_3; +import org.a2aproject.sdk.spec.A2AError; +import org.a2aproject.sdk.spec.ContentTypeNotSupportedError; +import org.a2aproject.sdk.spec.ExtendedAgentCardNotConfiguredError; +import org.a2aproject.sdk.spec.InternalError; +import org.a2aproject.sdk.spec.InvalidAgentResponseError; +import org.a2aproject.sdk.spec.InvalidParamsError; +import org.a2aproject.sdk.spec.InvalidRequestError; +import org.a2aproject.sdk.spec.JSONParseError; +import org.a2aproject.sdk.spec.MethodNotFoundError; +import org.a2aproject.sdk.spec.PushNotificationNotSupportedError; +import org.a2aproject.sdk.spec.TaskNotCancelableError; +import org.a2aproject.sdk.spec.TaskNotFoundError; +import org.a2aproject.sdk.spec.UnsupportedOperationError; + +/** + * Utility for converting v1.0 A2AError instances to v0.3 JSONRPCError instances. + *

+ * This converter preserves specific error types to ensure proper status code mapping + * in transport handlers (REST HTTP status codes, gRPC status codes, etc.). + *

+ */ +public final class ErrorConverter_v0_3 { + + private ErrorConverter_v0_3() { + // Utility class + } + + /** + * Converts a v1.0 A2AError to a v0.3 JSONRPCError. + *

+ * Since A2AError in v0.3 is an interface and JSONRPCError is the concrete implementation, + * we need to convert the v1.0 A2AError to the v0.3 JSONRPCError type. + * This method preserves specific error types by using instanceof checks to map + * v1.0 errors to their v0.3 equivalents. + *

+ * + * @param v10Error the v1.0 A2AError to convert + * @return the equivalent v0.3 JSONRPCError, preserving the specific error type + */ + public static JSONRPCError_v0_3 convertA2AError(A2AError v10Error) { + // A2AError from v1.0 has: code, message (via getMessage()), details + // JSONRPCError from v0.3 has: code, message (via getMessage()), data + // Preserve exact error code, message, and details from v1.0 error + + // Preserve specific error types by mapping v1.0 errors to v0.3 equivalents + if (v10Error instanceof TaskNotFoundError) { + return new TaskNotFoundError_v0_3(v10Error.getCode(), v10Error.getMessage(), v10Error.getDetails()); + } else if (v10Error instanceof UnsupportedOperationError) { + return new UnsupportedOperationError_v0_3(v10Error.getCode(), v10Error.getMessage(), v10Error.getDetails()); + } else if (v10Error instanceof TaskNotCancelableError) { + return new TaskNotCancelableError_v0_3(v10Error.getCode(), v10Error.getMessage(), v10Error.getDetails()); + } else if (v10Error instanceof InvalidParamsError) { + return new InvalidParamsError_v0_3(v10Error.getCode(), v10Error.getMessage(), v10Error.getDetails()); + } else if (v10Error instanceof InvalidRequestError) { + return new InvalidRequestError_v0_3(v10Error.getCode(), v10Error.getMessage(), v10Error.getDetails()); + } else if (v10Error instanceof InternalError) { + return new InternalError_v0_3(v10Error.getMessage()); + } else if (v10Error instanceof InvalidAgentResponseError) { + return new InvalidAgentResponseError_v0_3(v10Error.getCode(), v10Error.getMessage(), v10Error.getDetails()); + } else if (v10Error instanceof ContentTypeNotSupportedError) { + return new ContentTypeNotSupportedError_v0_3(v10Error.getCode(), v10Error.getMessage(), v10Error.getDetails()); + } else if (v10Error instanceof PushNotificationNotSupportedError) { + return new PushNotificationNotSupportedError_v0_3(v10Error.getCode(), v10Error.getMessage(), v10Error.getDetails()); + } else if (v10Error instanceof MethodNotFoundError) { + return new MethodNotFoundError_v0_3(v10Error.getCode(), v10Error.getMessage(), v10Error.getDetails()); + } else if (v10Error instanceof JSONParseError) { + return new JSONParseError_v0_3(v10Error.getCode(), v10Error.getMessage(), v10Error.getDetails()); + } else if (v10Error instanceof ExtendedAgentCardNotConfiguredError) { + return new AuthenticatedExtendedCardNotConfiguredError_v0_3( + v10Error.getCode(), v10Error.getMessage(), v10Error.getDetails()); + } + + // Fallback to generic JSONRPCError for unmapped types + return new JSONRPCError_v0_3(v10Error.getCode(), v10Error.getMessage(), v10Error.getDetails()); + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/config/A03ToV10MapperConfig.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/config/A03ToV10MapperConfig.java new file mode 100644 index 000000000..4067ef9f2 --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/config/A03ToV10MapperConfig.java @@ -0,0 +1,42 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.config; + +import org.mapstruct.MapperConfig; +import org.mapstruct.NullValuePropertyMappingStrategy; +import org.mapstruct.ReportingPolicy; + +/** + * Global MapStruct configuration for converting between A2A Protocol v0.3 and v1.0 types. + *

+ * This configuration interface provides shared settings and default conversion methods + * used by all mappers in the compat-0.3 conversion layer. It ensures consistent handling + * of unmapped fields, null values, and component instantiation across the codebase. + *

+ * Key Configuration: + *

    + *
  • unmappedTargetPolicy = ERROR: Compile-time validation ensures no fields are missed
  • + *
  • componentModel = "default": Uses singleton pattern via {@link A2AMappers_v0_3} factory
  • + *
  • nullValuePropertyMappingStrategy = IGNORE: Skip null source properties during mapping
  • + *
+ * + * @see A2AMappers_v0_3 + */ +@MapperConfig( + unmappedTargetPolicy = ReportingPolicy.ERROR, + componentModel = "default", + nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE +) +public interface A03ToV10MapperConfig { + + /** + * Default tenant value for conversions from 0.3 to 1.0. + *

+ * The 1.0 protocol adds a tenant field that doesn't exist in 0.3. + * When converting from 0.3 to 1.0, we use an empty string as the default tenant, + * matching the 1.0 MessageSendParams convenience constructor default. + * + * @return empty string as default tenant + */ + default String tenantDefault() { + return ""; + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/config/A2AMappers_v0_3.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/config/A2AMappers_v0_3.java new file mode 100644 index 000000000..2bdb85967 --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/config/A2AMappers_v0_3.java @@ -0,0 +1,69 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.config; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +/** + * Singleton factory for MapStruct mapper instances in the v0.3 to v1.0 conversion layer. + *

+ * This factory provides centralized access to mapper implementations, ensuring that + * each mapper interface has exactly one instance (singleton pattern). MapStruct + * generates implementation classes with an "Impl" suffix at compile time, and this + * factory uses reflection to instantiate and cache them. + *

+ * Example usage: + *

{@code
+ * public interface TaskStateMapper {
+ *     TaskStateMapper INSTANCE = A03Mappers.getMapper(TaskStateMapper.class);
+ *
+ *     org.a2aproject.sdk.spec.TaskState toV10(
+ *         org.a2aproject.sdk.compat03.spec.TaskState v03);
+ * }
+ * }
+ * + * Thread Safety: This factory uses {@link ConcurrentHashMap} to ensure thread-safe + * lazy initialization of mapper instances. + * + * @see A03ToV10MapperConfig + */ +public final class A2AMappers_v0_3 { + + /** + * Cache of instantiated mapper instances. + * Key: Mapper interface class, Value: Singleton mapper instance + */ + private static final Map, Object> MAPPERS = new ConcurrentHashMap<>(); + + /** + * Private constructor to prevent instantiation. + */ + private A2AMappers_v0_3() { + throw new UnsupportedOperationException("Utility class cannot be instantiated"); + } + + /** + * Returns the singleton instance of the specified mapper interface. + *

+ * This method uses reflection to load the MapStruct-generated implementation class + * (interface name + "Impl" suffix) and caches it for future use. If the implementation + * class cannot be loaded or instantiated, a {@link RuntimeException} is thrown. + * + * @param mapperInterface the mapper interface class (e.g., {@code TaskStateMapper.class}) + * @param the mapper type + * @return the singleton instance of the mapper + * @throws RuntimeException if the mapper implementation cannot be loaded or instantiated + */ + @SuppressWarnings("unchecked") + public static T getMapper(Class mapperInterface) { + return (T) MAPPERS.computeIfAbsent(mapperInterface, clazz -> { + try { + // MapStruct generates implementation with "Impl" suffix + String implName = clazz.getName() + "Impl"; + Class implClass = Class.forName(implName); + return implClass.getDeclaredConstructor().newInstance(); + } catch (Exception e) { + throw new RuntimeException("Failed to load mapper: " + clazz.getName(), e); + } + }); + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/ArtifactMapper_v0_3.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/ArtifactMapper_v0_3.java new file mode 100644 index 000000000..166842cbb --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/ArtifactMapper_v0_3.java @@ -0,0 +1,83 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.domain; + +import java.util.List; +import java.util.stream.Collectors; + +import org.a2aproject.sdk.compat03.conversion.mappers.config.A2AMappers_v0_3; +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03ToV10MapperConfig; +import org.a2aproject.sdk.compat03.spec.Artifact_v0_3; +import org.a2aproject.sdk.compat03.spec.Part_v0_3; +import org.a2aproject.sdk.spec.Artifact; +import org.a2aproject.sdk.spec.Part; +import org.mapstruct.Mapper; + +/** + * Bidirectional mapper for converting Artifact between A2A Protocol v0.3 and v1.0. + *

+ * Both versions are records with the same structure: + * {@code Artifact(artifactId, name, description, parts, metadata, extensions)}. + *

+ * The conversion primarily involves converting the nested {@link Part} list using {@link PartMapper_v0_3}. + */ +@Mapper(config = A03ToV10MapperConfig.class, uses = {PartMapper_v0_3.class}) +public interface ArtifactMapper_v0_3 { + + /** + * Singleton instance accessed via {@link A2AMappers_v0_3} factory. + */ + ArtifactMapper_v0_3 INSTANCE = A2AMappers_v0_3.getMapper(ArtifactMapper_v0_3.class); + + /** + * Converts v0.3 Artifact to v1.0 Artifact. + *

+ * Converts all Part instances in the parts list using PartMapper. + * + * @param v03 the v0.3 artifact + * @return the equivalent v1.0 artifact + */ + default Artifact toV10(Artifact_v0_3 v03) { + if (v03 == null) { + return null; + } + + List> parts = v03.parts().stream() + .map(PartMapper_v0_3.INSTANCE::toV10) + .collect(Collectors.toList()); + + return new Artifact( + v03.artifactId(), + v03.name(), + v03.description(), + parts, + v03.metadata(), + v03.extensions() + ); + } + + /** + * Converts v1.0 Artifact to v0.3 Artifact. + *

+ * Converts all Part instances in the parts list using PartMapper. + * + * @param v10 the v1.0 artifact + * @return the equivalent v0.3 artifact + */ + default Artifact_v0_3 fromV10(Artifact v10) { + if (v10 == null) { + return null; + } + + List> parts = v10.parts().stream() + .map(PartMapper_v0_3.INSTANCE::fromV10) + .collect(Collectors.toList()); + + return new Artifact_v0_3( + v10.artifactId(), + v10.name(), + v10.description(), + parts, + v10.metadata(), + v10.extensions() + ); + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/AuthenticationInfoMapper_v0_3.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/AuthenticationInfoMapper_v0_3.java new file mode 100644 index 000000000..f0c1106a3 --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/AuthenticationInfoMapper_v0_3.java @@ -0,0 +1,119 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.domain; + +import java.util.List; + +import org.a2aproject.sdk.compat03.conversion.mappers.config.A2AMappers_v0_3; +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03ToV10MapperConfig; +import org.a2aproject.sdk.compat03.spec.AuthenticationInfo_v0_3; +import org.a2aproject.sdk.compat03.spec.PushNotificationAuthenticationInfo_v0_3; +import org.a2aproject.sdk.spec.AuthenticationInfo; +import org.mapstruct.Mapper; + +/** + * Bidirectional mapper for converting AuthenticationInfo between A2A Protocol v0.3 and v1.0. + *

+ * Key differences: + *

    + *
  • v0.3: {@code AuthenticationInfo(List schemes, String credentials)} - supports multiple schemes
  • + *
  • v1.0: {@code AuthenticationInfo(String scheme, String credentials)} - single scheme only
  • + *
+ *

+ * Conversion strategy: + *

    + *
  • v0.3 → v1.0: Takes the first scheme from the list (or empty string if list is empty)
  • + *
  • v1.0 → v0.3: Wraps the single scheme in a list
  • + *
+ *

+ * Note: v0.3 also has {@code PushNotificationAuthenticationInfo} which has the same structure + * as v0.3 {@code AuthenticationInfo}, so this mapper handles both. + */ +@Mapper(config = A03ToV10MapperConfig.class) +public interface AuthenticationInfoMapper_v0_3 { + + /** + * Singleton instance accessed via {@link A2AMappers_v0_3} factory. + */ + AuthenticationInfoMapper_v0_3 INSTANCE = A2AMappers_v0_3.getMapper(AuthenticationInfoMapper_v0_3.class); + + /** + * Converts v0.3 AuthenticationInfo to v1.0 AuthenticationInfo. + *

+ * Takes the first scheme from the v0.3 schemes list. If the list is empty or null, + * uses an empty string for the v1.0 scheme. + * + * @param v03 the v0.3 authentication info + * @return the equivalent v1.0 authentication info + */ + default AuthenticationInfo toV10(AuthenticationInfo_v0_3 v03) { + if (v03 == null) { + return null; + } + + String scheme = (v03.schemes() != null && !v03.schemes().isEmpty()) + ? v03.schemes().get(0) + : ""; + + return new AuthenticationInfo(scheme, v03.credentials()); + } + + /** + * Converts v0.3 PushNotificationAuthenticationInfo to v1.0 AuthenticationInfo. + *

+ * Takes the first scheme from the v0.3 schemes list. If the list is empty or null, + * uses an empty string for the v1.0 scheme. + * + * @param v03 the v0.3 push notification authentication info + * @return the equivalent v1.0 authentication info + */ + default AuthenticationInfo toV10FromPushNotification( + PushNotificationAuthenticationInfo_v0_3 v03) { + if (v03 == null) { + return null; + } + + String scheme = (v03.schemes() != null && !v03.schemes().isEmpty()) + ? v03.schemes().get(0) + : ""; + + return new AuthenticationInfo(scheme, v03.credentials()); + } + + /** + * Converts v1.0 AuthenticationInfo to v0.3 AuthenticationInfo. + *

+ * Wraps the v1.0 single scheme in a list for v0.3. + * + * @param v10 the v1.0 authentication info + * @return the equivalent v0.3 authentication info + */ + default AuthenticationInfo_v0_3 fromV10(AuthenticationInfo v10) { + if (v10 == null) { + return null; + } + + return new AuthenticationInfo_v0_3( + List.of(v10.scheme()), + v10.credentials() + ); + } + + /** + * Converts v1.0 AuthenticationInfo to v0.3 PushNotificationAuthenticationInfo. + *

+ * Wraps the v1.0 single scheme in a list for v0.3. + * + * @param v10 the v1.0 authentication info + * @return the equivalent v0.3 push notification authentication info + */ + default PushNotificationAuthenticationInfo_v0_3 fromV10ToPushNotification( + AuthenticationInfo v10) { + if (v10 == null) { + return null; + } + + return new PushNotificationAuthenticationInfo_v0_3( + List.of(v10.scheme()), + v10.credentials() + ); + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/EventKindMapper_v0_3.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/EventKindMapper_v0_3.java new file mode 100644 index 000000000..e8fffde04 --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/EventKindMapper_v0_3.java @@ -0,0 +1,97 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.domain; + +import org.a2aproject.sdk.compat03.conversion.mappers.config.A2AMappers_v0_3; +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03ToV10MapperConfig; +import org.a2aproject.sdk.compat03.spec.EventKind_v0_3; +import org.a2aproject.sdk.compat03.spec.Message_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskArtifactUpdateEvent_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskStatusUpdateEvent_v0_3; +import org.a2aproject.sdk.compat03.spec.Task_v0_3; +import org.a2aproject.sdk.spec.EventKind; +import org.a2aproject.sdk.spec.InvalidRequestError; +import org.a2aproject.sdk.spec.Message; +import org.a2aproject.sdk.spec.Task; +import org.a2aproject.sdk.spec.TaskArtifactUpdateEvent; +import org.a2aproject.sdk.spec.TaskStatusUpdateEvent; +import org.mapstruct.Mapper; + +/** + * Bidirectional polymorphic mapper for converting EventKind between A2A Protocol v0.3 and v1.0. + *

+ * Handles conversion for all EventKind implementers: + *

    + *
  • {@link Task}
  • + *
  • {@link Message}
  • + *
  • {@link TaskStatusUpdateEvent}
  • + *
  • {@link TaskArtifactUpdateEvent}
  • + *
+ *

+ * Uses instanceof dispatch to determine the concrete type and delegates to the appropriate mapper. + */ +@Mapper(config = A03ToV10MapperConfig.class, uses = { + TaskMapper_v0_3.class, + MessageMapper_v0_3.class, + TaskStatusUpdateEventMapper_v0_3.class, + TaskArtifactUpdateEventMapper_v0_3.class +}) +public interface EventKindMapper_v0_3 { + + /** + * Singleton instance accessed via {@link A2AMappers_v0_3} factory. + */ + EventKindMapper_v0_3 INSTANCE = A2AMappers_v0_3.getMapper(EventKindMapper_v0_3.class); + + /** + * Converts v0.3 EventKind to v1.0 EventKind. + *

+ * Uses instanceof dispatch to determine the concrete type and delegates to the appropriate mapper. + * + * @param v03 the v0.3 event kind + * @return the equivalent v1.0 event kind + * @throws InvalidRequestError if the event kind type is unrecognized + */ + default EventKind toV10(EventKind_v0_3 v03) { + if (v03 == null) { + return null; + } + + if (v03 instanceof Task_v0_3 v03Task) { + return TaskMapper_v0_3.INSTANCE.toV10(v03Task); + } else if (v03 instanceof Message_v0_3 v03Message) { + return MessageMapper_v0_3.INSTANCE.toV10(v03Message); + } else if (v03 instanceof TaskStatusUpdateEvent_v0_3 v03StatusUpdate) { + return TaskStatusUpdateEventMapper_v0_3.INSTANCE.toV10(v03StatusUpdate); + } else if (v03 instanceof TaskArtifactUpdateEvent_v0_3 v03ArtifactUpdate) { + return TaskArtifactUpdateEventMapper_v0_3.INSTANCE.toV10(v03ArtifactUpdate); + } + + throw new InvalidRequestError(null, "Unrecognized EventKind type: " + v03.getClass().getName(), null); + } + + /** + * Converts v1.0 EventKind to v0.3 EventKind. + *

+ * Uses instanceof dispatch to determine the concrete type and delegates to the appropriate mapper. + * + * @param v10 the v1.0 event kind + * @return the equivalent v0.3 event kind + * @throws InvalidRequestError if the event kind type is unrecognized + */ + default EventKind_v0_3 fromV10(EventKind v10) { + if (v10 == null) { + return null; + } + + if (v10 instanceof Task v10Task) { + return TaskMapper_v0_3.INSTANCE.fromV10(v10Task); + } else if (v10 instanceof Message v10Message) { + return MessageMapper_v0_3.INSTANCE.fromV10(v10Message); + } else if (v10 instanceof TaskStatusUpdateEvent v10StatusUpdate) { + return TaskStatusUpdateEventMapper_v0_3.INSTANCE.fromV10(v10StatusUpdate); + } else if (v10 instanceof TaskArtifactUpdateEvent v10ArtifactUpdate) { + return TaskArtifactUpdateEventMapper_v0_3.INSTANCE.fromV10(v10ArtifactUpdate); + } + + throw new InvalidRequestError(null, "Unrecognized EventKind type: " + v10.getClass().getName(), null); + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/FileContentMapper_v0_3.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/FileContentMapper_v0_3.java new file mode 100644 index 000000000..c77998042 --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/FileContentMapper_v0_3.java @@ -0,0 +1,92 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.domain; + +import org.a2aproject.sdk.compat03.conversion.mappers.config.A2AMappers_v0_3; +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03ToV10MapperConfig; +import org.a2aproject.sdk.compat03.spec.FileContent_v0_3; +import org.a2aproject.sdk.compat03.spec.FileWithBytes_v0_3; +import org.a2aproject.sdk.compat03.spec.FileWithUri_v0_3; +import org.a2aproject.sdk.spec.FileContent; +import org.a2aproject.sdk.spec.FileWithBytes; +import org.a2aproject.sdk.spec.FileWithUri; +import org.a2aproject.sdk.spec.InvalidRequestError; +import org.mapstruct.Mapper; + +/** + * Bidirectional mapper for converting FileContent types between A2A Protocol v0.3 and v1.0. + *

+ * Handles polymorphic FileContent conversion for: + *

    + *
  • {@link FileWithBytes_v0_3} ↔ {@link FileWithBytes}
  • + *
  • {@link FileWithUri_v0_3} ↔ {@link FileWithUri}
  • + *
+ *

+ * Key differences: + *

    + *
  • v0.3: FileWithBytes and FileWithUri are simple records
  • + *
  • v1.0: FileWithBytes is a complex class with lazy loading; FileWithUri is a simple record
  • + *
+ *

+ * The conversion preserves the mimeType, name, and content (bytes or uri) fields across both versions. + */ +@Mapper(config = A03ToV10MapperConfig.class) +public interface FileContentMapper_v0_3 { + + /** + * Singleton instance accessed via {@link A2AMappers_v0_3} factory. + */ + FileContentMapper_v0_3 INSTANCE = A2AMappers_v0_3.getMapper(FileContentMapper_v0_3.class); + + /** + * Converts v0.3 FileContent to v1.0 FileContent. + *

+ * Handles FileWithBytes and FileWithUri polymorphism using instanceof dispatch. + * + * @param v03 the v0.3 file content + * @return the equivalent v1.0 file content + * @throws InvalidRequestError if the file content type is unrecognized + */ + default FileContent toV10(FileContent_v0_3 v03) { + if (v03 == null) { + return null; + } + + if (v03 instanceof FileWithBytes_v0_3 v03Bytes) { + return new FileWithBytes(v03Bytes.mimeType(), v03Bytes.name(), v03Bytes.bytes()); + } else if (v03 instanceof FileWithUri_v0_3 v03Uri) { + return new FileWithUri(v03Uri.mimeType(), v03Uri.name(), v03Uri.uri()); + } + + throw new InvalidRequestError(null, "Unrecognized FileContent type: " + v03.getClass().getName(), null); + } + + /** + * Converts v1.0 FileContent to v0.3 FileContent. + *

+ * Handles FileWithBytes and FileWithUri polymorphism using instanceof dispatch. + * + * @param v10 the v1.0 file content + * @return the equivalent v0.3 file content + * @throws InvalidRequestError if the file content type is unrecognized + */ + default FileContent_v0_3 fromV10(FileContent v10) { + if (v10 == null) { + return null; + } + + if (v10 instanceof FileWithBytes v10Bytes) { + return new FileWithBytes_v0_3( + v10Bytes.mimeType(), + v10Bytes.name(), + v10Bytes.bytes() + ); + } else if (v10 instanceof FileWithUri v10Uri) { + return new FileWithUri_v0_3( + v10Uri.mimeType(), + v10Uri.name(), + v10Uri.uri() + ); + } + + throw new InvalidRequestError(null, "Unrecognized FileContent type: " + v10.getClass().getName(), null); + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/MessageMapper_v0_3.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/MessageMapper_v0_3.java new file mode 100644 index 000000000..2c5a71528 --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/MessageMapper_v0_3.java @@ -0,0 +1,96 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.domain; + +import java.util.List; +import java.util.stream.Collectors; + +import org.a2aproject.sdk.compat03.conversion.mappers.config.A2AMappers_v0_3; +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03ToV10MapperConfig; +import org.a2aproject.sdk.compat03.spec.Message_v0_3; +import org.a2aproject.sdk.compat03.spec.Part_v0_3; +import org.a2aproject.sdk.spec.Message; +import org.a2aproject.sdk.spec.Part; +import org.mapstruct.Mapper; + +/** + * Bidirectional mapper for converting Message between A2A Protocol v0.3 and v1.0. + *

+ * Key differences: + *

    + *
  • v0.3: Message is a class with getter methods (e.g., {@code getRole()}, {@code getParts()})
  • + *
  • v1.0: Message is a record with accessor methods (e.g., {@code role()}, {@code parts()})
  • + *
  • Role enum values have "ROLE_" prefix in v1.0
  • + *
  • Part types (TextPart, FilePart, DataPart) changed from classes to records in v1.0
  • + *
+ *

+ * Uses {@link RoleMapper_v0_3} and {@link PartMapper_v0_3} for nested conversions. + */ +@Mapper(config = A03ToV10MapperConfig.class, uses = {RoleMapper_v0_3.class, PartMapper_v0_3.class}) +public interface MessageMapper_v0_3 { + + /** + * Singleton instance accessed via {@link A2AMappers_v0_3} factory. + */ + MessageMapper_v0_3 INSTANCE = A2AMappers_v0_3.getMapper(MessageMapper_v0_3.class); + + /** + * Converts v0.3 Message to v1.0 Message. + *

+ * Converts all fields including role, parts, messageId, contextId, taskId, + * referenceTaskIds, metadata, and extensions. + * + * @param v03 the v0.3 message + * @return the equivalent v1.0 message + */ + default Message toV10(Message_v0_3 v03) { + if (v03 == null) { + return null; + } + + Message.Role role = RoleMapper_v0_3.INSTANCE.toV10(v03.getRole()); + List> parts = v03.getParts().stream() + .map(PartMapper_v0_3.INSTANCE::toV10) + .collect(Collectors.toList()); + + return new Message( + role, + parts, + v03.getMessageId(), + v03.getContextId(), + v03.getTaskId(), + v03.getReferenceTaskIds(), + v03.getMetadata(), + v03.getExtensions() + ); + } + + /** + * Converts v1.0 Message to v0.3 Message. + *

+ * Converts all fields including role, parts, messageId, contextId, taskId, + * referenceTaskIds, metadata, and extensions. + * + * @param v10 the v1.0 message + * @return the equivalent v0.3 message + */ + default Message_v0_3 fromV10(Message v10) { + if (v10 == null) { + return null; + } + + Message_v0_3.Role role = RoleMapper_v0_3.INSTANCE.fromV10(v10.role()); + List> parts = v10.parts().stream() + .map(PartMapper_v0_3.INSTANCE::fromV10) + .collect(Collectors.toList()); + + return new Message_v0_3( + role, + parts, + v10.messageId(), + v10.contextId(), + v10.taskId(), + v10.referenceTaskIds(), + v10.metadata(), + v10.extensions() + ); + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/PartMapper_v0_3.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/PartMapper_v0_3.java new file mode 100644 index 000000000..5da63952e --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/PartMapper_v0_3.java @@ -0,0 +1,104 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.domain; + +import org.a2aproject.sdk.compat03.conversion.mappers.config.A2AMappers_v0_3; +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03ToV10MapperConfig; +import org.a2aproject.sdk.compat03.spec.DataPart_v0_3; +import org.a2aproject.sdk.compat03.spec.FilePart_v0_3; +import org.a2aproject.sdk.compat03.spec.Part_v0_3; +import org.a2aproject.sdk.compat03.spec.TextPart_v0_3; +import org.a2aproject.sdk.spec.DataPart; +import org.a2aproject.sdk.spec.FilePart; +import org.a2aproject.sdk.spec.InvalidRequestError; +import org.a2aproject.sdk.spec.Part; +import org.a2aproject.sdk.spec.TextPart; +import org.mapstruct.Mapper; + +/** + * Bidirectional mapper for converting Part types between A2A Protocol v0.3 and v1.0. + *

+ * Handles polymorphic Part conversion for: + *

    + *
  • {@link TextPart_v0_3} ↔ {@link TextPart}
  • + *
  • {@link FilePart_v0_3} ↔ {@link FilePart}
  • + *
  • {@link DataPart_v0_3} ↔ {@link DataPart}
  • + *
+ *

+ * Key differences: + *

    + *
  • v0.3: Part types are classes with getter methods (e.g., {@code getText()}, {@code getMetadata()})
  • + *
  • v1.0: Part types are records with accessor methods (e.g., {@code text()}, {@code metadata()})
  • + *
+ *

+ * Uses manual instanceof dispatch to handle polymorphic conversion. + */ +@Mapper(config = A03ToV10MapperConfig.class) +public interface PartMapper_v0_3 { + + /** + * Singleton instance accessed via {@link A2AMappers_v0_3} factory. + */ + PartMapper_v0_3 INSTANCE = A2AMappers_v0_3.getMapper(PartMapper_v0_3.class); + + /** + * Converts v0.3 Part to v1.0 Part. + *

+ * Handles TextPart, FilePart, and DataPart polymorphism using instanceof dispatch. + * + * @param v03 the v0.3 part + * @return the equivalent v1.0 part + * @throws InvalidRequestError if the part type is unrecognized + */ + default Part toV10(Part_v0_3 v03) { + if (v03 == null) { + return null; + } + + if (v03 instanceof TextPart_v0_3 v03Text) { + return new TextPart(v03Text.getText(), v03Text.getMetadata()); + } else if (v03 instanceof FilePart_v0_3 v03File) { + return new FilePart( + FileContentMapper_v0_3.INSTANCE.toV10(v03File.getFile()), + v03File.getMetadata() + ); + } else if (v03 instanceof DataPart_v0_3 v03Data) { + return new DataPart(v03Data.getData(), v03Data.getMetadata()); + } + + throw new InvalidRequestError(null, "Unrecognized Part type: " + v03.getClass().getName(), null); + } + + /** + * Converts v1.0 Part to v0.3 Part. + *

+ * Handles TextPart, FilePart, and DataPart polymorphism using instanceof dispatch. + * + * @param v10 the v1.0 part + * @return the equivalent v0.3 part + * @throws InvalidRequestError if the part type is unrecognized + */ + default Part_v0_3 fromV10(Part v10) { + if (v10 == null) { + return null; + } + + if (v10 instanceof TextPart v10Text) { + return new TextPart_v0_3(v10Text.text(), v10Text.metadata()); + } else if (v10 instanceof FilePart v10File) { + return new FilePart_v0_3( + FileContentMapper_v0_3.INSTANCE.fromV10(v10File.file()), + v10File.metadata() + ); + } else if (v10 instanceof DataPart v10Data) { + // v1.0 DataPart.data() returns Object, but v0.3 expects Map + Object data = v10Data.data(); + if (!(data instanceof java.util.Map)) { + throw new InvalidRequestError(null, "DataPart data must be a Map for v0.3 compatibility", null); + } + @SuppressWarnings("unchecked") + java.util.Map dataMap = (java.util.Map) data; + return new DataPart_v0_3(dataMap, v10Data.metadata()); + } + + throw new InvalidRequestError(null, "Unrecognized Part type: " + v10.getClass().getName(), null); + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/RoleMapper_v0_3.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/RoleMapper_v0_3.java new file mode 100644 index 000000000..2ae2dc733 --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/RoleMapper_v0_3.java @@ -0,0 +1,60 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.domain; + +import org.a2aproject.sdk.compat03.conversion.mappers.config.A2AMappers_v0_3; +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03ToV10MapperConfig; +import org.a2aproject.sdk.compat03.spec.Message_v0_3; +import org.a2aproject.sdk.spec.Message; +import org.mapstruct.Mapper; + +/** + * Bidirectional mapper for converting Message.Role enum between A2A Protocol v0.3 and v1.0. + *

+ * Key differences: + *

    + *
  • v0.3: {@code USER}, {@code AGENT}
  • + *
  • v1.0: {@code ROLE_USER}, {@code ROLE_AGENT}
  • + *
+ *

+ * The v1.0 enum adds a "ROLE_" prefix to align with protocol buffer conventions. + */ +@Mapper(config = A03ToV10MapperConfig.class) +public interface RoleMapper_v0_3 { + + /** + * Singleton instance accessed via {@link A2AMappers_v0_3} factory. + */ + RoleMapper_v0_3 INSTANCE = A2AMappers_v0_3.getMapper(RoleMapper_v0_3.class); + + /** + * Converts v0.3 Role to v1.0 Role. + * + * @param v03 the v0.3 role + * @return the equivalent v1.0 role + */ + default Message.Role toV10(Message_v0_3.Role v03) { + if (v03 == null) { + return null; + } + return switch (v03) { + case USER -> Message.Role.ROLE_USER; + case AGENT -> Message.Role.ROLE_AGENT; + }; + } + + /** + * Converts v1.0 Role to v0.3 Role. + * + * @param v10 the v1.0 role + * @return the equivalent v0.3 role + */ + default Message_v0_3.Role fromV10(Message.Role v10) { + if (v10 == null) { + return null; + } + return switch (v10) { + case ROLE_USER -> Message_v0_3.Role.USER; + case ROLE_AGENT -> Message_v0_3.Role.AGENT; + default -> throw new IllegalArgumentException("Unrecognized Role: " + v10); + }; + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/StreamingEventKindMapper_v0_3.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/StreamingEventKindMapper_v0_3.java new file mode 100644 index 000000000..8a3fe90df --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/StreamingEventKindMapper_v0_3.java @@ -0,0 +1,100 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.domain; + +import org.a2aproject.sdk.compat03.conversion.mappers.config.A2AMappers_v0_3; +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03ToV10MapperConfig; +import org.a2aproject.sdk.compat03.spec.Message_v0_3; +import org.a2aproject.sdk.compat03.spec.StreamingEventKind_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskArtifactUpdateEvent_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskStatusUpdateEvent_v0_3; +import org.a2aproject.sdk.compat03.spec.Task_v0_3; +import org.a2aproject.sdk.spec.InvalidRequestError; +import org.a2aproject.sdk.spec.Message; +import org.a2aproject.sdk.spec.StreamingEventKind; +import org.a2aproject.sdk.spec.Task; +import org.a2aproject.sdk.spec.TaskArtifactUpdateEvent; +import org.a2aproject.sdk.spec.TaskStatusUpdateEvent; +import org.mapstruct.Mapper; + +/** + * Bidirectional polymorphic mapper for converting StreamingEventKind between A2A Protocol v0.3 and v1.0. + *

+ * Handles conversion for all StreamingEventKind implementers: + *

    + *
  • {@link Task}
  • + *
  • {@link Message}
  • + *
  • {@link TaskStatusUpdateEvent}
  • + *
  • {@link TaskArtifactUpdateEvent}
  • + *
+ *

+ * Uses instanceof dispatch to determine the concrete type and delegates to the appropriate mapper. + *

+ * Note: The same types implement both {@link org.a2aproject.sdk.spec.EventKind} and + * {@link StreamingEventKind}, so this mapper uses the same delegation logic as {@link EventKindMapper_v0_3}. + */ +@Mapper(config = A03ToV10MapperConfig.class, uses = { + TaskMapper_v0_3.class, + MessageMapper_v0_3.class, + TaskStatusUpdateEventMapper_v0_3.class, + TaskArtifactUpdateEventMapper_v0_3.class +}) +public interface StreamingEventKindMapper_v0_3 { + + /** + * Singleton instance accessed via {@link A2AMappers_v0_3} factory. + */ + StreamingEventKindMapper_v0_3 INSTANCE = A2AMappers_v0_3.getMapper(StreamingEventKindMapper_v0_3.class); + + /** + * Converts v0.3 StreamingEventKind to v1.0 StreamingEventKind. + *

+ * Uses instanceof dispatch to determine the concrete type and delegates to the appropriate mapper. + * + * @param v03 the v0.3 streaming event kind + * @return the equivalent v1.0 streaming event kind + * @throws InvalidRequestError if the streaming event kind type is unrecognized + */ + default StreamingEventKind toV10(StreamingEventKind_v0_3 v03) { + if (v03 == null) { + return null; + } + + if (v03 instanceof Task_v0_3 v03Task) { + return TaskMapper_v0_3.INSTANCE.toV10(v03Task); + } else if (v03 instanceof Message_v0_3 v03Message) { + return MessageMapper_v0_3.INSTANCE.toV10(v03Message); + } else if (v03 instanceof TaskStatusUpdateEvent_v0_3 v03StatusUpdate) { + return TaskStatusUpdateEventMapper_v0_3.INSTANCE.toV10(v03StatusUpdate); + } else if (v03 instanceof TaskArtifactUpdateEvent_v0_3 v03ArtifactUpdate) { + return TaskArtifactUpdateEventMapper_v0_3.INSTANCE.toV10(v03ArtifactUpdate); + } + + throw new InvalidRequestError(null, "Unrecognized StreamingEventKind type: " + v03.getClass().getName(), null); + } + + /** + * Converts v1.0 StreamingEventKind to v0.3 StreamingEventKind. + *

+ * Uses instanceof dispatch to determine the concrete type and delegates to the appropriate mapper. + * + * @param v10 the v1.0 streaming event kind + * @return the equivalent v0.3 streaming event kind + * @throws InvalidRequestError if the streaming event kind type is unrecognized + */ + default StreamingEventKind_v0_3 fromV10(StreamingEventKind v10) { + if (v10 == null) { + return null; + } + + if (v10 instanceof Task v10Task) { + return TaskMapper_v0_3.INSTANCE.fromV10(v10Task); + } else if (v10 instanceof Message v10Message) { + return MessageMapper_v0_3.INSTANCE.fromV10(v10Message); + } else if (v10 instanceof TaskStatusUpdateEvent v10StatusUpdate) { + return TaskStatusUpdateEventMapper_v0_3.INSTANCE.fromV10(v10StatusUpdate); + } else if (v10 instanceof TaskArtifactUpdateEvent v10ArtifactUpdate) { + return TaskArtifactUpdateEventMapper_v0_3.INSTANCE.fromV10(v10ArtifactUpdate); + } + + throw new InvalidRequestError(null, "Unrecognized StreamingEventKind type: " + v10.getClass().getName(), null); + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskArtifactUpdateEventMapper_v0_3.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskArtifactUpdateEventMapper_v0_3.java new file mode 100644 index 000000000..defde82ac --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskArtifactUpdateEventMapper_v0_3.java @@ -0,0 +1,74 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.domain; + +import org.a2aproject.sdk.compat03.conversion.mappers.config.A2AMappers_v0_3; +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03ToV10MapperConfig; +import org.a2aproject.sdk.compat03.spec.TaskArtifactUpdateEvent_v0_3; +import org.a2aproject.sdk.spec.TaskArtifactUpdateEvent; +import org.mapstruct.Mapper; + +/** + * Bidirectional mapper for converting TaskArtifactUpdateEvent between A2A Protocol v0.3 and v1.0. + *

+ * Key differences: + *

    + *
  • v0.3: TaskArtifactUpdateEvent is a class with getter methods (e.g., {@code getTaskId()}, {@code isAppend()})
  • + *
  • v1.0: TaskArtifactUpdateEvent is a record with accessor methods (e.g., {@code taskId()}, {@code append()})
  • + *
+ *

+ * Both versions have the same structure: + * {@code TaskArtifactUpdateEvent(taskId, artifact, contextId, append, lastChunk, metadata)}. + */ +@Mapper(config = A03ToV10MapperConfig.class, uses = {ArtifactMapper_v0_3.class}) +public interface TaskArtifactUpdateEventMapper_v0_3 { + + /** + * Singleton instance accessed via {@link A2AMappers_v0_3} factory. + */ + TaskArtifactUpdateEventMapper_v0_3 INSTANCE = A2AMappers_v0_3.getMapper(TaskArtifactUpdateEventMapper_v0_3.class); + + /** + * Converts v0.3 TaskArtifactUpdateEvent to v1.0 TaskArtifactUpdateEvent. + *

+ * Converts the nested Artifact using ArtifactMapper. + * + * @param v03 the v0.3 task artifact update event + * @return the equivalent v1.0 task artifact update event + */ + default TaskArtifactUpdateEvent toV10(TaskArtifactUpdateEvent_v0_3 v03) { + if (v03 == null) { + return null; + } + + return new TaskArtifactUpdateEvent( + v03.getTaskId(), + ArtifactMapper_v0_3.INSTANCE.toV10(v03.getArtifact()), + v03.getContextId(), + v03.isAppend(), + v03.isLastChunk(), + v03.getMetadata() + ); + } + + /** + * Converts v1.0 TaskArtifactUpdateEvent to v0.3 TaskArtifactUpdateEvent. + *

+ * Converts the nested Artifact using ArtifactMapper. + * + * @param v10 the v1.0 task artifact update event + * @return the equivalent v0.3 task artifact update event + */ + default TaskArtifactUpdateEvent_v0_3 fromV10(TaskArtifactUpdateEvent v10) { + if (v10 == null) { + return null; + } + + return new TaskArtifactUpdateEvent_v0_3( + v10.taskId(), + ArtifactMapper_v0_3.INSTANCE.fromV10(v10.artifact()), + v10.contextId(), + v10.append(), + v10.lastChunk(), + v10.metadata() + ); + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskMapper_v0_3.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskMapper_v0_3.java new file mode 100644 index 000000000..47d6a4e3c --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskMapper_v0_3.java @@ -0,0 +1,111 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.domain; + +import java.util.List; +import java.util.stream.Collectors; + +import org.a2aproject.sdk.compat03.conversion.mappers.config.A2AMappers_v0_3; +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03ToV10MapperConfig; +import org.a2aproject.sdk.compat03.spec.Artifact_v0_3; +import org.a2aproject.sdk.compat03.spec.Message_v0_3; +import org.a2aproject.sdk.compat03.spec.Task_v0_3; +import org.a2aproject.sdk.spec.Artifact; +import org.a2aproject.sdk.spec.Message; +import org.a2aproject.sdk.spec.Task; +import org.mapstruct.Mapper; + +/** + * Bidirectional mapper for converting Task between A2A Protocol v0.3 and v1.0. + *

+ * Key differences: + *

    + *
  • v0.3: Task is a class with getter methods (e.g., {@code getId()}, {@code getStatus()})
  • + *
  • v1.0: Task is a record with accessor methods (e.g., {@code id()}, {@code status()})
  • + *
  • v0.3 has a {@code kind} field with {@code getKind()} method
  • + *
  • v1.0 has a {@code kind()} method from the {@link org.a2aproject.sdk.spec.StreamingEventKind} interface
  • + *
+ *

+ * The conversion involves mapping nested types: + *

    + *
  • {@link org.a2aproject.sdk.spec.TaskStatus} via {@link TaskStatusMapper_v0_3}
  • + *
  • {@link Artifact} list via {@link ArtifactMapper_v0_3}
  • + *
  • {@link Message} history list via {@link MessageMapper_v0_3}
  • + *
+ */ +@Mapper(config = A03ToV10MapperConfig.class, uses = {TaskStatusMapper_v0_3.class, ArtifactMapper_v0_3.class, MessageMapper_v0_3.class}) +public interface TaskMapper_v0_3 { + + /** + * Singleton instance accessed via {@link A2AMappers_v0_3} factory. + */ + TaskMapper_v0_3 INSTANCE = A2AMappers_v0_3.getMapper(TaskMapper_v0_3.class); + + /** + * Converts v0.3 Task to v1.0 Task. + *

+ * Converts all nested objects including status, artifacts, and history using their respective mappers. + * + * @param v03 the v0.3 task + * @return the equivalent v1.0 task + */ + default Task toV10(Task_v0_3 v03) { + if (v03 == null) { + return null; + } + + List artifacts = v03.getArtifacts() != null + ? v03.getArtifacts().stream() + .map(ArtifactMapper_v0_3.INSTANCE::toV10) + .collect(Collectors.toList()) + : null; + + List history = v03.getHistory() != null + ? v03.getHistory().stream() + .map(MessageMapper_v0_3.INSTANCE::toV10) + .collect(Collectors.toList()) + : null; + + return new Task( + v03.getId(), + v03.getContextId(), + TaskStatusMapper_v0_3.INSTANCE.toV10(v03.getStatus()), + artifacts, + history, + v03.getMetadata() + ); + } + + /** + * Converts v1.0 Task to v0.3 Task. + *

+ * Converts all nested objects including status, artifacts, and history using their respective mappers. + * + * @param v10 the v1.0 task + * @return the equivalent v0.3 task + */ + default Task_v0_3 fromV10(Task v10) { + if (v10 == null) { + return null; + } + + List artifacts = v10.artifacts() != null + ? v10.artifacts().stream() + .map(ArtifactMapper_v0_3.INSTANCE::fromV10) + .collect(Collectors.toList()) + : null; + + List history = v10.history() != null + ? v10.history().stream() + .map(MessageMapper_v0_3.INSTANCE::fromV10) + .collect(Collectors.toList()) + : null; + + return new Task_v0_3( + v10.id(), + v10.contextId(), + TaskStatusMapper_v0_3.INSTANCE.fromV10(v10.status()), + artifacts, + history, + v10.metadata() + ); + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskPushNotificationConfigMapper_v0_3.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskPushNotificationConfigMapper_v0_3.java new file mode 100644 index 000000000..0b9534a30 --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskPushNotificationConfigMapper_v0_3.java @@ -0,0 +1,89 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.domain; + +import org.a2aproject.sdk.compat03.conversion.mappers.config.A2AMappers_v0_3; +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03ToV10MapperConfig; +import org.a2aproject.sdk.compat03.spec.PushNotificationConfig_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig_v0_3; +import org.a2aproject.sdk.spec.TaskPushNotificationConfig; +import org.mapstruct.Mapper; + +/** + * Bidirectional mapper for converting TaskPushNotificationConfig between A2A Protocol v0.3 and v1.0. + *

+ * Key differences: + *

    + *
  • v0.3: Nested structure with {@code TaskPushNotificationConfig(taskId, PushNotificationConfig)}
  • + *
  • v1.0: Flattened structure with {@code TaskPushNotificationConfig(id, taskId, url, token, authentication, tenant)}
  • + *
+ *

+ * Conversion strategy: + *

    + *
  • v0.3 → v1.0: Extract fields from nested {@code PushNotificationConfig}, add tenant field (default "")
  • + *
  • v1.0 → v0.3: Nest url/token/authentication/id into {@code PushNotificationConfig}, drop tenant field
  • + *
+ */ +@Mapper(config = A03ToV10MapperConfig.class, uses = {AuthenticationInfoMapper_v0_3.class}) +public interface TaskPushNotificationConfigMapper_v0_3 { + + /** + * Singleton instance accessed via {@link A2AMappers_v0_3} factory. + */ + TaskPushNotificationConfigMapper_v0_3 INSTANCE = A2AMappers_v0_3.getMapper(TaskPushNotificationConfigMapper_v0_3.class); + + /** + * Converts v0.3 TaskPushNotificationConfig to v1.0 TaskPushNotificationConfig. + *

+ * Flattens the nested {@code PushNotificationConfig} structure and adds the tenant field (default ""). + * + * @param v03 the v0.3 task push notification config + * @return the equivalent v1.0 task push notification config + */ + default TaskPushNotificationConfig toV10( + TaskPushNotificationConfig_v0_3 v03) { + if (v03 == null) { + return null; + } + + PushNotificationConfig_v0_3 pushConfig = v03.pushNotificationConfig(); + + // v0.3 id can be null; v1.0 requires non-null id but stores use empty string to auto-assign + String id = pushConfig.id() != null ? pushConfig.id() : ""; + + return new TaskPushNotificationConfig( + id, + v03.taskId(), + pushConfig.url(), + pushConfig.token(), + AuthenticationInfoMapper_v0_3.INSTANCE.toV10FromPushNotification(pushConfig.authentication()), + "" // Default tenant + ); + } + + /** + * Converts v1.0 TaskPushNotificationConfig to v0.3 TaskPushNotificationConfig. + *

+ * Nests the url/token/authentication/id fields into a {@code PushNotificationConfig} and drops the tenant field. + * + * @param v10 the v1.0 task push notification config + * @return the equivalent v0.3 task push notification config + */ + default TaskPushNotificationConfig_v0_3 fromV10( + TaskPushNotificationConfig v10) { + if (v10 == null) { + return null; + } + + PushNotificationConfig_v0_3 pushConfig = + new PushNotificationConfig_v0_3( + v10.url(), + v10.token(), + AuthenticationInfoMapper_v0_3.INSTANCE.fromV10ToPushNotification(v10.authentication()), + v10.id() + ); + + return new TaskPushNotificationConfig_v0_3( + v10.taskId(), + pushConfig + ); + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskStateMapper_v0_3.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskStateMapper_v0_3.java new file mode 100644 index 000000000..05f8b464d --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskStateMapper_v0_3.java @@ -0,0 +1,115 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.domain; + +import org.a2aproject.sdk.compat03.conversion.mappers.config.A2AMappers_v0_3; +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03ToV10MapperConfig; +import org.a2aproject.sdk.compat03.spec.TaskState_v0_3; +import org.a2aproject.sdk.spec.TaskState; +import org.mapstruct.Mapper; + +/** + * Bidirectional mapper for converting {@code TaskState} enum between A2A Protocol v0.3 and v1.0. + *

+ * This is a critical mapper because v1.0 adds the {@code TASK_STATE_} prefix to all enum constants: + *

    + *
  • v0.3: {@code SUBMITTED, WORKING, ...}
  • + *
  • v1.0: {@code TASK_STATE_SUBMITTED, TASK_STATE_WORKING, ...}
  • + *
+ *

+ * Additionally, the {@code UNKNOWN} state in v0.3 maps to {@code UNRECOGNIZED} in v1.0. + *

+ * This mapper uses manual switch statements instead of {@code @ValueMapping} to: + *

    + *
  • Avoid mapstruct-spi-protobuf enum strategy initialization issues
  • + *
  • Handle explicit null mapping (null → UNRECOGNIZED/UNKNOWN)
  • + *
  • Provide clear, compile-time-safe enum conversions
  • + *
+ * + * @see TaskState_v0_3 + * @see TaskState + */ +@Mapper(config = A03ToV10MapperConfig.class) +public interface TaskStateMapper_v0_3 { + + /** + * Singleton instance accessed via {@link A2AMappers_v0_3} factory. + */ + TaskStateMapper_v0_3 INSTANCE = A2AMappers_v0_3.getMapper(TaskStateMapper_v0_3.class); + + /** + * Converts a v0.3 {@code TaskState} to v1.0 {@code TaskState}. + *

+ * Mapping: + *

+     * 0.3                    → 1.0
+     * ─────────────────────────────────────────────
+     * SUBMITTED              → TASK_STATE_SUBMITTED
+     * WORKING                → TASK_STATE_WORKING
+     * INPUT_REQUIRED         → TASK_STATE_INPUT_REQUIRED
+     * AUTH_REQUIRED          → TASK_STATE_AUTH_REQUIRED
+     * COMPLETED              → TASK_STATE_COMPLETED
+     * CANCELED               → TASK_STATE_CANCELED
+     * FAILED                 → TASK_STATE_FAILED
+     * REJECTED               → TASK_STATE_REJECTED
+     * UNKNOWN                → UNRECOGNIZED
+     * null                   → UNRECOGNIZED
+     * 
+ * + * @param v03 the v0.3 task state (may be null) + * @return the equivalent v1.0 task state (never null) + */ + default TaskState toV10(TaskState_v0_3 v03) { + if (v03 == null) { + return TaskState.UNRECOGNIZED; + } + return switch (v03) { + case SUBMITTED -> TaskState.TASK_STATE_SUBMITTED; + case WORKING -> TaskState.TASK_STATE_WORKING; + case INPUT_REQUIRED -> TaskState.TASK_STATE_INPUT_REQUIRED; + case AUTH_REQUIRED -> TaskState.TASK_STATE_AUTH_REQUIRED; + case COMPLETED -> TaskState.TASK_STATE_COMPLETED; + case CANCELED -> TaskState.TASK_STATE_CANCELED; + case FAILED -> TaskState.TASK_STATE_FAILED; + case REJECTED -> TaskState.TASK_STATE_REJECTED; + case UNKNOWN -> TaskState.UNRECOGNIZED; + }; + } + + /** + * Converts a v1.0 {@code TaskState} to v0.3 {@code TaskState}. + *

+ * Reverse mapping: + *

+     * 1.0                          → 0.3
+     * ───────────────────────────────────────────────────
+     * TASK_STATE_SUBMITTED         → SUBMITTED
+     * TASK_STATE_WORKING           → WORKING
+     * TASK_STATE_INPUT_REQUIRED    → INPUT_REQUIRED
+     * TASK_STATE_AUTH_REQUIRED     → AUTH_REQUIRED
+     * TASK_STATE_COMPLETED         → COMPLETED
+     * TASK_STATE_CANCELED          → CANCELED
+     * TASK_STATE_FAILED            → FAILED
+     * TASK_STATE_REJECTED          → REJECTED
+     * UNRECOGNIZED                 → UNKNOWN
+     * null                         → UNKNOWN
+     * 
+ * + * @param v10 the v1.0 task state (may be null) + * @return the equivalent v0.3 task state (never null) + */ + default TaskState_v0_3 fromV10(TaskState v10) { + if (v10 == null) { + return TaskState_v0_3.UNKNOWN; + } + return switch (v10) { + case TASK_STATE_SUBMITTED -> TaskState_v0_3.SUBMITTED; + case TASK_STATE_WORKING -> TaskState_v0_3.WORKING; + case TASK_STATE_INPUT_REQUIRED -> TaskState_v0_3.INPUT_REQUIRED; + case TASK_STATE_AUTH_REQUIRED -> TaskState_v0_3.AUTH_REQUIRED; + case TASK_STATE_COMPLETED -> TaskState_v0_3.COMPLETED; + case TASK_STATE_CANCELED -> TaskState_v0_3.CANCELED; + case TASK_STATE_FAILED -> TaskState_v0_3.FAILED; + case TASK_STATE_REJECTED -> TaskState_v0_3.REJECTED; + case UNRECOGNIZED -> TaskState_v0_3.UNKNOWN; + }; + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskStatusMapper_v0_3.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskStatusMapper_v0_3.java new file mode 100644 index 000000000..f72aafcf7 --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskStatusMapper_v0_3.java @@ -0,0 +1,71 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.domain; + +import org.a2aproject.sdk.compat03.conversion.mappers.config.A2AMappers_v0_3; +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03ToV10MapperConfig; +import org.a2aproject.sdk.compat03.spec.Message_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskState_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskStatus_v0_3; +import org.a2aproject.sdk.spec.TaskStatus; +import org.mapstruct.Mapper; + +/** + * Bidirectional mapper for converting TaskStatus between A2A Protocol v0.3 and v1.0. + *

+ * Both versions are records with the same structure: + * {@code TaskStatus(TaskState state, Message message, OffsetDateTime timestamp)}. + *

+ * The conversion involves: + *

    + *
  • Converting {@link TaskState_v0_3} to {@link org.a2aproject.sdk.spec.TaskState} (enum prefix mapping)
  • + *
  • Converting {@link Message_v0_3} to {@link org.a2aproject.sdk.spec.Message} (class ↔ record)
  • + *
  • Preserving the timestamp field (same type in both versions)
  • + *
+ */ +@Mapper(config = A03ToV10MapperConfig.class, uses = {TaskStateMapper_v0_3.class, MessageMapper_v0_3.class}) +public interface TaskStatusMapper_v0_3 { + + /** + * Singleton instance accessed via {@link A2AMappers_v0_3} factory. + */ + TaskStatusMapper_v0_3 INSTANCE = A2AMappers_v0_3.getMapper(TaskStatusMapper_v0_3.class); + + /** + * Converts v0.3 TaskStatus to v1.0 TaskStatus. + *

+ * Converts the state enum and message object using their respective mappers. + * + * @param v03 the v0.3 task status + * @return the equivalent v1.0 task status + */ + default TaskStatus toV10(TaskStatus_v0_3 v03) { + if (v03 == null) { + return null; + } + + return new TaskStatus( + TaskStateMapper_v0_3.INSTANCE.toV10(v03.state()), + MessageMapper_v0_3.INSTANCE.toV10(v03.message()), + v03.timestamp() + ); + } + + /** + * Converts v1.0 TaskStatus to v0.3 TaskStatus. + *

+ * Converts the state enum and message object using their respective mappers. + * + * @param v10 the v1.0 task status + * @return the equivalent v0.3 task status + */ + default TaskStatus_v0_3 fromV10(TaskStatus v10) { + if (v10 == null) { + return null; + } + + return new TaskStatus_v0_3( + TaskStateMapper_v0_3.INSTANCE.fromV10(v10.state()), + MessageMapper_v0_3.INSTANCE.fromV10(v10.message()), + v10.timestamp() + ); + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskStatusUpdateEventMapper_v0_3.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskStatusUpdateEventMapper_v0_3.java new file mode 100644 index 000000000..733688954 --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskStatusUpdateEventMapper_v0_3.java @@ -0,0 +1,72 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.domain; + +import org.a2aproject.sdk.compat03.conversion.mappers.config.A2AMappers_v0_3; +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03ToV10MapperConfig; +import org.a2aproject.sdk.compat03.spec.TaskStatusUpdateEvent_v0_3; +import org.a2aproject.sdk.spec.TaskStatusUpdateEvent; +import org.mapstruct.Mapper; + +/** + * Bidirectional mapper for converting TaskStatusUpdateEvent between A2A Protocol v0.3 and v1.0. + *

+ * Key differences: + *

    + *
  • v0.3: TaskStatusUpdateEvent is a class with getter methods
  • + *
  • v1.0: TaskStatusUpdateEvent is a record with accessor methods
  • + *
+ *

+ * Both versions have the same structure: + * {@code TaskStatusUpdateEvent(taskId, status, contextId, isFinal, metadata)}. + */ +@Mapper(config = A03ToV10MapperConfig.class, uses = {TaskStatusMapper_v0_3.class}) +public interface TaskStatusUpdateEventMapper_v0_3 { + + /** + * Singleton instance accessed via {@link A2AMappers_v0_3} factory. + */ + TaskStatusUpdateEventMapper_v0_3 INSTANCE = A2AMappers_v0_3.getMapper(TaskStatusUpdateEventMapper_v0_3.class); + + /** + * Converts v0.3 TaskStatusUpdateEvent to v1.0 TaskStatusUpdateEvent. + *

+ * Converts the nested TaskStatus using TaskStatusMapper. + * + * @param v03 the v0.3 task status update event + * @return the equivalent v1.0 task status update event + */ + default TaskStatusUpdateEvent toV10(TaskStatusUpdateEvent_v0_3 v03) { + if (v03 == null) { + return null; + } + + return new TaskStatusUpdateEvent( + v03.getTaskId(), + TaskStatusMapper_v0_3.INSTANCE.toV10(v03.getStatus()), + v03.getContextId(), + v03.isFinal(), + v03.getMetadata() + ); + } + + /** + * Converts v1.0 TaskStatusUpdateEvent to v0.3 TaskStatusUpdateEvent. + *

+ * Converts the nested TaskStatus using TaskStatusMapper. + * + * @param v10 the v1.0 task status update event + * @return the equivalent v0.3 task status update event + */ + default TaskStatusUpdateEvent_v0_3 fromV10(TaskStatusUpdateEvent v10) { + if (v10 == null) { + return null; + } + + return new TaskStatusUpdateEvent_v0_3( + v10.taskId(), + TaskStatusMapper_v0_3.INSTANCE.fromV10(v10.status()), + v10.contextId(), + v10.isFinal(), + v10.metadata() + ); + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/params/CancelTaskParamsMapper_v0_3.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/params/CancelTaskParamsMapper_v0_3.java new file mode 100644 index 000000000..67ee7a597 --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/params/CancelTaskParamsMapper_v0_3.java @@ -0,0 +1,72 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.params; + +import java.util.Collections; + +import org.a2aproject.sdk.compat03.conversion.mappers.config.A2AMappers_v0_3; +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03ToV10MapperConfig; +import org.a2aproject.sdk.compat03.spec.TaskIdParams_v0_3; +import org.a2aproject.sdk.spec.CancelTaskParams; +import org.mapstruct.Mapper; + +/** + * Bidirectional mapper for converting cancel task parameters between A2A Protocol v0.3 and v1.0. + *

+ * Key differences: + *

    + *
  • v0.3: Uses {@code TaskIdParams(String id, Map metadata)}
  • + *
  • v1.0: Uses {@code CancelTaskParams(String id, String tenant, Map metadata)}
  • + *
+ *

+ * Conversion strategy: + *

    + *
  • 0.3 → 1.0: Convert {@code TaskIdParams} to {@code CancelTaskParams} (add {@code tenant} field = "", preserve {@code metadata})
  • + *
  • 1.0 → 0.3: Convert {@code CancelTaskParams} to {@code TaskIdParams} (drop {@code tenant} field, preserve {@code metadata})
  • + *
+ * + * @see TaskIdParams_v0_3 + * @see CancelTaskParams + */ +@Mapper(config = A03ToV10MapperConfig.class) +public interface CancelTaskParamsMapper_v0_3 { + + /** + * Singleton instance accessed via {@link A2AMappers_v0_3} factory. + */ + CancelTaskParamsMapper_v0_3 INSTANCE = A2AMappers_v0_3.getMapper(CancelTaskParamsMapper_v0_3.class); + + /** + * Converts v0.3 {@code TaskIdParams} to v1.0 {@code CancelTaskParams}. + *

+ * The v0.3 {@code metadata} field is preserved in the v1.0 type, and the v1.0 + * {@code tenant} field is set to the empty string default. + * + * @param v03 the v0.3 task ID params used for cancel operations + * @return the equivalent v1.0 cancel task params + */ + default CancelTaskParams toV10(TaskIdParams_v0_3 v03) { + if (v03 == null) { + return null; + } + return new CancelTaskParams( + v03.id(), + "", // Default tenant + v03.metadata() != null ? v03.metadata() : Collections.emptyMap() + ); + } + + /** + * Converts v1.0 {@code CancelTaskParams} to v0.3 {@code TaskIdParams}. + *

+ * The v1.0 {@code tenant} field is dropped, and the v1.0 {@code metadata} field + * is preserved in the v0.3 type. + * + * @param v10 the v1.0 cancel task params + * @return the equivalent v0.3 task ID params + */ + default TaskIdParams_v0_3 fromV10(CancelTaskParams v10) { + if (v10 == null) { + return null; + } + return new TaskIdParams_v0_3(v10.id(), v10.metadata()); + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/params/MessageSendConfigurationMapper_v0_3.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/params/MessageSendConfigurationMapper_v0_3.java new file mode 100644 index 000000000..c1228087e --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/params/MessageSendConfigurationMapper_v0_3.java @@ -0,0 +1,107 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.params; + +import org.a2aproject.sdk.compat03.conversion.mappers.config.A2AMappers_v0_3; +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03ToV10MapperConfig; +import org.a2aproject.sdk.compat03.conversion.mappers.domain.TaskPushNotificationConfigMapper_v0_3; +import org.a2aproject.sdk.compat03.spec.MessageSendConfiguration_v0_3; +import org.a2aproject.sdk.compat03.spec.PushNotificationConfig_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig_v0_3; +import org.a2aproject.sdk.spec.MessageSendConfiguration; +import org.a2aproject.sdk.spec.TaskPushNotificationConfig; +import org.mapstruct.Mapper; + +/** + * Bidirectional mapper for converting MessageSendConfiguration between A2A Protocol v0.3 and v1.0. + *

+ * Key differences: + *

    + *
  • v0.3: {@code PushNotificationConfig pushNotificationConfig, Boolean blocking}
  • + *
  • v1.0: {@code TaskPushNotificationConfig taskPushNotificationConfig, Boolean returnImmediately}
  • + *
+ *

+ * Conversion strategy: + *

    + *
  • {@code blocking} (v0.3) ↔ {@code returnImmediately} (v1.0): Inverse semantics - {@code returnImmediately = !blocking}
  • + *
  • {@code PushNotificationConfig} wraps to {@code TaskPushNotificationConfig} with empty taskId
  • + *
+ */ +@Mapper(config = A03ToV10MapperConfig.class, uses = {TaskPushNotificationConfigMapper_v0_3.class}) +public interface MessageSendConfigurationMapper_v0_3 { + + /** + * Singleton instance accessed via {@link A2AMappers_v0_3} factory. + */ + MessageSendConfigurationMapper_v0_3 INSTANCE = A2AMappers_v0_3.getMapper(MessageSendConfigurationMapper_v0_3.class); + + /** + * Converts v0.3 MessageSendConfiguration to v1.0 MessageSendConfiguration. + *

+ * Converts {@code blocking} to {@code returnImmediately} with inverse semantics, + * and wraps {@code PushNotificationConfig} into {@code TaskPushNotificationConfig}. + * + * @param v03 the v0.3 message send configuration + * @return the equivalent v1.0 message send configuration + */ + default MessageSendConfiguration toV10( + MessageSendConfiguration_v0_3 v03) { + if (v03 == null) { + return null; + } + + // Convert PushNotificationConfig to TaskPushNotificationConfig if present + TaskPushNotificationConfig taskPushConfig = null; + if (v03.pushNotificationConfig() != null) { + // Wrap the push notification config with an empty taskId (will be set by the server) + TaskPushNotificationConfig_v0_3 v03TaskConfig = + new TaskPushNotificationConfig_v0_3( + "", // Empty taskId - will be populated by server + v03.pushNotificationConfig() + ); + taskPushConfig = TaskPushNotificationConfigMapper_v0_3.INSTANCE.toV10(v03TaskConfig); + } + + // Convert blocking to returnImmediately (inverse semantics) + Boolean returnImmediately = v03.blocking() != null ? !v03.blocking() : null; + + return new MessageSendConfiguration( + v03.acceptedOutputModes(), + v03.historyLength(), + taskPushConfig, + returnImmediately + ); + } + + /** + * Converts v1.0 MessageSendConfiguration to v0.3 MessageSendConfiguration. + *

+ * Converts {@code returnImmediately} to {@code blocking} with inverse semantics, + * and extracts {@code PushNotificationConfig} from {@code TaskPushNotificationConfig}. + * + * @param v10 the v1.0 message send configuration + * @return the equivalent v0.3 message send configuration + */ + default MessageSendConfiguration_v0_3 fromV10( + MessageSendConfiguration v10) { + if (v10 == null) { + return null; + } + + // Extract PushNotificationConfig from TaskPushNotificationConfig if present + PushNotificationConfig_v0_3 pushConfig = null; + if (v10.taskPushNotificationConfig() != null) { + TaskPushNotificationConfig_v0_3 v03TaskConfig = + TaskPushNotificationConfigMapper_v0_3.INSTANCE.fromV10(v10.taskPushNotificationConfig()); + pushConfig = v03TaskConfig.pushNotificationConfig(); + } + + // Convert returnImmediately to blocking (inverse semantics) + Boolean blocking = v10.returnImmediately() != null ? !v10.returnImmediately() : null; + + return new MessageSendConfiguration_v0_3( + v10.acceptedOutputModes(), + v10.historyLength(), + pushConfig, + blocking + ); + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/params/MessageSendParamsMapper_v0_3.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/params/MessageSendParamsMapper_v0_3.java new file mode 100644 index 000000000..862b4e0c8 --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/params/MessageSendParamsMapper_v0_3.java @@ -0,0 +1,75 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.params; + +import org.a2aproject.sdk.compat03.conversion.mappers.config.A2AMappers_v0_3; +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03ToV10MapperConfig; +import org.a2aproject.sdk.compat03.conversion.mappers.domain.MessageMapper_v0_3; +import org.a2aproject.sdk.compat03.spec.MessageSendParams_v0_3; +import org.a2aproject.sdk.spec.MessageSendParams; +import org.mapstruct.Mapper; + +/** + * Bidirectional mapper for converting MessageSendParams between A2A Protocol v0.3 and v1.0. + *

+ * Key differences: + *

    + *
  • v0.3: {@code MessageSendParams(message, configuration, metadata)} - no tenant field
  • + *
  • v1.0: {@code MessageSendParams(message, configuration, metadata, tenant)} - adds tenant field
  • + *
+ *

+ * Conversion strategy: + *

    + *
  • v0.3 → v1.0: Add tenant field with default value ""
  • + *
  • v1.0 → v0.3: Drop tenant field
  • + *
+ *

+ * Uses {@link MessageMapper_v0_3} and {@link MessageSendConfigurationMapper_v0_3} for nested conversions. + */ +@Mapper(config = A03ToV10MapperConfig.class, uses = {MessageMapper_v0_3.class, MessageSendConfigurationMapper_v0_3.class}) +public interface MessageSendParamsMapper_v0_3 { + + /** + * Singleton instance accessed via {@link A2AMappers_v0_3} factory. + */ + MessageSendParamsMapper_v0_3 INSTANCE = A2AMappers_v0_3.getMapper(MessageSendParamsMapper_v0_3.class); + + /** + * Converts v0.3 MessageSendParams to v1.0 MessageSendParams. + *

+ * Adds the tenant field with default value "". + * + * @param v03 the v0.3 message send params + * @return the equivalent v1.0 message send params + */ + default MessageSendParams toV10(MessageSendParams_v0_3 v03) { + if (v03 == null) { + return null; + } + + return new MessageSendParams( + MessageMapper_v0_3.INSTANCE.toV10(v03.message()), + MessageSendConfigurationMapper_v0_3.INSTANCE.toV10(v03.configuration()), + v03.metadata(), + "" // Default tenant + ); + } + + /** + * Converts v1.0 MessageSendParams to v0.3 MessageSendParams. + *

+ * Drops the tenant field. + * + * @param v10 the v1.0 message send params + * @return the equivalent v0.3 message send params + */ + default MessageSendParams_v0_3 fromV10(MessageSendParams v10) { + if (v10 == null) { + return null; + } + + return new MessageSendParams_v0_3( + MessageMapper_v0_3.INSTANCE.fromV10(v10.message()), + MessageSendConfigurationMapper_v0_3.INSTANCE.fromV10(v10.configuration()), + v10.metadata() + ); + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/params/TaskIdParamsMapper_v0_3.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/params/TaskIdParamsMapper_v0_3.java new file mode 100644 index 000000000..b8ae86dec --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/params/TaskIdParamsMapper_v0_3.java @@ -0,0 +1,66 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.params; + +import org.a2aproject.sdk.compat03.conversion.mappers.config.A2AMappers_v0_3; +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03ToV10MapperConfig; +import org.a2aproject.sdk.compat03.spec.TaskIdParams_v0_3; +import org.a2aproject.sdk.spec.TaskIdParams; +import org.mapstruct.Mapper; + +/** + * Bidirectional mapper for converting {@code TaskIdParams} between A2A Protocol v0.3 and v1.0. + *

+ * Key differences: + *

    + *
  • v0.3: {@code TaskIdParams(String id, Map metadata)}
  • + *
  • v1.0: {@code TaskIdParams(String id, String tenant)}
  • + *
+ *

+ * Conversion strategy: + *

    + *
  • 0.3 → 1.0: Drop {@code metadata} field, add {@code tenant} field (default to "")
  • + *
  • 1.0 → 0.3: Drop {@code tenant} field, add {@code metadata} field (set to null)
  • + *
+ * + * @see TaskIdParams_v0_3 + * @see TaskIdParams + */ +@Mapper(config = A03ToV10MapperConfig.class) +public interface TaskIdParamsMapper_v0_3 { + + /** + * Singleton instance accessed via {@link A2AMappers_v0_3} factory. + */ + TaskIdParamsMapper_v0_3 INSTANCE = A2AMappers_v0_3.getMapper(TaskIdParamsMapper_v0_3.class); + + /** + * Converts v0.3 {@code TaskIdParams} to v1.0 {@code TaskIdParams}. + *

+ * The {@code metadata} field from v0.3 is dropped, and the v1.0 {@code tenant} field + * is set to the empty string default. + * + * @param v03 the v0.3 task ID params + * @return the equivalent v1.0 task ID params + */ + default TaskIdParams toV10(TaskIdParams_v0_3 v03) { + if (v03 == null) { + return null; + } + return new TaskIdParams(v03.id(), ""); + } + + /** + * Converts v1.0 {@code TaskIdParams} to v0.3 {@code TaskIdParams}. + *

+ * The {@code tenant} field from v1.0 is dropped, and the v0.3 {@code metadata} field + * is set to null. + * + * @param v10 the v1.0 task ID params + * @return the equivalent v0.3 task ID params + */ + default TaskIdParams_v0_3 fromV10(TaskIdParams v10) { + if (v10 == null) { + return null; + } + return new TaskIdParams_v0_3(v10.id(), null); + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/params/TaskQueryParamsMapper_v0_3.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/params/TaskQueryParamsMapper_v0_3.java new file mode 100644 index 000000000..31357b42e --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/params/TaskQueryParamsMapper_v0_3.java @@ -0,0 +1,84 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.params; + +import org.a2aproject.sdk.compat03.conversion.mappers.config.A2AMappers_v0_3; +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03ToV10MapperConfig; +import org.a2aproject.sdk.compat03.spec.TaskQueryParams_v0_3; +import org.a2aproject.sdk.spec.TaskQueryParams; +import org.mapstruct.Mapper; + +/** + * Bidirectional mapper for converting {@code TaskQueryParams} between A2A Protocol v0.3 and v1.0. + *

+ * Key differences: + *

    + *
  • v0.3: {@code TaskQueryParams(String id, int historyLength, Map metadata)}
  • + *
  • v1.0: {@code TaskQueryParams(String id, Integer historyLength, String tenant)}
  • + *
+ *

+ * Conversion strategy: + *

    + *
  • 0.3 → 1.0: + *
      + *
    • {@code historyLength}: primitive int → nullable Integer (0 → null)
    • + *
    • {@code metadata}: dropped
    • + *
    • {@code tenant}: added as ""
    • + *
    + *
  • + *
  • 1.0 → 0.3: + *
      + *
    • {@code historyLength}: nullable Integer → primitive int (null → 0)
    • + *
    • {@code metadata}: added as null
    • + *
    • {@code tenant}: dropped
    • + *
    + *
  • + *
+ * + * @see TaskQueryParams_v0_3 + * @see TaskQueryParams + */ +@Mapper(config = A03ToV10MapperConfig.class) +public interface TaskQueryParamsMapper_v0_3 { + + /** + * Singleton instance accessed via {@link A2AMappers_v0_3} factory. + */ + TaskQueryParamsMapper_v0_3 INSTANCE = A2AMappers_v0_3.getMapper(TaskQueryParamsMapper_v0_3.class); + + /** + * Converts v0.3 {@code TaskQueryParams} to v1.0 {@code TaskQueryParams}. + *

+ * The {@code metadata} field from v0.3 is dropped, the {@code historyLength} is converted + * from primitive int to nullable Integer (0 becomes null), and the v1.0 {@code tenant} + * field is set to the empty string default. + * + * @param v03 the v0.3 task query params + * @return the equivalent v1.0 task query params + */ + default TaskQueryParams toV10(TaskQueryParams_v0_3 v03) { + if (v03 == null) { + return null; + } + // Convert historyLength: 0 (default) → null, non-zero → Integer + Integer historyLength = v03.historyLength() == 0 ? null : v03.historyLength(); + return new TaskQueryParams(v03.id(), historyLength, ""); + } + + /** + * Converts v1.0 {@code TaskQueryParams} to v0.3 {@code TaskQueryParams}. + *

+ * The {@code tenant} field from v1.0 is dropped, the {@code historyLength} is converted + * from nullable Integer to primitive int (null becomes 0), and the v0.3 {@code metadata} + * field is set to null. + * + * @param v10 the v1.0 task query params + * @return the equivalent v0.3 task query params + */ + default TaskQueryParams_v0_3 fromV10(TaskQueryParams v10) { + if (v10 == null) { + return null; + } + // Convert historyLength: null → 0 (default), Integer → int + int historyLength = v10.historyLength() == null ? 0 : v10.historyLength(); + return new TaskQueryParams_v0_3(v10.id(), historyLength, null); + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/result/ListTaskPushNotificationConfigsResultMapper_v0_3.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/result/ListTaskPushNotificationConfigsResultMapper_v0_3.java new file mode 100644 index 000000000..95320f8c8 --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/result/ListTaskPushNotificationConfigsResultMapper_v0_3.java @@ -0,0 +1,79 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.result; + +import java.util.List; +import java.util.stream.Collectors; + +import org.a2aproject.sdk.compat03.conversion.mappers.config.A2AMappers_v0_3; +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03ToV10MapperConfig; +import org.a2aproject.sdk.compat03.conversion.mappers.domain.TaskPushNotificationConfigMapper_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig_v0_3; +import org.a2aproject.sdk.spec.ListTaskPushNotificationConfigsResult; +import org.a2aproject.sdk.spec.TaskPushNotificationConfig; +import org.mapstruct.Mapper; + +/** + * Bidirectional mapper for converting between v0.3 {@code List} + * and v1.0 {@link ListTaskPushNotificationConfigsResult}. + *

+ * Key differences: + *

    + *
  • v0.3: Returns a plain {@code List} (no pagination support)
  • + *
  • v1.0: Returns {@link ListTaskPushNotificationConfigsResult} with pagination support (nextPageToken)
  • + *
+ *

+ * Conversion strategy: + *

    + *
  • v0.3 → v1.0: Wrap the list in {@code ListTaskPushNotificationConfigsResult} with no nextPageToken
  • + *
  • v1.0 → v0.3: Extract the configs list (discard nextPageToken as 0.3 doesn't support pagination)
  • + *
+ */ +@Mapper(config = A03ToV10MapperConfig.class, uses = {TaskPushNotificationConfigMapper_v0_3.class}) +public interface ListTaskPushNotificationConfigsResultMapper_v0_3 { + + /** + * Singleton instance accessed via {@link A2AMappers_v0_3} factory. + */ + ListTaskPushNotificationConfigsResultMapper_v0_3 INSTANCE = A2AMappers_v0_3.getMapper(ListTaskPushNotificationConfigsResultMapper_v0_3.class); + + /** + * Converts v0.3 {@code List} to v1.0 {@link ListTaskPushNotificationConfigsResult}. + *

+ * Wraps the list in a result object with no nextPageToken (pagination not supported in 0.3). + * Converts each TaskPushNotificationConfig using TaskPushNotificationConfigMapper. + * + * @param v03List the v0.3 list of task push notification configs + * @return the equivalent v1.0 result object + */ + default ListTaskPushNotificationConfigsResult toV10( + List v03List) { + if (v03List == null) { + return null; + } + + List v10Configs = v03List.stream() + .map(TaskPushNotificationConfigMapper_v0_3.INSTANCE::toV10) + .collect(Collectors.toList()); + + return new ListTaskPushNotificationConfigsResult(v10Configs, null); + } + + /** + * Converts v1.0 {@link ListTaskPushNotificationConfigsResult} to v0.3 {@code List}. + *

+ * Extracts the configs list and discards the nextPageToken (pagination not supported in 0.3). + * Converts each TaskPushNotificationConfig using TaskPushNotificationConfigMapper. + * + * @param v10Result the v1.0 result object + * @return the equivalent v0.3 list + */ + default List fromV10( + ListTaskPushNotificationConfigsResult v10Result) { + if (v10Result == null) { + return null; + } + + return v10Result.configs().stream() + .map(TaskPushNotificationConfigMapper_v0_3.INSTANCE::fromV10) + .collect(Collectors.toList()); + } +} diff --git a/compat-0.3/server-conversion/src/main/resources/META-INF/beans.xml b/compat-0.3/server-conversion/src/main/resources/META-INF/beans.xml new file mode 100644 index 000000000..548d44b72 --- /dev/null +++ b/compat-0.3/server-conversion/src/main/resources/META-INF/beans.xml @@ -0,0 +1,6 @@ + + + diff --git a/compat-0.3/server-conversion/src/test/java/org/a2aproject/sdk/compat03/conversion/AbstractA2ARequestHandlerTest_v0_3.java b/compat-0.3/server-conversion/src/test/java/org/a2aproject/sdk/compat03/conversion/AbstractA2ARequestHandlerTest_v0_3.java new file mode 100644 index 000000000..701e2ea63 --- /dev/null +++ b/compat-0.3/server-conversion/src/test/java/org/a2aproject/sdk/compat03/conversion/AbstractA2ARequestHandlerTest_v0_3.java @@ -0,0 +1,287 @@ +package org.a2aproject.sdk.compat03.conversion; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.Executor; +import java.util.concurrent.Executors; +import java.util.function.Consumer; + +import jakarta.enterprise.context.Dependent; + +import org.a2aproject.sdk.client.http.A2AHttpClient; +import org.a2aproject.sdk.client.http.A2AHttpResponse; +import org.a2aproject.sdk.jsonrpc.common.json.JsonProcessingException; +import org.a2aproject.sdk.jsonrpc.common.json.JsonUtil; +import org.a2aproject.sdk.server.agentexecution.AgentExecutor; +import org.a2aproject.sdk.server.agentexecution.RequestContext; +import org.a2aproject.sdk.server.events.EventQueueUtil; +import org.a2aproject.sdk.server.events.InMemoryQueueManager; +import org.a2aproject.sdk.server.events.MainEventBus; +import org.a2aproject.sdk.server.events.MainEventBusProcessor; +import org.a2aproject.sdk.server.requesthandlers.DefaultRequestHandler; +import org.a2aproject.sdk.server.tasks.AgentEmitter; +import org.a2aproject.sdk.server.tasks.BasePushNotificationSender; +import org.a2aproject.sdk.server.tasks.InMemoryPushNotificationConfigStore; +import org.a2aproject.sdk.server.tasks.InMemoryTaskStore; +import org.a2aproject.sdk.server.tasks.PushNotificationConfigStore; +import org.a2aproject.sdk.server.tasks.PushNotificationSender; +import org.a2aproject.sdk.server.tasks.TaskStore; +import org.a2aproject.sdk.spec.A2AError; +import org.a2aproject.sdk.spec.StreamingEventKind; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import io.quarkus.arc.profile.IfBuildProfile; + +// V0.3 imports for test fixtures +import org.a2aproject.sdk.compat03.spec.AgentCapabilities_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentCard_v0_3; +import org.a2aproject.sdk.compat03.spec.Message_v0_3; +import org.a2aproject.sdk.compat03.spec.Task_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskState_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskStatus_v0_3; +import org.a2aproject.sdk.compat03.spec.TextPart_v0_3; + +/** + * Base test class for v0.3 transport handler tests. + *

+ * This class sets up the test infrastructure that bridges v0.3 transport handlers + * to the v1.0 backend via the {@link Convert_v0_3_To10RequestHandler} conversion layer. + *

+ * + *

Architecture:

+ *
+ * Test (v0.3 types) → Handler (v0.3) → Convert03To10RequestHandler → v1.0 Backend
+ * 
+ * + *

Test fixtures:

+ * All test fixtures use v0.3 types ({@code org.a2aproject.sdk.compat03.spec.*}) + * to match the client perspective. + * + *

Backend:

+ * The backend uses v1.0 components ({@code org.a2aproject.sdk.server.*}) with + * the conversion happening transparently in {@link Convert_v0_3_To10RequestHandler}. + */ +public abstract class AbstractA2ARequestHandlerTest_v0_3 { + + // V0.3 test fixtures (client perspective) + protected static final AgentCard_v0_3 CARD = createAgentCard(true, true, true); + + protected static final Task_v0_3 MINIMAL_TASK = new Task_v0_3.Builder() + .id("task-123") + .contextId("session-xyz") + .status(new TaskStatus_v0_3(TaskState_v0_3.SUBMITTED)) + .build(); + + protected static final Message_v0_3 MESSAGE = new Message_v0_3.Builder() + .messageId("111") + .role(Message_v0_3.Role.AGENT) + .parts(new TextPart_v0_3("test message")) + .build(); + + private static final PushNotificationSender NOOP_PUSHNOTIFICATION_SENDER = task -> {}; + + // V1.0 backend infrastructure + protected AgentExecutor agentExecutor; + protected TaskStore taskStore; + protected InMemoryQueueManager queueManager; + protected TestHttpClient httpClient; + protected MainEventBus mainEventBus; + protected MainEventBusProcessor mainEventBusProcessor; + + // V0.3 conversion layer (what transport handlers use) + protected Convert_v0_3_To10RequestHandler convert03To10Handler; + + // Lambda injection for AgentExecutor behavior (v0.3.x pattern) + protected AgentExecutorMethod agentExecutorExecute; + protected AgentExecutorMethod agentExecutorCancel; + + protected final Executor internalExecutor = Executors.newCachedThreadPool(); + + @BeforeEach + public void init() { + // Create AgentExecutor with lambda injection (v1.0 interface) + agentExecutor = new AgentExecutor() { + @Override + public void execute(RequestContext context, AgentEmitter agentEmitter) throws A2AError { + if (agentExecutorExecute != null) { + agentExecutorExecute.invoke(context, agentEmitter); + } + } + + @Override + public void cancel(RequestContext context, AgentEmitter agentEmitter) throws A2AError { + if (agentExecutorCancel != null) { + agentExecutorCancel.invoke(context, agentEmitter); + } + } + }; + + // Set up v1.0 backend components + InMemoryTaskStore inMemoryTaskStore = new InMemoryTaskStore(); + taskStore = inMemoryTaskStore; + + // Create push notification components BEFORE MainEventBusProcessor + httpClient = new TestHttpClient(); + PushNotificationConfigStore pushConfigStore = new InMemoryPushNotificationConfigStore(); + PushNotificationSender pushSender = new BasePushNotificationSender(pushConfigStore, httpClient); + + // Create MainEventBus and MainEventBusProcessor (production code path) + mainEventBus = new MainEventBus(); + queueManager = new InMemoryQueueManager(inMemoryTaskStore, mainEventBus); + mainEventBusProcessor = new MainEventBusProcessor(mainEventBus, taskStore, pushSender, queueManager); + EventQueueUtil.start(mainEventBusProcessor); + + // Create v1.0 DefaultRequestHandler + org.a2aproject.sdk.server.requesthandlers.DefaultRequestHandler v10Handler = + DefaultRequestHandler.create( + agentExecutor, taskStore, queueManager, pushConfigStore, + mainEventBusProcessor, internalExecutor, internalExecutor); + + // Wrap in v0.3 conversion handler + convert03To10Handler = new Convert_v0_3_To10RequestHandler(); + convert03To10Handler.v10Handler = v10Handler; + } + + @AfterEach + public void cleanup() { + agentExecutorExecute = null; + agentExecutorCancel = null; + + // Stop MainEventBusProcessor background thread + if (mainEventBusProcessor != null) { + EventQueueUtil.stop(mainEventBusProcessor); + } + } + + /** + * Creates a v0.3 AgentCard with specified capabilities. + * + * @param streaming whether streaming is supported + * @param pushNotifications whether push notifications are supported + * @param stateTransitionHistory whether state transition history is supported + * @return configured AgentCard + */ + protected static AgentCard_v0_3 createAgentCard(boolean streaming, boolean pushNotifications, + boolean stateTransitionHistory) { + return new AgentCard_v0_3.Builder() + .name("test-card") + .description("A test agent card") + .url("http://example.com") + .version("1.0") + .documentationUrl("http://example.com/docs") + .capabilities(new AgentCapabilities_v0_3.Builder() + .streaming(streaming) + .pushNotifications(pushNotifications) + .stateTransitionHistory(stateTransitionHistory) + .build()) + .defaultInputModes(new ArrayList<>()) + .defaultOutputModes(new ArrayList<>()) + .preferredTransport("jsonrpc") + .skills(new ArrayList<>()) + .protocolVersion("0.3") + .build(); + } + + /** + * Lambda interface for AgentExecutor method injection in tests. + */ + protected interface AgentExecutorMethod { + void invoke(RequestContext context, AgentEmitter agentEmitter) throws A2AError; + } + + /** + * Test HTTP client for push notification testing. + * Captures posted events for verification. + */ + @Dependent + @IfBuildProfile("test") + protected static class TestHttpClient implements A2AHttpClient { + public final List events = Collections.synchronizedList(new ArrayList<>()); + public volatile CountDownLatch latch; + + @Override + public GetBuilder createGet() { + return null; + } + + @Override + public PostBuilder createPost() { + return new TestHttpClient.TestPostBuilder(); + } + + @Override + public DeleteBuilder createDelete() { + return null; + } + + class TestPostBuilder implements A2AHttpClient.PostBuilder { + private volatile String body; + + @Override + public PostBuilder body(String body) { + this.body = body; + return this; + } + + @Override + public A2AHttpResponse post() throws IOException, InterruptedException { + try { + // Parse StreamResponse format to extract the streaming event + // The body contains a wrapper with one of: task, message, statusUpdate, artifactUpdate + StreamingEventKind event = JsonUtil.fromJson(body, StreamingEventKind.class); + events.add(event); + return new A2AHttpResponse() { + @Override + public int status() { + return 200; + } + + @Override + public boolean success() { + return true; + } + + @Override + public String body() { + return ""; + } + }; + } catch (JsonProcessingException e) { + throw new IOException("Failed to parse StreamingEventKind JSON", e); + } finally { + if (latch != null) { + latch.countDown(); + } + } + } + + @Override + public CompletableFuture postAsyncSSE(Consumer messageConsumer, + Consumer errorConsumer, + Runnable completeRunnable) + throws IOException, InterruptedException { + return null; + } + + @Override + public PostBuilder url(String s) { + return this; + } + + @Override + public PostBuilder addHeader(String name, String value) { + return this; + } + + @Override + public PostBuilder addHeaders(Map headers) { + return this; + } + } + } +} diff --git a/compat-0.3/server-conversion/src/test/java/org/a2aproject/sdk/compat03/conversion/AbstractA2AServerServerTest_v0_3.java b/compat-0.3/server-conversion/src/test/java/org/a2aproject/sdk/compat03/conversion/AbstractA2AServerServerTest_v0_3.java new file mode 100644 index 000000000..b881c0cc0 --- /dev/null +++ b/compat-0.3/server-conversion/src/test/java/org/a2aproject/sdk/compat03/conversion/AbstractA2AServerServerTest_v0_3.java @@ -0,0 +1,2038 @@ +package org.a2aproject.sdk.compat03.conversion; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; +import static org.junit.jupiter.api.Assumptions.assumeTrue; + +import java.io.EOFException; +import java.io.IOException; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.nio.charset.StandardCharsets; +import java.util.List; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.BiConsumer; +import java.util.function.Consumer; +import java.util.stream.Stream; + +import jakarta.ws.rs.core.MediaType; + +import io.restassured.RestAssured; +import io.restassured.config.ObjectMapperConfig; +import io.restassured.specification.RequestSpecification; +import org.a2aproject.sdk.compat03.client.Client_v0_3; +import org.a2aproject.sdk.compat03.client.ClientBuilder_v0_3; +import org.a2aproject.sdk.compat03.client.ClientEvent_v0_3; +import org.a2aproject.sdk.compat03.client.MessageEvent_v0_3; +import org.a2aproject.sdk.compat03.client.TaskEvent_v0_3; +import org.a2aproject.sdk.compat03.client.TaskUpdateEvent_v0_3; +import org.a2aproject.sdk.compat03.client.config.ClientConfig_v0_3; +import org.a2aproject.sdk.compat03.conversion.mappers.config.A2AMappers_v0_3; +import org.a2aproject.sdk.compat03.conversion.mappers.domain.TaskArtifactUpdateEventMapper_v0_3; +import org.a2aproject.sdk.compat03.conversion.mappers.domain.TaskMapper_v0_3; +import org.a2aproject.sdk.compat03.conversion.mappers.domain.TaskPushNotificationConfigMapper_v0_3; +import org.a2aproject.sdk.compat03.conversion.mappers.domain.TaskStatusUpdateEventMapper_v0_3; +import org.a2aproject.sdk.compat03.json.JsonProcessingException_v0_3; +import org.a2aproject.sdk.compat03.json.JsonUtil_v0_3; +import org.a2aproject.sdk.compat03.spec.A2AClientException_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentCapabilities_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentCard_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentInterface_v0_3; +import org.a2aproject.sdk.compat03.spec.Artifact_v0_3; +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigParams_v0_3; +import org.a2aproject.sdk.compat03.spec.Event_v0_3; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigParams_v0_3; +import org.a2aproject.sdk.compat03.spec.InvalidParamsError_v0_3; +import org.a2aproject.sdk.compat03.spec.InvalidRequestError_v0_3; +import org.a2aproject.sdk.compat03.spec.JSONParseError_v0_3; +import org.a2aproject.sdk.compat03.spec.JSONRPCErrorResponse_v0_3; +import org.a2aproject.sdk.compat03.spec.ListTaskPushNotificationConfigParams_v0_3; +import org.a2aproject.sdk.compat03.spec.Message_v0_3; +import org.a2aproject.sdk.compat03.spec.MessageSendParams_v0_3; +import org.a2aproject.sdk.compat03.spec.MethodNotFoundError_v0_3; +import org.a2aproject.sdk.compat03.spec.Part_v0_3; +import org.a2aproject.sdk.compat03.spec.PushNotificationConfig_v0_3; +import org.a2aproject.sdk.compat03.spec.SendStreamingMessageRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.SendStreamingMessageResponse_v0_3; +import org.a2aproject.sdk.compat03.spec.StreamingJSONRPCRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.Task_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskArtifactUpdateEvent_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskIdParams_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskNotFoundError_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskQueryParams_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskState_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskStatus_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskStatusUpdateEvent_v0_3; +import org.a2aproject.sdk.compat03.spec.TextPart_v0_3; +import org.a2aproject.sdk.compat03.spec.TransportProtocol_v0_3; +import org.a2aproject.sdk.compat03.spec.UnsupportedOperationError_v0_3; +import org.a2aproject.sdk.compat03.spec.UpdateEvent_v0_3; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.Timeout; + +/** + * Abstract test class for v0.3 to v1.0 compatibility layer integration tests. + *

+ * This test requires server-side test utilities (TestUtilsBean) exposed via REST endpoints + * to add/get/delete tasks and enqueue events. + *

+ * Type conversion strategy: + *

    + *
  • Test code uses v0.3 client types ({@link org.a2aproject.sdk.compat03.spec.*})
  • + *
  • Server test utilities expect v1.0 types ({@link org.a2aproject.sdk.spec.*})
  • + *
  • Conversion at boundaries using mappers from {@link A2AMappers_v0_3}
  • + *
  • REST-Assured configured with {@link V10GsonObjectMapper_v0_3} for server communication
  • + *
+ */ +public abstract class AbstractA2AServerServerTest_v0_3 { + + protected static final Task_v0_3 MINIMAL_TASK = new Task_v0_3.Builder() + .id("task-123") + .contextId("session-xyz") + .status(new TaskStatus_v0_3(TaskState_v0_3.SUBMITTED)) + .build(); + + private static final Task_v0_3 CANCEL_TASK = new Task_v0_3.Builder() + .id("cancel-task-123") + .contextId("session-xyz") + .status(new TaskStatus_v0_3(TaskState_v0_3.SUBMITTED)) + .build(); + + private static final Task_v0_3 CANCEL_TASK_NOT_SUPPORTED = new Task_v0_3.Builder() + .id("cancel-task-not-supported-123") + .contextId("session-xyz") + .status(new TaskStatus_v0_3(TaskState_v0_3.SUBMITTED)) + .build(); + + private static final Task_v0_3 SEND_MESSAGE_NOT_SUPPORTED = new Task_v0_3.Builder() + .id("task-not-supported-123") + .contextId("session-xyz") + .status(new TaskStatus_v0_3(TaskState_v0_3.SUBMITTED)) + .build(); + + protected static final Message_v0_3 MESSAGE = new Message_v0_3.Builder() + .messageId("111") + .role(Message_v0_3.Role.AGENT) + .parts(new TextPart_v0_3("test message")) + .build(); + + public static final String APPLICATION_JSON = "application/json"; + + /** + * REST-Assured configuration using v1.0 JSON mapper. + * Server test endpoints expect v1.0 JSON format. + */ + public static RequestSpecification given() { + return RestAssured.given() + .config(RestAssured.config() + .objectMapperConfig(new ObjectMapperConfig(V10GsonObjectMapper_v0_3.INSTANCE))); + } + + /** + * REST-Assured configuration using v0.3 JSON mapper. + * Use for deserializing v0.3 JSONRPC server responses (errors, etc.). + */ + public static RequestSpecification givenV03() { + return RestAssured.given() + .config(RestAssured.config() + .objectMapperConfig(new ObjectMapperConfig(GsonObjectMapper_v0_3.INSTANCE))); + } + + protected final int serverPort; + private Client_v0_3 client; + private Client_v0_3 nonStreamingClient; + private Client_v0_3 pollingClient; + + protected AbstractA2AServerServerTest_v0_3(int serverPort) { + this.serverPort = serverPort; + } + + /** + * Get the transport protocol to use for this test (e.g., "JSONRPC", "GRPC"). + */ + protected abstract String getTransportProtocol(); + + /** + * Get the transport URL for this test. + */ + protected abstract String getTransportUrl(); + + /** + * Configure transport-specific settings for the client builder. + */ + protected abstract void configureTransport(ClientBuilder_v0_3 builder); + + @Test + public void testTaskStoreMethodsSanityTest() throws Exception { + Task_v0_3 task = new Task_v0_3.Builder(MINIMAL_TASK).id("abcde").build(); + saveTaskInTaskStore(task); + Task_v0_3 saved = getTaskFromTaskStore(task.getId()); + assertEquals(task.getId(), saved.getId()); + assertEquals(task.getContextId(), saved.getContextId()); + assertEquals(task.getStatus().state(), saved.getStatus().state()); + + deleteTaskInTaskStore(task.getId()); + Task_v0_3 saved2 = getTaskFromTaskStore(task.getId()); + assertNull(saved2); + } + + @Test + public void testGetTaskSuccess() throws Exception { + testGetTask(); + } + + private void testGetTask() throws Exception { + testGetTask(null); + } + + private void testGetTask(String mediaType) throws Exception { + saveTaskInTaskStore(MINIMAL_TASK); + try { + Task_v0_3 response = getClient().getTask(new TaskQueryParams_v0_3(MINIMAL_TASK.getId())); + assertEquals("task-123", response.getId()); + assertEquals("session-xyz", response.getContextId()); + assertEquals(TaskState_v0_3.SUBMITTED, response.getStatus().state()); + } catch (A2AClientException_v0_3 e) { + fail("Unexpected exception during getTask: " + e.getMessage(), e); + } finally { + deleteTaskInTaskStore(MINIMAL_TASK.getId()); + } + } + + @Test + public void testGetTaskNotFound() throws Exception { + assertTrue(getTaskFromTaskStore("non-existent-task") == null); + try { + getClient().getTask(new TaskQueryParams_v0_3("non-existent-task")); + fail("Expected A2AClientException for non-existent task"); + } catch (A2AClientException_v0_3 e) { + // Expected - the client should throw an exception for non-existent tasks + assertInstanceOf(TaskNotFoundError_v0_3.class, e.getCause()); + } + } + + @Test + public void testCancelTaskSuccess() throws Exception { + saveTaskInTaskStore(CANCEL_TASK); + try { + Task_v0_3 task = getClient().cancelTask(new TaskIdParams_v0_3(CANCEL_TASK.getId())); + assertEquals(CANCEL_TASK.getId(), task.getId()); + assertEquals(CANCEL_TASK.getContextId(), task.getContextId()); + assertEquals(TaskState_v0_3.CANCELED, task.getStatus().state()); + } catch (A2AClientException_v0_3 e) { + fail("Unexpected exception during cancel task: " + e.getMessage(), e); + } finally { + deleteTaskInTaskStore(CANCEL_TASK.getId()); + } + } + + @Test + public void testCancelTaskNotSupported() throws Exception { + saveTaskInTaskStore(CANCEL_TASK_NOT_SUPPORTED); + try { + getClient().cancelTask(new TaskIdParams_v0_3(CANCEL_TASK_NOT_SUPPORTED.getId())); + fail("Expected A2AClientException for unsupported cancel operation"); + } catch (A2AClientException_v0_3 e) { + // Expected - the client should throw an exception for unsupported operations + assertInstanceOf(UnsupportedOperationError_v0_3.class, e.getCause()); + } finally { + deleteTaskInTaskStore(CANCEL_TASK_NOT_SUPPORTED.getId()); + } + } + + @Test + public void testCancelTaskNotFound() { + try { + getClient().cancelTask(new TaskIdParams_v0_3("non-existent-task")); + fail("Expected A2AClientException for non-existent task"); + } catch (A2AClientException_v0_3 e) { + // Expected - the client should throw an exception for non-existent tasks + assertInstanceOf(TaskNotFoundError_v0_3.class, e.getCause()); + } + } + + @Test + public void testSendMessageNewMessageSuccess() throws Exception { + Message_v0_3 message = new Message_v0_3.Builder(MESSAGE) + .build(); + + CountDownLatch latch = new CountDownLatch(1); + AtomicReference receivedMessage = new AtomicReference<>(); + AtomicBoolean wasUnexpectedEvent = new AtomicBoolean(false); + BiConsumer consumer = (event, agentCard) -> { + if (event instanceof MessageEvent_v0_3 messageEvent) { + if (latch.getCount() > 0) { + receivedMessage.set(messageEvent.getMessage()); + latch.countDown(); + } else { + wasUnexpectedEvent.set(true); + } + } else { + wasUnexpectedEvent.set(true); + } + }; + + // testing the non-streaming send message + getNonStreamingClient().sendMessage(message, List.of(consumer), null); + + assertTrue(latch.await(10, TimeUnit.SECONDS)); + assertFalse(wasUnexpectedEvent.get()); + Message_v0_3 messageResponse = receivedMessage.get(); + assertNotNull(messageResponse); + assertEquals(MESSAGE.getMessageId(), messageResponse.getMessageId()); + assertEquals(MESSAGE.getRole(), messageResponse.getRole()); + Part_v0_3 part = messageResponse.getParts().get(0); + assertEquals(Part_v0_3.Kind.TEXT, part.getKind()); + assertEquals("test message", ((TextPart_v0_3) part).getText()); + } + + @Test + public void testSendMessageExistingTaskSuccess() throws Exception { + saveTaskInTaskStore(MINIMAL_TASK); + try { + Message_v0_3 message = new Message_v0_3.Builder(MESSAGE) + .taskId(MINIMAL_TASK.getId()) + .contextId(MINIMAL_TASK.getContextId()) + .build(); + + CountDownLatch latch = new CountDownLatch(1); + AtomicReference receivedMessage = new AtomicReference<>(); + AtomicBoolean wasUnexpectedEvent = new AtomicBoolean(false); + BiConsumer consumer = (event, agentCard) -> { + if (event instanceof MessageEvent_v0_3 messageEvent) { + if (latch.getCount() > 0) { + receivedMessage.set(messageEvent.getMessage()); + latch.countDown(); + } else { + wasUnexpectedEvent.set(true); + } + } else { + wasUnexpectedEvent.set(true); + } + }; + + // testing the non-streaming send message + getNonStreamingClient().sendMessage(message, List.of(consumer), null); + assertFalse(wasUnexpectedEvent.get()); + assertTrue(latch.await(10, TimeUnit.SECONDS)); + Message_v0_3 messageResponse = receivedMessage.get(); + assertNotNull(messageResponse); + assertEquals(MESSAGE.getMessageId(), messageResponse.getMessageId()); + assertEquals(MESSAGE.getRole(), messageResponse.getRole()); + Part_v0_3 part = messageResponse.getParts().get(0); + assertEquals(Part_v0_3.Kind.TEXT, part.getKind()); + assertEquals("test message", ((TextPart_v0_3) part).getText()); + } catch (A2AClientException_v0_3 e) { + fail("Unexpected exception during sendMessage: " + e.getMessage(), e); + } finally { + deleteTaskInTaskStore(MINIMAL_TASK.getId()); + } + } + + @Test + public void testSetPushNotificationSuccess() throws Exception { + saveTaskInTaskStore(MINIMAL_TASK); + try { + TaskPushNotificationConfig_v0_3 taskPushConfig = + new TaskPushNotificationConfig_v0_3( + MINIMAL_TASK.getId(), new PushNotificationConfig_v0_3.Builder().url("http://example.com").build()); + TaskPushNotificationConfig_v0_3 config = getClient().setTaskPushNotificationConfiguration(taskPushConfig); + assertEquals(MINIMAL_TASK.getId(), config.taskId()); + assertEquals("http://example.com", config.pushNotificationConfig().url()); + } catch (A2AClientException_v0_3 e) { + fail("Unexpected exception during set push notification test: " + e.getMessage(), e); + } finally { + deletePushNotificationConfigInStore(MINIMAL_TASK.getId(), MINIMAL_TASK.getId()); + deleteTaskInTaskStore(MINIMAL_TASK.getId()); + } + } + + @Test + public void testGetPushNotificationSuccess() throws Exception { + saveTaskInTaskStore(MINIMAL_TASK); + try { + TaskPushNotificationConfig_v0_3 taskPushConfig = + new TaskPushNotificationConfig_v0_3( + MINIMAL_TASK.getId(), new PushNotificationConfig_v0_3.Builder().url("http://example.com").build()); + + TaskPushNotificationConfig_v0_3 setResult = getClient().setTaskPushNotificationConfiguration(taskPushConfig); + assertNotNull(setResult); + + TaskPushNotificationConfig_v0_3 config = getClient().getTaskPushNotificationConfiguration( + new GetTaskPushNotificationConfigParams_v0_3(MINIMAL_TASK.getId())); + assertEquals(MINIMAL_TASK.getId(), config.taskId()); + assertEquals("http://example.com", config.pushNotificationConfig().url()); + } catch (A2AClientException_v0_3 e) { + fail("Unexpected exception during get push notification test: " + e.getMessage(), e); + } finally { + deletePushNotificationConfigInStore(MINIMAL_TASK.getId(), MINIMAL_TASK.getId()); + deleteTaskInTaskStore(MINIMAL_TASK.getId()); + } + } + + @Test + public void testError() throws Exception { + saveTaskInTaskStore(SEND_MESSAGE_NOT_SUPPORTED); + try { + Message_v0_3 message = new Message_v0_3.Builder(MESSAGE) + .taskId(SEND_MESSAGE_NOT_SUPPORTED.getId()) + .contextId(SEND_MESSAGE_NOT_SUPPORTED.getContextId()) + .build(); + + try { + getNonStreamingClient().sendMessage(message); + + // For non-streaming clients, the error should still be thrown as an exception + fail("Expected A2AClientException for unsupported send message operation"); + } catch (A2AClientException_v0_3 e) { + // Expected - the client should throw an exception for unsupported operations + assertInstanceOf(UnsupportedOperationError_v0_3.class, e.getCause()); + } + } finally { + deleteTaskInTaskStore(SEND_MESSAGE_NOT_SUPPORTED.getId()); + } + } + + @Test + public void testGetAgentCard() throws A2AClientException_v0_3 { + AgentCard_v0_3 agentCard = getClient().getAgentCard(); + assertNotNull(agentCard); + assertEquals("test-card", agentCard.name()); + assertEquals("A test agent card", agentCard.description()); + assertEquals(getTransportUrl(), agentCard.url()); + assertEquals("1.0", agentCard.version()); + assertEquals("http://example.com/docs", agentCard.documentationUrl()); + assertTrue(agentCard.capabilities().pushNotifications()); + assertTrue(agentCard.capabilities().streaming()); + assertTrue(agentCard.capabilities().stateTransitionHistory()); + assertTrue(agentCard.skills().isEmpty()); + assertFalse(agentCard.supportsAuthenticatedExtendedCard()); + } + + @Test + public void testSendMessageStreamNewMessageSuccess() throws Exception { + testSendStreamingMessage(false); + } + + @Test + public void testSendMessageStreamExistingTaskSuccess() throws Exception { + testSendStreamingMessage(true); + } + + @Test + @Timeout(value = 3, unit = TimeUnit.MINUTES) + public void testResubscribeExistingTaskSuccess() throws Exception { + saveTaskInTaskStore(MINIMAL_TASK); + try { + // attempting to send a streaming message instead of explicitly calling queueManager#createOrTap + // does not work because after the message is sent, the queue becomes null but task resubscription + // requires the queue to still be active + ensureQueueForTask(MINIMAL_TASK.getId()); + + CountDownLatch eventLatch = new CountDownLatch(2); + AtomicReference artifactUpdateEvent = new AtomicReference<>(); + AtomicReference statusUpdateEvent = new AtomicReference<>(); + AtomicBoolean wasUnexpectedEvent = new AtomicBoolean(false); + AtomicReference errorRef = new AtomicReference<>(); + AtomicBoolean receivedInitialSnapshot = new AtomicBoolean(false); + + // Create consumer to handle resubscribed events + BiConsumer consumer = (event, agentCard) -> { + if (event instanceof TaskUpdateEvent_v0_3 taskUpdateEvent) { + if (taskUpdateEvent.getUpdateEvent() instanceof TaskArtifactUpdateEvent_v0_3 artifactEvent) { + artifactUpdateEvent.set(artifactEvent); + eventLatch.countDown(); + } else if (taskUpdateEvent.getUpdateEvent() instanceof TaskStatusUpdateEvent_v0_3 statusEvent) { + statusUpdateEvent.set(statusEvent); + eventLatch.countDown(); + } else { + wasUnexpectedEvent.set(true); + } + } else if (event instanceof TaskEvent_v0_3) { + // v0.3 spec confirms task snapshot as first event on resubscribe is valid behavior + // See: https://a2a-protocol.org/v0.3.0/specification/#721-sendstreamingmessageresponse-object + if (!receivedInitialSnapshot.compareAndSet(false, true)) { + wasUnexpectedEvent.set(true); // TaskEvent received after first event + } + } else { + wasUnexpectedEvent.set(true); + } + }; + + // Create error handler + Consumer errorHandler = error -> { + if (!isStreamClosedError(error)) { + errorRef.set(error); + } + eventLatch.countDown(); + }; + + // Count down when the streaming subscription is established + CountDownLatch subscriptionLatch = new CountDownLatch(1); + awaitStreamingSubscription() + .whenComplete((unused, throwable) -> subscriptionLatch.countDown()); + + // Resubscribe to the task with specific consumer and error handler + getClient().resubscribe(new TaskIdParams_v0_3(MINIMAL_TASK.getId()), List.of(consumer), errorHandler); + + // Wait for subscription to be established + assertTrue(subscriptionLatch.await(15, TimeUnit.SECONDS)); + + // Enqueue events on the server + List events = List.of( + new TaskArtifactUpdateEvent_v0_3.Builder() + .taskId(MINIMAL_TASK.getId()) + .contextId(MINIMAL_TASK.getContextId()) + .artifact(new Artifact_v0_3.Builder() + .artifactId("11") + .parts(new TextPart_v0_3("text")) + .build()) + .build(), + new TaskStatusUpdateEvent_v0_3.Builder() + .taskId(MINIMAL_TASK.getId()) + .contextId(MINIMAL_TASK.getContextId()) + .status(new TaskStatus_v0_3(TaskState_v0_3.COMPLETED)) + .isFinal(true) + .build()); + + for (Event_v0_3 event : events) { + enqueueEventOnServer(event); + } + + // Wait for events to be received + assertTrue(eventLatch.await(30, TimeUnit.SECONDS)); + assertFalse(wasUnexpectedEvent.get()); + assertNull(errorRef.get()); + + // Verify artifact update event + TaskArtifactUpdateEvent_v0_3 receivedArtifactEvent = artifactUpdateEvent.get(); + assertNotNull(receivedArtifactEvent); + assertEquals(MINIMAL_TASK.getId(), receivedArtifactEvent.getTaskId()); + assertEquals(MINIMAL_TASK.getContextId(), receivedArtifactEvent.getContextId()); + Part_v0_3 part = receivedArtifactEvent.getArtifact().parts().get(0); + assertEquals(Part_v0_3.Kind.TEXT, part.getKind()); + assertEquals("text", ((TextPart_v0_3) part).getText()); + + // Verify status update event + TaskStatusUpdateEvent_v0_3 receivedStatusEvent = statusUpdateEvent.get(); + assertNotNull(receivedStatusEvent); + assertEquals(MINIMAL_TASK.getId(), receivedStatusEvent.getTaskId()); + assertEquals(MINIMAL_TASK.getContextId(), receivedStatusEvent.getContextId()); + assertEquals(TaskState_v0_3.COMPLETED, receivedStatusEvent.getStatus().state()); + assertNotNull(receivedStatusEvent.getStatus().timestamp()); + } finally { + deleteTaskInTaskStore(MINIMAL_TASK.getId()); + } + } + + @Test + public void testResubscribeNoExistingTaskError() throws Exception { + CountDownLatch errorLatch = new CountDownLatch(1); + AtomicReference errorRef = new AtomicReference<>(); + + // Create error handler to capture the TaskNotFoundError + Consumer errorHandler = error -> { + if (error == null) { + // Stream completed successfully - ignore, we're waiting for an error + return; + } + if (!isStreamClosedError(error)) { + errorRef.set(error); + } + errorLatch.countDown(); + }; + + try { + getClient().resubscribe(new TaskIdParams_v0_3("non-existent-task"), List.of(), errorHandler); + + // Wait for error to be captured (may come via error handler for streaming) + boolean errorReceived = errorLatch.await(10, TimeUnit.SECONDS); + + if (errorReceived) { + // Error came via error handler + Throwable error = errorRef.get(); + assertNotNull(error); + if (error instanceof A2AClientException_v0_3) { + assertInstanceOf(TaskNotFoundError_v0_3.class, ((A2AClientException_v0_3) error).getCause()); + } else { + // Check if it's directly a TaskNotFoundError or walk the cause chain + Throwable cause = error; + boolean foundTaskNotFound = false; + while (cause != null && !foundTaskNotFound) { + if (cause instanceof TaskNotFoundError_v0_3) { + foundTaskNotFound = true; + } + cause = cause.getCause(); + } + if (!foundTaskNotFound) { + fail("Expected TaskNotFoundError in error chain"); + } + } + } else { + fail("Expected error for non-existent task resubscription"); + } + } catch (A2AClientException_v0_3 e) { + fail("Expected error for non-existent task resubscription"); + } + } + + /** + * Regression test for race condition where MainQueue closed when first ChildQueue closed, + * preventing resubscription. With reference counting, MainQueue stays alive while any + * ChildQueue exists, allowing successful concurrent operations. + * + * This test verifies that: + * 1. Multiple consumers can be active simultaneously + * 2. All consumers receive events while the MainQueue is alive + * 3. MainQueue doesn't close prematurely when earlier operations complete + */ + @Test + @Timeout(value = 1, unit = TimeUnit.MINUTES) + public void testMainQueueReferenceCountingWithMultipleConsumers() throws Exception { + saveTaskInTaskStore(MINIMAL_TASK); + try { + // 1. Ensure queue exists for the task + ensureQueueForTask(MINIMAL_TASK.getId()); + + // 2. First consumer subscribes and receives initial event + CountDownLatch firstConsumerLatch = new CountDownLatch(1); + AtomicReference firstConsumerEvent = new AtomicReference<>(); + AtomicBoolean firstUnexpectedEvent = new AtomicBoolean(false); + AtomicReference firstErrorRef = new AtomicReference<>(); + AtomicBoolean firstReceivedInitialSnapshot = new AtomicBoolean(false); + + BiConsumer firstConsumer = (event, agentCard) -> { + if (event instanceof TaskUpdateEvent_v0_3 tue && tue.getUpdateEvent() instanceof TaskArtifactUpdateEvent_v0_3 artifact) { + firstConsumerEvent.set(artifact); + firstConsumerLatch.countDown(); + } else if (event instanceof TaskEvent_v0_3) { + // v0.3 spec confirms task snapshot as first event on resubscribe is valid behavior + // See: https://a2a-protocol.org/v0.3.0/specification/#721-sendstreamingmessageresponse-object + if (!firstReceivedInitialSnapshot.compareAndSet(false, true)) { + firstUnexpectedEvent.set(true); // TaskEvent received after first event + } + } else if (!(event instanceof TaskUpdateEvent_v0_3)) { + firstUnexpectedEvent.set(true); + } + }; + + Consumer firstErrorHandler = error -> { + if (!isStreamClosedError(error)) { + firstErrorRef.set(error); + } + firstConsumerLatch.countDown(); + }; + + // Wait for first subscription to be established + CountDownLatch firstSubscriptionLatch = new CountDownLatch(1); + awaitStreamingSubscription() + .whenComplete((unused, throwable) -> firstSubscriptionLatch.countDown()); + + getClient().resubscribe(new TaskIdParams_v0_3(MINIMAL_TASK.getId()), + List.of(firstConsumer), + firstErrorHandler); + + assertTrue(firstSubscriptionLatch.await(15, TimeUnit.SECONDS), "First subscription should be established"); + + // Enqueue first event + TaskArtifactUpdateEvent_v0_3 event1 = new TaskArtifactUpdateEvent_v0_3.Builder() + .taskId(MINIMAL_TASK.getId()) + .contextId(MINIMAL_TASK.getContextId()) + .artifact(new Artifact_v0_3.Builder() + .artifactId("artifact-1") + .parts(new TextPart_v0_3("First artifact")) + .build()) + .build(); + enqueueEventOnServer(event1); + + // Wait for first consumer to receive event + assertTrue(firstConsumerLatch.await(15, TimeUnit.SECONDS), "First consumer should receive event"); + assertFalse(firstUnexpectedEvent.get()); + assertNull(firstErrorRef.get()); + assertNotNull(firstConsumerEvent.get()); + + // Verify we have multiple child queues (ensureQueue + first resubscribe) + int childCountBeforeSecond = getChildQueueCount(MINIMAL_TASK.getId()); + assertTrue(childCountBeforeSecond >= 2, "Should have at least 2 child queues"); + + // 3. Second consumer resubscribes while first is still active + // This simulates the Kafka replication race condition where resubscription happens + // while other consumers are still active. Without reference counting, the MainQueue + // might close when the ensureQueue ChildQueue closes, preventing this resubscription. + CountDownLatch secondConsumerLatch = new CountDownLatch(1); + AtomicReference secondConsumerEvent = new AtomicReference<>(); + AtomicBoolean secondUnexpectedEvent = new AtomicBoolean(false); + AtomicReference secondErrorRef = new AtomicReference<>(); + AtomicBoolean secondReceivedInitialSnapshot = new AtomicBoolean(false); + + BiConsumer secondConsumer = (event, agentCard) -> { + if (event instanceof TaskUpdateEvent_v0_3 tue && tue.getUpdateEvent() instanceof TaskArtifactUpdateEvent_v0_3 artifact) { + secondConsumerEvent.set(artifact); + secondConsumerLatch.countDown(); + } else if (event instanceof TaskEvent_v0_3) { + // v0.3 spec confirms task snapshot as first event on resubscribe is valid behavior + // See: https://a2a-protocol.org/v0.3.0/specification/#721-sendstreamingmessageresponse-object + if (!secondReceivedInitialSnapshot.compareAndSet(false, true)) { + secondUnexpectedEvent.set(true); // TaskEvent received after first event + } + } else if (!(event instanceof TaskUpdateEvent_v0_3)) { + secondUnexpectedEvent.set(true); + } + }; + + Consumer secondErrorHandler = error -> { + if (!isStreamClosedError(error)) { + secondErrorRef.set(error); + } + secondConsumerLatch.countDown(); + }; + + // Wait for second subscription to be established + CountDownLatch secondSubscriptionLatch = new CountDownLatch(1); + awaitStreamingSubscription() + .whenComplete((unused, throwable) -> secondSubscriptionLatch.countDown()); + + // This should succeed with reference counting because MainQueue stays alive + // while first consumer's ChildQueue exists + getClient().resubscribe(new TaskIdParams_v0_3(MINIMAL_TASK.getId()), + List.of(secondConsumer), + secondErrorHandler); + + assertTrue(secondSubscriptionLatch.await(15, TimeUnit.SECONDS), "Second subscription should be established"); + + // Verify child queue count increased (now ensureQueue + first + second) + int childCountAfterSecond = getChildQueueCount(MINIMAL_TASK.getId()); + assertTrue(childCountAfterSecond > childCountBeforeSecond, + "Child queue count should increase after second resubscription"); + + // 4. Enqueue second event - both consumers should receive it + TaskArtifactUpdateEvent_v0_3 event2 = new TaskArtifactUpdateEvent_v0_3.Builder() + .taskId(MINIMAL_TASK.getId()) + .contextId(MINIMAL_TASK.getContextId()) + .artifact(new Artifact_v0_3.Builder() + .artifactId("artifact-2") + .parts(new TextPart_v0_3("Second artifact")) + .build()) + .build(); + enqueueEventOnServer(event2); + + // Both consumers should receive the event + assertTrue(secondConsumerLatch.await(15, TimeUnit.SECONDS), "Second consumer should receive event"); + assertFalse(secondUnexpectedEvent.get()); + assertNull(secondErrorRef.get(), + "Resubscription should succeed with reference counting (MainQueue stays alive)"); + + TaskArtifactUpdateEvent_v0_3 receivedEvent = secondConsumerEvent.get(); + assertNotNull(receivedEvent); + assertEquals("artifact-2", receivedEvent.getArtifact().artifactId()); + assertEquals("Second artifact", ((TextPart_v0_3) receivedEvent.getArtifact().parts().get(0)).getText()); + + } finally { + deleteTaskInTaskStore(MINIMAL_TASK.getId()); + } + } + + /** + * Wait for the child queue count to reach a specific value. + * Uses polling with sleep intervals, similar to awaitStreamingSubscription(). + * + * @param taskId The task ID + * @param expectedCount The expected child queue count + * @param timeoutMs Timeout in milliseconds + * @return true if count reached expected value within timeout, false otherwise + */ + private boolean waitForChildQueueCountToBe(String taskId, int expectedCount, long timeoutMs) { + long endTime = System.currentTimeMillis() + timeoutMs; + while (System.currentTimeMillis() < endTime) { + if (getChildQueueCount(taskId) == expectedCount) { + return true; + } + try { + Thread.sleep(100); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + return false; + } + } + return false; + } + + @Test + public void testListPushNotificationConfigWithConfigId() throws Exception { + saveTaskInTaskStore(MINIMAL_TASK); + PushNotificationConfig_v0_3 notificationConfig1 = + new PushNotificationConfig_v0_3.Builder() + .url("http://example.com") + .id("config1") + .build(); + PushNotificationConfig_v0_3 notificationConfig2 = + new PushNotificationConfig_v0_3.Builder() + .url("http://example.com") + .id("config2") + .build(); + savePushNotificationConfigInStore(MINIMAL_TASK.getId(), notificationConfig1); + savePushNotificationConfigInStore(MINIMAL_TASK.getId(), notificationConfig2); + + try { + List result = getClient().listTaskPushNotificationConfigurations( + new ListTaskPushNotificationConfigParams_v0_3(MINIMAL_TASK.getId())); + assertEquals(2, result.size()); + assertEquals(new TaskPushNotificationConfig_v0_3(MINIMAL_TASK.getId(), notificationConfig1), result.get(0)); + assertEquals(new TaskPushNotificationConfig_v0_3(MINIMAL_TASK.getId(), notificationConfig2), result.get(1)); + } catch (Exception e) { + fail(); + } finally { + deletePushNotificationConfigInStore(MINIMAL_TASK.getId(), "config1"); + deletePushNotificationConfigInStore(MINIMAL_TASK.getId(), "config2"); + deleteTaskInTaskStore(MINIMAL_TASK.getId()); + } + } + + @Test + public void testListPushNotificationConfigWithoutConfigId() throws Exception { + saveTaskInTaskStore(MINIMAL_TASK); + PushNotificationConfig_v0_3 notificationConfig1 = + new PushNotificationConfig_v0_3.Builder() + .url("http://1.example.com") + .build(); + PushNotificationConfig_v0_3 notificationConfig2 = + new PushNotificationConfig_v0_3.Builder() + .url("http://2.example.com") + .build(); + savePushNotificationConfigInStore(MINIMAL_TASK.getId(), notificationConfig1); + + // will overwrite the previous one + savePushNotificationConfigInStore(MINIMAL_TASK.getId(), notificationConfig2); + try { + List result = getClient().listTaskPushNotificationConfigurations( + new ListTaskPushNotificationConfigParams_v0_3(MINIMAL_TASK.getId())); + assertEquals(1, result.size()); + + PushNotificationConfig_v0_3 expectedNotificationConfig = new PushNotificationConfig_v0_3.Builder() + .url("http://2.example.com") + .id(MINIMAL_TASK.getId()) + .build(); + assertEquals(new TaskPushNotificationConfig_v0_3(MINIMAL_TASK.getId(), expectedNotificationConfig), + result.get(0)); + } catch (Exception e) { + fail(); + } finally { + deletePushNotificationConfigInStore(MINIMAL_TASK.getId(), MINIMAL_TASK.getId()); + deleteTaskInTaskStore(MINIMAL_TASK.getId()); + } + } + + @Test + public void testListPushNotificationConfigTaskNotFound() { + try { + List result = getClient().listTaskPushNotificationConfigurations( + new ListTaskPushNotificationConfigParams_v0_3("non-existent-task")); + fail(); + } catch (A2AClientException_v0_3 e) { + assertInstanceOf(TaskNotFoundError_v0_3.class, e.getCause()); + } + } + + @Test + public void testListPushNotificationConfigEmptyList() throws Exception { + saveTaskInTaskStore(MINIMAL_TASK); + try { + List result = getClient().listTaskPushNotificationConfigurations( + new ListTaskPushNotificationConfigParams_v0_3(MINIMAL_TASK.getId())); + assertEquals(0, result.size()); + } catch (Exception e) { + fail(e.getMessage()); + } finally { + deleteTaskInTaskStore(MINIMAL_TASK.getId()); + } + } + + @Test + public void testDeletePushNotificationConfigWithValidConfigId() throws Exception { + saveTaskInTaskStore(MINIMAL_TASK); + saveTaskInTaskStore(new Task_v0_3.Builder() + .id("task-456") + .contextId("session-xyz") + .status(new TaskStatus_v0_3(TaskState_v0_3.SUBMITTED)) + .build()); + + PushNotificationConfig_v0_3 notificationConfig1 = + new PushNotificationConfig_v0_3.Builder() + .url("http://example.com") + .id("config1") + .build(); + PushNotificationConfig_v0_3 notificationConfig2 = + new PushNotificationConfig_v0_3.Builder() + .url("http://example.com") + .id("config2") + .build(); + savePushNotificationConfigInStore(MINIMAL_TASK.getId(), notificationConfig1); + savePushNotificationConfigInStore(MINIMAL_TASK.getId(), notificationConfig2); + savePushNotificationConfigInStore("task-456", notificationConfig1); + + try { + // specify the config ID to delete + getClient().deleteTaskPushNotificationConfigurations( + new DeleteTaskPushNotificationConfigParams_v0_3(MINIMAL_TASK.getId(), "config1")); + + // should now be 1 left + List result = getClient().listTaskPushNotificationConfigurations( + new ListTaskPushNotificationConfigParams_v0_3(MINIMAL_TASK.getId())); + assertEquals(1, result.size()); + + // should remain unchanged, this is a different task + result = getClient().listTaskPushNotificationConfigurations( + new ListTaskPushNotificationConfigParams_v0_3("task-456")); + assertEquals(1, result.size()); + } catch (Exception e) { + fail(e.getMessage()); + } finally { + deletePushNotificationConfigInStore(MINIMAL_TASK.getId(), "config1"); + deletePushNotificationConfigInStore(MINIMAL_TASK.getId(), "config2"); + deletePushNotificationConfigInStore("task-456", "config1"); + deleteTaskInTaskStore(MINIMAL_TASK.getId()); + deleteTaskInTaskStore("task-456"); + } + } + + @Test + public void testDeletePushNotificationConfigWithNonExistingConfigId() throws Exception { + saveTaskInTaskStore(MINIMAL_TASK); + PushNotificationConfig_v0_3 notificationConfig1 = + new PushNotificationConfig_v0_3.Builder() + .url("http://example.com") + .id("config1") + .build(); + PushNotificationConfig_v0_3 notificationConfig2 = + new PushNotificationConfig_v0_3.Builder() + .url("http://example.com") + .id("config2") + .build(); + savePushNotificationConfigInStore(MINIMAL_TASK.getId(), notificationConfig1); + savePushNotificationConfigInStore(MINIMAL_TASK.getId(), notificationConfig2); + + try { + getClient().deleteTaskPushNotificationConfigurations( + new DeleteTaskPushNotificationConfigParams_v0_3(MINIMAL_TASK.getId(), "non-existent-config-id")); + + // should remain unchanged + List result = getClient().listTaskPushNotificationConfigurations( + new ListTaskPushNotificationConfigParams_v0_3(MINIMAL_TASK.getId())); + assertEquals(2, result.size()); + } catch (Exception e) { + fail(); + } finally { + deletePushNotificationConfigInStore(MINIMAL_TASK.getId(), "config1"); + deletePushNotificationConfigInStore(MINIMAL_TASK.getId(), "config2"); + deleteTaskInTaskStore(MINIMAL_TASK.getId()); + } + } + + @Test + public void testDeletePushNotificationConfigTaskNotFound() { + try { + getClient().deleteTaskPushNotificationConfigurations( + new DeleteTaskPushNotificationConfigParams_v0_3("non-existent-task", + "non-existent-config-id")); + fail(); + } catch (A2AClientException_v0_3 e) { + assertInstanceOf(TaskNotFoundError_v0_3.class, e.getCause()); + } + } + + @Test + public void testDeletePushNotificationConfigSetWithoutConfigId() throws Exception { + saveTaskInTaskStore(MINIMAL_TASK); + PushNotificationConfig_v0_3 notificationConfig1 = + new PushNotificationConfig_v0_3.Builder() + .url("http://1.example.com") + .build(); + PushNotificationConfig_v0_3 notificationConfig2 = + new PushNotificationConfig_v0_3.Builder() + .url("http://2.example.com") + .build(); + savePushNotificationConfigInStore(MINIMAL_TASK.getId(), notificationConfig1); + + // this one will overwrite the previous one + savePushNotificationConfigInStore(MINIMAL_TASK.getId(), notificationConfig2); + + try { + getClient().deleteTaskPushNotificationConfigurations( + new DeleteTaskPushNotificationConfigParams_v0_3(MINIMAL_TASK.getId(), MINIMAL_TASK.getId())); + + // should now be 0 + List result = getClient().listTaskPushNotificationConfigurations( + new ListTaskPushNotificationConfigParams_v0_3(MINIMAL_TASK.getId()), null); + assertEquals(0, result.size()); + } catch (Exception e) { + fail(); + } finally { + deletePushNotificationConfigInStore(MINIMAL_TASK.getId(), MINIMAL_TASK.getId()); + deleteTaskInTaskStore(MINIMAL_TASK.getId()); + } + } + + @Test + @Timeout(value = 1, unit = TimeUnit.MINUTES) + public void testNonBlockingWithMultipleMessages() throws Exception { + AtomicReference generatedTaskIdRef = new AtomicReference<>(); + try { + // 1. Send first non-blocking message without taskId - server generates one + // Routing is by message content prefix "multi-event:first" + Message_v0_3 message1 = new Message_v0_3.Builder(MESSAGE) + .parts(new TextPart_v0_3("multi-event:first")) + .build(); + + AtomicReference taskIdRef = new AtomicReference<>(); + CountDownLatch firstTaskLatch = new CountDownLatch(1); + + BiConsumer firstMessageConsumer = (event, agentCard) -> { + if (event instanceof TaskEvent_v0_3 te) { + taskIdRef.set(te.getTask().getId()); + firstTaskLatch.countDown(); + } else if (event instanceof TaskUpdateEvent_v0_3 tue && tue.getUpdateEvent() instanceof TaskStatusUpdateEvent_v0_3 status) { + taskIdRef.set(status.getTaskId()); + firstTaskLatch.countDown(); + } + }; + + // Non-blocking message creates task in WORKING state and returns immediately + // Queue stays open because task is not in final state + getPollingClient().sendMessage(message1, List.of(firstMessageConsumer), null); + + assertTrue(firstTaskLatch.await(10, TimeUnit.SECONDS)); + String taskId = taskIdRef.get(); + assertNotNull(taskId); + generatedTaskIdRef.set(taskId); + + // 2. Resubscribe to task (queue should still be open) + CountDownLatch resubEventLatch = new CountDownLatch(2); // artifact-2 + completion + List resubReceivedEvents = new CopyOnWriteArrayList<>(); + AtomicBoolean resubUnexpectedEvent = new AtomicBoolean(false); + AtomicReference resubErrorRef = new AtomicReference<>(); + AtomicBoolean resubReceivedInitialSnapshot = new AtomicBoolean(false); + + BiConsumer resubConsumer = (event, agentCard) -> { + if (event instanceof TaskUpdateEvent_v0_3 tue) { + resubReceivedEvents.add(tue.getUpdateEvent()); + resubEventLatch.countDown(); + } else if (event instanceof TaskEvent_v0_3) { + // v0.3 spec confirms task snapshot as first event on resubscribe is valid behavior + // See: https://a2a-protocol.org/v0.3.0/specification/#721-sendstreamingmessageresponse-object + if (!resubReceivedInitialSnapshot.compareAndSet(false, true)) { + System.err.println("testNonBlockingWithMultipleMessages: TaskEvent received after first event"); + resubUnexpectedEvent.set(true); // TaskEvent received after first event + } + } else { + System.err.println("testNonBlockingWithMultipleMessages: Unexpected event type in resubConsumer: " + event.getClass().getName()); + resubUnexpectedEvent.set(true); + } + }; + + Consumer resubErrorHandler = error -> { + if (!isStreamClosedError(error)) { + resubErrorRef.set(error); + } + }; + + // Wait for subscription to be active + CountDownLatch subscriptionLatch = new CountDownLatch(1); + awaitStreamingSubscription() + .whenComplete((unused, throwable) -> subscriptionLatch.countDown()); + + getClient().resubscribe(new TaskIdParams_v0_3(taskId), + List.of(resubConsumer), + resubErrorHandler); + + assertTrue(subscriptionLatch.await(15, TimeUnit.SECONDS)); + + // 3. Send second streaming message to same taskId + Message_v0_3 message2 = new Message_v0_3.Builder(MESSAGE) + .taskId(taskId) + .parts(new TextPart_v0_3("multi-event:second")) + .build(); + + CountDownLatch streamEventLatch = new CountDownLatch(2); // artifact-2 + completion + List streamReceivedEvents = new CopyOnWriteArrayList<>(); + AtomicBoolean streamUnexpectedEvent = new AtomicBoolean(false); + + BiConsumer streamConsumer = (event, agentCard) -> { + if (event instanceof TaskUpdateEvent_v0_3 tue) { + streamReceivedEvents.add(tue.getUpdateEvent()); + streamEventLatch.countDown(); + } else { + streamUnexpectedEvent.set(true); + } + }; + + // Streaming message adds artifact-2 and completes task + getClient().sendMessage(message2, List.of(streamConsumer), null); + + // 4. Verify both consumers received artifact-2 and completion + assertTrue(resubEventLatch.await(10, TimeUnit.SECONDS)); + assertTrue(streamEventLatch.await(10, TimeUnit.SECONDS)); + + assertFalse(resubUnexpectedEvent.get()); + assertFalse(streamUnexpectedEvent.get()); + assertNull(resubErrorRef.get()); + + // Both should have received 2 events: artifact-2 and completion + assertEquals(2, resubReceivedEvents.size()); + assertEquals(2, streamReceivedEvents.size()); + + // Verify resubscription events + long resubArtifactCount = resubReceivedEvents.stream() + .filter(e -> e instanceof TaskArtifactUpdateEvent_v0_3) + .count(); + assertEquals(1, resubArtifactCount); + + long resubCompletionCount = resubReceivedEvents.stream() + .filter(e -> e instanceof TaskStatusUpdateEvent_v0_3) + .filter(e -> ((TaskStatusUpdateEvent_v0_3) e).isFinal()) + .count(); + assertEquals(1, resubCompletionCount); + + // Verify streaming events + long streamArtifactCount = streamReceivedEvents.stream() + .filter(e -> e instanceof TaskArtifactUpdateEvent_v0_3) + .count(); + assertEquals(1, streamArtifactCount); + + long streamCompletionCount = streamReceivedEvents.stream() + .filter(e -> e instanceof TaskStatusUpdateEvent_v0_3) + .filter(e -> ((TaskStatusUpdateEvent_v0_3) e).isFinal()) + .count(); + assertEquals(1, streamCompletionCount); + + // Verify artifact-2 details from resubscription + TaskArtifactUpdateEvent_v0_3 resubArtifact = (TaskArtifactUpdateEvent_v0_3) resubReceivedEvents.stream() + .filter(e -> e instanceof TaskArtifactUpdateEvent_v0_3) + .findFirst() + .orElseThrow(); + assertEquals("artifact-2", resubArtifact.getArtifact().artifactId()); + assertEquals("Second message artifact", + ((TextPart_v0_3) resubArtifact.getArtifact().parts().get(0)).getText()); + + // Verify artifact-2 details from streaming + TaskArtifactUpdateEvent_v0_3 streamArtifact = (TaskArtifactUpdateEvent_v0_3) streamReceivedEvents.stream() + .filter(e -> e instanceof TaskArtifactUpdateEvent_v0_3) + .findFirst() + .orElseThrow(); + assertEquals("artifact-2", streamArtifact.getArtifact().artifactId()); + assertEquals("Second message artifact", + ((TextPart_v0_3) streamArtifact.getArtifact().parts().get(0)).getText()); + } finally { + String taskId = generatedTaskIdRef.get(); + if (taskId != null) { + deleteTaskInTaskStore(taskId); + } + } + } + + @Test + public void testMalformedJSONRPCRequest() { + // skip this test for non-JSONRPC transports + assumeTrue(TransportProtocol_v0_3.JSONRPC.asString().equals(getTransportProtocol()), + "JSONRPC-specific test"); + + // missing closing bracket + String malformedRequest = "{\"jsonrpc\": \"2.0\", \"method\": \"message/send\", \"params\": {\"foo\": \"bar\"}"; + JSONRPCErrorResponse_v0_3 response = givenV03() + .contentType(MediaType.APPLICATION_JSON) + .body(malformedRequest) + .when() + .post("/") + .then() + .statusCode(200) + .extract() + .as(JSONRPCErrorResponse_v0_3.class); + assertNotNull(response.getError()); + assertEquals(new JSONParseError_v0_3().getCode(), response.getError().getCode()); + } + + @Test + public void testInvalidParamsJSONRPCRequest() { + // skip this test for non-JSONRPC transports + assumeTrue(TransportProtocol_v0_3.JSONRPC.asString().equals(getTransportProtocol()), + "JSONRPC-specific test"); + + String invalidParamsRequest = """ + {"jsonrpc": "2.0", "method": "message/send", "params": "not_a_dict", "id": "1"} + """; + testInvalidParams(invalidParamsRequest); + + invalidParamsRequest = """ + {"jsonrpc": "2.0", "method": "message/send", "params": {"message": {"parts": "invalid"}}, "id": "1"} + """; + testInvalidParams(invalidParamsRequest); + } + + private void testInvalidParams(String invalidParamsRequest) { + JSONRPCErrorResponse_v0_3 response = givenV03() + .contentType(MediaType.APPLICATION_JSON) + .body(invalidParamsRequest) + .when() + .post("/") + .then() + .statusCode(200) + .extract() + .as(JSONRPCErrorResponse_v0_3.class); + assertNotNull(response.getError()); + assertEquals(new InvalidParamsError_v0_3().getCode(), response.getError().getCode()); + assertEquals("1", response.getId()); + } + + @Test + public void testInvalidJSONRPCRequestMissingJsonrpc() { + // skip this test for non-JSONRPC transports + assumeTrue(TransportProtocol_v0_3.JSONRPC.asString().equals(getTransportProtocol()), + "JSONRPC-specific test"); + + String invalidRequest = """ + { + "method": "message/send", + "params": {} + } + """; + JSONRPCErrorResponse_v0_3 response = givenV03() + .contentType(MediaType.APPLICATION_JSON) + .body(invalidRequest) + .when() + .post("/") + .then() + .statusCode(200) + .extract() + .as(JSONRPCErrorResponse_v0_3.class); + assertNotNull(response.getError()); + assertEquals(new InvalidRequestError_v0_3().getCode(), response.getError().getCode()); + } + + @Test + public void testInvalidJSONRPCRequestMissingMethod() { + // skip this test for non-JSONRPC transports + assumeTrue(TransportProtocol_v0_3.JSONRPC.asString().equals(getTransportProtocol()), + "JSONRPC-specific test"); + + String invalidRequest = """ + {"jsonrpc": "2.0", "params": {}} + """; + JSONRPCErrorResponse_v0_3 response = givenV03() + .contentType(MediaType.APPLICATION_JSON) + .body(invalidRequest) + .when() + .post("/") + .then() + .statusCode(200) + .extract() + .as(JSONRPCErrorResponse_v0_3.class); + assertNotNull(response.getError()); + assertEquals(new InvalidRequestError_v0_3().getCode(), response.getError().getCode()); + } + + @Test + public void testInvalidJSONRPCRequestInvalidId() { + // skip this test for non-JSONRPC transports + assumeTrue(TransportProtocol_v0_3.JSONRPC.asString().equals(getTransportProtocol()), + "JSONRPC-specific test"); + + String invalidRequest = """ + {"jsonrpc": "2.0", "method": "message/send", "params": {}, "id": {"bad": "type"}} + """; + JSONRPCErrorResponse_v0_3 response = givenV03() + .contentType(MediaType.APPLICATION_JSON) + .body(invalidRequest) + .when() + .post("/") + .then() + .statusCode(200) + .extract() + .as(JSONRPCErrorResponse_v0_3.class); + assertNotNull(response.getError()); + assertEquals(new InvalidRequestError_v0_3().getCode(), response.getError().getCode()); + } + + @Test + public void testInvalidJSONRPCRequestNonExistentMethod() { + // skip this test for non-JSONRPC transports + assumeTrue(TransportProtocol_v0_3.JSONRPC.asString().equals(getTransportProtocol()), + "JSONRPC-specific test"); + + String invalidRequest = """ + {"jsonrpc": "2.0", "method" : "nonexistent/method", "params": {}} + """; + JSONRPCErrorResponse_v0_3 response = givenV03() + .contentType(MediaType.APPLICATION_JSON) + .body(invalidRequest) + .when() + .post("/") + .then() + .statusCode(200) + .extract() + .as(JSONRPCErrorResponse_v0_3.class); + assertNotNull(response.getError()); + assertEquals(new MethodNotFoundError_v0_3().getCode(), response.getError().getCode()); + } + + @Test + public void testNonStreamingMethodWithAcceptHeader() throws Exception { + // skip this test for non-JSONRPC transports + assumeTrue(TransportProtocol_v0_3.JSONRPC.asString().equals(getTransportProtocol()), + "JSONRPC-specific test"); + testGetTask(MediaType.APPLICATION_JSON); + } + + @Test + public void testStreamingMethodWithAcceptHeader() throws Exception { + // skip this test for non-JSONRPC transports + assumeTrue(TransportProtocol_v0_3.JSONRPC.asString().equals(getTransportProtocol()), + "JSONRPC-specific test"); + + testSendStreamingMessageWithHttpClient(MediaType.SERVER_SENT_EVENTS); + } + + @Test + public void testStreamingMethodWithoutAcceptHeader() throws Exception { + // skip this test for non-JSONRPC transports + assumeTrue(TransportProtocol_v0_3.JSONRPC.asString().equals(getTransportProtocol()), + "JSONRPC-specific test"); + + testSendStreamingMessageWithHttpClient(null); + } + + private void testSendStreamingMessageWithHttpClient(String mediaType) throws Exception { + saveTaskInTaskStore(MINIMAL_TASK); + try { + Message_v0_3 message = new Message_v0_3.Builder(MESSAGE) + .taskId(MINIMAL_TASK.getId()) + .contextId(MINIMAL_TASK.getContextId()) + .build(); + SendStreamingMessageRequest_v0_3 request = new SendStreamingMessageRequest_v0_3( + "1", new MessageSendParams_v0_3(message, null, null)); + + CompletableFuture>> responseFuture = initialiseStreamingRequest(request, mediaType); + + CountDownLatch latch = new CountDownLatch(1); + AtomicReference errorRef = new AtomicReference<>(); + + responseFuture.thenAccept(response -> { + if (response.statusCode() != 200) { + throw new IllegalStateException("Status code was " + response.statusCode()); + } + response.body().forEach(line -> { + try { + SendStreamingMessageResponse_v0_3 jsonResponse = extractJsonResponseFromSseLine(line); + if (jsonResponse != null) { + assertNull(jsonResponse.getError()); + Message_v0_3 messageResponse = (Message_v0_3) jsonResponse.getResult(); + assertEquals(MESSAGE.getMessageId(), messageResponse.getMessageId()); + assertEquals(MESSAGE.getRole(), messageResponse.getRole()); + Part_v0_3 part = messageResponse.getParts().get(0); + assertEquals(Part_v0_3.Kind.TEXT, part.getKind()); + assertEquals("test message", ((TextPart_v0_3) part).getText()); + latch.countDown(); + } + } catch (JsonProcessingException_v0_3 e) { + throw new RuntimeException(e); + } + }); + }).exceptionally(t -> { + if (!isStreamClosedError(t)) { + errorRef.set(t); + } + latch.countDown(); + return null; + }); + + boolean dataRead = latch.await(20, TimeUnit.SECONDS); + Assertions.assertTrue(dataRead); + Assertions.assertNull(errorRef.get()); + + } finally { + deleteTaskInTaskStore(MINIMAL_TASK.getId()); + } + } + + public void testSendStreamingMessage(boolean createTask) throws Exception { + if (createTask) { + saveTaskInTaskStore(MINIMAL_TASK); + } + try { + Message_v0_3.Builder messageBuilder = new Message_v0_3.Builder(MESSAGE); + if (createTask) { + messageBuilder.taskId(MINIMAL_TASK.getId()).contextId(MINIMAL_TASK.getContextId()); + } + Message_v0_3 message = messageBuilder.build(); + + CountDownLatch latch = new CountDownLatch(1); + AtomicReference receivedMessage = new AtomicReference<>(); + AtomicBoolean wasUnexpectedEvent = new AtomicBoolean(false); + AtomicReference errorRef = new AtomicReference<>(); + + BiConsumer consumer = (event, agentCard) -> { + if (event instanceof MessageEvent_v0_3 messageEvent) { + if (latch.getCount() > 0) { + receivedMessage.set(messageEvent.getMessage()); + latch.countDown(); + } else { + wasUnexpectedEvent.set(true); + } + } else { + wasUnexpectedEvent.set(true); + } + }; + + Consumer errorHandler = error -> { + errorRef.set(error); + latch.countDown(); + }; + + // testing the streaming send message + getClient().sendMessage(message, List.of(consumer), errorHandler); + + assertTrue(latch.await(10, TimeUnit.SECONDS)); + assertFalse(wasUnexpectedEvent.get()); + assertNull(errorRef.get()); + + Message_v0_3 messageResponse = receivedMessage.get(); + assertNotNull(messageResponse); + assertEquals(MESSAGE.getMessageId(), messageResponse.getMessageId()); + assertEquals(MESSAGE.getRole(), messageResponse.getRole()); + Part_v0_3 part = messageResponse.getParts().get(0); + assertEquals(Part_v0_3.Kind.TEXT, part.getKind()); + assertEquals("test message", ((TextPart_v0_3) part).getText()); + } catch (A2AClientException_v0_3 e) { + fail("Unexpected exception during sendMessage: " + e.getMessage(), e); + } finally { + if (createTask) { + deleteTaskInTaskStore(MINIMAL_TASK.getId()); + } + } + } + + private CompletableFuture>> initialiseStreamingRequest( + StreamingJSONRPCRequest_v0_3 request, String mediaType) throws Exception { + + // Create the client + HttpClient client = HttpClient.newBuilder() + .version(HttpClient.Version.HTTP_2) + .build(); + + // Create the request + HttpRequest.Builder builder = HttpRequest.newBuilder() + .uri(URI.create("http://localhost:" + serverPort + "/")) + .POST(HttpRequest.BodyPublishers.ofString(JsonUtil_v0_3.toJson(request))) + .header("Content-Type", APPLICATION_JSON); + if (mediaType != null) { + builder.header("Accept", mediaType); + } + HttpRequest httpRequest = builder.build(); + + // Send request async and return the CompletableFuture + return client.sendAsync(httpRequest, HttpResponse.BodyHandlers.ofLines()); + } + + private SendStreamingMessageResponse_v0_3 extractJsonResponseFromSseLine(String line) throws JsonProcessingException_v0_3 { + line = extractSseData(line); + if (line != null) { + return JsonUtil_v0_3.fromJson(line, SendStreamingMessageResponse_v0_3.class); + } + return null; + } + + private static String extractSseData(String line) { + if (line.startsWith("data:")) { + line = line.substring(5).trim(); + return line; + } + return null; + } + + protected boolean isStreamClosedError(Throwable throwable) { + // Unwrap the CompletionException + Throwable cause = throwable; + + while (cause != null) { + if (cause instanceof EOFException) { + return true; + } + if (cause instanceof IOException && cause.getMessage() != null + && cause.getMessage().contains("cancelled")) { + // stream is closed upon cancellation + return true; + } + cause = cause.getCause(); + } + return false; + } + + /** + * Save a v0.3 task to the v1.0 task store via HTTP. + * Converts v0.3 → v1.0 using TaskMapper. + */ + protected void saveTaskInTaskStore(Task_v0_3 task) throws Exception { + // Convert v0.3 → v1.0 + org.a2aproject.sdk.spec.Task v10Task = TaskMapper_v0_3.INSTANCE.toV10(task); + + HttpClient client = HttpClient.newBuilder() + .version(HttpClient.Version.HTTP_2) + .build(); + HttpRequest request = HttpRequest.newBuilder() + .uri(URI.create("http://localhost:" + serverPort + "/test/task")) + .POST(HttpRequest.BodyPublishers.ofString(org.a2aproject.sdk.jsonrpc.common.json.JsonUtil.toJson(v10Task))) + .header("Content-Type", APPLICATION_JSON) + .build(); + + HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString(StandardCharsets.UTF_8)); + if (response.statusCode() != 200) { + throw new RuntimeException(String.format("Saving task failed! Status: %d, Body: %s", response.statusCode(), response.body())); + } + } + + /** + * Get a v0.3 task from the v1.0 task store via HTTP. + * Converts v1.0 → v0.3 using TaskMapper. + */ + protected Task_v0_3 getTaskFromTaskStore(String taskId) throws Exception { + HttpClient client = HttpClient.newBuilder() + .version(HttpClient.Version.HTTP_2) + .build(); + HttpRequest request = HttpRequest.newBuilder() + .uri(URI.create("http://localhost:" + serverPort + "/test/task/" + taskId)) + .GET() + .build(); + + HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString(StandardCharsets.UTF_8)); + if (response.statusCode() == 404) { + return null; + } + if (response.statusCode() != 200) { + throw new RuntimeException(String.format("Getting task failed! Status: %d, Body: %s", response.statusCode(), response.body())); + } + + // Convert v1.0 → v0.3 + org.a2aproject.sdk.spec.Task v10Task = org.a2aproject.sdk.jsonrpc.common.json.JsonUtil.fromJson( + response.body(), org.a2aproject.sdk.spec.Task.class); + return TaskMapper_v0_3.INSTANCE.fromV10(v10Task); + } + + protected void deleteTaskInTaskStore(String taskId) throws Exception { + HttpClient client = HttpClient.newBuilder() + .version(HttpClient.Version.HTTP_2) + .build(); + HttpRequest request = HttpRequest.newBuilder() + .uri(URI.create(("http://localhost:" + serverPort + "/test/task/" + taskId))) + .DELETE() + .build(); + HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString(StandardCharsets.UTF_8)); + if (response.statusCode() != 200) { + throw new RuntimeException(response.statusCode() + ": Deleting task failed!" + response.body()); + } + } + + protected void ensureQueueForTask(String taskId) throws Exception { + HttpClient client = HttpClient.newBuilder() + .version(HttpClient.Version.HTTP_2) + .build(); + HttpRequest request = HttpRequest.newBuilder() + .uri(URI.create("http://localhost:" + serverPort + "/test/queue/ensure/" + taskId)) + .POST(HttpRequest.BodyPublishers.noBody()) + .build(); + HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString(StandardCharsets.UTF_8)); + if (response.statusCode() != 200) { + throw new RuntimeException(String.format("Ensuring queue failed! Status: %d, Body: %s", response.statusCode(), response.body())); + } + } + + /** + * Enqueue a v0.3 event on the server. + * Converts v0.3 → v1.0 using event-specific mappers. + */ + protected void enqueueEventOnServer(Event_v0_3 event) throws Exception { + String path; + Object v10Event; + + if (event instanceof TaskArtifactUpdateEvent_v0_3 e) { + path = "test/queue/enqueueTaskArtifactUpdateEvent/" + e.getTaskId(); + v10Event = TaskArtifactUpdateEventMapper_v0_3.INSTANCE.toV10(e); + } else if (event instanceof TaskStatusUpdateEvent_v0_3 e) { + path = "test/queue/enqueueTaskStatusUpdateEvent/" + e.getTaskId(); + v10Event = TaskStatusUpdateEventMapper_v0_3.INSTANCE.toV10(e); + } else { + throw new RuntimeException("Unknown event type " + event.getClass() + ". If you need the ability to" + + " handle more types, please add the REST endpoints."); + } + + HttpClient client = HttpClient.newBuilder() + .version(HttpClient.Version.HTTP_2) + .build(); + HttpRequest request = HttpRequest.newBuilder() + .uri(URI.create("http://localhost:" + serverPort + "/" + path)) + .header("Content-Type", APPLICATION_JSON) + .POST(HttpRequest.BodyPublishers.ofString(org.a2aproject.sdk.jsonrpc.common.json.JsonUtil.toJson(v10Event))) + .build(); + + HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString(StandardCharsets.UTF_8)); + if (response.statusCode() != 200) { + throw new RuntimeException(response.statusCode() + ": Queueing event failed!" + response.body()); + } + } + + private CompletableFuture awaitStreamingSubscription() { + int cnt = getStreamingSubscribedCount(); + AtomicInteger initialCount = new AtomicInteger(cnt); + + return CompletableFuture.runAsync(() -> { + try { + boolean done = false; + long end = System.currentTimeMillis() + 15000; + while (System.currentTimeMillis() < end) { + int count = getStreamingSubscribedCount(); + if (count > initialCount.get()) { + done = true; + break; + } + Thread.sleep(500); + } + if (!done) { + throw new RuntimeException("Timed out waiting for subscription"); + } + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new RuntimeException("Interrupted"); + } + }); + } + + private int getStreamingSubscribedCount() { + HttpClient client = HttpClient.newBuilder() + .version(HttpClient.Version.HTTP_2) + .build(); + HttpRequest request = HttpRequest.newBuilder() + .uri(URI.create("http://localhost:" + serverPort + "/test/streamingSubscribedCount")) + .GET() + .build(); + try { + HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString(StandardCharsets.UTF_8)); + String body = response.body().trim(); + return Integer.parseInt(body); + } catch (IOException | InterruptedException e) { + throw new RuntimeException(e); + } + } + + protected int getChildQueueCount(String taskId) { + HttpClient client = HttpClient.newBuilder() + .version(HttpClient.Version.HTTP_2) + .build(); + HttpRequest request = HttpRequest.newBuilder() + .uri(URI.create("http://localhost:" + serverPort + "/test/queue/childCount/" + taskId)) + .GET() + .build(); + try { + HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString(StandardCharsets.UTF_8)); + String body = response.body().trim(); + return Integer.parseInt(body); + } catch (IOException | InterruptedException e) { + throw new RuntimeException(e); + } + } + + /** + * Delete a push notification config from the v1.0 store. + */ + protected void deletePushNotificationConfigInStore(String taskId, String configId) throws Exception { + HttpClient client = HttpClient.newBuilder() + .version(HttpClient.Version.HTTP_2) + .build(); + HttpRequest request = HttpRequest.newBuilder() + .uri(URI.create(("http://localhost:" + serverPort + "/test/task/" + taskId + "/config/" + configId))) + .DELETE() + .build(); + HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString(StandardCharsets.UTF_8)); + if (response.statusCode() != 200) { + throw new RuntimeException(response.statusCode() + ": Deleting task failed!" + response.body()); + } + } + + /** + * Save a v0.3 push notification config to the v1.0 store. + * Converts v0.3 → v1.0 using mappers. + */ + protected void savePushNotificationConfigInStore(String taskId, PushNotificationConfig_v0_3 notificationConfig) throws Exception { + // Create v0.3 TaskPushNotificationConfig wrapper + TaskPushNotificationConfig_v0_3 v03Config = + new TaskPushNotificationConfig_v0_3(taskId, notificationConfig); + + // Convert v0.3 → v1.0 + org.a2aproject.sdk.spec.TaskPushNotificationConfig v10Config = + TaskPushNotificationConfigMapper_v0_3.INSTANCE.toV10(v03Config); + + // Send to v1.0 server using v1.0 JSON serialization + HttpClient client = HttpClient.newBuilder() + .version(HttpClient.Version.HTTP_2) + .build(); + HttpRequest request = HttpRequest.newBuilder() + .uri(URI.create("http://localhost:" + serverPort + "/test/task/" + taskId)) + .POST(HttpRequest.BodyPublishers.ofString(org.a2aproject.sdk.jsonrpc.common.json.JsonUtil.toJson(v10Config))) + .header("Content-Type", APPLICATION_JSON) + .build(); + + HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString(StandardCharsets.UTF_8)); + if (response.statusCode() != 200) { + throw new RuntimeException(response.statusCode() + ": Creating task push notification config failed! " + response.body()); + } + } + + /** + * Get a client instance. + */ + protected Client_v0_3 getClient() throws A2AClientException_v0_3 { + if (client == null) { + client = createClient(true); + } + return client; + } + + /** + * Get a client configured for non-streaming operations. + */ + protected Client_v0_3 getNonStreamingClient() throws A2AClientException_v0_3 { + if (nonStreamingClient == null) { + nonStreamingClient = createClient(false); + } + return nonStreamingClient; + } + + /** + * Get a client configured for polling (non-blocking) operations. + */ + protected Client_v0_3 getPollingClient() throws A2AClientException_v0_3 { + if (pollingClient == null) { + pollingClient = createPollingClient(); + } + return pollingClient; + } + + /** + * Create a client with the specified streaming configuration. + */ + private Client_v0_3 createClient(boolean streaming) throws A2AClientException_v0_3 { + AgentCard_v0_3 agentCard = createTestAgentCard(); + ClientConfig_v0_3 clientConfig = createClientConfig(streaming); + + ClientBuilder_v0_3 clientBuilder = Client_v0_3 + .builder(agentCard) + .clientConfig(clientConfig); + + configureTransport(clientBuilder); + + return clientBuilder.build(); + } + + /** + * Create a test agent card with the appropriate transport configuration. + */ + private AgentCard_v0_3 createTestAgentCard() { + return new AgentCard_v0_3.Builder() + .name("test-card") + .description("A test agent card") + .url(getTransportUrl()) + .version("1.0") + .documentationUrl("http://example.com/docs") + .preferredTransport(getTransportProtocol()) + .capabilities(new AgentCapabilities_v0_3.Builder() + .streaming(true) + .pushNotifications(true) + .stateTransitionHistory(true) + .build()) + .defaultInputModes(List.of("text")) + .defaultOutputModes(List.of("text")) + .skills(List.of()) + .additionalInterfaces(List.of(new AgentInterface_v0_3(getTransportProtocol(), getTransportUrl()))) + .protocolVersion("0.2.5") + .build(); + } + + /** + * Create client configuration with transport-specific settings. + */ + private ClientConfig_v0_3 createClientConfig(boolean streaming) { + return new ClientConfig_v0_3.Builder() + .setStreaming(streaming) + .build(); + } + + /** + * Create a client configured for polling (non-blocking) operations. + */ + private Client_v0_3 createPollingClient() throws A2AClientException_v0_3 { + AgentCard_v0_3 agentCard = createTestAgentCard(); + ClientConfig_v0_3 clientConfig = new ClientConfig_v0_3.Builder() + .setStreaming(false) // Non-streaming + .setPolling(true) // Polling mode (translates to blocking=false on server) + .build(); + + ClientBuilder_v0_3 clientBuilder = Client_v0_3 + .builder(agentCard) + .clientConfig(clientConfig); + + configureTransport(clientBuilder); + + return clientBuilder.build(); + } + + /** + * Integration test for THE BIG IDEA: MainQueue stays open for non-final tasks, + * enabling fire-and-forget patterns and late resubscription. + * + * Flow: + * 1. Agent emits WORKING state (non-final) and finishes without completing + * 2. Client disconnects (ChildQueue closes) + * 3. MainQueue should stay OPEN because task is non-final + * 4. Late resubscription should succeed + */ + @Test + @Timeout(value = 2, unit = TimeUnit.MINUTES) + public void testMainQueueStaysOpenForNonFinalTasks() throws Exception { + String taskId = "fire-and-forget-task-integration"; + String contextId = "fire-ctx"; + + // Create task in WORKING state (non-final) + Task_v0_3 workingTask = new Task_v0_3.Builder() + .id(taskId) + .contextId(contextId) + .status(new TaskStatus_v0_3(TaskState_v0_3.WORKING)) + .build(); + saveTaskInTaskStore(workingTask); + + try { + // Ensure queue exists for the task + ensureQueueForTask(taskId); + + // Send a message that will leave task in WORKING state (fire-and-forget pattern) + Message_v0_3 message = new Message_v0_3.Builder(MESSAGE) + .taskId(taskId) + .contextId(contextId) + .parts(new TextPart_v0_3("fire and forget")) + .build(); + + CountDownLatch firstEventLatch = new CountDownLatch(1); + AtomicReference errorRef = new AtomicReference<>(); + + BiConsumer consumer = (event, agentCard) -> { + // Receive any event (Message) to know agent processed the request + if (event instanceof MessageEvent_v0_3) { + firstEventLatch.countDown(); + } + }; + + Consumer errorHandler = error -> { + if (!isStreamClosedError(error)) { + errorRef.set(error); + } + firstEventLatch.countDown(); + }; + + // Start streaming subscription + CountDownLatch subscriptionLatch = new CountDownLatch(1); + awaitStreamingSubscription() + .whenComplete((unused, throwable) -> subscriptionLatch.countDown()); + + getClient().sendMessage(message, List.of(consumer), errorHandler); + + // Wait for subscription to be established + assertTrue(subscriptionLatch.await(15, TimeUnit.SECONDS), + "Subscription should be established"); + + // Wait for agent to respond (test agent sends Message, not WORKING status) + assertTrue(firstEventLatch.await(15, TimeUnit.SECONDS), + "Should receive agent response"); + assertNull(errorRef.get()); + + // Give agent time to finish (task remains in WORKING state - non-final) + Thread.sleep(2000); + + // THE BIG IDEA TEST: Resubscribe to the task + // Even though the agent finished and original ChildQueue closed, + // MainQueue should still be open because task is in non-final WORKING state + + CountDownLatch resubLatch = new CountDownLatch(1); + AtomicReference resubErrorRef = new AtomicReference<>(); + + BiConsumer resubConsumer = (event, agentCard) -> { + // We might not receive events immediately, but subscription should succeed + resubLatch.countDown(); + }; + + Consumer resubErrorHandler = error -> { + if (!isStreamClosedError(error)) { + resubErrorRef.set(error); + } + resubLatch.countDown(); + }; + + // This should succeed - MainQueue is still open for non-final task + CountDownLatch resubSubscriptionLatch = new CountDownLatch(1); + awaitStreamingSubscription() + .whenComplete((unused, throwable) -> resubSubscriptionLatch.countDown()); + + getClient().resubscribe(new TaskIdParams_v0_3(taskId), + List.of(resubConsumer), + resubErrorHandler); + + // Wait for resubscription to be established + assertTrue(resubSubscriptionLatch.await(15, TimeUnit.SECONDS), + "Resubscription should succeed - MainQueue stayed open for non-final task"); + + // Verify no errors during resubscription + assertNull(resubErrorRef.get(), + "Resubscription should not error - validates THE BIG IDEA works end-to-end"); + + } finally { + deleteTaskInTaskStore(taskId); + } + } + + /** + * Integration test verifying MainQueue DOES close when task is finalized. + * This ensures Level 2 protection doesn't prevent cleanup of completed tasks. + * + * Flow: + * 1. Send message to new task (creates task in WORKING, then completes it) + * 2. Task reaches COMPLETED state (final) + * 3. ChildQueue closes after receiving final event + * 4. MainQueue should close because task is finalized + * 5. Resubscription should fail with TaskNotFoundError + */ + @Test + @Timeout(value = 2, unit = TimeUnit.MINUTES) + public void testMainQueueClosesForFinalizedTasks() throws Exception { + // Send a message without taskId - server generates one + Message_v0_3 message = new Message_v0_3.Builder(MESSAGE) + .parts(new TextPart_v0_3("complete task")) + .build(); + + CountDownLatch completionLatch = new CountDownLatch(1); + AtomicReference errorRef = new AtomicReference<>(); + AtomicReference generatedTaskId = new AtomicReference<>(); + + BiConsumer consumer = (event, agentCard) -> { + if (event instanceof TaskEvent_v0_3 te) { + generatedTaskId.compareAndSet(null, te.getTask().getId()); + // Might get Task with final state + if (te.getTask().getStatus().state().isFinal()) { + completionLatch.countDown(); + } + } else if (event instanceof MessageEvent_v0_3 me) { + // Message is considered a final event - capture taskId from the message + generatedTaskId.compareAndSet(null, me.getMessage().getTaskId()); + completionLatch.countDown(); + } else if (event instanceof TaskUpdateEvent_v0_3 tue && + tue.getUpdateEvent() instanceof TaskStatusUpdateEvent_v0_3 status) { + generatedTaskId.compareAndSet(null, status.getTaskId()); + if (status.isFinal()) { + completionLatch.countDown(); + } + } + }; + + Consumer errorHandler = error -> { + if (!isStreamClosedError(error)) { + errorRef.set(error); + } + completionLatch.countDown(); + }; + + try { + // Send message and wait for completion + getClient().sendMessage(message, List.of(consumer), errorHandler); + + assertTrue(completionLatch.await(15, TimeUnit.SECONDS), + "Should receive final event"); + assertNull(errorRef.get(), "Should not have errors during message send"); + + String taskId = generatedTaskId.get(); + assertNotNull(taskId, "Should have captured server-generated taskId"); + + // Give cleanup time to run after final event + Thread.sleep(2000); + + // Try to resubscribe to finalized task - should fail + CountDownLatch errorLatch = new CountDownLatch(1); + AtomicReference resubErrorRef = new AtomicReference<>(); + + Consumer resubErrorHandler = error -> { + if (error == null) { + // Stream completed successfully - ignore, we're waiting for an error + return; + } + if (!isStreamClosedError(error)) { + resubErrorRef.set(error); + } + errorLatch.countDown(); + }; + + // Attempt resubscription + try { + getClient().resubscribe(new TaskIdParams_v0_3(taskId), + List.of(), + resubErrorHandler); + + // Wait for error + assertTrue(errorLatch.await(15, TimeUnit.SECONDS), + "Should receive error for finalized task"); + + Throwable error = resubErrorRef.get(); + assertNotNull(error, "Resubscription should fail for finalized task"); + + // Verify it's a TaskNotFoundError + Throwable cause = error; + boolean foundTaskNotFound = false; + while (cause != null && !foundTaskNotFound) { + if (cause instanceof TaskNotFoundError_v0_3 || + (cause instanceof A2AClientException_v0_3 && + ((A2AClientException_v0_3) cause).getCause() instanceof TaskNotFoundError_v0_3)) { + foundTaskNotFound = true; + } + cause = cause.getCause(); + } + assertTrue(foundTaskNotFound, + "Should receive TaskNotFoundError - MainQueue closed for finalized task"); + + } catch (A2AClientException_v0_3 e) { + // Exception might be thrown immediately instead of via error handler + assertInstanceOf(TaskNotFoundError_v0_3.class, e.getCause(), + "Should fail with TaskNotFoundError - MainQueue cleaned up for finalized task"); + } + + } finally { + // Task might not exist in store if created via message send + String taskId = generatedTaskId.get(); + if (taskId != null) { + try { + Task_v0_3 task = getTaskFromTaskStore(taskId); + if (task != null) { + deleteTaskInTaskStore(taskId); + } + } catch (Exception e) { + // Ignore cleanup errors + } + } + } + } +} diff --git a/compat-0.3/server-conversion/src/test/java/org/a2aproject/sdk/compat03/conversion/AgentCardProducer_v0_3.java b/compat-0.3/server-conversion/src/test/java/org/a2aproject/sdk/compat03/conversion/AgentCardProducer_v0_3.java new file mode 100644 index 000000000..130ace31c --- /dev/null +++ b/compat-0.3/server-conversion/src/test/java/org/a2aproject/sdk/compat03/conversion/AgentCardProducer_v0_3.java @@ -0,0 +1,73 @@ +package org.a2aproject.sdk.compat03.conversion; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; + +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.enterprise.inject.Produces; + +import org.a2aproject.sdk.compat03.spec.AgentCard_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentCapabilities_v0_3; +import org.a2aproject.sdk.server.PublicAgentCard; + +import io.quarkus.arc.DefaultBean; +import io.quarkus.arc.profile.IfBuildProfile; + +/** + * Produces v0.3 AgentCard for compat layer tests. + * Duplicated from v1.0 tests/server-common to avoid dependency on v1.0 test infrastructure. + */ +@ApplicationScoped +@IfBuildProfile("test") +public class AgentCardProducer_v0_3 { + + private static final String PREFERRED_TRANSPORT = "preferred-transport"; + private static final String PROPERTIES_FILE = "/compat-0.3-requesthandler-test.properties"; + + @Produces + @PublicAgentCard + @DefaultBean + public AgentCard_v0_3 createTestAgentCard() { + String port = System.getProperty("test.agent.card.port", "8081"); + String preferredTransport = loadPreferredTransportFromProperties(); + + // v0.3 uses 'url' field for primary endpoint + String url = "grpc".equalsIgnoreCase(preferredTransport) + ? "localhost:" + port + : "http://localhost:" + port; + + return new AgentCard_v0_3.Builder() + .name("compat-0.3-test-agent") + .description("Test agent for v0.3 compatibility layer") + .url(url) + .version("1.0.0") + .preferredTransport(preferredTransport) + .capabilities(new AgentCapabilities_v0_3(true, true, true, List.of())) + .defaultInputModes(List.of("text")) + .defaultOutputModes(List.of("text")) + .skills(List.of()) + .additionalInterfaces(new ArrayList<>()) + .build(); + } + + private static String loadPreferredTransportFromProperties() { + URL url = AgentCardProducer_v0_3.class.getResource(PROPERTIES_FILE); + if (url == null) { + // Default to jsonrpc if no config found + return "jsonrpc"; + } + Properties properties = new Properties(); + try { + try (InputStream in = url.openStream()) { + properties.load(in); + } + } catch (IOException e) { + throw new RuntimeException("Failed to load test properties", e); + } + return properties.getProperty(PREFERRED_TRANSPORT, "jsonrpc"); + } +} diff --git a/compat-0.3/server-conversion/src/test/java/org/a2aproject/sdk/compat03/conversion/AgentExecutorProducer_v0_3.java b/compat-0.3/server-conversion/src/test/java/org/a2aproject/sdk/compat03/conversion/AgentExecutorProducer_v0_3.java new file mode 100644 index 000000000..2a684f391 --- /dev/null +++ b/compat-0.3/server-conversion/src/test/java/org/a2aproject/sdk/compat03/conversion/AgentExecutorProducer_v0_3.java @@ -0,0 +1,106 @@ +package org.a2aproject.sdk.compat03.conversion; + +import java.util.List; + +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.enterprise.inject.Produces; + +import org.a2aproject.sdk.server.agentexecution.AgentExecutor; +import org.a2aproject.sdk.server.agentexecution.RequestContext; +import org.a2aproject.sdk.server.tasks.AgentEmitter; +import org.a2aproject.sdk.spec.A2AError; +import org.a2aproject.sdk.spec.TextPart; +import org.a2aproject.sdk.spec.UnsupportedOperationError; +import io.quarkus.arc.profile.IfBuildProfile; + +@ApplicationScoped +@IfBuildProfile("test") +public class AgentExecutorProducer_v0_3 { + + @Produces + public AgentExecutor agentExecutor() { + return new AgentExecutor() { + @Override + public void execute(RequestContext context, AgentEmitter agentEmitter) throws A2AError { + String taskId = context.getTaskId(); + String input = context.getMessage() != null ? extractTextFromMessage(context.getMessage()) : ""; + + // Special handling for multi-event test (routed by message content) + if (input.startsWith("multi-event:first")) { + agentEmitter.startWork(); + // Return immediately - queue stays open because task is in WORKING state + return; + } + if (input.startsWith("multi-event:second")) { + agentEmitter.addArtifact( + List.of(new TextPart("Second message artifact")), + "artifact-2", "Second Artifact", null); + agentEmitter.complete(); + return; + } + + // Special handling for input-required test (routed by message content) + if (input.startsWith("input-required:")) { + String payload = input.substring("input-required:".length()); + // Second call: user provided the required input - complete the task + if ("User input".equals(payload)) { + agentEmitter.complete(); + return; + } + // First call: emit INPUT_REQUIRED + agentEmitter.requiresInput(agentEmitter.newAgentMessage( + List.of(new TextPart("Please provide additional information")), + context.getMessage().metadata())); + return; + } + + // Special handling for auth-required test (routed by message content) + if (input.startsWith("auth-required:")) { + agentEmitter.requiresAuth(agentEmitter.newAgentMessage( + List.of(new TextPart("Please authenticate with OAuth provider")), + context.getMessage().metadata())); + + try { + Thread.sleep(2000); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new org.a2aproject.sdk.spec.InternalError("Auth simulation interrupted: " + e.getMessage()); + } + + agentEmitter.complete(); + return; + } + + if ("task-not-supported-123".equals(taskId)) { + throw new UnsupportedOperationError(); + } + + if (context.getMessage() != null) { + agentEmitter.sendMessage(context.getMessage()); + } else { + agentEmitter.addTask(context.getTask()); + } + } + + private String extractTextFromMessage(org.a2aproject.sdk.spec.Message message) { + if (message.parts() == null || message.parts().isEmpty()) { + return ""; + } + return message.parts().stream() + .filter(part -> part instanceof TextPart) + .map(part -> ((TextPart) part).text()) + .findFirst() + .orElse(""); + } + + @Override + public void cancel(RequestContext context, AgentEmitter agentEmitter) throws A2AError { + if (context.getTask().id().equals("cancel-task-123")) { + agentEmitter.cancel(); + } else if (context.getTask().id().equals("cancel-task-not-supported-123")) { + throw new UnsupportedOperationError(); + } + } + }; + } +} diff --git a/compat-0.3/server-conversion/src/test/java/org/a2aproject/sdk/compat03/conversion/GsonObjectMapper_v0_3.java b/compat-0.3/server-conversion/src/test/java/org/a2aproject/sdk/compat03/conversion/GsonObjectMapper_v0_3.java new file mode 100644 index 000000000..bc1c6cfbf --- /dev/null +++ b/compat-0.3/server-conversion/src/test/java/org/a2aproject/sdk/compat03/conversion/GsonObjectMapper_v0_3.java @@ -0,0 +1,39 @@ +package org.a2aproject.sdk.compat03.conversion; + +import io.restassured.mapper.ObjectMapper; +import io.restassured.mapper.ObjectMapperDeserializationContext; +import io.restassured.mapper.ObjectMapperSerializationContext; +import org.a2aproject.sdk.compat03.json.JsonProcessingException_v0_3; +import org.a2aproject.sdk.compat03.json.JsonUtil_v0_3; + +/** + * REST-Assured ObjectMapper adapter for v0.3 JSON serialization. + *

+ * Used to deserialize v0.3 server JSONRPC responses that contain v0.3 types + * (JSONRPCError, JSONRPCErrorResponse, etc.). Complements {@link V10GsonObjectMapper_v0_3} + * which is used for test utility endpoints that expect v1.0 types. + */ +public class GsonObjectMapper_v0_3 implements ObjectMapper { + public static final GsonObjectMapper_v0_3 INSTANCE = new GsonObjectMapper_v0_3(); + + private GsonObjectMapper_v0_3() { + } + + @Override + public Object deserialize(ObjectMapperDeserializationContext context) { + try { + return JsonUtil_v0_3.fromJson(context.getDataToDeserialize().asString(), context.getType()); + } catch (JsonProcessingException_v0_3 ex) { + throw new RuntimeException(ex); + } + } + + @Override + public Object serialize(ObjectMapperSerializationContext context) { + try { + return JsonUtil_v0_3.toJson(context.getObjectToSerialize()); + } catch (JsonProcessingException_v0_3 ex) { + throw new RuntimeException(ex); + } + } +} diff --git a/compat-0.3/server-conversion/src/test/java/org/a2aproject/sdk/compat03/conversion/TestHttpClient_v0_3.java b/compat-0.3/server-conversion/src/test/java/org/a2aproject/sdk/compat03/conversion/TestHttpClient_v0_3.java new file mode 100644 index 000000000..f95fb723d --- /dev/null +++ b/compat-0.3/server-conversion/src/test/java/org/a2aproject/sdk/compat03/conversion/TestHttpClient_v0_3.java @@ -0,0 +1,106 @@ +package org.a2aproject.sdk.compat03.conversion; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CountDownLatch; +import java.util.function.Consumer; + +import jakarta.enterprise.context.Dependent; +import jakarta.enterprise.inject.Alternative; + +import org.a2aproject.sdk.client.http.A2AHttpClient; +import org.a2aproject.sdk.client.http.A2AHttpResponse; +import org.a2aproject.sdk.jsonrpc.common.json.JsonProcessingException; +import org.a2aproject.sdk.jsonrpc.common.json.JsonUtil; +import org.a2aproject.sdk.spec.Task; + +import io.quarkus.arc.profile.IfBuildProfile; + +/** + * Test implementation of A2AHttpClient for push notification testing. + * Duplicated from v1.0 tests/server-common to avoid dependency on v1.0 test infrastructure. + */ +@Dependent +@Alternative +@IfBuildProfile("test") +public class TestHttpClient_v0_3 implements A2AHttpClient { + final List tasks = Collections.synchronizedList(new ArrayList<>()); + volatile CountDownLatch latch; + + @Override + public GetBuilder createGet() { + return null; + } + + @Override + public PostBuilder createPost() { + return new TestPostBuilder(); + } + + @Override + public DeleteBuilder createDelete() { + return null; + } + + class TestPostBuilder implements A2AHttpClient.PostBuilder { + private volatile String body; + @Override + public PostBuilder body(String body) { + this.body = body; + return this; + } + + @Override + public A2AHttpResponse post() throws IOException, InterruptedException { + try { + tasks.add(JsonUtil.fromJson(body, Task.class)); + } catch (JsonProcessingException e) { + throw new IOException("Failed to parse task JSON", e); + } + try { + return new A2AHttpResponse() { + @Override + public int status() { + return 200; + } + + @Override + public boolean success() { + return true; + } + + @Override + public String body() { + return ""; + } + }; + } finally { + latch.countDown(); + } + } + + @Override + public CompletableFuture postAsyncSSE(Consumer messageConsumer, Consumer errorConsumer, Runnable completeRunnable) throws IOException, InterruptedException { + return null; + } + + @Override + public PostBuilder url(String s) { + return this; + } + + @Override + public PostBuilder addHeader(String name, String value) { + return this; + } + + @Override + public PostBuilder addHeaders(Map headers) { + return this; + } + } +} diff --git a/compat-0.3/server-conversion/src/test/java/org/a2aproject/sdk/compat03/conversion/TestUtilsBean_v0_3.java b/compat-0.3/server-conversion/src/test/java/org/a2aproject/sdk/compat03/conversion/TestUtilsBean_v0_3.java new file mode 100644 index 000000000..6a43e444c --- /dev/null +++ b/compat-0.3/server-conversion/src/test/java/org/a2aproject/sdk/compat03/conversion/TestUtilsBean_v0_3.java @@ -0,0 +1,118 @@ +package org.a2aproject.sdk.compat03.conversion; + +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; + +import org.a2aproject.sdk.server.events.QueueManager; +import org.a2aproject.sdk.server.tasks.PushNotificationConfigStore; +import org.a2aproject.sdk.server.tasks.TaskStore; +import org.a2aproject.sdk.spec.Event; +import org.a2aproject.sdk.spec.TaskPushNotificationConfig; +import org.a2aproject.sdk.spec.Task; + +import io.quarkus.arc.profile.IfBuildProfile; + +/** + * Contains utilities to interact with the server side for the v0.3 compat tests. + * Duplicated from v1.0 tests/server-common to avoid dependency on v1.0 test infrastructure. + * + *

The intent for this bean is to be exposed via REST. + * + *

There is a Quarkus implementation in {@code A2ATestRoutes} which shows the contract for how to + * expose it via REST. For other REST frameworks, you will need to provide an implementation that works in a similar + * way to {@code A2ATestRoutes}.

+ */ +@ApplicationScoped +@IfBuildProfile("test") +public class TestUtilsBean_v0_3 { + + @Inject + TaskStore taskStore; + + @Inject + QueueManager queueManager; + + @Inject + PushNotificationConfigStore pushNotificationConfigStore; + + public void saveTask(Task task) { + taskStore.save(task, false); + } + + public Task getTask(String taskId) { + return taskStore.get(taskId); + } + + public void deleteTask(String taskId) { + taskStore.delete(taskId); + } + + public void ensureQueue(String taskId) { + queueManager.createOrTap(taskId); + } + + public void enqueueEvent(String taskId, Event event) { + queueManager.get(taskId).enqueueEvent(event); + } + + public int getChildQueueCount(String taskId) { + return queueManager.getActiveChildQueueCount(taskId); + } + + public void deleteTaskPushNotificationConfig(String taskId, String configId) { + pushNotificationConfigStore.deleteInfo(taskId, configId); + } + + public void saveTaskPushNotificationConfig(String taskId, TaskPushNotificationConfig notificationConfig) { + pushNotificationConfigStore.setInfo(TaskPushNotificationConfig.builder(notificationConfig).taskId(taskId).build()); + } + + /** + * Waits for the EventConsumer polling loop to start for the specified task's queue. + * This ensures the queue is ready to receive and process events. + * + * @param taskId the task ID whose queue poller to wait for + * @throws InterruptedException if interrupted while waiting + */ + public void awaitQueuePollerStart(String taskId) throws InterruptedException { + queueManager.awaitQueuePollerStart(queueManager.get(taskId)); + } + + /** + * Waits for the child queue count to stabilize at the expected value. + *

+ * This method addresses a race condition where EventConsumer polling loops may not have started + * yet when events are emitted. It waits for the child queue count to match the expected value + * for 3 consecutive checks (150ms total), ensuring EventConsumers are actively polling and + * won't miss events. + *

+ * Use this after operations that create child queues (e.g., subscribeToTask, sendMessage) to + * ensure their EventConsumer polling loops have started before the agent emits events. + * + * @param taskId the task ID whose child queues to monitor + * @param expectedCount the expected number of active child queues + * @param timeoutMs maximum time to wait in milliseconds + * @return true if the count stabilized at the expected value, false if timeout occurred + * @throws InterruptedException if interrupted while waiting + */ + public boolean awaitChildQueueCountStable(String taskId, int expectedCount, long timeoutMs) throws InterruptedException { + long endTime = System.currentTimeMillis() + timeoutMs; + int consecutiveMatches = 0; + final int requiredMatches = 3; // Count must match 3 times in a row (150ms) to be considered stable + + while (System.currentTimeMillis() < endTime) { + int count = queueManager.getActiveChildQueueCount(taskId); + if (count == expectedCount) { + consecutiveMatches++; + if (consecutiveMatches >= requiredMatches) { + // Count is stable - all child queues exist and haven't closed + return true; + } + } else { + consecutiveMatches = 0; // Reset if count changes + } + Thread.sleep(50); + } + return false; + } +} diff --git a/compat-0.3/server-conversion/src/test/java/org/a2aproject/sdk/compat03/conversion/V10GsonObjectMapper_v0_3.java b/compat-0.3/server-conversion/src/test/java/org/a2aproject/sdk/compat03/conversion/V10GsonObjectMapper_v0_3.java new file mode 100644 index 000000000..04439ab28 --- /dev/null +++ b/compat-0.3/server-conversion/src/test/java/org/a2aproject/sdk/compat03/conversion/V10GsonObjectMapper_v0_3.java @@ -0,0 +1,39 @@ +package org.a2aproject.sdk.compat03.conversion; + +import io.restassured.mapper.ObjectMapper; +import io.restassured.mapper.ObjectMapperDeserializationContext; +import io.restassured.mapper.ObjectMapperSerializationContext; +import org.a2aproject.sdk.jsonrpc.common.json.JsonProcessingException; +import org.a2aproject.sdk.jsonrpc.common.json.JsonUtil; + +/** + * REST-Assured ObjectMapper adapter for v1.0 JSON serialization. + *

+ * Used by test utilities to communicate with server test endpoints that expect v1.0 JSON format. + * The v0.3 compatibility tests use v0.3 client types, but the server test infrastructure + * (TestUtilsBean endpoints) operates on v1.0 types. + */ +public class V10GsonObjectMapper_v0_3 implements ObjectMapper { + public static final V10GsonObjectMapper_v0_3 INSTANCE = new V10GsonObjectMapper_v0_3(); + + private V10GsonObjectMapper_v0_3() { + } + + @Override + public Object deserialize(ObjectMapperDeserializationContext context) { + try { + return JsonUtil.fromJson(context.getDataToDeserialize().asString(), context.getType()); + } catch (JsonProcessingException ex) { + throw new RuntimeException(ex); + } + } + + @Override + public Object serialize(ObjectMapperSerializationContext context) { + try { + return JsonUtil.toJson(context.getObjectToSerialize()); + } catch (JsonProcessingException ex) { + throw new RuntimeException(ex); + } + } +} diff --git a/compat-0.3/server-conversion/src/test/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskMapper_v0_3_Test.java b/compat-0.3/server-conversion/src/test/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskMapper_v0_3_Test.java new file mode 100644 index 000000000..be1695469 --- /dev/null +++ b/compat-0.3/server-conversion/src/test/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskMapper_v0_3_Test.java @@ -0,0 +1,186 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.domain; + +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.List; +import java.util.Map; + +import org.a2aproject.sdk.compat03.spec.Artifact_v0_3; +import org.a2aproject.sdk.compat03.spec.DataPart_v0_3; +import org.a2aproject.sdk.compat03.spec.Message_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskState_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskStatus_v0_3; +import org.a2aproject.sdk.compat03.spec.Task_v0_3; +import org.a2aproject.sdk.compat03.spec.TextPart_v0_3; +import org.a2aproject.sdk.spec.Task; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; + +/** + * Test for {@link TaskMapper_v0_3} to verify conversion of fully populated Task objects + * between v0.3 and v1.0 protocol versions. + */ +class TaskMapper_v0_3_Test { + + @Test + void testFullyPopulatedTaskConversion() { + // Create a fully populated v0.3 Task + OffsetDateTime now = OffsetDateTime.now(ZoneOffset.UTC); + + Message_v0_3 v03Message = new Message_v0_3( + Message_v0_3.Role.USER, + List.of(new TextPart_v0_3("Hello, agent!")), + "msg-001", + "ctx-001", + "task-001", + List.of("ref-task-001"), + Map.of("key", "value"), + List.of("ext1") + ); + + TaskStatus_v0_3 v03Status = new TaskStatus_v0_3( + TaskState_v0_3.WORKING, + v03Message, + now + ); + + Artifact_v0_3 v03Artifact = new Artifact_v0_3( + "artifact-001", + "Test Artifact", + "A test artifact", + List.of( + new TextPart_v0_3("Response text"), + new DataPart_v0_3(Map.of("result", "success")) + ), + Map.of("artifactMeta", "value"), + List.of("artifactExt") + ); + + Message_v0_3 v03HistoryMessage = new Message_v0_3( + Message_v0_3.Role.AGENT, + List.of(new TextPart_v0_3("Agent response")), + "msg-002", + "ctx-001", + "task-001", + null, + null, + null + ); + + Task_v0_3 v03Task = new Task_v0_3( + "task-001", + "ctx-001", + v03Status, + List.of(v03Artifact), + List.of(v03HistoryMessage), + Map.of("taskMeta", "taskValue") + ); + + // Convert v0.3 → v1.0 + Task v10Task = TaskMapper_v0_3.INSTANCE.toV10(v03Task); + + // Verify v1.0 Task + assertNotNull(v10Task); + assertEquals("task-001", v10Task.id()); + assertEquals("ctx-001", v10Task.contextId()); + assertEquals(Map.of("taskMeta", "taskValue"), v10Task.metadata()); + + // Verify status conversion + assertNotNull(v10Task.status()); + assertEquals(org.a2aproject.sdk.spec.TaskState.TASK_STATE_WORKING, v10Task.status().state()); + assertEquals(now, v10Task.status().timestamp()); + + // Verify status message conversion + assertNotNull(v10Task.status().message()); + assertEquals(org.a2aproject.sdk.spec.Message.Role.ROLE_USER, v10Task.status().message().role()); + assertEquals("msg-001", v10Task.status().message().messageId()); + assertEquals("ctx-001", v10Task.status().message().contextId()); + assertEquals("task-001", v10Task.status().message().taskId()); + assertEquals(1, v10Task.status().message().parts().size()); + assertEquals("Hello, agent!", ((org.a2aproject.sdk.spec.TextPart) v10Task.status().message().parts().get(0)).text()); + + // Verify artifacts conversion + assertNotNull(v10Task.artifacts()); + assertEquals(1, v10Task.artifacts().size()); + org.a2aproject.sdk.spec.Artifact v10Artifact = v10Task.artifacts().get(0); + assertEquals("artifact-001", v10Artifact.artifactId()); + assertEquals("Test Artifact", v10Artifact.name()); + assertEquals("A test artifact", v10Artifact.description()); + assertEquals(2, v10Artifact.parts().size()); + assertEquals("Response text", ((org.a2aproject.sdk.spec.TextPart) v10Artifact.parts().get(0)).text()); + + // Verify history conversion + assertNotNull(v10Task.history()); + assertEquals(1, v10Task.history().size()); + org.a2aproject.sdk.spec.Message v10HistoryMsg = v10Task.history().get(0); + assertEquals(org.a2aproject.sdk.spec.Message.Role.ROLE_AGENT, v10HistoryMsg.role()); + assertEquals("msg-002", v10HistoryMsg.messageId()); + assertEquals("Agent response", ((org.a2aproject.sdk.spec.TextPart) v10HistoryMsg.parts().get(0)).text()); + + // Convert v1.0 → v0.3 (round trip) + Task_v0_3 v03TaskRoundTrip = TaskMapper_v0_3.INSTANCE.fromV10(v10Task); + + // Verify round-trip conversion + assertNotNull(v03TaskRoundTrip); + assertEquals("task-001", v03TaskRoundTrip.getId()); + assertEquals("ctx-001", v03TaskRoundTrip.getContextId()); + assertEquals(TaskState_v0_3.WORKING, v03TaskRoundTrip.getStatus().state()); + assertEquals("msg-001", v03TaskRoundTrip.getStatus().message().getMessageId()); + assertEquals(1, v03TaskRoundTrip.getArtifacts().size()); + assertEquals("artifact-001", v03TaskRoundTrip.getArtifacts().get(0).artifactId()); + assertEquals(1, v03TaskRoundTrip.getHistory().size()); + assertEquals("msg-002", v03TaskRoundTrip.getHistory().get(0).getMessageId()); + } + + @Test + void testMinimalTaskConversion() { + // Test with minimal Task (no artifacts, no history, no metadata) + OffsetDateTime now = OffsetDateTime.now(ZoneOffset.UTC); + + TaskStatus_v0_3 v03Status = new TaskStatus_v0_3( + TaskState_v0_3.SUBMITTED + ); + + Task_v0_3 v03Task = new Task_v0_3( + "task-minimal", + "ctx-minimal", + v03Status, + null, + null, + null + ); + + // Convert v0.3 → v1.0 + Task v10Task = TaskMapper_v0_3.INSTANCE.toV10(v03Task); + + // Verify minimal conversion + assertNotNull(v10Task); + assertEquals("task-minimal", v10Task.id()); + assertEquals("ctx-minimal", v10Task.contextId()); + assertEquals(org.a2aproject.sdk.spec.TaskState.TASK_STATE_SUBMITTED, v10Task.status().state()); + assertNull(v10Task.status().message()); + + // v1.0 Task compact constructor converts null to empty list + assertNotNull(v10Task.artifacts()); + assertEquals(0, v10Task.artifacts().size()); + assertNotNull(v10Task.history()); + assertEquals(0, v10Task.history().size()); + assertNull(v10Task.metadata()); + + // Round trip + Task_v0_3 v03TaskRoundTrip = TaskMapper_v0_3.INSTANCE.fromV10(v10Task); + assertNotNull(v03TaskRoundTrip); + assertEquals("task-minimal", v03TaskRoundTrip.getId()); + assertEquals(TaskState_v0_3.SUBMITTED, v03TaskRoundTrip.getStatus().state()); + } + + @Test + void testNullTaskConversion() { + // Null safety + assertNull(TaskMapper_v0_3.INSTANCE.toV10(null)); + assertNull(TaskMapper_v0_3.INSTANCE.fromV10(null)); + } +} diff --git a/compat-0.3/server-conversion/src/test/resources/META-INF/beans.xml b/compat-0.3/server-conversion/src/test/resources/META-INF/beans.xml new file mode 100644 index 000000000..b708636eb --- /dev/null +++ b/compat-0.3/server-conversion/src/test/resources/META-INF/beans.xml @@ -0,0 +1,7 @@ + + + diff --git a/compat-0.3/spec-grpc/pom.xml b/compat-0.3/spec-grpc/pom.xml new file mode 100644 index 000000000..6021f6820 --- /dev/null +++ b/compat-0.3/spec-grpc/pom.xml @@ -0,0 +1,147 @@ + + + 4.0.0 + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-parent + 1.0.0.Beta2-SNAPSHOT + .. + + a2a-java-sdk-compat-0.3-spec-grpc + + jar + + Java SDK A2A Compat 0.3 Spec: gRPC + Java SDK for the Agent2Agent Protocol (A2A) - Spec: gRPC + + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec + + + com.google.protobuf + protobuf-java + + + io.grpc + grpc-protobuf + provided + + + io.grpc + grpc-stub + provided + + + jakarta.enterprise + jakarta.enterprise.cdi-api + + + jakarta.inject + jakarta.inject-api + + + com.google.api.grpc + proto-google-common-protos + + + + + javax.annotation + javax.annotation-api + provided + + + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-params + test + + + org.junit.jupiter + junit-jupiter-engine + test + + + + + + + + kr.motd.maven + os-maven-plugin + ${os-maven-plugin.version} + + + + + + + proto-compile + + + + + org.apache.maven.plugins + maven-clean-plugin + ${maven-clean-plugin.version} + + + remove-generated-files + initialize + + clean + + + true + + + ${project.basedir}/src/main/java/io/a2a/grpc + false + + *.java + + + + + + + + + + org.xolstice.maven.plugins + protobuf-maven-plugin + ${protobuf-maven-plugin.version} + + com.google.protobuf:protoc:${protobuf-java.version}:exe:${os.detected.classifier} + grpc-java + io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier} + src/main/java + false + + + + + compile + compile-custom + + + + + + + + + + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/A2A.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/A2A.java new file mode 100644 index 000000000..cbed7cc2c --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/A2A.java @@ -0,0 +1,827 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public final class A2A extends com.google.protobuf.GeneratedFile { + private A2A() {} + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "A2A"); + } + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_SendMessageConfiguration_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_SendMessageConfiguration_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_Task_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_Task_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_TaskStatus_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_TaskStatus_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_Part_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_Part_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_FilePart_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_FilePart_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_DataPart_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_DataPart_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_Message_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_Message_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_Artifact_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_Artifact_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_TaskStatusUpdateEvent_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_TaskStatusUpdateEvent_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_TaskArtifactUpdateEvent_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_TaskArtifactUpdateEvent_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_PushNotificationConfig_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_PushNotificationConfig_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_AuthenticationInfo_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_AuthenticationInfo_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_AgentInterface_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_AgentInterface_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_AgentCard_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_AgentCard_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_AgentCard_SecuritySchemesEntry_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_AgentCard_SecuritySchemesEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_AgentProvider_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_AgentProvider_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_AgentCapabilities_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_AgentCapabilities_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_AgentExtension_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_AgentExtension_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_AgentSkill_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_AgentSkill_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_AgentCardSignature_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_AgentCardSignature_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_TaskPushNotificationConfig_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_TaskPushNotificationConfig_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_StringList_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_StringList_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_Security_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_Security_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_Security_SchemesEntry_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_Security_SchemesEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_SecurityScheme_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_SecurityScheme_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_APIKeySecurityScheme_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_APIKeySecurityScheme_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_HTTPAuthSecurityScheme_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_HTTPAuthSecurityScheme_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_OAuth2SecurityScheme_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_OAuth2SecurityScheme_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_OpenIdConnectSecurityScheme_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_OpenIdConnectSecurityScheme_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_MutualTlsSecurityScheme_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_MutualTlsSecurityScheme_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_OAuthFlows_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_OAuthFlows_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_AuthorizationCodeOAuthFlow_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_AuthorizationCodeOAuthFlow_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_AuthorizationCodeOAuthFlow_ScopesEntry_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_AuthorizationCodeOAuthFlow_ScopesEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_ClientCredentialsOAuthFlow_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_ClientCredentialsOAuthFlow_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_ClientCredentialsOAuthFlow_ScopesEntry_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_ClientCredentialsOAuthFlow_ScopesEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_ImplicitOAuthFlow_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_ImplicitOAuthFlow_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_ImplicitOAuthFlow_ScopesEntry_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_ImplicitOAuthFlow_ScopesEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_PasswordOAuthFlow_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_PasswordOAuthFlow_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_PasswordOAuthFlow_ScopesEntry_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_PasswordOAuthFlow_ScopesEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_SendMessageRequest_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_SendMessageRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_GetTaskRequest_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_GetTaskRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_CancelTaskRequest_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_CancelTaskRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_GetTaskPushNotificationConfigRequest_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_GetTaskPushNotificationConfigRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_DeleteTaskPushNotificationConfigRequest_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_DeleteTaskPushNotificationConfigRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_CreateTaskPushNotificationConfigRequest_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_CreateTaskPushNotificationConfigRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_TaskSubscriptionRequest_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_TaskSubscriptionRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_ListTaskPushNotificationConfigRequest_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_ListTaskPushNotificationConfigRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_GetAgentCardRequest_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_GetAgentCardRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_SendMessageResponse_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_SendMessageResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_StreamResponse_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_StreamResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_ListTaskPushNotificationConfigResponse_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_ListTaskPushNotificationConfigResponse_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n\ta2a.proto\022\006a2a.v1\032\034google/api/annotati" + + "ons.proto\032\027google/api/client.proto\032\037goog" + + "le/api/field_behavior.proto\032\033google/prot" + + "obuf/empty.proto\032\034google/protobuf/struct" + + ".proto\032\037google/protobuf/timestamp.proto\"" + + "\236\001\n\030SendMessageConfiguration\022\035\n\025accepted" + + "_output_modes\030\001 \003(\t\0229\n\021push_notification" + + "\030\002 \001(\0132\036.a2a.v1.PushNotificationConfig\022\026" + + "\n\016history_length\030\003 \001(\005\022\020\n\010blocking\030\004 \001(\010" + + "\"\274\001\n\004Task\022\n\n\002id\030\001 \001(\t\022\022\n\ncontext_id\030\002 \001(" + + "\t\022\"\n\006status\030\003 \001(\0132\022.a2a.v1.TaskStatus\022#\n" + + "\tartifacts\030\004 \003(\0132\020.a2a.v1.Artifact\022 \n\007hi" + + "story\030\005 \003(\0132\017.a2a.v1.Message\022)\n\010metadata" + + "\030\006 \001(\0132\027.google.protobuf.Struct\"\207\001\n\nTask" + + "Status\022 \n\005state\030\001 \001(\0162\021.a2a.v1.TaskState" + + "\022(\n\006update\030\002 \001(\0132\017.a2a.v1.MessageR\007messa" + + "ge\022-\n\ttimestamp\030\003 \001(\0132\032.google.protobuf." + + "Timestamp\"b\n\004Part\022\016\n\004text\030\001 \001(\tH\000\022 \n\004fil" + + "e\030\002 \001(\0132\020.a2a.v1.FilePartH\000\022 \n\004data\030\003 \001(" + + "\0132\020.a2a.v1.DataPartH\000B\006\n\004part\"Y\n\010FilePar" + + "t\022\027\n\rfile_with_uri\030\001 \001(\tH\000\022\031\n\017file_with_" + + "bytes\030\002 \001(\014H\000\022\021\n\tmime_type\030\003 \001(\tB\006\n\004file" + + "\"1\n\010DataPart\022%\n\004data\030\001 \001(\0132\027.google.prot" + + "obuf.Struct\"\274\001\n\007Message\022\022\n\nmessage_id\030\001 " + + "\001(\t\022\022\n\ncontext_id\030\002 \001(\t\022\017\n\007task_id\030\003 \001(\t" + + "\022\032\n\004role\030\004 \001(\0162\014.a2a.v1.Role\022\035\n\007content\030" + + "\005 \003(\0132\014.a2a.v1.Part\022)\n\010metadata\030\006 \001(\0132\027." + + "google.protobuf.Struct\022\022\n\nextensions\030\007 \003" + + "(\t\"\236\001\n\010Artifact\022\023\n\013artifact_id\030\001 \001(\t\022\014\n\004" + + "name\030\003 \001(\t\022\023\n\013description\030\004 \001(\t\022\033\n\005parts" + + "\030\005 \003(\0132\014.a2a.v1.Part\022)\n\010metadata\030\006 \001(\0132\027" + + ".google.protobuf.Struct\022\022\n\nextensions\030\007 " + + "\003(\t\"\232\001\n\025TaskStatusUpdateEvent\022\017\n\007task_id" + + "\030\001 \001(\t\022\022\n\ncontext_id\030\002 \001(\t\022\"\n\006status\030\003 \001" + + "(\0132\022.a2a.v1.TaskStatus\022\r\n\005final\030\004 \001(\010\022)\n" + + "\010metadata\030\005 \001(\0132\027.google.protobuf.Struct" + + "\"\261\001\n\027TaskArtifactUpdateEvent\022\017\n\007task_id\030" + + "\001 \001(\t\022\022\n\ncontext_id\030\002 \001(\t\022\"\n\010artifact\030\003 " + + "\001(\0132\020.a2a.v1.Artifact\022\016\n\006append\030\004 \001(\010\022\022\n" + + "\nlast_chunk\030\005 \001(\010\022)\n\010metadata\030\006 \001(\0132\027.go" + + "ogle.protobuf.Struct\"t\n\026PushNotification" + + "Config\022\n\n\002id\030\001 \001(\t\022\013\n\003url\030\002 \001(\t\022\r\n\005token" + + "\030\003 \001(\t\0222\n\016authentication\030\004 \001(\0132\032.a2a.v1." + + "AuthenticationInfo\":\n\022AuthenticationInfo" + + "\022\017\n\007schemes\030\001 \003(\t\022\023\n\013credentials\030\002 \001(\t\"0" + + "\n\016AgentInterface\022\013\n\003url\030\001 \001(\t\022\021\n\ttranspo" + + "rt\030\002 \001(\t\"\242\005\n\tAgentCard\022\030\n\020protocol_versi" + + "on\030\020 \001(\t\022\014\n\004name\030\001 \001(\t\022\023\n\013description\030\002 " + + "\001(\t\022\013\n\003url\030\003 \001(\t\022\033\n\023preferred_transport\030" + + "\016 \001(\t\0225\n\025additional_interfaces\030\017 \003(\0132\026.a" + + "2a.v1.AgentInterface\022\'\n\010provider\030\004 \001(\0132\025" + + ".a2a.v1.AgentProvider\022\017\n\007version\030\005 \001(\t\022\031" + + "\n\021documentation_url\030\006 \001(\t\022/\n\014capabilitie" + + "s\030\007 \001(\0132\031.a2a.v1.AgentCapabilities\022@\n\020se" + + "curity_schemes\030\010 \003(\0132&.a2a.v1.AgentCard." + + "SecuritySchemesEntry\022\"\n\010security\030\t \003(\0132\020" + + ".a2a.v1.Security\022\033\n\023default_input_modes\030" + + "\n \003(\t\022\034\n\024default_output_modes\030\013 \003(\t\022\"\n\006s" + + "kills\030\014 \003(\0132\022.a2a.v1.AgentSkill\022,\n$suppo" + + "rts_authenticated_extended_card\030\r \001(\010\022.\n" + + "\nsignatures\030\021 \003(\0132\032.a2a.v1.AgentCardSign" + + "ature\032N\n\024SecuritySchemesEntry\022\013\n\003key\030\001 \001" + + "(\t\022%\n\005value\030\002 \001(\0132\026.a2a.v1.SecuritySchem" + + "e:\0028\001\"2\n\rAgentProvider\022\013\n\003url\030\001 \001(\t\022\024\n\014o" + + "rganization\030\002 \001(\t\"n\n\021AgentCapabilities\022\021" + + "\n\tstreaming\030\001 \001(\010\022\032\n\022push_notifications\030" + + "\002 \001(\010\022*\n\nextensions\030\003 \003(\0132\026.a2a.v1.Agent" + + "Extension\"m\n\016AgentExtension\022\013\n\003uri\030\001 \001(\t" + + "\022\023\n\013description\030\002 \001(\t\022\020\n\010required\030\003 \001(\010\022" + + "\'\n\006params\030\004 \001(\0132\027.google.protobuf.Struct" + + "\"\252\001\n\nAgentSkill\022\n\n\002id\030\001 \001(\t\022\014\n\004name\030\002 \001(" + + "\t\022\023\n\013description\030\003 \001(\t\022\014\n\004tags\030\004 \003(\t\022\020\n\010" + + "examples\030\005 \003(\t\022\023\n\013input_modes\030\006 \003(\t\022\024\n\014o" + + "utput_modes\030\007 \003(\t\022\"\n\010security\030\010 \003(\0132\020.a2" + + "a.v1.Security\"m\n\022AgentCardSignature\022\026\n\tp" + + "rotected\030\001 \001(\tB\003\340A\002\022\026\n\tsignature\030\002 \001(\tB\003" + + "\340A\002\022\'\n\006header\030\003 \001(\0132\027.google.protobuf.St" + + "ruct\"l\n\032TaskPushNotificationConfig\022\014\n\004na" + + "me\030\001 \001(\t\022@\n\030push_notification_config\030\002 \001" + + "(\0132\036.a2a.v1.PushNotificationConfig\"\032\n\nSt" + + "ringList\022\014\n\004list\030\001 \003(\t\"~\n\010Security\022.\n\007sc" + + "hemes\030\001 \003(\0132\035.a2a.v1.Security.SchemesEnt" + + "ry\032B\n\014SchemesEntry\022\013\n\003key\030\001 \001(\t\022!\n\005value" + + "\030\002 \001(\0132\022.a2a.v1.StringList:\0028\001\"\361\002\n\016Secur" + + "ityScheme\022?\n\027api_key_security_scheme\030\001 \001" + + "(\0132\034.a2a.v1.APIKeySecuritySchemeH\000\022C\n\031ht" + + "tp_auth_security_scheme\030\002 \001(\0132\036.a2a.v1.H" + + "TTPAuthSecuritySchemeH\000\022>\n\026oauth2_securi" + + "ty_scheme\030\003 \001(\0132\034.a2a.v1.OAuth2SecurityS" + + "chemeH\000\022N\n\037open_id_connect_security_sche" + + "me\030\004 \001(\0132#.a2a.v1.OpenIdConnectSecurityS" + + "chemeH\000\022?\n\024mtls_security_scheme\030\005 \001(\0132\037." + + "a2a.v1.MutualTlsSecuritySchemeH\000B\010\n\006sche" + + "me\"K\n\024APIKeySecurityScheme\022\023\n\013descriptio" + + "n\030\001 \001(\t\022\020\n\010location\030\002 \001(\t\022\014\n\004name\030\003 \001(\t\"" + + "T\n\026HTTPAuthSecurityScheme\022\023\n\013description" + + "\030\001 \001(\t\022\016\n\006scheme\030\002 \001(\t\022\025\n\rbearer_format\030" + + "\003 \001(\t\"k\n\024OAuth2SecurityScheme\022\023\n\013descrip" + + "tion\030\001 \001(\t\022!\n\005flows\030\002 \001(\0132\022.a2a.v1.OAuth" + + "Flows\022\033\n\023oauth2_metadata_url\030\003 \001(\t\"O\n\033Op" + + "enIdConnectSecurityScheme\022\023\n\013description" + + "\030\001 \001(\t\022\033\n\023open_id_connect_url\030\002 \001(\t\".\n\027M" + + "utualTlsSecurityScheme\022\023\n\013description\030\001 " + + "\001(\t\"\366\001\n\nOAuthFlows\022@\n\022authorization_code" + + "\030\001 \001(\0132\".a2a.v1.AuthorizationCodeOAuthFl" + + "owH\000\022@\n\022client_credentials\030\002 \001(\0132\".a2a.v" + + "1.ClientCredentialsOAuthFlowH\000\022-\n\010implic" + + "it\030\003 \001(\0132\031.a2a.v1.ImplicitOAuthFlowH\000\022-\n" + + "\010password\030\004 \001(\0132\031.a2a.v1.PasswordOAuthFl" + + "owH\000B\006\n\004flow\"\316\001\n\032AuthorizationCodeOAuthF" + + "low\022\031\n\021authorization_url\030\001 \001(\t\022\021\n\ttoken_" + + "url\030\002 \001(\t\022\023\n\013refresh_url\030\003 \001(\t\022>\n\006scopes" + + "\030\004 \003(\0132..a2a.v1.AuthorizationCodeOAuthFl" + + "ow.ScopesEntry\032-\n\013ScopesEntry\022\013\n\003key\030\001 \001" + + "(\t\022\r\n\005value\030\002 \001(\t:\0028\001\"\263\001\n\032ClientCredenti" + + "alsOAuthFlow\022\021\n\ttoken_url\030\001 \001(\t\022\023\n\013refre" + + "sh_url\030\002 \001(\t\022>\n\006scopes\030\003 \003(\0132..a2a.v1.Cl" + + "ientCredentialsOAuthFlow.ScopesEntry\032-\n\013" + + "ScopesEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:" + + "\0028\001\"\251\001\n\021ImplicitOAuthFlow\022\031\n\021authorizati" + + "on_url\030\001 \001(\t\022\023\n\013refresh_url\030\002 \001(\t\0225\n\006sco" + + "pes\030\003 \003(\0132%.a2a.v1.ImplicitOAuthFlow.Sco" + + "pesEntry\032-\n\013ScopesEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005" + + "value\030\002 \001(\t:\0028\001\"\241\001\n\021PasswordOAuthFlow\022\021\n" + + "\ttoken_url\030\001 \001(\t\022\023\n\013refresh_url\030\002 \001(\t\0225\n" + + "\006scopes\030\003 \003(\0132%.a2a.v1.PasswordOAuthFlow" + + ".ScopesEntry\032-\n\013ScopesEntry\022\013\n\003key\030\001 \001(\t" + + "\022\r\n\005value\030\002 \001(\t:\0028\001\"\250\001\n\022SendMessageReque" + + "st\022.\n\007request\030\001 \001(\0132\017.a2a.v1.MessageB\003\340A" + + "\002R\007message\0227\n\rconfiguration\030\002 \001(\0132 .a2a." + + "v1.SendMessageConfiguration\022)\n\010metadata\030" + + "\003 \001(\0132\027.google.protobuf.Struct\";\n\016GetTas" + + "kRequest\022\021\n\004name\030\001 \001(\tB\003\340A\002\022\026\n\016history_l" + + "ength\030\002 \001(\005\"!\n\021CancelTaskRequest\022\014\n\004name" + + "\030\001 \001(\t\"4\n$GetTaskPushNotificationConfigR" + + "equest\022\014\n\004name\030\001 \001(\t\"7\n\'DeleteTaskPushNo" + + "tificationConfigRequest\022\014\n\004name\030\001 \001(\t\"\217\001" + + "\n\'CreateTaskPushNotificationConfigReques" + + "t\022\023\n\006parent\030\001 \001(\tB\003\340A\002\022\026\n\tconfig_id\030\002 \001(" + + "\tB\003\340A\002\0227\n\006config\030\003 \001(\0132\".a2a.v1.TaskPush" + + "NotificationConfigB\003\340A\002\"\'\n\027TaskSubscript" + + "ionRequest\022\014\n\004name\030\001 \001(\t\"^\n%ListTaskPush" + + "NotificationConfigRequest\022\016\n\006parent\030\001 \001(" + + "\t\022\021\n\tpage_size\030\002 \001(\005\022\022\n\npage_token\030\003 \001(\t" + + "\"\025\n\023GetAgentCardRequest\"g\n\023SendMessageRe" + + "sponse\022\034\n\004task\030\001 \001(\0132\014.a2a.v1.TaskH\000\022\'\n\003" + + "msg\030\002 \001(\0132\017.a2a.v1.MessageH\000R\007messageB\t\n" + + "\007payload\"\326\001\n\016StreamResponse\022\034\n\004task\030\001 \001(" + + "\0132\014.a2a.v1.TaskH\000\022\'\n\003msg\030\002 \001(\0132\017.a2a.v1." + + "MessageH\000R\007message\0226\n\rstatus_update\030\003 \001(" + + "\0132\035.a2a.v1.TaskStatusUpdateEventH\000\022:\n\017ar" + + "tifact_update\030\004 \001(\0132\037.a2a.v1.TaskArtifac" + + "tUpdateEventH\000B\t\n\007payload\"v\n&ListTaskPus" + + "hNotificationConfigResponse\0223\n\007configs\030\001" + + " \003(\0132\".a2a.v1.TaskPushNotificationConfig" + + "\022\027\n\017next_page_token\030\002 \001(\t*\372\001\n\tTaskState\022" + + "\032\n\026TASK_STATE_UNSPECIFIED\020\000\022\030\n\024TASK_STAT" + + "E_SUBMITTED\020\001\022\026\n\022TASK_STATE_WORKING\020\002\022\030\n" + + "\024TASK_STATE_COMPLETED\020\003\022\025\n\021TASK_STATE_FA" + + "ILED\020\004\022\030\n\024TASK_STATE_CANCELLED\020\005\022\035\n\031TASK" + + "_STATE_INPUT_REQUIRED\020\006\022\027\n\023TASK_STATE_RE" + + "JECTED\020\007\022\034\n\030TASK_STATE_AUTH_REQUIRED\020\010*;" + + "\n\004Role\022\024\n\020ROLE_UNSPECIFIED\020\000\022\r\n\tROLE_USE" + + "R\020\001\022\016\n\nROLE_AGENT\020\0022\272\n\n\nA2AService\022c\n\013Se" + + "ndMessage\022\032.a2a.v1.SendMessageRequest\032\033." + + "a2a.v1.SendMessageResponse\"\033\202\323\344\223\002\025\"\020/v1/" + + "message:send:\001*\022k\n\024SendStreamingMessage\022" + + "\032.a2a.v1.SendMessageRequest\032\026.a2a.v1.Str" + + "eamResponse\"\035\202\323\344\223\002\027\"\022/v1/message:stream:" + + "\001*0\001\022R\n\007GetTask\022\026.a2a.v1.GetTaskRequest\032" + + "\014.a2a.v1.Task\"!\332A\004name\202\323\344\223\002\024\022\022/v1/{name=" + + "tasks/*}\022[\n\nCancelTask\022\031.a2a.v1.CancelTa" + + "skRequest\032\014.a2a.v1.Task\"$\202\323\344\223\002\036\"\031/v1/{na" + + "me=tasks/*}:cancel:\001*\022s\n\020TaskSubscriptio" + + "n\022\037.a2a.v1.TaskSubscriptionRequest\032\026.a2a" + + ".v1.StreamResponse\"$\202\323\344\223\002\036\022\034/v1/{name=ta" + + "sks/*}:subscribe0\001\022\304\001\n CreateTaskPushNot" + + "ificationConfig\022/.a2a.v1.CreateTaskPushN" + + "otificationConfigRequest\032\".a2a.v1.TaskPu" + + "shNotificationConfig\"K\332A\rparent,config\202\323" + + "\344\223\0025\"+/v1/{parent=task/*/pushNotificatio" + + "nConfigs}:\006config\022\256\001\n\035GetTaskPushNotific" + + "ationConfig\022,.a2a.v1.GetTaskPushNotifica" + + "tionConfigRequest\032\".a2a.v1.TaskPushNotif" + + "icationConfig\";\332A\004name\202\323\344\223\002.\022,/v1/{name=" + + "tasks/*/pushNotificationConfigs/*}\022\276\001\n\036L" + + "istTaskPushNotificationConfig\022-.a2a.v1.L" + + "istTaskPushNotificationConfigRequest\032..a" + + "2a.v1.ListTaskPushNotificationConfigResp" + + "onse\"=\332A\006parent\202\323\344\223\002.\022,/v1/{parent=tasks" + + "/*}/pushNotificationConfigs\022P\n\014GetAgentC" + + "ard\022\033.a2a.v1.GetAgentCardRequest\032\021.a2a.v" + + "1.AgentCard\"\020\202\323\344\223\002\n\022\010/v1/card\022\250\001\n Delete" + + "TaskPushNotificationConfig\022/.a2a.v1.Dele" + + "teTaskPushNotificationConfigRequest\032\026.go" + + "ogle.protobuf.Empty\";\332A\004name\202\323\344\223\002.*,/v1/" + + "{name=tasks/*/pushNotificationConfigs/*}" + + "BL\n org.a2aproject.sdk.compat03.grpcB\003A2" + + "AP\001Z\030google.golang.org/a2a/v1\252\002\006A2a.V1b\006" + + "proto3" + }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.AnnotationsProto.getDescriptor(), + com.google.api.ClientProto.getDescriptor(), + com.google.api.FieldBehaviorProto.getDescriptor(), + com.google.protobuf.EmptyProto.getDescriptor(), + com.google.protobuf.StructProto.getDescriptor(), + com.google.protobuf.TimestampProto.getDescriptor(), + }); + internal_static_a2a_v1_SendMessageConfiguration_descriptor = + getDescriptor().getMessageType(0); + internal_static_a2a_v1_SendMessageConfiguration_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_SendMessageConfiguration_descriptor, + new java.lang.String[] { "AcceptedOutputModes", "PushNotification", "HistoryLength", "Blocking", }); + internal_static_a2a_v1_Task_descriptor = + getDescriptor().getMessageType(1); + internal_static_a2a_v1_Task_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_Task_descriptor, + new java.lang.String[] { "Id", "ContextId", "Status", "Artifacts", "History", "Metadata", }); + internal_static_a2a_v1_TaskStatus_descriptor = + getDescriptor().getMessageType(2); + internal_static_a2a_v1_TaskStatus_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_TaskStatus_descriptor, + new java.lang.String[] { "State", "Update", "Timestamp", }); + internal_static_a2a_v1_Part_descriptor = + getDescriptor().getMessageType(3); + internal_static_a2a_v1_Part_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_Part_descriptor, + new java.lang.String[] { "Text", "File", "Data", "Part", }); + internal_static_a2a_v1_FilePart_descriptor = + getDescriptor().getMessageType(4); + internal_static_a2a_v1_FilePart_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_FilePart_descriptor, + new java.lang.String[] { "FileWithUri", "FileWithBytes", "MimeType", "File", }); + internal_static_a2a_v1_DataPart_descriptor = + getDescriptor().getMessageType(5); + internal_static_a2a_v1_DataPart_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_DataPart_descriptor, + new java.lang.String[] { "Data", }); + internal_static_a2a_v1_Message_descriptor = + getDescriptor().getMessageType(6); + internal_static_a2a_v1_Message_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_Message_descriptor, + new java.lang.String[] { "MessageId", "ContextId", "TaskId", "Role", "Content", "Metadata", "Extensions", }); + internal_static_a2a_v1_Artifact_descriptor = + getDescriptor().getMessageType(7); + internal_static_a2a_v1_Artifact_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_Artifact_descriptor, + new java.lang.String[] { "ArtifactId", "Name", "Description", "Parts", "Metadata", "Extensions", }); + internal_static_a2a_v1_TaskStatusUpdateEvent_descriptor = + getDescriptor().getMessageType(8); + internal_static_a2a_v1_TaskStatusUpdateEvent_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_TaskStatusUpdateEvent_descriptor, + new java.lang.String[] { "TaskId", "ContextId", "Status", "Final", "Metadata", }); + internal_static_a2a_v1_TaskArtifactUpdateEvent_descriptor = + getDescriptor().getMessageType(9); + internal_static_a2a_v1_TaskArtifactUpdateEvent_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_TaskArtifactUpdateEvent_descriptor, + new java.lang.String[] { "TaskId", "ContextId", "Artifact", "Append", "LastChunk", "Metadata", }); + internal_static_a2a_v1_PushNotificationConfig_descriptor = + getDescriptor().getMessageType(10); + internal_static_a2a_v1_PushNotificationConfig_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_PushNotificationConfig_descriptor, + new java.lang.String[] { "Id", "Url", "Token", "Authentication", }); + internal_static_a2a_v1_AuthenticationInfo_descriptor = + getDescriptor().getMessageType(11); + internal_static_a2a_v1_AuthenticationInfo_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_AuthenticationInfo_descriptor, + new java.lang.String[] { "Schemes", "Credentials", }); + internal_static_a2a_v1_AgentInterface_descriptor = + getDescriptor().getMessageType(12); + internal_static_a2a_v1_AgentInterface_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_AgentInterface_descriptor, + new java.lang.String[] { "Url", "Transport", }); + internal_static_a2a_v1_AgentCard_descriptor = + getDescriptor().getMessageType(13); + internal_static_a2a_v1_AgentCard_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_AgentCard_descriptor, + new java.lang.String[] { "ProtocolVersion", "Name", "Description", "Url", "PreferredTransport", "AdditionalInterfaces", "Provider", "Version", "DocumentationUrl", "Capabilities", "SecuritySchemes", "Security", "DefaultInputModes", "DefaultOutputModes", "Skills", "SupportsAuthenticatedExtendedCard", "Signatures", }); + internal_static_a2a_v1_AgentCard_SecuritySchemesEntry_descriptor = + internal_static_a2a_v1_AgentCard_descriptor.getNestedType(0); + internal_static_a2a_v1_AgentCard_SecuritySchemesEntry_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_AgentCard_SecuritySchemesEntry_descriptor, + new java.lang.String[] { "Key", "Value", }); + internal_static_a2a_v1_AgentProvider_descriptor = + getDescriptor().getMessageType(14); + internal_static_a2a_v1_AgentProvider_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_AgentProvider_descriptor, + new java.lang.String[] { "Url", "Organization", }); + internal_static_a2a_v1_AgentCapabilities_descriptor = + getDescriptor().getMessageType(15); + internal_static_a2a_v1_AgentCapabilities_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_AgentCapabilities_descriptor, + new java.lang.String[] { "Streaming", "PushNotifications", "Extensions", }); + internal_static_a2a_v1_AgentExtension_descriptor = + getDescriptor().getMessageType(16); + internal_static_a2a_v1_AgentExtension_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_AgentExtension_descriptor, + new java.lang.String[] { "Uri", "Description", "Required", "Params", }); + internal_static_a2a_v1_AgentSkill_descriptor = + getDescriptor().getMessageType(17); + internal_static_a2a_v1_AgentSkill_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_AgentSkill_descriptor, + new java.lang.String[] { "Id", "Name", "Description", "Tags", "Examples", "InputModes", "OutputModes", "Security", }); + internal_static_a2a_v1_AgentCardSignature_descriptor = + getDescriptor().getMessageType(18); + internal_static_a2a_v1_AgentCardSignature_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_AgentCardSignature_descriptor, + new java.lang.String[] { "Protected", "Signature", "Header", }); + internal_static_a2a_v1_TaskPushNotificationConfig_descriptor = + getDescriptor().getMessageType(19); + internal_static_a2a_v1_TaskPushNotificationConfig_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_TaskPushNotificationConfig_descriptor, + new java.lang.String[] { "Name", "PushNotificationConfig", }); + internal_static_a2a_v1_StringList_descriptor = + getDescriptor().getMessageType(20); + internal_static_a2a_v1_StringList_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_StringList_descriptor, + new java.lang.String[] { "List", }); + internal_static_a2a_v1_Security_descriptor = + getDescriptor().getMessageType(21); + internal_static_a2a_v1_Security_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_Security_descriptor, + new java.lang.String[] { "Schemes", }); + internal_static_a2a_v1_Security_SchemesEntry_descriptor = + internal_static_a2a_v1_Security_descriptor.getNestedType(0); + internal_static_a2a_v1_Security_SchemesEntry_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_Security_SchemesEntry_descriptor, + new java.lang.String[] { "Key", "Value", }); + internal_static_a2a_v1_SecurityScheme_descriptor = + getDescriptor().getMessageType(22); + internal_static_a2a_v1_SecurityScheme_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_SecurityScheme_descriptor, + new java.lang.String[] { "ApiKeySecurityScheme", "HttpAuthSecurityScheme", "Oauth2SecurityScheme", "OpenIdConnectSecurityScheme", "MtlsSecurityScheme", "Scheme", }); + internal_static_a2a_v1_APIKeySecurityScheme_descriptor = + getDescriptor().getMessageType(23); + internal_static_a2a_v1_APIKeySecurityScheme_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_APIKeySecurityScheme_descriptor, + new java.lang.String[] { "Description", "Location", "Name", }); + internal_static_a2a_v1_HTTPAuthSecurityScheme_descriptor = + getDescriptor().getMessageType(24); + internal_static_a2a_v1_HTTPAuthSecurityScheme_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_HTTPAuthSecurityScheme_descriptor, + new java.lang.String[] { "Description", "Scheme", "BearerFormat", }); + internal_static_a2a_v1_OAuth2SecurityScheme_descriptor = + getDescriptor().getMessageType(25); + internal_static_a2a_v1_OAuth2SecurityScheme_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_OAuth2SecurityScheme_descriptor, + new java.lang.String[] { "Description", "Flows", "Oauth2MetadataUrl", }); + internal_static_a2a_v1_OpenIdConnectSecurityScheme_descriptor = + getDescriptor().getMessageType(26); + internal_static_a2a_v1_OpenIdConnectSecurityScheme_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_OpenIdConnectSecurityScheme_descriptor, + new java.lang.String[] { "Description", "OpenIdConnectUrl", }); + internal_static_a2a_v1_MutualTlsSecurityScheme_descriptor = + getDescriptor().getMessageType(27); + internal_static_a2a_v1_MutualTlsSecurityScheme_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_MutualTlsSecurityScheme_descriptor, + new java.lang.String[] { "Description", }); + internal_static_a2a_v1_OAuthFlows_descriptor = + getDescriptor().getMessageType(28); + internal_static_a2a_v1_OAuthFlows_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_OAuthFlows_descriptor, + new java.lang.String[] { "AuthorizationCode", "ClientCredentials", "Implicit", "Password", "Flow", }); + internal_static_a2a_v1_AuthorizationCodeOAuthFlow_descriptor = + getDescriptor().getMessageType(29); + internal_static_a2a_v1_AuthorizationCodeOAuthFlow_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_AuthorizationCodeOAuthFlow_descriptor, + new java.lang.String[] { "AuthorizationUrl", "TokenUrl", "RefreshUrl", "Scopes", }); + internal_static_a2a_v1_AuthorizationCodeOAuthFlow_ScopesEntry_descriptor = + internal_static_a2a_v1_AuthorizationCodeOAuthFlow_descriptor.getNestedType(0); + internal_static_a2a_v1_AuthorizationCodeOAuthFlow_ScopesEntry_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_AuthorizationCodeOAuthFlow_ScopesEntry_descriptor, + new java.lang.String[] { "Key", "Value", }); + internal_static_a2a_v1_ClientCredentialsOAuthFlow_descriptor = + getDescriptor().getMessageType(30); + internal_static_a2a_v1_ClientCredentialsOAuthFlow_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_ClientCredentialsOAuthFlow_descriptor, + new java.lang.String[] { "TokenUrl", "RefreshUrl", "Scopes", }); + internal_static_a2a_v1_ClientCredentialsOAuthFlow_ScopesEntry_descriptor = + internal_static_a2a_v1_ClientCredentialsOAuthFlow_descriptor.getNestedType(0); + internal_static_a2a_v1_ClientCredentialsOAuthFlow_ScopesEntry_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_ClientCredentialsOAuthFlow_ScopesEntry_descriptor, + new java.lang.String[] { "Key", "Value", }); + internal_static_a2a_v1_ImplicitOAuthFlow_descriptor = + getDescriptor().getMessageType(31); + internal_static_a2a_v1_ImplicitOAuthFlow_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_ImplicitOAuthFlow_descriptor, + new java.lang.String[] { "AuthorizationUrl", "RefreshUrl", "Scopes", }); + internal_static_a2a_v1_ImplicitOAuthFlow_ScopesEntry_descriptor = + internal_static_a2a_v1_ImplicitOAuthFlow_descriptor.getNestedType(0); + internal_static_a2a_v1_ImplicitOAuthFlow_ScopesEntry_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_ImplicitOAuthFlow_ScopesEntry_descriptor, + new java.lang.String[] { "Key", "Value", }); + internal_static_a2a_v1_PasswordOAuthFlow_descriptor = + getDescriptor().getMessageType(32); + internal_static_a2a_v1_PasswordOAuthFlow_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_PasswordOAuthFlow_descriptor, + new java.lang.String[] { "TokenUrl", "RefreshUrl", "Scopes", }); + internal_static_a2a_v1_PasswordOAuthFlow_ScopesEntry_descriptor = + internal_static_a2a_v1_PasswordOAuthFlow_descriptor.getNestedType(0); + internal_static_a2a_v1_PasswordOAuthFlow_ScopesEntry_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_PasswordOAuthFlow_ScopesEntry_descriptor, + new java.lang.String[] { "Key", "Value", }); + internal_static_a2a_v1_SendMessageRequest_descriptor = + getDescriptor().getMessageType(33); + internal_static_a2a_v1_SendMessageRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_SendMessageRequest_descriptor, + new java.lang.String[] { "Request", "Configuration", "Metadata", }); + internal_static_a2a_v1_GetTaskRequest_descriptor = + getDescriptor().getMessageType(34); + internal_static_a2a_v1_GetTaskRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_GetTaskRequest_descriptor, + new java.lang.String[] { "Name", "HistoryLength", }); + internal_static_a2a_v1_CancelTaskRequest_descriptor = + getDescriptor().getMessageType(35); + internal_static_a2a_v1_CancelTaskRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_CancelTaskRequest_descriptor, + new java.lang.String[] { "Name", }); + internal_static_a2a_v1_GetTaskPushNotificationConfigRequest_descriptor = + getDescriptor().getMessageType(36); + internal_static_a2a_v1_GetTaskPushNotificationConfigRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_GetTaskPushNotificationConfigRequest_descriptor, + new java.lang.String[] { "Name", }); + internal_static_a2a_v1_DeleteTaskPushNotificationConfigRequest_descriptor = + getDescriptor().getMessageType(37); + internal_static_a2a_v1_DeleteTaskPushNotificationConfigRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_DeleteTaskPushNotificationConfigRequest_descriptor, + new java.lang.String[] { "Name", }); + internal_static_a2a_v1_CreateTaskPushNotificationConfigRequest_descriptor = + getDescriptor().getMessageType(38); + internal_static_a2a_v1_CreateTaskPushNotificationConfigRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_CreateTaskPushNotificationConfigRequest_descriptor, + new java.lang.String[] { "Parent", "ConfigId", "Config", }); + internal_static_a2a_v1_TaskSubscriptionRequest_descriptor = + getDescriptor().getMessageType(39); + internal_static_a2a_v1_TaskSubscriptionRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_TaskSubscriptionRequest_descriptor, + new java.lang.String[] { "Name", }); + internal_static_a2a_v1_ListTaskPushNotificationConfigRequest_descriptor = + getDescriptor().getMessageType(40); + internal_static_a2a_v1_ListTaskPushNotificationConfigRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_ListTaskPushNotificationConfigRequest_descriptor, + new java.lang.String[] { "Parent", "PageSize", "PageToken", }); + internal_static_a2a_v1_GetAgentCardRequest_descriptor = + getDescriptor().getMessageType(41); + internal_static_a2a_v1_GetAgentCardRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_GetAgentCardRequest_descriptor, + new java.lang.String[] { }); + internal_static_a2a_v1_SendMessageResponse_descriptor = + getDescriptor().getMessageType(42); + internal_static_a2a_v1_SendMessageResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_SendMessageResponse_descriptor, + new java.lang.String[] { "Task", "Msg", "Payload", }); + internal_static_a2a_v1_StreamResponse_descriptor = + getDescriptor().getMessageType(43); + internal_static_a2a_v1_StreamResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_StreamResponse_descriptor, + new java.lang.String[] { "Task", "Msg", "StatusUpdate", "ArtifactUpdate", "Payload", }); + internal_static_a2a_v1_ListTaskPushNotificationConfigResponse_descriptor = + getDescriptor().getMessageType(44); + internal_static_a2a_v1_ListTaskPushNotificationConfigResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_ListTaskPushNotificationConfigResponse_descriptor, + new java.lang.String[] { "Configs", "NextPageToken", }); + descriptor.resolveAllFeaturesImmutable(); + com.google.api.AnnotationsProto.getDescriptor(); + com.google.api.ClientProto.getDescriptor(); + com.google.api.FieldBehaviorProto.getDescriptor(); + com.google.protobuf.EmptyProto.getDescriptor(); + com.google.protobuf.StructProto.getDescriptor(); + com.google.protobuf.TimestampProto.getDescriptor(); + com.google.protobuf.ExtensionRegistry registry = + com.google.protobuf.ExtensionRegistry.newInstance(); + registry.add(com.google.api.FieldBehaviorProto.fieldBehavior); + registry.add(com.google.api.AnnotationsProto.http); + registry.add(com.google.api.ClientProto.methodSignature); + com.google.protobuf.Descriptors.FileDescriptor + .internalUpdateFileDescriptor(descriptor, registry); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/A2AServiceGrpc.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/A2AServiceGrpc.java new file mode 100644 index 000000000..f169371e2 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/A2AServiceGrpc.java @@ -0,0 +1,1323 @@ +package org.a2aproject.sdk.compat03.grpc; + +import static io.grpc.MethodDescriptor.generateFullMethodName; + +/** + *

+ * A2AService defines the gRPC version of the A2A protocol. This has a slightly
+ * different shape than the JSONRPC version to better conform to AIP-127,
+ * where appropriate. The nouns are AgentCard, Message, Task and
+ * TaskPushNotificationConfig.
+ * - Messages are not a standard resource so there is no get/delete/update/list
+ *   interface, only a send and stream custom methods.
+ * - Tasks have a get interface and custom cancel and subscribe methods.
+ * - TaskPushNotificationConfig are a resource whose parent is a task.
+ *   They have get, list and create methods.
+ * - AgentCard is a static resource with only a get method.
+ * fields are not present as they don't comply with AIP rules, and the
+ * optional history_length on the get task method is not present as it also
+ * violates AIP-127 and AIP-131.
+ * 
+ */ +@io.grpc.stub.annotations.GrpcGenerated +public final class A2AServiceGrpc { + + private A2AServiceGrpc() {} + + public static final java.lang.String SERVICE_NAME = "a2a.v1.A2AService"; + + // Static method descriptors that strictly reflect the proto. + private static volatile io.grpc.MethodDescriptor getSendMessageMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "SendMessage", + requestType = org.a2aproject.sdk.compat03.grpc.SendMessageRequest.class, + responseType = org.a2aproject.sdk.compat03.grpc.SendMessageResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getSendMessageMethod() { + io.grpc.MethodDescriptor getSendMessageMethod; + if ((getSendMessageMethod = A2AServiceGrpc.getSendMessageMethod) == null) { + synchronized (A2AServiceGrpc.class) { + if ((getSendMessageMethod = A2AServiceGrpc.getSendMessageMethod) == null) { + A2AServiceGrpc.getSendMessageMethod = getSendMessageMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "SendMessage")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.a2aproject.sdk.compat03.grpc.SendMessageRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.a2aproject.sdk.compat03.grpc.SendMessageResponse.getDefaultInstance())) + .setSchemaDescriptor(new A2AServiceMethodDescriptorSupplier("SendMessage")) + .build(); + } + } + } + return getSendMessageMethod; + } + + private static volatile io.grpc.MethodDescriptor getSendStreamingMessageMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "SendStreamingMessage", + requestType = org.a2aproject.sdk.compat03.grpc.SendMessageRequest.class, + responseType = org.a2aproject.sdk.compat03.grpc.StreamResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING) + public static io.grpc.MethodDescriptor getSendStreamingMessageMethod() { + io.grpc.MethodDescriptor getSendStreamingMessageMethod; + if ((getSendStreamingMessageMethod = A2AServiceGrpc.getSendStreamingMessageMethod) == null) { + synchronized (A2AServiceGrpc.class) { + if ((getSendStreamingMessageMethod = A2AServiceGrpc.getSendStreamingMessageMethod) == null) { + A2AServiceGrpc.getSendStreamingMessageMethod = getSendStreamingMessageMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "SendStreamingMessage")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.a2aproject.sdk.compat03.grpc.SendMessageRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.a2aproject.sdk.compat03.grpc.StreamResponse.getDefaultInstance())) + .setSchemaDescriptor(new A2AServiceMethodDescriptorSupplier("SendStreamingMessage")) + .build(); + } + } + } + return getSendStreamingMessageMethod; + } + + private static volatile io.grpc.MethodDescriptor getGetTaskMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetTask", + requestType = org.a2aproject.sdk.compat03.grpc.GetTaskRequest.class, + responseType = org.a2aproject.sdk.compat03.grpc.Task.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getGetTaskMethod() { + io.grpc.MethodDescriptor getGetTaskMethod; + if ((getGetTaskMethod = A2AServiceGrpc.getGetTaskMethod) == null) { + synchronized (A2AServiceGrpc.class) { + if ((getGetTaskMethod = A2AServiceGrpc.getGetTaskMethod) == null) { + A2AServiceGrpc.getGetTaskMethod = getGetTaskMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetTask")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.a2aproject.sdk.compat03.grpc.GetTaskRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.a2aproject.sdk.compat03.grpc.Task.getDefaultInstance())) + .setSchemaDescriptor(new A2AServiceMethodDescriptorSupplier("GetTask")) + .build(); + } + } + } + return getGetTaskMethod; + } + + private static volatile io.grpc.MethodDescriptor getCancelTaskMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "CancelTask", + requestType = org.a2aproject.sdk.compat03.grpc.CancelTaskRequest.class, + responseType = org.a2aproject.sdk.compat03.grpc.Task.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getCancelTaskMethod() { + io.grpc.MethodDescriptor getCancelTaskMethod; + if ((getCancelTaskMethod = A2AServiceGrpc.getCancelTaskMethod) == null) { + synchronized (A2AServiceGrpc.class) { + if ((getCancelTaskMethod = A2AServiceGrpc.getCancelTaskMethod) == null) { + A2AServiceGrpc.getCancelTaskMethod = getCancelTaskMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "CancelTask")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.a2aproject.sdk.compat03.grpc.CancelTaskRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.a2aproject.sdk.compat03.grpc.Task.getDefaultInstance())) + .setSchemaDescriptor(new A2AServiceMethodDescriptorSupplier("CancelTask")) + .build(); + } + } + } + return getCancelTaskMethod; + } + + private static volatile io.grpc.MethodDescriptor getTaskSubscriptionMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "TaskSubscription", + requestType = org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest.class, + responseType = org.a2aproject.sdk.compat03.grpc.StreamResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING) + public static io.grpc.MethodDescriptor getTaskSubscriptionMethod() { + io.grpc.MethodDescriptor getTaskSubscriptionMethod; + if ((getTaskSubscriptionMethod = A2AServiceGrpc.getTaskSubscriptionMethod) == null) { + synchronized (A2AServiceGrpc.class) { + if ((getTaskSubscriptionMethod = A2AServiceGrpc.getTaskSubscriptionMethod) == null) { + A2AServiceGrpc.getTaskSubscriptionMethod = getTaskSubscriptionMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "TaskSubscription")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.a2aproject.sdk.compat03.grpc.StreamResponse.getDefaultInstance())) + .setSchemaDescriptor(new A2AServiceMethodDescriptorSupplier("TaskSubscription")) + .build(); + } + } + } + return getTaskSubscriptionMethod; + } + + private static volatile io.grpc.MethodDescriptor getCreateTaskPushNotificationConfigMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "CreateTaskPushNotificationConfig", + requestType = org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest.class, + responseType = org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getCreateTaskPushNotificationConfigMethod() { + io.grpc.MethodDescriptor getCreateTaskPushNotificationConfigMethod; + if ((getCreateTaskPushNotificationConfigMethod = A2AServiceGrpc.getCreateTaskPushNotificationConfigMethod) == null) { + synchronized (A2AServiceGrpc.class) { + if ((getCreateTaskPushNotificationConfigMethod = A2AServiceGrpc.getCreateTaskPushNotificationConfigMethod) == null) { + A2AServiceGrpc.getCreateTaskPushNotificationConfigMethod = getCreateTaskPushNotificationConfigMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "CreateTaskPushNotificationConfig")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.getDefaultInstance())) + .setSchemaDescriptor(new A2AServiceMethodDescriptorSupplier("CreateTaskPushNotificationConfig")) + .build(); + } + } + } + return getCreateTaskPushNotificationConfigMethod; + } + + private static volatile io.grpc.MethodDescriptor getGetTaskPushNotificationConfigMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetTaskPushNotificationConfig", + requestType = org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest.class, + responseType = org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getGetTaskPushNotificationConfigMethod() { + io.grpc.MethodDescriptor getGetTaskPushNotificationConfigMethod; + if ((getGetTaskPushNotificationConfigMethod = A2AServiceGrpc.getGetTaskPushNotificationConfigMethod) == null) { + synchronized (A2AServiceGrpc.class) { + if ((getGetTaskPushNotificationConfigMethod = A2AServiceGrpc.getGetTaskPushNotificationConfigMethod) == null) { + A2AServiceGrpc.getGetTaskPushNotificationConfigMethod = getGetTaskPushNotificationConfigMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetTaskPushNotificationConfig")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.getDefaultInstance())) + .setSchemaDescriptor(new A2AServiceMethodDescriptorSupplier("GetTaskPushNotificationConfig")) + .build(); + } + } + } + return getGetTaskPushNotificationConfigMethod; + } + + private static volatile io.grpc.MethodDescriptor getListTaskPushNotificationConfigMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ListTaskPushNotificationConfig", + requestType = org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest.class, + responseType = org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getListTaskPushNotificationConfigMethod() { + io.grpc.MethodDescriptor getListTaskPushNotificationConfigMethod; + if ((getListTaskPushNotificationConfigMethod = A2AServiceGrpc.getListTaskPushNotificationConfigMethod) == null) { + synchronized (A2AServiceGrpc.class) { + if ((getListTaskPushNotificationConfigMethod = A2AServiceGrpc.getListTaskPushNotificationConfigMethod) == null) { + A2AServiceGrpc.getListTaskPushNotificationConfigMethod = getListTaskPushNotificationConfigMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ListTaskPushNotificationConfig")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse.getDefaultInstance())) + .setSchemaDescriptor(new A2AServiceMethodDescriptorSupplier("ListTaskPushNotificationConfig")) + .build(); + } + } + } + return getListTaskPushNotificationConfigMethod; + } + + private static volatile io.grpc.MethodDescriptor getGetAgentCardMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetAgentCard", + requestType = org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest.class, + responseType = org.a2aproject.sdk.compat03.grpc.AgentCard.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getGetAgentCardMethod() { + io.grpc.MethodDescriptor getGetAgentCardMethod; + if ((getGetAgentCardMethod = A2AServiceGrpc.getGetAgentCardMethod) == null) { + synchronized (A2AServiceGrpc.class) { + if ((getGetAgentCardMethod = A2AServiceGrpc.getGetAgentCardMethod) == null) { + A2AServiceGrpc.getGetAgentCardMethod = getGetAgentCardMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetAgentCard")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.a2aproject.sdk.compat03.grpc.AgentCard.getDefaultInstance())) + .setSchemaDescriptor(new A2AServiceMethodDescriptorSupplier("GetAgentCard")) + .build(); + } + } + } + return getGetAgentCardMethod; + } + + private static volatile io.grpc.MethodDescriptor getDeleteTaskPushNotificationConfigMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "DeleteTaskPushNotificationConfig", + requestType = org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest.class, + responseType = com.google.protobuf.Empty.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getDeleteTaskPushNotificationConfigMethod() { + io.grpc.MethodDescriptor getDeleteTaskPushNotificationConfigMethod; + if ((getDeleteTaskPushNotificationConfigMethod = A2AServiceGrpc.getDeleteTaskPushNotificationConfigMethod) == null) { + synchronized (A2AServiceGrpc.class) { + if ((getDeleteTaskPushNotificationConfigMethod = A2AServiceGrpc.getDeleteTaskPushNotificationConfigMethod) == null) { + A2AServiceGrpc.getDeleteTaskPushNotificationConfigMethod = getDeleteTaskPushNotificationConfigMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "DeleteTaskPushNotificationConfig")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.protobuf.Empty.getDefaultInstance())) + .setSchemaDescriptor(new A2AServiceMethodDescriptorSupplier("DeleteTaskPushNotificationConfig")) + .build(); + } + } + } + return getDeleteTaskPushNotificationConfigMethod; + } + + /** + * Creates a new async stub that supports all call types for the service + */ + public static A2AServiceStub newStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public A2AServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new A2AServiceStub(channel, callOptions); + } + }; + return A2AServiceStub.newStub(factory, channel); + } + + /** + * Creates a new blocking-style stub that supports all types of calls on the service + */ + public static A2AServiceBlockingV2Stub newBlockingV2Stub( + io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public A2AServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new A2AServiceBlockingV2Stub(channel, callOptions); + } + }; + return A2AServiceBlockingV2Stub.newStub(factory, channel); + } + + /** + * Creates a new blocking-style stub that supports unary and streaming output calls on the service + */ + public static A2AServiceBlockingStub newBlockingStub( + io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public A2AServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new A2AServiceBlockingStub(channel, callOptions); + } + }; + return A2AServiceBlockingStub.newStub(factory, channel); + } + + /** + * Creates a new ListenableFuture-style stub that supports unary calls on the service + */ + public static A2AServiceFutureStub newFutureStub( + io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public A2AServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new A2AServiceFutureStub(channel, callOptions); + } + }; + return A2AServiceFutureStub.newStub(factory, channel); + } + + /** + *
+   * A2AService defines the gRPC version of the A2A protocol. This has a slightly
+   * different shape than the JSONRPC version to better conform to AIP-127,
+   * where appropriate. The nouns are AgentCard, Message, Task and
+   * TaskPushNotificationConfig.
+   * - Messages are not a standard resource so there is no get/delete/update/list
+   *   interface, only a send and stream custom methods.
+   * - Tasks have a get interface and custom cancel and subscribe methods.
+   * - TaskPushNotificationConfig are a resource whose parent is a task.
+   *   They have get, list and create methods.
+   * - AgentCard is a static resource with only a get method.
+   * fields are not present as they don't comply with AIP rules, and the
+   * optional history_length on the get task method is not present as it also
+   * violates AIP-127 and AIP-131.
+   * 
+ */ + public interface AsyncService { + + /** + *
+     * Send a message to the agent. This is a blocking call that will return the
+     * task once it is completed, or a LRO if requested.
+     * 
+ */ + default void sendMessage(org.a2aproject.sdk.compat03.grpc.SendMessageRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getSendMessageMethod(), responseObserver); + } + + /** + *
+     * SendStreamingMessage is a streaming call that will return a stream of
+     * task update events until the Task is in an interrupted or terminal state.
+     * 
+ */ + default void sendStreamingMessage(org.a2aproject.sdk.compat03.grpc.SendMessageRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getSendStreamingMessageMethod(), responseObserver); + } + + /** + *
+     * Get the current state of a task from the agent.
+     * 
+ */ + default void getTask(org.a2aproject.sdk.compat03.grpc.GetTaskRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetTaskMethod(), responseObserver); + } + + /** + *
+     * Cancel a task from the agent. If supported one should expect no
+     * more task updates for the task.
+     * 
+ */ + default void cancelTask(org.a2aproject.sdk.compat03.grpc.CancelTaskRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getCancelTaskMethod(), responseObserver); + } + + /** + *
+     * TaskSubscription is a streaming call that will return a stream of task
+     * update events. This attaches the stream to an existing in process task.
+     * If the task is complete the stream will return the completed task (like
+     * GetTask) and close the stream.
+     * 
+ */ + default void taskSubscription(org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getTaskSubscriptionMethod(), responseObserver); + } + + /** + *
+     * Set a push notification config for a task.
+     * 
+ */ + default void createTaskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getCreateTaskPushNotificationConfigMethod(), responseObserver); + } + + /** + *
+     * Get a push notification config for a task.
+     * 
+ */ + default void getTaskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetTaskPushNotificationConfigMethod(), responseObserver); + } + + /** + *
+     * Get a list of push notifications configured for a task.
+     * 
+ */ + default void listTaskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getListTaskPushNotificationConfigMethod(), responseObserver); + } + + /** + *
+     * GetAgentCard returns the agent card for the agent.
+     * 
+ */ + default void getAgentCard(org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetAgentCardMethod(), responseObserver); + } + + /** + *
+     * Delete a push notification config for a task.
+     * 
+ */ + default void deleteTaskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getDeleteTaskPushNotificationConfigMethod(), responseObserver); + } + } + + /** + * Base class for the server implementation of the service A2AService. + *
+   * A2AService defines the gRPC version of the A2A protocol. This has a slightly
+   * different shape than the JSONRPC version to better conform to AIP-127,
+   * where appropriate. The nouns are AgentCard, Message, Task and
+   * TaskPushNotificationConfig.
+   * - Messages are not a standard resource so there is no get/delete/update/list
+   *   interface, only a send and stream custom methods.
+   * - Tasks have a get interface and custom cancel and subscribe methods.
+   * - TaskPushNotificationConfig are a resource whose parent is a task.
+   *   They have get, list and create methods.
+   * - AgentCard is a static resource with only a get method.
+   * fields are not present as they don't comply with AIP rules, and the
+   * optional history_length on the get task method is not present as it also
+   * violates AIP-127 and AIP-131.
+   * 
+ */ + public static abstract class A2AServiceImplBase + implements io.grpc.BindableService, AsyncService { + + @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { + return A2AServiceGrpc.bindService(this); + } + } + + /** + * A stub to allow clients to do asynchronous rpc calls to service A2AService. + *
+   * A2AService defines the gRPC version of the A2A protocol. This has a slightly
+   * different shape than the JSONRPC version to better conform to AIP-127,
+   * where appropriate. The nouns are AgentCard, Message, Task and
+   * TaskPushNotificationConfig.
+   * - Messages are not a standard resource so there is no get/delete/update/list
+   *   interface, only a send and stream custom methods.
+   * - Tasks have a get interface and custom cancel and subscribe methods.
+   * - TaskPushNotificationConfig are a resource whose parent is a task.
+   *   They have get, list and create methods.
+   * - AgentCard is a static resource with only a get method.
+   * fields are not present as they don't comply with AIP rules, and the
+   * optional history_length on the get task method is not present as it also
+   * violates AIP-127 and AIP-131.
+   * 
+ */ + public static final class A2AServiceStub + extends io.grpc.stub.AbstractAsyncStub { + private A2AServiceStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected A2AServiceStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new A2AServiceStub(channel, callOptions); + } + + /** + *
+     * Send a message to the agent. This is a blocking call that will return the
+     * task once it is completed, or a LRO if requested.
+     * 
+ */ + public void sendMessage(org.a2aproject.sdk.compat03.grpc.SendMessageRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getSendMessageMethod(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * SendStreamingMessage is a streaming call that will return a stream of
+     * task update events until the Task is in an interrupted or terminal state.
+     * 
+ */ + public void sendStreamingMessage(org.a2aproject.sdk.compat03.grpc.SendMessageRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncServerStreamingCall( + getChannel().newCall(getSendStreamingMessageMethod(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * Get the current state of a task from the agent.
+     * 
+ */ + public void getTask(org.a2aproject.sdk.compat03.grpc.GetTaskRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetTaskMethod(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * Cancel a task from the agent. If supported one should expect no
+     * more task updates for the task.
+     * 
+ */ + public void cancelTask(org.a2aproject.sdk.compat03.grpc.CancelTaskRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getCancelTaskMethod(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * TaskSubscription is a streaming call that will return a stream of task
+     * update events. This attaches the stream to an existing in process task.
+     * If the task is complete the stream will return the completed task (like
+     * GetTask) and close the stream.
+     * 
+ */ + public void taskSubscription(org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncServerStreamingCall( + getChannel().newCall(getTaskSubscriptionMethod(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * Set a push notification config for a task.
+     * 
+ */ + public void createTaskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getCreateTaskPushNotificationConfigMethod(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * Get a push notification config for a task.
+     * 
+ */ + public void getTaskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetTaskPushNotificationConfigMethod(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * Get a list of push notifications configured for a task.
+     * 
+ */ + public void listTaskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getListTaskPushNotificationConfigMethod(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * GetAgentCard returns the agent card for the agent.
+     * 
+ */ + public void getAgentCard(org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetAgentCardMethod(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * Delete a push notification config for a task.
+     * 
+ */ + public void deleteTaskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getDeleteTaskPushNotificationConfigMethod(), getCallOptions()), request, responseObserver); + } + } + + /** + * A stub to allow clients to do synchronous rpc calls to service A2AService. + *
+   * A2AService defines the gRPC version of the A2A protocol. This has a slightly
+   * different shape than the JSONRPC version to better conform to AIP-127,
+   * where appropriate. The nouns are AgentCard, Message, Task and
+   * TaskPushNotificationConfig.
+   * - Messages are not a standard resource so there is no get/delete/update/list
+   *   interface, only a send and stream custom methods.
+   * - Tasks have a get interface and custom cancel and subscribe methods.
+   * - TaskPushNotificationConfig are a resource whose parent is a task.
+   *   They have get, list and create methods.
+   * - AgentCard is a static resource with only a get method.
+   * fields are not present as they don't comply with AIP rules, and the
+   * optional history_length on the get task method is not present as it also
+   * violates AIP-127 and AIP-131.
+   * 
+ */ + public static final class A2AServiceBlockingV2Stub + extends io.grpc.stub.AbstractBlockingStub { + private A2AServiceBlockingV2Stub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected A2AServiceBlockingV2Stub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new A2AServiceBlockingV2Stub(channel, callOptions); + } + + /** + *
+     * Send a message to the agent. This is a blocking call that will return the
+     * task once it is completed, or a LRO if requested.
+     * 
+ */ + public org.a2aproject.sdk.compat03.grpc.SendMessageResponse sendMessage(org.a2aproject.sdk.compat03.grpc.SendMessageRequest request) throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getSendMessageMethod(), getCallOptions(), request); + } + + /** + *
+     * SendStreamingMessage is a streaming call that will return a stream of
+     * task update events until the Task is in an interrupted or terminal state.
+     * 
+ */ + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918") + public io.grpc.stub.BlockingClientCall + sendStreamingMessage(org.a2aproject.sdk.compat03.grpc.SendMessageRequest request) { + return io.grpc.stub.ClientCalls.blockingV2ServerStreamingCall( + getChannel(), getSendStreamingMessageMethod(), getCallOptions(), request); + } + + /** + *
+     * Get the current state of a task from the agent.
+     * 
+ */ + public org.a2aproject.sdk.compat03.grpc.Task getTask(org.a2aproject.sdk.compat03.grpc.GetTaskRequest request) throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getGetTaskMethod(), getCallOptions(), request); + } + + /** + *
+     * Cancel a task from the agent. If supported one should expect no
+     * more task updates for the task.
+     * 
+ */ + public org.a2aproject.sdk.compat03.grpc.Task cancelTask(org.a2aproject.sdk.compat03.grpc.CancelTaskRequest request) throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getCancelTaskMethod(), getCallOptions(), request); + } + + /** + *
+     * TaskSubscription is a streaming call that will return a stream of task
+     * update events. This attaches the stream to an existing in process task.
+     * If the task is complete the stream will return the completed task (like
+     * GetTask) and close the stream.
+     * 
+ */ + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918") + public io.grpc.stub.BlockingClientCall + taskSubscription(org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest request) { + return io.grpc.stub.ClientCalls.blockingV2ServerStreamingCall( + getChannel(), getTaskSubscriptionMethod(), getCallOptions(), request); + } + + /** + *
+     * Set a push notification config for a task.
+     * 
+ */ + public org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig createTaskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest request) throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getCreateTaskPushNotificationConfigMethod(), getCallOptions(), request); + } + + /** + *
+     * Get a push notification config for a task.
+     * 
+ */ + public org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig getTaskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest request) throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getGetTaskPushNotificationConfigMethod(), getCallOptions(), request); + } + + /** + *
+     * Get a list of push notifications configured for a task.
+     * 
+ */ + public org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse listTaskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest request) throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getListTaskPushNotificationConfigMethod(), getCallOptions(), request); + } + + /** + *
+     * GetAgentCard returns the agent card for the agent.
+     * 
+ */ + public org.a2aproject.sdk.compat03.grpc.AgentCard getAgentCard(org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest request) throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getGetAgentCardMethod(), getCallOptions(), request); + } + + /** + *
+     * Delete a push notification config for a task.
+     * 
+ */ + public com.google.protobuf.Empty deleteTaskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest request) throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getDeleteTaskPushNotificationConfigMethod(), getCallOptions(), request); + } + } + + /** + * A stub to allow clients to do limited synchronous rpc calls to service A2AService. + *
+   * A2AService defines the gRPC version of the A2A protocol. This has a slightly
+   * different shape than the JSONRPC version to better conform to AIP-127,
+   * where appropriate. The nouns are AgentCard, Message, Task and
+   * TaskPushNotificationConfig.
+   * - Messages are not a standard resource so there is no get/delete/update/list
+   *   interface, only a send and stream custom methods.
+   * - Tasks have a get interface and custom cancel and subscribe methods.
+   * - TaskPushNotificationConfig are a resource whose parent is a task.
+   *   They have get, list and create methods.
+   * - AgentCard is a static resource with only a get method.
+   * fields are not present as they don't comply with AIP rules, and the
+   * optional history_length on the get task method is not present as it also
+   * violates AIP-127 and AIP-131.
+   * 
+ */ + public static final class A2AServiceBlockingStub + extends io.grpc.stub.AbstractBlockingStub { + private A2AServiceBlockingStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected A2AServiceBlockingStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new A2AServiceBlockingStub(channel, callOptions); + } + + /** + *
+     * Send a message to the agent. This is a blocking call that will return the
+     * task once it is completed, or a LRO if requested.
+     * 
+ */ + public org.a2aproject.sdk.compat03.grpc.SendMessageResponse sendMessage(org.a2aproject.sdk.compat03.grpc.SendMessageRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getSendMessageMethod(), getCallOptions(), request); + } + + /** + *
+     * SendStreamingMessage is a streaming call that will return a stream of
+     * task update events until the Task is in an interrupted or terminal state.
+     * 
+ */ + public java.util.Iterator sendStreamingMessage( + org.a2aproject.sdk.compat03.grpc.SendMessageRequest request) { + return io.grpc.stub.ClientCalls.blockingServerStreamingCall( + getChannel(), getSendStreamingMessageMethod(), getCallOptions(), request); + } + + /** + *
+     * Get the current state of a task from the agent.
+     * 
+ */ + public org.a2aproject.sdk.compat03.grpc.Task getTask(org.a2aproject.sdk.compat03.grpc.GetTaskRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetTaskMethod(), getCallOptions(), request); + } + + /** + *
+     * Cancel a task from the agent. If supported one should expect no
+     * more task updates for the task.
+     * 
+ */ + public org.a2aproject.sdk.compat03.grpc.Task cancelTask(org.a2aproject.sdk.compat03.grpc.CancelTaskRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getCancelTaskMethod(), getCallOptions(), request); + } + + /** + *
+     * TaskSubscription is a streaming call that will return a stream of task
+     * update events. This attaches the stream to an existing in process task.
+     * If the task is complete the stream will return the completed task (like
+     * GetTask) and close the stream.
+     * 
+ */ + public java.util.Iterator taskSubscription( + org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest request) { + return io.grpc.stub.ClientCalls.blockingServerStreamingCall( + getChannel(), getTaskSubscriptionMethod(), getCallOptions(), request); + } + + /** + *
+     * Set a push notification config for a task.
+     * 
+ */ + public org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig createTaskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getCreateTaskPushNotificationConfigMethod(), getCallOptions(), request); + } + + /** + *
+     * Get a push notification config for a task.
+     * 
+ */ + public org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig getTaskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetTaskPushNotificationConfigMethod(), getCallOptions(), request); + } + + /** + *
+     * Get a list of push notifications configured for a task.
+     * 
+ */ + public org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse listTaskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getListTaskPushNotificationConfigMethod(), getCallOptions(), request); + } + + /** + *
+     * GetAgentCard returns the agent card for the agent.
+     * 
+ */ + public org.a2aproject.sdk.compat03.grpc.AgentCard getAgentCard(org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetAgentCardMethod(), getCallOptions(), request); + } + + /** + *
+     * Delete a push notification config for a task.
+     * 
+ */ + public com.google.protobuf.Empty deleteTaskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getDeleteTaskPushNotificationConfigMethod(), getCallOptions(), request); + } + } + + /** + * A stub to allow clients to do ListenableFuture-style rpc calls to service A2AService. + *
+   * A2AService defines the gRPC version of the A2A protocol. This has a slightly
+   * different shape than the JSONRPC version to better conform to AIP-127,
+   * where appropriate. The nouns are AgentCard, Message, Task and
+   * TaskPushNotificationConfig.
+   * - Messages are not a standard resource so there is no get/delete/update/list
+   *   interface, only a send and stream custom methods.
+   * - Tasks have a get interface and custom cancel and subscribe methods.
+   * - TaskPushNotificationConfig are a resource whose parent is a task.
+   *   They have get, list and create methods.
+   * - AgentCard is a static resource with only a get method.
+   * fields are not present as they don't comply with AIP rules, and the
+   * optional history_length on the get task method is not present as it also
+   * violates AIP-127 and AIP-131.
+   * 
+ */ + public static final class A2AServiceFutureStub + extends io.grpc.stub.AbstractFutureStub { + private A2AServiceFutureStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected A2AServiceFutureStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new A2AServiceFutureStub(channel, callOptions); + } + + /** + *
+     * Send a message to the agent. This is a blocking call that will return the
+     * task once it is completed, or a LRO if requested.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture sendMessage( + org.a2aproject.sdk.compat03.grpc.SendMessageRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getSendMessageMethod(), getCallOptions()), request); + } + + /** + *
+     * Get the current state of a task from the agent.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture getTask( + org.a2aproject.sdk.compat03.grpc.GetTaskRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetTaskMethod(), getCallOptions()), request); + } + + /** + *
+     * Cancel a task from the agent. If supported one should expect no
+     * more task updates for the task.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture cancelTask( + org.a2aproject.sdk.compat03.grpc.CancelTaskRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getCancelTaskMethod(), getCallOptions()), request); + } + + /** + *
+     * Set a push notification config for a task.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture createTaskPushNotificationConfig( + org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getCreateTaskPushNotificationConfigMethod(), getCallOptions()), request); + } + + /** + *
+     * Get a push notification config for a task.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture getTaskPushNotificationConfig( + org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetTaskPushNotificationConfigMethod(), getCallOptions()), request); + } + + /** + *
+     * Get a list of push notifications configured for a task.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture listTaskPushNotificationConfig( + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getListTaskPushNotificationConfigMethod(), getCallOptions()), request); + } + + /** + *
+     * GetAgentCard returns the agent card for the agent.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture getAgentCard( + org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetAgentCardMethod(), getCallOptions()), request); + } + + /** + *
+     * Delete a push notification config for a task.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture deleteTaskPushNotificationConfig( + org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getDeleteTaskPushNotificationConfigMethod(), getCallOptions()), request); + } + } + + private static final int METHODID_SEND_MESSAGE = 0; + private static final int METHODID_SEND_STREAMING_MESSAGE = 1; + private static final int METHODID_GET_TASK = 2; + private static final int METHODID_CANCEL_TASK = 3; + private static final int METHODID_TASK_SUBSCRIPTION = 4; + private static final int METHODID_CREATE_TASK_PUSH_NOTIFICATION_CONFIG = 5; + private static final int METHODID_GET_TASK_PUSH_NOTIFICATION_CONFIG = 6; + private static final int METHODID_LIST_TASK_PUSH_NOTIFICATION_CONFIG = 7; + private static final int METHODID_GET_AGENT_CARD = 8; + private static final int METHODID_DELETE_TASK_PUSH_NOTIFICATION_CONFIG = 9; + + private static final class MethodHandlers implements + io.grpc.stub.ServerCalls.UnaryMethod, + io.grpc.stub.ServerCalls.ServerStreamingMethod, + io.grpc.stub.ServerCalls.ClientStreamingMethod, + io.grpc.stub.ServerCalls.BidiStreamingMethod { + private final AsyncService serviceImpl; + private final int methodId; + + MethodHandlers(AsyncService serviceImpl, int methodId) { + this.serviceImpl = serviceImpl; + this.methodId = methodId; + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + case METHODID_SEND_MESSAGE: + serviceImpl.sendMessage((org.a2aproject.sdk.compat03.grpc.SendMessageRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_SEND_STREAMING_MESSAGE: + serviceImpl.sendStreamingMessage((org.a2aproject.sdk.compat03.grpc.SendMessageRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_GET_TASK: + serviceImpl.getTask((org.a2aproject.sdk.compat03.grpc.GetTaskRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_CANCEL_TASK: + serviceImpl.cancelTask((org.a2aproject.sdk.compat03.grpc.CancelTaskRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_TASK_SUBSCRIPTION: + serviceImpl.taskSubscription((org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_CREATE_TASK_PUSH_NOTIFICATION_CONFIG: + serviceImpl.createTaskPushNotificationConfig((org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_GET_TASK_PUSH_NOTIFICATION_CONFIG: + serviceImpl.getTaskPushNotificationConfig((org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_LIST_TASK_PUSH_NOTIFICATION_CONFIG: + serviceImpl.listTaskPushNotificationConfig((org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_GET_AGENT_CARD: + serviceImpl.getAgentCard((org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_DELETE_TASK_PUSH_NOTIFICATION_CONFIG: + serviceImpl.deleteTaskPushNotificationConfig((org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + default: + throw new AssertionError(); + } + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public io.grpc.stub.StreamObserver invoke( + io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + default: + throw new AssertionError(); + } + } + } + + public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getSendMessageMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + org.a2aproject.sdk.compat03.grpc.SendMessageRequest, + org.a2aproject.sdk.compat03.grpc.SendMessageResponse>( + service, METHODID_SEND_MESSAGE))) + .addMethod( + getSendStreamingMessageMethod(), + io.grpc.stub.ServerCalls.asyncServerStreamingCall( + new MethodHandlers< + org.a2aproject.sdk.compat03.grpc.SendMessageRequest, + org.a2aproject.sdk.compat03.grpc.StreamResponse>( + service, METHODID_SEND_STREAMING_MESSAGE))) + .addMethod( + getGetTaskMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + org.a2aproject.sdk.compat03.grpc.GetTaskRequest, + org.a2aproject.sdk.compat03.grpc.Task>( + service, METHODID_GET_TASK))) + .addMethod( + getCancelTaskMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + org.a2aproject.sdk.compat03.grpc.CancelTaskRequest, + org.a2aproject.sdk.compat03.grpc.Task>( + service, METHODID_CANCEL_TASK))) + .addMethod( + getTaskSubscriptionMethod(), + io.grpc.stub.ServerCalls.asyncServerStreamingCall( + new MethodHandlers< + org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest, + org.a2aproject.sdk.compat03.grpc.StreamResponse>( + service, METHODID_TASK_SUBSCRIPTION))) + .addMethod( + getCreateTaskPushNotificationConfigMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest, + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig>( + service, METHODID_CREATE_TASK_PUSH_NOTIFICATION_CONFIG))) + .addMethod( + getGetTaskPushNotificationConfigMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest, + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig>( + service, METHODID_GET_TASK_PUSH_NOTIFICATION_CONFIG))) + .addMethod( + getListTaskPushNotificationConfigMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest, + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse>( + service, METHODID_LIST_TASK_PUSH_NOTIFICATION_CONFIG))) + .addMethod( + getGetAgentCardMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest, + org.a2aproject.sdk.compat03.grpc.AgentCard>( + service, METHODID_GET_AGENT_CARD))) + .addMethod( + getDeleteTaskPushNotificationConfigMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest, + com.google.protobuf.Empty>( + service, METHODID_DELETE_TASK_PUSH_NOTIFICATION_CONFIG))) + .build(); + } + + private static abstract class A2AServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier { + A2AServiceBaseDescriptorSupplier() {} + + @java.lang.Override + public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { + return A2A.getDescriptor(); + } + + @java.lang.Override + public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { + return getFileDescriptor().findServiceByName("A2AService"); + } + } + + private static final class A2AServiceFileDescriptorSupplier + extends A2AServiceBaseDescriptorSupplier { + A2AServiceFileDescriptorSupplier() {} + } + + private static final class A2AServiceMethodDescriptorSupplier + extends A2AServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { + private final java.lang.String methodName; + + A2AServiceMethodDescriptorSupplier(java.lang.String methodName) { + this.methodName = methodName; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { + return getServiceDescriptor().findMethodByName(methodName); + } + } + + private static volatile io.grpc.ServiceDescriptor serviceDescriptor; + + public static io.grpc.ServiceDescriptor getServiceDescriptor() { + io.grpc.ServiceDescriptor result = serviceDescriptor; + if (result == null) { + synchronized (A2AServiceGrpc.class) { + result = serviceDescriptor; + if (result == null) { + serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) + .setSchemaDescriptor(new A2AServiceFileDescriptorSupplier()) + .addMethod(getSendMessageMethod()) + .addMethod(getSendStreamingMessageMethod()) + .addMethod(getGetTaskMethod()) + .addMethod(getCancelTaskMethod()) + .addMethod(getTaskSubscriptionMethod()) + .addMethod(getCreateTaskPushNotificationConfigMethod()) + .addMethod(getGetTaskPushNotificationConfigMethod()) + .addMethod(getListTaskPushNotificationConfigMethod()) + .addMethod(getGetAgentCardMethod()) + .addMethod(getDeleteTaskPushNotificationConfigMethod()) + .build(); + } + } + } + return result; + } +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/APIKeySecurityScheme.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/APIKeySecurityScheme.java new file mode 100644 index 000000000..f26fa1f1a --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/APIKeySecurityScheme.java @@ -0,0 +1,858 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.APIKeySecurityScheme} + */ +@com.google.protobuf.Generated +public final class APIKeySecurityScheme extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.APIKeySecurityScheme) + APIKeySecuritySchemeOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "APIKeySecurityScheme"); + } + // Use APIKeySecurityScheme.newBuilder() to construct. + private APIKeySecurityScheme(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private APIKeySecurityScheme() { + description_ = ""; + location_ = ""; + name_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_APIKeySecurityScheme_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_APIKeySecurityScheme_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.class, org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.Builder.class); + } + + public static final int DESCRIPTION_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object description_ = ""; + /** + *
+   * Description of this security scheme.
+   * 
+ * + * string description = 1; + * @return The description. + */ + @java.lang.Override + public java.lang.String getDescription() { + java.lang.Object ref = description_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + description_ = s; + return s; + } + } + /** + *
+   * Description of this security scheme.
+   * 
+ * + * string description = 1; + * @return The bytes for description. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int LOCATION_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object location_ = ""; + /** + *
+   * Location of the API key, valid values are "query", "header", or "cookie"
+   * 
+ * + * string location = 2; + * @return The location. + */ + @java.lang.Override + public java.lang.String getLocation() { + java.lang.Object ref = location_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + location_ = s; + return s; + } + } + /** + *
+   * Location of the API key, valid values are "query", "header", or "cookie"
+   * 
+ * + * string location = 2; + * @return The bytes for location. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getLocationBytes() { + java.lang.Object ref = location_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + location_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int NAME_FIELD_NUMBER = 3; + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + *
+   * Name of the header, query or cookie parameter to be used.
+   * 
+ * + * string name = 3; + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + *
+   * Name of the header, query or cookie parameter to be used.
+   * 
+ * + * string name = 3; + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(description_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, description_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(location_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, location_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 3, name_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(description_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, description_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(location_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, location_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(3, name_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme other = (org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme) obj; + + if (!getDescription() + .equals(other.getDescription())) return false; + if (!getLocation() + .equals(other.getLocation())) return false; + if (!getName() + .equals(other.getName())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + DESCRIPTION_FIELD_NUMBER; + hash = (53 * hash) + getDescription().hashCode(); + hash = (37 * hash) + LOCATION_FIELD_NUMBER; + hash = (53 * hash) + getLocation().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.APIKeySecurityScheme} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.APIKeySecurityScheme) + org.a2aproject.sdk.compat03.grpc.APIKeySecuritySchemeOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_APIKeySecurityScheme_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_APIKeySecurityScheme_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.class, org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + description_ = ""; + location_ = ""; + name_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_APIKeySecurityScheme_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme build() { + org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme buildPartial() { + org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme result = new org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.description_ = description_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.location_ = location_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.name_ = name_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme other) { + if (other == org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.getDefaultInstance()) return this; + if (!other.getDescription().isEmpty()) { + description_ = other.description_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getLocation().isEmpty()) { + location_ = other.location_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000004; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + description_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + location_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object description_ = ""; + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @return The description. + */ + public java.lang.String getDescription() { + java.lang.Object ref = description_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + description_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @return The bytes for description. + */ + public com.google.protobuf.ByteString + getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @param value The description to set. + * @return This builder for chaining. + */ + public Builder setDescription( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + description_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @return This builder for chaining. + */ + public Builder clearDescription() { + description_ = getDefaultInstance().getDescription(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @param value The bytes for description to set. + * @return This builder for chaining. + */ + public Builder setDescriptionBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + description_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object location_ = ""; + /** + *
+     * Location of the API key, valid values are "query", "header", or "cookie"
+     * 
+ * + * string location = 2; + * @return The location. + */ + public java.lang.String getLocation() { + java.lang.Object ref = location_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + location_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Location of the API key, valid values are "query", "header", or "cookie"
+     * 
+ * + * string location = 2; + * @return The bytes for location. + */ + public com.google.protobuf.ByteString + getLocationBytes() { + java.lang.Object ref = location_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + location_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Location of the API key, valid values are "query", "header", or "cookie"
+     * 
+ * + * string location = 2; + * @param value The location to set. + * @return This builder for chaining. + */ + public Builder setLocation( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + location_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * Location of the API key, valid values are "query", "header", or "cookie"
+     * 
+ * + * string location = 2; + * @return This builder for chaining. + */ + public Builder clearLocation() { + location_ = getDefaultInstance().getLocation(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * Location of the API key, valid values are "query", "header", or "cookie"
+     * 
+ * + * string location = 2; + * @param value The bytes for location to set. + * @return This builder for chaining. + */ + public Builder setLocationBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + location_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private java.lang.Object name_ = ""; + /** + *
+     * Name of the header, query or cookie parameter to be used.
+     * 
+ * + * string name = 3; + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Name of the header, query or cookie parameter to be used.
+     * 
+ * + * string name = 3; + * @return The bytes for name. + */ + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Name of the header, query or cookie parameter to be used.
+     * 
+ * + * string name = 3; + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + name_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * Name of the header, query or cookie parameter to be used.
+     * 
+ * + * string name = 3; + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + *
+     * Name of the header, query or cookie parameter to be used.
+     * 
+ * + * string name = 3; + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.APIKeySecurityScheme) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.APIKeySecurityScheme) + private static final org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme(); + } + + public static org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public APIKeySecurityScheme parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/APIKeySecuritySchemeOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/APIKeySecuritySchemeOrBuilder.java new file mode 100644 index 000000000..7c5b8258e --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/APIKeySecuritySchemeOrBuilder.java @@ -0,0 +1,72 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface APIKeySecuritySchemeOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.APIKeySecurityScheme) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Description of this security scheme.
+   * 
+ * + * string description = 1; + * @return The description. + */ + java.lang.String getDescription(); + /** + *
+   * Description of this security scheme.
+   * 
+ * + * string description = 1; + * @return The bytes for description. + */ + com.google.protobuf.ByteString + getDescriptionBytes(); + + /** + *
+   * Location of the API key, valid values are "query", "header", or "cookie"
+   * 
+ * + * string location = 2; + * @return The location. + */ + java.lang.String getLocation(); + /** + *
+   * Location of the API key, valid values are "query", "header", or "cookie"
+   * 
+ * + * string location = 2; + * @return The bytes for location. + */ + com.google.protobuf.ByteString + getLocationBytes(); + + /** + *
+   * Name of the header, query or cookie parameter to be used.
+   * 
+ * + * string name = 3; + * @return The name. + */ + java.lang.String getName(); + /** + *
+   * Name of the header, query or cookie parameter to be used.
+   * 
+ * + * string name = 3; + * @return The bytes for name. + */ + com.google.protobuf.ByteString + getNameBytes(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentCapabilities.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentCapabilities.java new file mode 100644 index 000000000..37b323b72 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentCapabilities.java @@ -0,0 +1,986 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * Defines the A2A feature set supported by the agent
+ * 
+ * + * Protobuf type {@code a2a.v1.AgentCapabilities} + */ +@com.google.protobuf.Generated +public final class AgentCapabilities extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.AgentCapabilities) + AgentCapabilitiesOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "AgentCapabilities"); + } + // Use AgentCapabilities.newBuilder() to construct. + private AgentCapabilities(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private AgentCapabilities() { + extensions_ = java.util.Collections.emptyList(); + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_AgentCapabilities_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_AgentCapabilities_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.AgentCapabilities.class, org.a2aproject.sdk.compat03.grpc.AgentCapabilities.Builder.class); + } + + public static final int STREAMING_FIELD_NUMBER = 1; + private boolean streaming_ = false; + /** + *
+   * If the agent will support streaming responses
+   * 
+ * + * bool streaming = 1; + * @return The streaming. + */ + @java.lang.Override + public boolean getStreaming() { + return streaming_; + } + + public static final int PUSH_NOTIFICATIONS_FIELD_NUMBER = 2; + private boolean pushNotifications_ = false; + /** + *
+   * If the agent can send push notifications to the clients webhook
+   * 
+ * + * bool push_notifications = 2; + * @return The pushNotifications. + */ + @java.lang.Override + public boolean getPushNotifications() { + return pushNotifications_; + } + + public static final int EXTENSIONS_FIELD_NUMBER = 3; + @SuppressWarnings("serial") + private java.util.List extensions_; + /** + *
+   * Extensions supported by this agent.
+   * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + @java.lang.Override + public java.util.List getExtensionsList() { + return extensions_; + } + /** + *
+   * Extensions supported by this agent.
+   * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + @java.lang.Override + public java.util.List + getExtensionsOrBuilderList() { + return extensions_; + } + /** + *
+   * Extensions supported by this agent.
+   * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + @java.lang.Override + public int getExtensionsCount() { + return extensions_.size(); + } + /** + *
+   * Extensions supported by this agent.
+   * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentExtension getExtensions(int index) { + return extensions_.get(index); + } + /** + *
+   * Extensions supported by this agent.
+   * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentExtensionOrBuilder getExtensionsOrBuilder( + int index) { + return extensions_.get(index); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (streaming_ != false) { + output.writeBool(1, streaming_); + } + if (pushNotifications_ != false) { + output.writeBool(2, pushNotifications_); + } + for (int i = 0; i < extensions_.size(); i++) { + output.writeMessage(3, extensions_.get(i)); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (streaming_ != false) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(1, streaming_); + } + if (pushNotifications_ != false) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(2, pushNotifications_); + } + for (int i = 0; i < extensions_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, extensions_.get(i)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.AgentCapabilities)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.AgentCapabilities other = (org.a2aproject.sdk.compat03.grpc.AgentCapabilities) obj; + + if (getStreaming() + != other.getStreaming()) return false; + if (getPushNotifications() + != other.getPushNotifications()) return false; + if (!getExtensionsList() + .equals(other.getExtensionsList())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + STREAMING_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( + getStreaming()); + hash = (37 * hash) + PUSH_NOTIFICATIONS_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( + getPushNotifications()); + if (getExtensionsCount() > 0) { + hash = (37 * hash) + EXTENSIONS_FIELD_NUMBER; + hash = (53 * hash) + getExtensionsList().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.AgentCapabilities parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCapabilities parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCapabilities parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCapabilities parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCapabilities parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCapabilities parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCapabilities parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCapabilities parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentCapabilities parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentCapabilities parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCapabilities parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCapabilities parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.AgentCapabilities prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * Defines the A2A feature set supported by the agent
+   * 
+ * + * Protobuf type {@code a2a.v1.AgentCapabilities} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.AgentCapabilities) + org.a2aproject.sdk.compat03.grpc.AgentCapabilitiesOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_AgentCapabilities_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_AgentCapabilities_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.AgentCapabilities.class, org.a2aproject.sdk.compat03.grpc.AgentCapabilities.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.AgentCapabilities.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + streaming_ = false; + pushNotifications_ = false; + if (extensionsBuilder_ == null) { + extensions_ = java.util.Collections.emptyList(); + } else { + extensions_ = null; + extensionsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_AgentCapabilities_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentCapabilities getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.AgentCapabilities.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentCapabilities build() { + org.a2aproject.sdk.compat03.grpc.AgentCapabilities result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentCapabilities buildPartial() { + org.a2aproject.sdk.compat03.grpc.AgentCapabilities result = new org.a2aproject.sdk.compat03.grpc.AgentCapabilities(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields(org.a2aproject.sdk.compat03.grpc.AgentCapabilities result) { + if (extensionsBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0)) { + extensions_ = java.util.Collections.unmodifiableList(extensions_); + bitField0_ = (bitField0_ & ~0x00000004); + } + result.extensions_ = extensions_; + } else { + result.extensions_ = extensionsBuilder_.build(); + } + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.AgentCapabilities result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.streaming_ = streaming_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.pushNotifications_ = pushNotifications_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.AgentCapabilities) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.AgentCapabilities)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.AgentCapabilities other) { + if (other == org.a2aproject.sdk.compat03.grpc.AgentCapabilities.getDefaultInstance()) return this; + if (other.getStreaming() != false) { + setStreaming(other.getStreaming()); + } + if (other.getPushNotifications() != false) { + setPushNotifications(other.getPushNotifications()); + } + if (extensionsBuilder_ == null) { + if (!other.extensions_.isEmpty()) { + if (extensions_.isEmpty()) { + extensions_ = other.extensions_; + bitField0_ = (bitField0_ & ~0x00000004); + } else { + ensureExtensionsIsMutable(); + extensions_.addAll(other.extensions_); + } + onChanged(); + } + } else { + if (!other.extensions_.isEmpty()) { + if (extensionsBuilder_.isEmpty()) { + extensionsBuilder_.dispose(); + extensionsBuilder_ = null; + extensions_ = other.extensions_; + bitField0_ = (bitField0_ & ~0x00000004); + extensionsBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + internalGetExtensionsFieldBuilder() : null; + } else { + extensionsBuilder_.addAllMessages(other.extensions_); + } + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + streaming_ = input.readBool(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 16: { + pushNotifications_ = input.readBool(); + bitField0_ |= 0x00000002; + break; + } // case 16 + case 26: { + org.a2aproject.sdk.compat03.grpc.AgentExtension m = + input.readMessage( + org.a2aproject.sdk.compat03.grpc.AgentExtension.parser(), + extensionRegistry); + if (extensionsBuilder_ == null) { + ensureExtensionsIsMutable(); + extensions_.add(m); + } else { + extensionsBuilder_.addMessage(m); + } + break; + } // case 26 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private boolean streaming_ ; + /** + *
+     * If the agent will support streaming responses
+     * 
+ * + * bool streaming = 1; + * @return The streaming. + */ + @java.lang.Override + public boolean getStreaming() { + return streaming_; + } + /** + *
+     * If the agent will support streaming responses
+     * 
+ * + * bool streaming = 1; + * @param value The streaming to set. + * @return This builder for chaining. + */ + public Builder setStreaming(boolean value) { + + streaming_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * If the agent will support streaming responses
+     * 
+ * + * bool streaming = 1; + * @return This builder for chaining. + */ + public Builder clearStreaming() { + bitField0_ = (bitField0_ & ~0x00000001); + streaming_ = false; + onChanged(); + return this; + } + + private boolean pushNotifications_ ; + /** + *
+     * If the agent can send push notifications to the clients webhook
+     * 
+ * + * bool push_notifications = 2; + * @return The pushNotifications. + */ + @java.lang.Override + public boolean getPushNotifications() { + return pushNotifications_; + } + /** + *
+     * If the agent can send push notifications to the clients webhook
+     * 
+ * + * bool push_notifications = 2; + * @param value The pushNotifications to set. + * @return This builder for chaining. + */ + public Builder setPushNotifications(boolean value) { + + pushNotifications_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * If the agent can send push notifications to the clients webhook
+     * 
+ * + * bool push_notifications = 2; + * @return This builder for chaining. + */ + public Builder clearPushNotifications() { + bitField0_ = (bitField0_ & ~0x00000002); + pushNotifications_ = false; + onChanged(); + return this; + } + + private java.util.List extensions_ = + java.util.Collections.emptyList(); + private void ensureExtensionsIsMutable() { + if (!((bitField0_ & 0x00000004) != 0)) { + extensions_ = new java.util.ArrayList(extensions_); + bitField0_ |= 0x00000004; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AgentExtension, org.a2aproject.sdk.compat03.grpc.AgentExtension.Builder, org.a2aproject.sdk.compat03.grpc.AgentExtensionOrBuilder> extensionsBuilder_; + + /** + *
+     * Extensions supported by this agent.
+     * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + public java.util.List getExtensionsList() { + if (extensionsBuilder_ == null) { + return java.util.Collections.unmodifiableList(extensions_); + } else { + return extensionsBuilder_.getMessageList(); + } + } + /** + *
+     * Extensions supported by this agent.
+     * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + public int getExtensionsCount() { + if (extensionsBuilder_ == null) { + return extensions_.size(); + } else { + return extensionsBuilder_.getCount(); + } + } + /** + *
+     * Extensions supported by this agent.
+     * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + public org.a2aproject.sdk.compat03.grpc.AgentExtension getExtensions(int index) { + if (extensionsBuilder_ == null) { + return extensions_.get(index); + } else { + return extensionsBuilder_.getMessage(index); + } + } + /** + *
+     * Extensions supported by this agent.
+     * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + public Builder setExtensions( + int index, org.a2aproject.sdk.compat03.grpc.AgentExtension value) { + if (extensionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureExtensionsIsMutable(); + extensions_.set(index, value); + onChanged(); + } else { + extensionsBuilder_.setMessage(index, value); + } + return this; + } + /** + *
+     * Extensions supported by this agent.
+     * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + public Builder setExtensions( + int index, org.a2aproject.sdk.compat03.grpc.AgentExtension.Builder builderForValue) { + if (extensionsBuilder_ == null) { + ensureExtensionsIsMutable(); + extensions_.set(index, builderForValue.build()); + onChanged(); + } else { + extensionsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * Extensions supported by this agent.
+     * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + public Builder addExtensions(org.a2aproject.sdk.compat03.grpc.AgentExtension value) { + if (extensionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureExtensionsIsMutable(); + extensions_.add(value); + onChanged(); + } else { + extensionsBuilder_.addMessage(value); + } + return this; + } + /** + *
+     * Extensions supported by this agent.
+     * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + public Builder addExtensions( + int index, org.a2aproject.sdk.compat03.grpc.AgentExtension value) { + if (extensionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureExtensionsIsMutable(); + extensions_.add(index, value); + onChanged(); + } else { + extensionsBuilder_.addMessage(index, value); + } + return this; + } + /** + *
+     * Extensions supported by this agent.
+     * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + public Builder addExtensions( + org.a2aproject.sdk.compat03.grpc.AgentExtension.Builder builderForValue) { + if (extensionsBuilder_ == null) { + ensureExtensionsIsMutable(); + extensions_.add(builderForValue.build()); + onChanged(); + } else { + extensionsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + *
+     * Extensions supported by this agent.
+     * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + public Builder addExtensions( + int index, org.a2aproject.sdk.compat03.grpc.AgentExtension.Builder builderForValue) { + if (extensionsBuilder_ == null) { + ensureExtensionsIsMutable(); + extensions_.add(index, builderForValue.build()); + onChanged(); + } else { + extensionsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * Extensions supported by this agent.
+     * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + public Builder addAllExtensions( + java.lang.Iterable values) { + if (extensionsBuilder_ == null) { + ensureExtensionsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, extensions_); + onChanged(); + } else { + extensionsBuilder_.addAllMessages(values); + } + return this; + } + /** + *
+     * Extensions supported by this agent.
+     * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + public Builder clearExtensions() { + if (extensionsBuilder_ == null) { + extensions_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + } else { + extensionsBuilder_.clear(); + } + return this; + } + /** + *
+     * Extensions supported by this agent.
+     * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + public Builder removeExtensions(int index) { + if (extensionsBuilder_ == null) { + ensureExtensionsIsMutable(); + extensions_.remove(index); + onChanged(); + } else { + extensionsBuilder_.remove(index); + } + return this; + } + /** + *
+     * Extensions supported by this agent.
+     * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + public org.a2aproject.sdk.compat03.grpc.AgentExtension.Builder getExtensionsBuilder( + int index) { + return internalGetExtensionsFieldBuilder().getBuilder(index); + } + /** + *
+     * Extensions supported by this agent.
+     * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + public org.a2aproject.sdk.compat03.grpc.AgentExtensionOrBuilder getExtensionsOrBuilder( + int index) { + if (extensionsBuilder_ == null) { + return extensions_.get(index); } else { + return extensionsBuilder_.getMessageOrBuilder(index); + } + } + /** + *
+     * Extensions supported by this agent.
+     * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + public java.util.List + getExtensionsOrBuilderList() { + if (extensionsBuilder_ != null) { + return extensionsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(extensions_); + } + } + /** + *
+     * Extensions supported by this agent.
+     * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + public org.a2aproject.sdk.compat03.grpc.AgentExtension.Builder addExtensionsBuilder() { + return internalGetExtensionsFieldBuilder().addBuilder( + org.a2aproject.sdk.compat03.grpc.AgentExtension.getDefaultInstance()); + } + /** + *
+     * Extensions supported by this agent.
+     * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + public org.a2aproject.sdk.compat03.grpc.AgentExtension.Builder addExtensionsBuilder( + int index) { + return internalGetExtensionsFieldBuilder().addBuilder( + index, org.a2aproject.sdk.compat03.grpc.AgentExtension.getDefaultInstance()); + } + /** + *
+     * Extensions supported by this agent.
+     * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + public java.util.List + getExtensionsBuilderList() { + return internalGetExtensionsFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AgentExtension, org.a2aproject.sdk.compat03.grpc.AgentExtension.Builder, org.a2aproject.sdk.compat03.grpc.AgentExtensionOrBuilder> + internalGetExtensionsFieldBuilder() { + if (extensionsBuilder_ == null) { + extensionsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AgentExtension, org.a2aproject.sdk.compat03.grpc.AgentExtension.Builder, org.a2aproject.sdk.compat03.grpc.AgentExtensionOrBuilder>( + extensions_, + ((bitField0_ & 0x00000004) != 0), + getParentForChildren(), + isClean()); + extensions_ = null; + } + return extensionsBuilder_; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.AgentCapabilities) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.AgentCapabilities) + private static final org.a2aproject.sdk.compat03.grpc.AgentCapabilities DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.AgentCapabilities(); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentCapabilities getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AgentCapabilities parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentCapabilities getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentCapabilitiesOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentCapabilitiesOrBuilder.java new file mode 100644 index 000000000..47b710f89 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentCapabilitiesOrBuilder.java @@ -0,0 +1,76 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface AgentCapabilitiesOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.AgentCapabilities) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * If the agent will support streaming responses
+   * 
+ * + * bool streaming = 1; + * @return The streaming. + */ + boolean getStreaming(); + + /** + *
+   * If the agent can send push notifications to the clients webhook
+   * 
+ * + * bool push_notifications = 2; + * @return The pushNotifications. + */ + boolean getPushNotifications(); + + /** + *
+   * Extensions supported by this agent.
+   * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + java.util.List + getExtensionsList(); + /** + *
+   * Extensions supported by this agent.
+   * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + org.a2aproject.sdk.compat03.grpc.AgentExtension getExtensions(int index); + /** + *
+   * Extensions supported by this agent.
+   * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + int getExtensionsCount(); + /** + *
+   * Extensions supported by this agent.
+   * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + java.util.List + getExtensionsOrBuilderList(); + /** + *
+   * Extensions supported by this agent.
+   * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + org.a2aproject.sdk.compat03.grpc.AgentExtensionOrBuilder getExtensionsOrBuilder( + int index); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentCard.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentCard.java new file mode 100644 index 000000000..6e0eeeba1 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentCard.java @@ -0,0 +1,5131 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * AgentCard conveys key information:
+ * - Overall details (version, name, description, uses)
+ * - Skills; a set of actions/solutions the agent can perform
+ * - Default modalities/content types supported by the agent.
+ * - Authentication requirements
+ * Next ID: 18
+ * 
+ * + * Protobuf type {@code a2a.v1.AgentCard} + */ +@com.google.protobuf.Generated +public final class AgentCard extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.AgentCard) + AgentCardOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "AgentCard"); + } + // Use AgentCard.newBuilder() to construct. + private AgentCard(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private AgentCard() { + protocolVersion_ = ""; + name_ = ""; + description_ = ""; + url_ = ""; + preferredTransport_ = ""; + additionalInterfaces_ = java.util.Collections.emptyList(); + version_ = ""; + documentationUrl_ = ""; + security_ = java.util.Collections.emptyList(); + defaultInputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + defaultOutputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + skills_ = java.util.Collections.emptyList(); + signatures_ = java.util.Collections.emptyList(); + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_AgentCard_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { + switch (number) { + case 8: + return internalGetSecuritySchemes(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_AgentCard_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.AgentCard.class, org.a2aproject.sdk.compat03.grpc.AgentCard.Builder.class); + } + + private int bitField0_; + public static final int PROTOCOL_VERSION_FIELD_NUMBER = 16; + @SuppressWarnings("serial") + private volatile java.lang.Object protocolVersion_ = ""; + /** + *
+   * The version of the A2A protocol this agent supports.
+   * 
+ * + * string protocol_version = 16; + * @return The protocolVersion. + */ + @java.lang.Override + public java.lang.String getProtocolVersion() { + java.lang.Object ref = protocolVersion_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + protocolVersion_ = s; + return s; + } + } + /** + *
+   * The version of the A2A protocol this agent supports.
+   * 
+ * + * string protocol_version = 16; + * @return The bytes for protocolVersion. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getProtocolVersionBytes() { + java.lang.Object ref = protocolVersion_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + protocolVersion_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int NAME_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + *
+   * A human readable name for the agent.
+   * Example: "Recipe Agent"
+   * 
+ * + * string name = 1; + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + *
+   * A human readable name for the agent.
+   * Example: "Recipe Agent"
+   * 
+ * + * string name = 1; + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DESCRIPTION_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object description_ = ""; + /** + *
+   * A description of the agent's domain of action/solution space.
+   * Example: "Agent that helps users with recipes and cooking."
+   * 
+ * + * string description = 2; + * @return The description. + */ + @java.lang.Override + public java.lang.String getDescription() { + java.lang.Object ref = description_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + description_ = s; + return s; + } + } + /** + *
+   * A description of the agent's domain of action/solution space.
+   * Example: "Agent that helps users with recipes and cooking."
+   * 
+ * + * string description = 2; + * @return The bytes for description. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int URL_FIELD_NUMBER = 3; + @SuppressWarnings("serial") + private volatile java.lang.Object url_ = ""; + /** + *
+   * A URL to the address the agent is hosted at. This represents the
+   * preferred endpoint as declared by the agent.
+   * 
+ * + * string url = 3; + * @return The url. + */ + @java.lang.Override + public java.lang.String getUrl() { + java.lang.Object ref = url_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + url_ = s; + return s; + } + } + /** + *
+   * A URL to the address the agent is hosted at. This represents the
+   * preferred endpoint as declared by the agent.
+   * 
+ * + * string url = 3; + * @return The bytes for url. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getUrlBytes() { + java.lang.Object ref = url_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + url_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PREFERRED_TRANSPORT_FIELD_NUMBER = 14; + @SuppressWarnings("serial") + private volatile java.lang.Object preferredTransport_ = ""; + /** + *
+   * The transport of the preferred endpoint. If empty, defaults to JSONRPC.
+   * 
+ * + * string preferred_transport = 14; + * @return The preferredTransport. + */ + @java.lang.Override + public java.lang.String getPreferredTransport() { + java.lang.Object ref = preferredTransport_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + preferredTransport_ = s; + return s; + } + } + /** + *
+   * The transport of the preferred endpoint. If empty, defaults to JSONRPC.
+   * 
+ * + * string preferred_transport = 14; + * @return The bytes for preferredTransport. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getPreferredTransportBytes() { + java.lang.Object ref = preferredTransport_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + preferredTransport_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int ADDITIONAL_INTERFACES_FIELD_NUMBER = 15; + @SuppressWarnings("serial") + private java.util.List additionalInterfaces_; + /** + *
+   * Announcement of additional supported transports. Client can use any of
+   * the supported transports.
+   * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + @java.lang.Override + public java.util.List getAdditionalInterfacesList() { + return additionalInterfaces_; + } + /** + *
+   * Announcement of additional supported transports. Client can use any of
+   * the supported transports.
+   * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + @java.lang.Override + public java.util.List + getAdditionalInterfacesOrBuilderList() { + return additionalInterfaces_; + } + /** + *
+   * Announcement of additional supported transports. Client can use any of
+   * the supported transports.
+   * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + @java.lang.Override + public int getAdditionalInterfacesCount() { + return additionalInterfaces_.size(); + } + /** + *
+   * Announcement of additional supported transports. Client can use any of
+   * the supported transports.
+   * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentInterface getAdditionalInterfaces(int index) { + return additionalInterfaces_.get(index); + } + /** + *
+   * Announcement of additional supported transports. Client can use any of
+   * the supported transports.
+   * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentInterfaceOrBuilder getAdditionalInterfacesOrBuilder( + int index) { + return additionalInterfaces_.get(index); + } + + public static final int PROVIDER_FIELD_NUMBER = 4; + private org.a2aproject.sdk.compat03.grpc.AgentProvider provider_; + /** + *
+   * The service provider of the agent.
+   * 
+ * + * .a2a.v1.AgentProvider provider = 4; + * @return Whether the provider field is set. + */ + @java.lang.Override + public boolean hasProvider() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + *
+   * The service provider of the agent.
+   * 
+ * + * .a2a.v1.AgentProvider provider = 4; + * @return The provider. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentProvider getProvider() { + return provider_ == null ? org.a2aproject.sdk.compat03.grpc.AgentProvider.getDefaultInstance() : provider_; + } + /** + *
+   * The service provider of the agent.
+   * 
+ * + * .a2a.v1.AgentProvider provider = 4; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentProviderOrBuilder getProviderOrBuilder() { + return provider_ == null ? org.a2aproject.sdk.compat03.grpc.AgentProvider.getDefaultInstance() : provider_; + } + + public static final int VERSION_FIELD_NUMBER = 5; + @SuppressWarnings("serial") + private volatile java.lang.Object version_ = ""; + /** + *
+   * The version of the agent.
+   * Example: "1.0.0"
+   * 
+ * + * string version = 5; + * @return The version. + */ + @java.lang.Override + public java.lang.String getVersion() { + java.lang.Object ref = version_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + version_ = s; + return s; + } + } + /** + *
+   * The version of the agent.
+   * Example: "1.0.0"
+   * 
+ * + * string version = 5; + * @return The bytes for version. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getVersionBytes() { + java.lang.Object ref = version_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + version_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DOCUMENTATION_URL_FIELD_NUMBER = 6; + @SuppressWarnings("serial") + private volatile java.lang.Object documentationUrl_ = ""; + /** + *
+   * A url to provide additional documentation about the agent.
+   * 
+ * + * string documentation_url = 6; + * @return The documentationUrl. + */ + @java.lang.Override + public java.lang.String getDocumentationUrl() { + java.lang.Object ref = documentationUrl_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + documentationUrl_ = s; + return s; + } + } + /** + *
+   * A url to provide additional documentation about the agent.
+   * 
+ * + * string documentation_url = 6; + * @return The bytes for documentationUrl. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getDocumentationUrlBytes() { + java.lang.Object ref = documentationUrl_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + documentationUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CAPABILITIES_FIELD_NUMBER = 7; + private org.a2aproject.sdk.compat03.grpc.AgentCapabilities capabilities_; + /** + *
+   * A2A Capability set supported by the agent.
+   * 
+ * + * .a2a.v1.AgentCapabilities capabilities = 7; + * @return Whether the capabilities field is set. + */ + @java.lang.Override + public boolean hasCapabilities() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + *
+   * A2A Capability set supported by the agent.
+   * 
+ * + * .a2a.v1.AgentCapabilities capabilities = 7; + * @return The capabilities. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentCapabilities getCapabilities() { + return capabilities_ == null ? org.a2aproject.sdk.compat03.grpc.AgentCapabilities.getDefaultInstance() : capabilities_; + } + /** + *
+   * A2A Capability set supported by the agent.
+   * 
+ * + * .a2a.v1.AgentCapabilities capabilities = 7; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentCapabilitiesOrBuilder getCapabilitiesOrBuilder() { + return capabilities_ == null ? org.a2aproject.sdk.compat03.grpc.AgentCapabilities.getDefaultInstance() : capabilities_; + } + + public static final int SECURITY_SCHEMES_FIELD_NUMBER = 8; + private static final class SecuritySchemesDefaultEntryHolder { + static final com.google.protobuf.MapEntry< + java.lang.String, org.a2aproject.sdk.compat03.grpc.SecurityScheme> defaultEntry = + com.google.protobuf.MapEntry + .newDefaultInstance( + A2A.internal_static_a2a_v1_AgentCard_SecuritySchemesEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.MESSAGE, + org.a2aproject.sdk.compat03.grpc.SecurityScheme.getDefaultInstance()); + } + @SuppressWarnings("serial") + private com.google.protobuf.MapField< + java.lang.String, org.a2aproject.sdk.compat03.grpc.SecurityScheme> securitySchemes_; + private com.google.protobuf.MapField + internalGetSecuritySchemes() { + if (securitySchemes_ == null) { + return com.google.protobuf.MapField.emptyMapField( + SecuritySchemesDefaultEntryHolder.defaultEntry); + } + return securitySchemes_; + } + public int getSecuritySchemesCount() { + return internalGetSecuritySchemes().getMap().size(); + } + /** + *
+   * The security scheme details used for authenticating with this agent.
+   * 
+ * + * map<string, .a2a.v1.SecurityScheme> security_schemes = 8; + */ + @java.lang.Override + public boolean containsSecuritySchemes( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + return internalGetSecuritySchemes().getMap().containsKey(key); + } + /** + * Use {@link #getSecuritySchemesMap()} instead. + */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getSecuritySchemes() { + return getSecuritySchemesMap(); + } + /** + *
+   * The security scheme details used for authenticating with this agent.
+   * 
+ * + * map<string, .a2a.v1.SecurityScheme> security_schemes = 8; + */ + @java.lang.Override + public java.util.Map getSecuritySchemesMap() { + return internalGetSecuritySchemes().getMap(); + } + /** + *
+   * The security scheme details used for authenticating with this agent.
+   * 
+ * + * map<string, .a2a.v1.SecurityScheme> security_schemes = 8; + */ + @java.lang.Override + public /* nullable */ +org.a2aproject.sdk.compat03.grpc.SecurityScheme getSecuritySchemesOrDefault( + java.lang.String key, + /* nullable */ +org.a2aproject.sdk.compat03.grpc.SecurityScheme defaultValue) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetSecuritySchemes().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + *
+   * The security scheme details used for authenticating with this agent.
+   * 
+ * + * map<string, .a2a.v1.SecurityScheme> security_schemes = 8; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SecurityScheme getSecuritySchemesOrThrow( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetSecuritySchemes().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public static final int SECURITY_FIELD_NUMBER = 9; + @SuppressWarnings("serial") + private java.util.List security_; + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Security requirements for contacting the agent.
+   * This list can be seen as an OR of ANDs. Each object in the list describes
+   * one possible set of security requirements that must be present on a
+   * request. This allows specifying, for example, "callers must either use
+   * OAuth OR an API Key AND mTLS."
+   * Example:
+   * security {
+   * schemes { key: "oauth" value { list: ["read"] } }
+   * }
+   * security {
+   * schemes { key: "api-key" }
+   * schemes { key: "mtls" }
+   * }
+   * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + @java.lang.Override + public java.util.List getSecurityList() { + return security_; + } + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Security requirements for contacting the agent.
+   * This list can be seen as an OR of ANDs. Each object in the list describes
+   * one possible set of security requirements that must be present on a
+   * request. This allows specifying, for example, "callers must either use
+   * OAuth OR an API Key AND mTLS."
+   * Example:
+   * security {
+   * schemes { key: "oauth" value { list: ["read"] } }
+   * }
+   * security {
+   * schemes { key: "api-key" }
+   * schemes { key: "mtls" }
+   * }
+   * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + @java.lang.Override + public java.util.List + getSecurityOrBuilderList() { + return security_; + } + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Security requirements for contacting the agent.
+   * This list can be seen as an OR of ANDs. Each object in the list describes
+   * one possible set of security requirements that must be present on a
+   * request. This allows specifying, for example, "callers must either use
+   * OAuth OR an API Key AND mTLS."
+   * Example:
+   * security {
+   * schemes { key: "oauth" value { list: ["read"] } }
+   * }
+   * security {
+   * schemes { key: "api-key" }
+   * schemes { key: "mtls" }
+   * }
+   * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + @java.lang.Override + public int getSecurityCount() { + return security_.size(); + } + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Security requirements for contacting the agent.
+   * This list can be seen as an OR of ANDs. Each object in the list describes
+   * one possible set of security requirements that must be present on a
+   * request. This allows specifying, for example, "callers must either use
+   * OAuth OR an API Key AND mTLS."
+   * Example:
+   * security {
+   * schemes { key: "oauth" value { list: ["read"] } }
+   * }
+   * security {
+   * schemes { key: "api-key" }
+   * schemes { key: "mtls" }
+   * }
+   * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Security getSecurity(int index) { + return security_.get(index); + } + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Security requirements for contacting the agent.
+   * This list can be seen as an OR of ANDs. Each object in the list describes
+   * one possible set of security requirements that must be present on a
+   * request. This allows specifying, for example, "callers must either use
+   * OAuth OR an API Key AND mTLS."
+   * Example:
+   * security {
+   * schemes { key: "oauth" value { list: ["read"] } }
+   * }
+   * security {
+   * schemes { key: "api-key" }
+   * schemes { key: "mtls" }
+   * }
+   * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SecurityOrBuilder getSecurityOrBuilder( + int index) { + return security_.get(index); + } + + public static final int DEFAULT_INPUT_MODES_FIELD_NUMBER = 10; + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList defaultInputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + /** + *
+   * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+   * The set of interaction modes that the agent supports across all skills.
+   * This can be overridden per skill. Defined as mime types.
+   * 
+ * + * repeated string default_input_modes = 10; + * @return A list containing the defaultInputModes. + */ + public com.google.protobuf.ProtocolStringList + getDefaultInputModesList() { + return defaultInputModes_; + } + /** + *
+   * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+   * The set of interaction modes that the agent supports across all skills.
+   * This can be overridden per skill. Defined as mime types.
+   * 
+ * + * repeated string default_input_modes = 10; + * @return The count of defaultInputModes. + */ + public int getDefaultInputModesCount() { + return defaultInputModes_.size(); + } + /** + *
+   * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+   * The set of interaction modes that the agent supports across all skills.
+   * This can be overridden per skill. Defined as mime types.
+   * 
+ * + * repeated string default_input_modes = 10; + * @param index The index of the element to return. + * @return The defaultInputModes at the given index. + */ + public java.lang.String getDefaultInputModes(int index) { + return defaultInputModes_.get(index); + } + /** + *
+   * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+   * The set of interaction modes that the agent supports across all skills.
+   * This can be overridden per skill. Defined as mime types.
+   * 
+ * + * repeated string default_input_modes = 10; + * @param index The index of the value to return. + * @return The bytes of the defaultInputModes at the given index. + */ + public com.google.protobuf.ByteString + getDefaultInputModesBytes(int index) { + return defaultInputModes_.getByteString(index); + } + + public static final int DEFAULT_OUTPUT_MODES_FIELD_NUMBER = 11; + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList defaultOutputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + /** + *
+   * The mime types supported as outputs from this agent.
+   * 
+ * + * repeated string default_output_modes = 11; + * @return A list containing the defaultOutputModes. + */ + public com.google.protobuf.ProtocolStringList + getDefaultOutputModesList() { + return defaultOutputModes_; + } + /** + *
+   * The mime types supported as outputs from this agent.
+   * 
+ * + * repeated string default_output_modes = 11; + * @return The count of defaultOutputModes. + */ + public int getDefaultOutputModesCount() { + return defaultOutputModes_.size(); + } + /** + *
+   * The mime types supported as outputs from this agent.
+   * 
+ * + * repeated string default_output_modes = 11; + * @param index The index of the element to return. + * @return The defaultOutputModes at the given index. + */ + public java.lang.String getDefaultOutputModes(int index) { + return defaultOutputModes_.get(index); + } + /** + *
+   * The mime types supported as outputs from this agent.
+   * 
+ * + * repeated string default_output_modes = 11; + * @param index The index of the value to return. + * @return The bytes of the defaultOutputModes at the given index. + */ + public com.google.protobuf.ByteString + getDefaultOutputModesBytes(int index) { + return defaultOutputModes_.getByteString(index); + } + + public static final int SKILLS_FIELD_NUMBER = 12; + @SuppressWarnings("serial") + private java.util.List skills_; + /** + *
+   * Skills represent a unit of ability an agent can perform. This may
+   * somewhat abstract but represents a more focused set of actions that the
+   * agent is highly likely to succeed at.
+   * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + @java.lang.Override + public java.util.List getSkillsList() { + return skills_; + } + /** + *
+   * Skills represent a unit of ability an agent can perform. This may
+   * somewhat abstract but represents a more focused set of actions that the
+   * agent is highly likely to succeed at.
+   * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + @java.lang.Override + public java.util.List + getSkillsOrBuilderList() { + return skills_; + } + /** + *
+   * Skills represent a unit of ability an agent can perform. This may
+   * somewhat abstract but represents a more focused set of actions that the
+   * agent is highly likely to succeed at.
+   * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + @java.lang.Override + public int getSkillsCount() { + return skills_.size(); + } + /** + *
+   * Skills represent a unit of ability an agent can perform. This may
+   * somewhat abstract but represents a more focused set of actions that the
+   * agent is highly likely to succeed at.
+   * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentSkill getSkills(int index) { + return skills_.get(index); + } + /** + *
+   * Skills represent a unit of ability an agent can perform. This may
+   * somewhat abstract but represents a more focused set of actions that the
+   * agent is highly likely to succeed at.
+   * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentSkillOrBuilder getSkillsOrBuilder( + int index) { + return skills_.get(index); + } + + public static final int SUPPORTS_AUTHENTICATED_EXTENDED_CARD_FIELD_NUMBER = 13; + private boolean supportsAuthenticatedExtendedCard_ = false; + /** + *
+   * Whether the agent supports providing an extended agent card when
+   * the user is authenticated, i.e. is the card from .well-known
+   * different than the card from GetAgentCard.
+   * 
+ * + * bool supports_authenticated_extended_card = 13; + * @return The supportsAuthenticatedExtendedCard. + */ + @java.lang.Override + public boolean getSupportsAuthenticatedExtendedCard() { + return supportsAuthenticatedExtendedCard_; + } + + public static final int SIGNATURES_FIELD_NUMBER = 17; + @SuppressWarnings("serial") + private java.util.List signatures_; + /** + *
+   * JSON Web Signatures computed for this AgentCard.
+   * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + @java.lang.Override + public java.util.List getSignaturesList() { + return signatures_; + } + /** + *
+   * JSON Web Signatures computed for this AgentCard.
+   * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + @java.lang.Override + public java.util.List + getSignaturesOrBuilderList() { + return signatures_; + } + /** + *
+   * JSON Web Signatures computed for this AgentCard.
+   * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + @java.lang.Override + public int getSignaturesCount() { + return signatures_.size(); + } + /** + *
+   * JSON Web Signatures computed for this AgentCard.
+   * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentCardSignature getSignatures(int index) { + return signatures_.get(index); + } + /** + *
+   * JSON Web Signatures computed for this AgentCard.
+   * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentCardSignatureOrBuilder getSignaturesOrBuilder( + int index) { + return signatures_.get(index); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, name_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(description_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, description_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(url_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 3, url_); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(4, getProvider()); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(version_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 5, version_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(documentationUrl_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 6, documentationUrl_); + } + if (((bitField0_ & 0x00000002) != 0)) { + output.writeMessage(7, getCapabilities()); + } + com.google.protobuf.GeneratedMessage + .serializeStringMapTo( + output, + internalGetSecuritySchemes(), + SecuritySchemesDefaultEntryHolder.defaultEntry, + 8); + for (int i = 0; i < security_.size(); i++) { + output.writeMessage(9, security_.get(i)); + } + for (int i = 0; i < defaultInputModes_.size(); i++) { + com.google.protobuf.GeneratedMessage.writeString(output, 10, defaultInputModes_.getRaw(i)); + } + for (int i = 0; i < defaultOutputModes_.size(); i++) { + com.google.protobuf.GeneratedMessage.writeString(output, 11, defaultOutputModes_.getRaw(i)); + } + for (int i = 0; i < skills_.size(); i++) { + output.writeMessage(12, skills_.get(i)); + } + if (supportsAuthenticatedExtendedCard_ != false) { + output.writeBool(13, supportsAuthenticatedExtendedCard_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(preferredTransport_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 14, preferredTransport_); + } + for (int i = 0; i < additionalInterfaces_.size(); i++) { + output.writeMessage(15, additionalInterfaces_.get(i)); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(protocolVersion_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 16, protocolVersion_); + } + for (int i = 0; i < signatures_.size(); i++) { + output.writeMessage(17, signatures_.get(i)); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, name_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(description_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, description_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(url_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(3, url_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, getProvider()); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(version_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(5, version_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(documentationUrl_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(6, documentationUrl_); + } + if (((bitField0_ & 0x00000002) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(7, getCapabilities()); + } + for (java.util.Map.Entry entry + : internalGetSecuritySchemes().getMap().entrySet()) { + com.google.protobuf.MapEntry + securitySchemes__ = SecuritySchemesDefaultEntryHolder.defaultEntry.newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(8, securitySchemes__); + } + for (int i = 0; i < security_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(9, security_.get(i)); + } + { + int dataSize = 0; + for (int i = 0; i < defaultInputModes_.size(); i++) { + dataSize += computeStringSizeNoTag(defaultInputModes_.getRaw(i)); + } + size += dataSize; + size += 1 * getDefaultInputModesList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < defaultOutputModes_.size(); i++) { + dataSize += computeStringSizeNoTag(defaultOutputModes_.getRaw(i)); + } + size += dataSize; + size += 1 * getDefaultOutputModesList().size(); + } + for (int i = 0; i < skills_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(12, skills_.get(i)); + } + if (supportsAuthenticatedExtendedCard_ != false) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(13, supportsAuthenticatedExtendedCard_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(preferredTransport_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(14, preferredTransport_); + } + for (int i = 0; i < additionalInterfaces_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(15, additionalInterfaces_.get(i)); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(protocolVersion_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(16, protocolVersion_); + } + for (int i = 0; i < signatures_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(17, signatures_.get(i)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.AgentCard)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.AgentCard other = (org.a2aproject.sdk.compat03.grpc.AgentCard) obj; + + if (!getProtocolVersion() + .equals(other.getProtocolVersion())) return false; + if (!getName() + .equals(other.getName())) return false; + if (!getDescription() + .equals(other.getDescription())) return false; + if (!getUrl() + .equals(other.getUrl())) return false; + if (!getPreferredTransport() + .equals(other.getPreferredTransport())) return false; + if (!getAdditionalInterfacesList() + .equals(other.getAdditionalInterfacesList())) return false; + if (hasProvider() != other.hasProvider()) return false; + if (hasProvider()) { + if (!getProvider() + .equals(other.getProvider())) return false; + } + if (!getVersion() + .equals(other.getVersion())) return false; + if (!getDocumentationUrl() + .equals(other.getDocumentationUrl())) return false; + if (hasCapabilities() != other.hasCapabilities()) return false; + if (hasCapabilities()) { + if (!getCapabilities() + .equals(other.getCapabilities())) return false; + } + if (!internalGetSecuritySchemes().equals( + other.internalGetSecuritySchemes())) return false; + if (!getSecurityList() + .equals(other.getSecurityList())) return false; + if (!getDefaultInputModesList() + .equals(other.getDefaultInputModesList())) return false; + if (!getDefaultOutputModesList() + .equals(other.getDefaultOutputModesList())) return false; + if (!getSkillsList() + .equals(other.getSkillsList())) return false; + if (getSupportsAuthenticatedExtendedCard() + != other.getSupportsAuthenticatedExtendedCard()) return false; + if (!getSignaturesList() + .equals(other.getSignaturesList())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PROTOCOL_VERSION_FIELD_NUMBER; + hash = (53 * hash) + getProtocolVersion().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + DESCRIPTION_FIELD_NUMBER; + hash = (53 * hash) + getDescription().hashCode(); + hash = (37 * hash) + URL_FIELD_NUMBER; + hash = (53 * hash) + getUrl().hashCode(); + hash = (37 * hash) + PREFERRED_TRANSPORT_FIELD_NUMBER; + hash = (53 * hash) + getPreferredTransport().hashCode(); + if (getAdditionalInterfacesCount() > 0) { + hash = (37 * hash) + ADDITIONAL_INTERFACES_FIELD_NUMBER; + hash = (53 * hash) + getAdditionalInterfacesList().hashCode(); + } + if (hasProvider()) { + hash = (37 * hash) + PROVIDER_FIELD_NUMBER; + hash = (53 * hash) + getProvider().hashCode(); + } + hash = (37 * hash) + VERSION_FIELD_NUMBER; + hash = (53 * hash) + getVersion().hashCode(); + hash = (37 * hash) + DOCUMENTATION_URL_FIELD_NUMBER; + hash = (53 * hash) + getDocumentationUrl().hashCode(); + if (hasCapabilities()) { + hash = (37 * hash) + CAPABILITIES_FIELD_NUMBER; + hash = (53 * hash) + getCapabilities().hashCode(); + } + if (!internalGetSecuritySchemes().getMap().isEmpty()) { + hash = (37 * hash) + SECURITY_SCHEMES_FIELD_NUMBER; + hash = (53 * hash) + internalGetSecuritySchemes().hashCode(); + } + if (getSecurityCount() > 0) { + hash = (37 * hash) + SECURITY_FIELD_NUMBER; + hash = (53 * hash) + getSecurityList().hashCode(); + } + if (getDefaultInputModesCount() > 0) { + hash = (37 * hash) + DEFAULT_INPUT_MODES_FIELD_NUMBER; + hash = (53 * hash) + getDefaultInputModesList().hashCode(); + } + if (getDefaultOutputModesCount() > 0) { + hash = (37 * hash) + DEFAULT_OUTPUT_MODES_FIELD_NUMBER; + hash = (53 * hash) + getDefaultOutputModesList().hashCode(); + } + if (getSkillsCount() > 0) { + hash = (37 * hash) + SKILLS_FIELD_NUMBER; + hash = (53 * hash) + getSkillsList().hashCode(); + } + hash = (37 * hash) + SUPPORTS_AUTHENTICATED_EXTENDED_CARD_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( + getSupportsAuthenticatedExtendedCard()); + if (getSignaturesCount() > 0) { + hash = (37 * hash) + SIGNATURES_FIELD_NUMBER; + hash = (53 * hash) + getSignaturesList().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.AgentCard parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCard parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCard parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCard parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCard parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCard parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCard parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCard parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentCard parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentCard parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCard parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCard parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.AgentCard prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * AgentCard conveys key information:
+   * - Overall details (version, name, description, uses)
+   * - Skills; a set of actions/solutions the agent can perform
+   * - Default modalities/content types supported by the agent.
+   * - Authentication requirements
+   * Next ID: 18
+   * 
+ * + * Protobuf type {@code a2a.v1.AgentCard} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.AgentCard) + org.a2aproject.sdk.compat03.grpc.AgentCardOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_AgentCard_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { + switch (number) { + case 8: + return internalGetSecuritySchemes(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMutableMapFieldReflection( + int number) { + switch (number) { + case 8: + return internalGetMutableSecuritySchemes(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_AgentCard_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.AgentCard.class, org.a2aproject.sdk.compat03.grpc.AgentCard.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.AgentCard.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage + .alwaysUseFieldBuilders) { + internalGetAdditionalInterfacesFieldBuilder(); + internalGetProviderFieldBuilder(); + internalGetCapabilitiesFieldBuilder(); + internalGetSecurityFieldBuilder(); + internalGetSkillsFieldBuilder(); + internalGetSignaturesFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + protocolVersion_ = ""; + name_ = ""; + description_ = ""; + url_ = ""; + preferredTransport_ = ""; + if (additionalInterfacesBuilder_ == null) { + additionalInterfaces_ = java.util.Collections.emptyList(); + } else { + additionalInterfaces_ = null; + additionalInterfacesBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000020); + provider_ = null; + if (providerBuilder_ != null) { + providerBuilder_.dispose(); + providerBuilder_ = null; + } + version_ = ""; + documentationUrl_ = ""; + capabilities_ = null; + if (capabilitiesBuilder_ != null) { + capabilitiesBuilder_.dispose(); + capabilitiesBuilder_ = null; + } + internalGetMutableSecuritySchemes().clear(); + if (securityBuilder_ == null) { + security_ = java.util.Collections.emptyList(); + } else { + security_ = null; + securityBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000800); + defaultInputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + defaultOutputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + if (skillsBuilder_ == null) { + skills_ = java.util.Collections.emptyList(); + } else { + skills_ = null; + skillsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00004000); + supportsAuthenticatedExtendedCard_ = false; + if (signaturesBuilder_ == null) { + signatures_ = java.util.Collections.emptyList(); + } else { + signatures_ = null; + signaturesBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00010000); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_AgentCard_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentCard getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.AgentCard.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentCard build() { + org.a2aproject.sdk.compat03.grpc.AgentCard result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentCard buildPartial() { + org.a2aproject.sdk.compat03.grpc.AgentCard result = new org.a2aproject.sdk.compat03.grpc.AgentCard(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields(org.a2aproject.sdk.compat03.grpc.AgentCard result) { + if (additionalInterfacesBuilder_ == null) { + if (((bitField0_ & 0x00000020) != 0)) { + additionalInterfaces_ = java.util.Collections.unmodifiableList(additionalInterfaces_); + bitField0_ = (bitField0_ & ~0x00000020); + } + result.additionalInterfaces_ = additionalInterfaces_; + } else { + result.additionalInterfaces_ = additionalInterfacesBuilder_.build(); + } + if (securityBuilder_ == null) { + if (((bitField0_ & 0x00000800) != 0)) { + security_ = java.util.Collections.unmodifiableList(security_); + bitField0_ = (bitField0_ & ~0x00000800); + } + result.security_ = security_; + } else { + result.security_ = securityBuilder_.build(); + } + if (skillsBuilder_ == null) { + if (((bitField0_ & 0x00004000) != 0)) { + skills_ = java.util.Collections.unmodifiableList(skills_); + bitField0_ = (bitField0_ & ~0x00004000); + } + result.skills_ = skills_; + } else { + result.skills_ = skillsBuilder_.build(); + } + if (signaturesBuilder_ == null) { + if (((bitField0_ & 0x00010000) != 0)) { + signatures_ = java.util.Collections.unmodifiableList(signatures_); + bitField0_ = (bitField0_ & ~0x00010000); + } + result.signatures_ = signatures_; + } else { + result.signatures_ = signaturesBuilder_.build(); + } + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.AgentCard result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.protocolVersion_ = protocolVersion_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.name_ = name_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.description_ = description_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.url_ = url_; + } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.preferredTransport_ = preferredTransport_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000040) != 0)) { + result.provider_ = providerBuilder_ == null + ? provider_ + : providerBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000080) != 0)) { + result.version_ = version_; + } + if (((from_bitField0_ & 0x00000100) != 0)) { + result.documentationUrl_ = documentationUrl_; + } + if (((from_bitField0_ & 0x00000200) != 0)) { + result.capabilities_ = capabilitiesBuilder_ == null + ? capabilities_ + : capabilitiesBuilder_.build(); + to_bitField0_ |= 0x00000002; + } + if (((from_bitField0_ & 0x00000400) != 0)) { + result.securitySchemes_ = internalGetSecuritySchemes().build(SecuritySchemesDefaultEntryHolder.defaultEntry); + } + if (((from_bitField0_ & 0x00001000) != 0)) { + defaultInputModes_.makeImmutable(); + result.defaultInputModes_ = defaultInputModes_; + } + if (((from_bitField0_ & 0x00002000) != 0)) { + defaultOutputModes_.makeImmutable(); + result.defaultOutputModes_ = defaultOutputModes_; + } + if (((from_bitField0_ & 0x00008000) != 0)) { + result.supportsAuthenticatedExtendedCard_ = supportsAuthenticatedExtendedCard_; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.AgentCard) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.AgentCard)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.AgentCard other) { + if (other == org.a2aproject.sdk.compat03.grpc.AgentCard.getDefaultInstance()) return this; + if (!other.getProtocolVersion().isEmpty()) { + protocolVersion_ = other.protocolVersion_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (!other.getDescription().isEmpty()) { + description_ = other.description_; + bitField0_ |= 0x00000004; + onChanged(); + } + if (!other.getUrl().isEmpty()) { + url_ = other.url_; + bitField0_ |= 0x00000008; + onChanged(); + } + if (!other.getPreferredTransport().isEmpty()) { + preferredTransport_ = other.preferredTransport_; + bitField0_ |= 0x00000010; + onChanged(); + } + if (additionalInterfacesBuilder_ == null) { + if (!other.additionalInterfaces_.isEmpty()) { + if (additionalInterfaces_.isEmpty()) { + additionalInterfaces_ = other.additionalInterfaces_; + bitField0_ = (bitField0_ & ~0x00000020); + } else { + ensureAdditionalInterfacesIsMutable(); + additionalInterfaces_.addAll(other.additionalInterfaces_); + } + onChanged(); + } + } else { + if (!other.additionalInterfaces_.isEmpty()) { + if (additionalInterfacesBuilder_.isEmpty()) { + additionalInterfacesBuilder_.dispose(); + additionalInterfacesBuilder_ = null; + additionalInterfaces_ = other.additionalInterfaces_; + bitField0_ = (bitField0_ & ~0x00000020); + additionalInterfacesBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + internalGetAdditionalInterfacesFieldBuilder() : null; + } else { + additionalInterfacesBuilder_.addAllMessages(other.additionalInterfaces_); + } + } + } + if (other.hasProvider()) { + mergeProvider(other.getProvider()); + } + if (!other.getVersion().isEmpty()) { + version_ = other.version_; + bitField0_ |= 0x00000080; + onChanged(); + } + if (!other.getDocumentationUrl().isEmpty()) { + documentationUrl_ = other.documentationUrl_; + bitField0_ |= 0x00000100; + onChanged(); + } + if (other.hasCapabilities()) { + mergeCapabilities(other.getCapabilities()); + } + internalGetMutableSecuritySchemes().mergeFrom( + other.internalGetSecuritySchemes()); + bitField0_ |= 0x00000400; + if (securityBuilder_ == null) { + if (!other.security_.isEmpty()) { + if (security_.isEmpty()) { + security_ = other.security_; + bitField0_ = (bitField0_ & ~0x00000800); + } else { + ensureSecurityIsMutable(); + security_.addAll(other.security_); + } + onChanged(); + } + } else { + if (!other.security_.isEmpty()) { + if (securityBuilder_.isEmpty()) { + securityBuilder_.dispose(); + securityBuilder_ = null; + security_ = other.security_; + bitField0_ = (bitField0_ & ~0x00000800); + securityBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + internalGetSecurityFieldBuilder() : null; + } else { + securityBuilder_.addAllMessages(other.security_); + } + } + } + if (!other.defaultInputModes_.isEmpty()) { + if (defaultInputModes_.isEmpty()) { + defaultInputModes_ = other.defaultInputModes_; + bitField0_ |= 0x00001000; + } else { + ensureDefaultInputModesIsMutable(); + defaultInputModes_.addAll(other.defaultInputModes_); + } + onChanged(); + } + if (!other.defaultOutputModes_.isEmpty()) { + if (defaultOutputModes_.isEmpty()) { + defaultOutputModes_ = other.defaultOutputModes_; + bitField0_ |= 0x00002000; + } else { + ensureDefaultOutputModesIsMutable(); + defaultOutputModes_.addAll(other.defaultOutputModes_); + } + onChanged(); + } + if (skillsBuilder_ == null) { + if (!other.skills_.isEmpty()) { + if (skills_.isEmpty()) { + skills_ = other.skills_; + bitField0_ = (bitField0_ & ~0x00004000); + } else { + ensureSkillsIsMutable(); + skills_.addAll(other.skills_); + } + onChanged(); + } + } else { + if (!other.skills_.isEmpty()) { + if (skillsBuilder_.isEmpty()) { + skillsBuilder_.dispose(); + skillsBuilder_ = null; + skills_ = other.skills_; + bitField0_ = (bitField0_ & ~0x00004000); + skillsBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + internalGetSkillsFieldBuilder() : null; + } else { + skillsBuilder_.addAllMessages(other.skills_); + } + } + } + if (other.getSupportsAuthenticatedExtendedCard() != false) { + setSupportsAuthenticatedExtendedCard(other.getSupportsAuthenticatedExtendedCard()); + } + if (signaturesBuilder_ == null) { + if (!other.signatures_.isEmpty()) { + if (signatures_.isEmpty()) { + signatures_ = other.signatures_; + bitField0_ = (bitField0_ & ~0x00010000); + } else { + ensureSignaturesIsMutable(); + signatures_.addAll(other.signatures_); + } + onChanged(); + } + } else { + if (!other.signatures_.isEmpty()) { + if (signaturesBuilder_.isEmpty()) { + signaturesBuilder_.dispose(); + signaturesBuilder_ = null; + signatures_ = other.signatures_; + bitField0_ = (bitField0_ & ~0x00010000); + signaturesBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + internalGetSignaturesFieldBuilder() : null; + } else { + signaturesBuilder_.addAllMessages(other.signatures_); + } + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 10 + case 18: { + description_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 18 + case 26: { + url_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000008; + break; + } // case 26 + case 34: { + input.readMessage( + internalGetProviderFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000040; + break; + } // case 34 + case 42: { + version_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000080; + break; + } // case 42 + case 50: { + documentationUrl_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000100; + break; + } // case 50 + case 58: { + input.readMessage( + internalGetCapabilitiesFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000200; + break; + } // case 58 + case 66: { + com.google.protobuf.MapEntry + securitySchemes__ = input.readMessage( + SecuritySchemesDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); + internalGetMutableSecuritySchemes().ensureBuilderMap().put( + securitySchemes__.getKey(), securitySchemes__.getValue()); + bitField0_ |= 0x00000400; + break; + } // case 66 + case 74: { + org.a2aproject.sdk.compat03.grpc.Security m = + input.readMessage( + org.a2aproject.sdk.compat03.grpc.Security.parser(), + extensionRegistry); + if (securityBuilder_ == null) { + ensureSecurityIsMutable(); + security_.add(m); + } else { + securityBuilder_.addMessage(m); + } + break; + } // case 74 + case 82: { + java.lang.String s = input.readStringRequireUtf8(); + ensureDefaultInputModesIsMutable(); + defaultInputModes_.add(s); + break; + } // case 82 + case 90: { + java.lang.String s = input.readStringRequireUtf8(); + ensureDefaultOutputModesIsMutable(); + defaultOutputModes_.add(s); + break; + } // case 90 + case 98: { + org.a2aproject.sdk.compat03.grpc.AgentSkill m = + input.readMessage( + org.a2aproject.sdk.compat03.grpc.AgentSkill.parser(), + extensionRegistry); + if (skillsBuilder_ == null) { + ensureSkillsIsMutable(); + skills_.add(m); + } else { + skillsBuilder_.addMessage(m); + } + break; + } // case 98 + case 104: { + supportsAuthenticatedExtendedCard_ = input.readBool(); + bitField0_ |= 0x00008000; + break; + } // case 104 + case 114: { + preferredTransport_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000010; + break; + } // case 114 + case 122: { + org.a2aproject.sdk.compat03.grpc.AgentInterface m = + input.readMessage( + org.a2aproject.sdk.compat03.grpc.AgentInterface.parser(), + extensionRegistry); + if (additionalInterfacesBuilder_ == null) { + ensureAdditionalInterfacesIsMutable(); + additionalInterfaces_.add(m); + } else { + additionalInterfacesBuilder_.addMessage(m); + } + break; + } // case 122 + case 130: { + protocolVersion_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 130 + case 138: { + org.a2aproject.sdk.compat03.grpc.AgentCardSignature m = + input.readMessage( + org.a2aproject.sdk.compat03.grpc.AgentCardSignature.parser(), + extensionRegistry); + if (signaturesBuilder_ == null) { + ensureSignaturesIsMutable(); + signatures_.add(m); + } else { + signaturesBuilder_.addMessage(m); + } + break; + } // case 138 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object protocolVersion_ = ""; + /** + *
+     * The version of the A2A protocol this agent supports.
+     * 
+ * + * string protocol_version = 16; + * @return The protocolVersion. + */ + public java.lang.String getProtocolVersion() { + java.lang.Object ref = protocolVersion_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + protocolVersion_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The version of the A2A protocol this agent supports.
+     * 
+ * + * string protocol_version = 16; + * @return The bytes for protocolVersion. + */ + public com.google.protobuf.ByteString + getProtocolVersionBytes() { + java.lang.Object ref = protocolVersion_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + protocolVersion_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The version of the A2A protocol this agent supports.
+     * 
+ * + * string protocol_version = 16; + * @param value The protocolVersion to set. + * @return This builder for chaining. + */ + public Builder setProtocolVersion( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + protocolVersion_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * The version of the A2A protocol this agent supports.
+     * 
+ * + * string protocol_version = 16; + * @return This builder for chaining. + */ + public Builder clearProtocolVersion() { + protocolVersion_ = getDefaultInstance().getProtocolVersion(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * The version of the A2A protocol this agent supports.
+     * 
+ * + * string protocol_version = 16; + * @param value The bytes for protocolVersion to set. + * @return This builder for chaining. + */ + public Builder setProtocolVersionBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + protocolVersion_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object name_ = ""; + /** + *
+     * A human readable name for the agent.
+     * Example: "Recipe Agent"
+     * 
+ * + * string name = 1; + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * A human readable name for the agent.
+     * Example: "Recipe Agent"
+     * 
+ * + * string name = 1; + * @return The bytes for name. + */ + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * A human readable name for the agent.
+     * Example: "Recipe Agent"
+     * 
+ * + * string name = 1; + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + name_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * A human readable name for the agent.
+     * Example: "Recipe Agent"
+     * 
+ * + * string name = 1; + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * A human readable name for the agent.
+     * Example: "Recipe Agent"
+     * 
+ * + * string name = 1; + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private java.lang.Object description_ = ""; + /** + *
+     * A description of the agent's domain of action/solution space.
+     * Example: "Agent that helps users with recipes and cooking."
+     * 
+ * + * string description = 2; + * @return The description. + */ + public java.lang.String getDescription() { + java.lang.Object ref = description_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + description_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * A description of the agent's domain of action/solution space.
+     * Example: "Agent that helps users with recipes and cooking."
+     * 
+ * + * string description = 2; + * @return The bytes for description. + */ + public com.google.protobuf.ByteString + getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * A description of the agent's domain of action/solution space.
+     * Example: "Agent that helps users with recipes and cooking."
+     * 
+ * + * string description = 2; + * @param value The description to set. + * @return This builder for chaining. + */ + public Builder setDescription( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + description_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * A description of the agent's domain of action/solution space.
+     * Example: "Agent that helps users with recipes and cooking."
+     * 
+ * + * string description = 2; + * @return This builder for chaining. + */ + public Builder clearDescription() { + description_ = getDefaultInstance().getDescription(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + *
+     * A description of the agent's domain of action/solution space.
+     * Example: "Agent that helps users with recipes and cooking."
+     * 
+ * + * string description = 2; + * @param value The bytes for description to set. + * @return This builder for chaining. + */ + public Builder setDescriptionBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + description_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + private java.lang.Object url_ = ""; + /** + *
+     * A URL to the address the agent is hosted at. This represents the
+     * preferred endpoint as declared by the agent.
+     * 
+ * + * string url = 3; + * @return The url. + */ + public java.lang.String getUrl() { + java.lang.Object ref = url_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + url_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * A URL to the address the agent is hosted at. This represents the
+     * preferred endpoint as declared by the agent.
+     * 
+ * + * string url = 3; + * @return The bytes for url. + */ + public com.google.protobuf.ByteString + getUrlBytes() { + java.lang.Object ref = url_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + url_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * A URL to the address the agent is hosted at. This represents the
+     * preferred endpoint as declared by the agent.
+     * 
+ * + * string url = 3; + * @param value The url to set. + * @return This builder for chaining. + */ + public Builder setUrl( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + url_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + *
+     * A URL to the address the agent is hosted at. This represents the
+     * preferred endpoint as declared by the agent.
+     * 
+ * + * string url = 3; + * @return This builder for chaining. + */ + public Builder clearUrl() { + url_ = getDefaultInstance().getUrl(); + bitField0_ = (bitField0_ & ~0x00000008); + onChanged(); + return this; + } + /** + *
+     * A URL to the address the agent is hosted at. This represents the
+     * preferred endpoint as declared by the agent.
+     * 
+ * + * string url = 3; + * @param value The bytes for url to set. + * @return This builder for chaining. + */ + public Builder setUrlBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + url_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + + private java.lang.Object preferredTransport_ = ""; + /** + *
+     * The transport of the preferred endpoint. If empty, defaults to JSONRPC.
+     * 
+ * + * string preferred_transport = 14; + * @return The preferredTransport. + */ + public java.lang.String getPreferredTransport() { + java.lang.Object ref = preferredTransport_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + preferredTransport_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The transport of the preferred endpoint. If empty, defaults to JSONRPC.
+     * 
+ * + * string preferred_transport = 14; + * @return The bytes for preferredTransport. + */ + public com.google.protobuf.ByteString + getPreferredTransportBytes() { + java.lang.Object ref = preferredTransport_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + preferredTransport_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The transport of the preferred endpoint. If empty, defaults to JSONRPC.
+     * 
+ * + * string preferred_transport = 14; + * @param value The preferredTransport to set. + * @return This builder for chaining. + */ + public Builder setPreferredTransport( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + preferredTransport_ = value; + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + *
+     * The transport of the preferred endpoint. If empty, defaults to JSONRPC.
+     * 
+ * + * string preferred_transport = 14; + * @return This builder for chaining. + */ + public Builder clearPreferredTransport() { + preferredTransport_ = getDefaultInstance().getPreferredTransport(); + bitField0_ = (bitField0_ & ~0x00000010); + onChanged(); + return this; + } + /** + *
+     * The transport of the preferred endpoint. If empty, defaults to JSONRPC.
+     * 
+ * + * string preferred_transport = 14; + * @param value The bytes for preferredTransport to set. + * @return This builder for chaining. + */ + public Builder setPreferredTransportBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + preferredTransport_ = value; + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + + private java.util.List additionalInterfaces_ = + java.util.Collections.emptyList(); + private void ensureAdditionalInterfacesIsMutable() { + if (!((bitField0_ & 0x00000020) != 0)) { + additionalInterfaces_ = new java.util.ArrayList(additionalInterfaces_); + bitField0_ |= 0x00000020; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AgentInterface, org.a2aproject.sdk.compat03.grpc.AgentInterface.Builder, org.a2aproject.sdk.compat03.grpc.AgentInterfaceOrBuilder> additionalInterfacesBuilder_; + + /** + *
+     * Announcement of additional supported transports. Client can use any of
+     * the supported transports.
+     * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + public java.util.List getAdditionalInterfacesList() { + if (additionalInterfacesBuilder_ == null) { + return java.util.Collections.unmodifiableList(additionalInterfaces_); + } else { + return additionalInterfacesBuilder_.getMessageList(); + } + } + /** + *
+     * Announcement of additional supported transports. Client can use any of
+     * the supported transports.
+     * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + public int getAdditionalInterfacesCount() { + if (additionalInterfacesBuilder_ == null) { + return additionalInterfaces_.size(); + } else { + return additionalInterfacesBuilder_.getCount(); + } + } + /** + *
+     * Announcement of additional supported transports. Client can use any of
+     * the supported transports.
+     * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + public org.a2aproject.sdk.compat03.grpc.AgentInterface getAdditionalInterfaces(int index) { + if (additionalInterfacesBuilder_ == null) { + return additionalInterfaces_.get(index); + } else { + return additionalInterfacesBuilder_.getMessage(index); + } + } + /** + *
+     * Announcement of additional supported transports. Client can use any of
+     * the supported transports.
+     * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + public Builder setAdditionalInterfaces( + int index, org.a2aproject.sdk.compat03.grpc.AgentInterface value) { + if (additionalInterfacesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureAdditionalInterfacesIsMutable(); + additionalInterfaces_.set(index, value); + onChanged(); + } else { + additionalInterfacesBuilder_.setMessage(index, value); + } + return this; + } + /** + *
+     * Announcement of additional supported transports. Client can use any of
+     * the supported transports.
+     * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + public Builder setAdditionalInterfaces( + int index, org.a2aproject.sdk.compat03.grpc.AgentInterface.Builder builderForValue) { + if (additionalInterfacesBuilder_ == null) { + ensureAdditionalInterfacesIsMutable(); + additionalInterfaces_.set(index, builderForValue.build()); + onChanged(); + } else { + additionalInterfacesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * Announcement of additional supported transports. Client can use any of
+     * the supported transports.
+     * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + public Builder addAdditionalInterfaces(org.a2aproject.sdk.compat03.grpc.AgentInterface value) { + if (additionalInterfacesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureAdditionalInterfacesIsMutable(); + additionalInterfaces_.add(value); + onChanged(); + } else { + additionalInterfacesBuilder_.addMessage(value); + } + return this; + } + /** + *
+     * Announcement of additional supported transports. Client can use any of
+     * the supported transports.
+     * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + public Builder addAdditionalInterfaces( + int index, org.a2aproject.sdk.compat03.grpc.AgentInterface value) { + if (additionalInterfacesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureAdditionalInterfacesIsMutable(); + additionalInterfaces_.add(index, value); + onChanged(); + } else { + additionalInterfacesBuilder_.addMessage(index, value); + } + return this; + } + /** + *
+     * Announcement of additional supported transports. Client can use any of
+     * the supported transports.
+     * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + public Builder addAdditionalInterfaces( + org.a2aproject.sdk.compat03.grpc.AgentInterface.Builder builderForValue) { + if (additionalInterfacesBuilder_ == null) { + ensureAdditionalInterfacesIsMutable(); + additionalInterfaces_.add(builderForValue.build()); + onChanged(); + } else { + additionalInterfacesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + *
+     * Announcement of additional supported transports. Client can use any of
+     * the supported transports.
+     * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + public Builder addAdditionalInterfaces( + int index, org.a2aproject.sdk.compat03.grpc.AgentInterface.Builder builderForValue) { + if (additionalInterfacesBuilder_ == null) { + ensureAdditionalInterfacesIsMutable(); + additionalInterfaces_.add(index, builderForValue.build()); + onChanged(); + } else { + additionalInterfacesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * Announcement of additional supported transports. Client can use any of
+     * the supported transports.
+     * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + public Builder addAllAdditionalInterfaces( + java.lang.Iterable values) { + if (additionalInterfacesBuilder_ == null) { + ensureAdditionalInterfacesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, additionalInterfaces_); + onChanged(); + } else { + additionalInterfacesBuilder_.addAllMessages(values); + } + return this; + } + /** + *
+     * Announcement of additional supported transports. Client can use any of
+     * the supported transports.
+     * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + public Builder clearAdditionalInterfaces() { + if (additionalInterfacesBuilder_ == null) { + additionalInterfaces_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000020); + onChanged(); + } else { + additionalInterfacesBuilder_.clear(); + } + return this; + } + /** + *
+     * Announcement of additional supported transports. Client can use any of
+     * the supported transports.
+     * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + public Builder removeAdditionalInterfaces(int index) { + if (additionalInterfacesBuilder_ == null) { + ensureAdditionalInterfacesIsMutable(); + additionalInterfaces_.remove(index); + onChanged(); + } else { + additionalInterfacesBuilder_.remove(index); + } + return this; + } + /** + *
+     * Announcement of additional supported transports. Client can use any of
+     * the supported transports.
+     * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + public org.a2aproject.sdk.compat03.grpc.AgentInterface.Builder getAdditionalInterfacesBuilder( + int index) { + return internalGetAdditionalInterfacesFieldBuilder().getBuilder(index); + } + /** + *
+     * Announcement of additional supported transports. Client can use any of
+     * the supported transports.
+     * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + public org.a2aproject.sdk.compat03.grpc.AgentInterfaceOrBuilder getAdditionalInterfacesOrBuilder( + int index) { + if (additionalInterfacesBuilder_ == null) { + return additionalInterfaces_.get(index); } else { + return additionalInterfacesBuilder_.getMessageOrBuilder(index); + } + } + /** + *
+     * Announcement of additional supported transports. Client can use any of
+     * the supported transports.
+     * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + public java.util.List + getAdditionalInterfacesOrBuilderList() { + if (additionalInterfacesBuilder_ != null) { + return additionalInterfacesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(additionalInterfaces_); + } + } + /** + *
+     * Announcement of additional supported transports. Client can use any of
+     * the supported transports.
+     * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + public org.a2aproject.sdk.compat03.grpc.AgentInterface.Builder addAdditionalInterfacesBuilder() { + return internalGetAdditionalInterfacesFieldBuilder().addBuilder( + org.a2aproject.sdk.compat03.grpc.AgentInterface.getDefaultInstance()); + } + /** + *
+     * Announcement of additional supported transports. Client can use any of
+     * the supported transports.
+     * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + public org.a2aproject.sdk.compat03.grpc.AgentInterface.Builder addAdditionalInterfacesBuilder( + int index) { + return internalGetAdditionalInterfacesFieldBuilder().addBuilder( + index, org.a2aproject.sdk.compat03.grpc.AgentInterface.getDefaultInstance()); + } + /** + *
+     * Announcement of additional supported transports. Client can use any of
+     * the supported transports.
+     * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + public java.util.List + getAdditionalInterfacesBuilderList() { + return internalGetAdditionalInterfacesFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AgentInterface, org.a2aproject.sdk.compat03.grpc.AgentInterface.Builder, org.a2aproject.sdk.compat03.grpc.AgentInterfaceOrBuilder> + internalGetAdditionalInterfacesFieldBuilder() { + if (additionalInterfacesBuilder_ == null) { + additionalInterfacesBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AgentInterface, org.a2aproject.sdk.compat03.grpc.AgentInterface.Builder, org.a2aproject.sdk.compat03.grpc.AgentInterfaceOrBuilder>( + additionalInterfaces_, + ((bitField0_ & 0x00000020) != 0), + getParentForChildren(), + isClean()); + additionalInterfaces_ = null; + } + return additionalInterfacesBuilder_; + } + + private org.a2aproject.sdk.compat03.grpc.AgentProvider provider_; + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AgentProvider, org.a2aproject.sdk.compat03.grpc.AgentProvider.Builder, org.a2aproject.sdk.compat03.grpc.AgentProviderOrBuilder> providerBuilder_; + /** + *
+     * The service provider of the agent.
+     * 
+ * + * .a2a.v1.AgentProvider provider = 4; + * @return Whether the provider field is set. + */ + public boolean hasProvider() { + return ((bitField0_ & 0x00000040) != 0); + } + /** + *
+     * The service provider of the agent.
+     * 
+ * + * .a2a.v1.AgentProvider provider = 4; + * @return The provider. + */ + public org.a2aproject.sdk.compat03.grpc.AgentProvider getProvider() { + if (providerBuilder_ == null) { + return provider_ == null ? org.a2aproject.sdk.compat03.grpc.AgentProvider.getDefaultInstance() : provider_; + } else { + return providerBuilder_.getMessage(); + } + } + /** + *
+     * The service provider of the agent.
+     * 
+ * + * .a2a.v1.AgentProvider provider = 4; + */ + public Builder setProvider(org.a2aproject.sdk.compat03.grpc.AgentProvider value) { + if (providerBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + provider_ = value; + } else { + providerBuilder_.setMessage(value); + } + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + *
+     * The service provider of the agent.
+     * 
+ * + * .a2a.v1.AgentProvider provider = 4; + */ + public Builder setProvider( + org.a2aproject.sdk.compat03.grpc.AgentProvider.Builder builderForValue) { + if (providerBuilder_ == null) { + provider_ = builderForValue.build(); + } else { + providerBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + *
+     * The service provider of the agent.
+     * 
+ * + * .a2a.v1.AgentProvider provider = 4; + */ + public Builder mergeProvider(org.a2aproject.sdk.compat03.grpc.AgentProvider value) { + if (providerBuilder_ == null) { + if (((bitField0_ & 0x00000040) != 0) && + provider_ != null && + provider_ != org.a2aproject.sdk.compat03.grpc.AgentProvider.getDefaultInstance()) { + getProviderBuilder().mergeFrom(value); + } else { + provider_ = value; + } + } else { + providerBuilder_.mergeFrom(value); + } + if (provider_ != null) { + bitField0_ |= 0x00000040; + onChanged(); + } + return this; + } + /** + *
+     * The service provider of the agent.
+     * 
+ * + * .a2a.v1.AgentProvider provider = 4; + */ + public Builder clearProvider() { + bitField0_ = (bitField0_ & ~0x00000040); + provider_ = null; + if (providerBuilder_ != null) { + providerBuilder_.dispose(); + providerBuilder_ = null; + } + onChanged(); + return this; + } + /** + *
+     * The service provider of the agent.
+     * 
+ * + * .a2a.v1.AgentProvider provider = 4; + */ + public org.a2aproject.sdk.compat03.grpc.AgentProvider.Builder getProviderBuilder() { + bitField0_ |= 0x00000040; + onChanged(); + return internalGetProviderFieldBuilder().getBuilder(); + } + /** + *
+     * The service provider of the agent.
+     * 
+ * + * .a2a.v1.AgentProvider provider = 4; + */ + public org.a2aproject.sdk.compat03.grpc.AgentProviderOrBuilder getProviderOrBuilder() { + if (providerBuilder_ != null) { + return providerBuilder_.getMessageOrBuilder(); + } else { + return provider_ == null ? + org.a2aproject.sdk.compat03.grpc.AgentProvider.getDefaultInstance() : provider_; + } + } + /** + *
+     * The service provider of the agent.
+     * 
+ * + * .a2a.v1.AgentProvider provider = 4; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AgentProvider, org.a2aproject.sdk.compat03.grpc.AgentProvider.Builder, org.a2aproject.sdk.compat03.grpc.AgentProviderOrBuilder> + internalGetProviderFieldBuilder() { + if (providerBuilder_ == null) { + providerBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AgentProvider, org.a2aproject.sdk.compat03.grpc.AgentProvider.Builder, org.a2aproject.sdk.compat03.grpc.AgentProviderOrBuilder>( + getProvider(), + getParentForChildren(), + isClean()); + provider_ = null; + } + return providerBuilder_; + } + + private java.lang.Object version_ = ""; + /** + *
+     * The version of the agent.
+     * Example: "1.0.0"
+     * 
+ * + * string version = 5; + * @return The version. + */ + public java.lang.String getVersion() { + java.lang.Object ref = version_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + version_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The version of the agent.
+     * Example: "1.0.0"
+     * 
+ * + * string version = 5; + * @return The bytes for version. + */ + public com.google.protobuf.ByteString + getVersionBytes() { + java.lang.Object ref = version_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + version_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The version of the agent.
+     * Example: "1.0.0"
+     * 
+ * + * string version = 5; + * @param value The version to set. + * @return This builder for chaining. + */ + public Builder setVersion( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + version_ = value; + bitField0_ |= 0x00000080; + onChanged(); + return this; + } + /** + *
+     * The version of the agent.
+     * Example: "1.0.0"
+     * 
+ * + * string version = 5; + * @return This builder for chaining. + */ + public Builder clearVersion() { + version_ = getDefaultInstance().getVersion(); + bitField0_ = (bitField0_ & ~0x00000080); + onChanged(); + return this; + } + /** + *
+     * The version of the agent.
+     * Example: "1.0.0"
+     * 
+ * + * string version = 5; + * @param value The bytes for version to set. + * @return This builder for chaining. + */ + public Builder setVersionBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + version_ = value; + bitField0_ |= 0x00000080; + onChanged(); + return this; + } + + private java.lang.Object documentationUrl_ = ""; + /** + *
+     * A url to provide additional documentation about the agent.
+     * 
+ * + * string documentation_url = 6; + * @return The documentationUrl. + */ + public java.lang.String getDocumentationUrl() { + java.lang.Object ref = documentationUrl_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + documentationUrl_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * A url to provide additional documentation about the agent.
+     * 
+ * + * string documentation_url = 6; + * @return The bytes for documentationUrl. + */ + public com.google.protobuf.ByteString + getDocumentationUrlBytes() { + java.lang.Object ref = documentationUrl_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + documentationUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * A url to provide additional documentation about the agent.
+     * 
+ * + * string documentation_url = 6; + * @param value The documentationUrl to set. + * @return This builder for chaining. + */ + public Builder setDocumentationUrl( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + documentationUrl_ = value; + bitField0_ |= 0x00000100; + onChanged(); + return this; + } + /** + *
+     * A url to provide additional documentation about the agent.
+     * 
+ * + * string documentation_url = 6; + * @return This builder for chaining. + */ + public Builder clearDocumentationUrl() { + documentationUrl_ = getDefaultInstance().getDocumentationUrl(); + bitField0_ = (bitField0_ & ~0x00000100); + onChanged(); + return this; + } + /** + *
+     * A url to provide additional documentation about the agent.
+     * 
+ * + * string documentation_url = 6; + * @param value The bytes for documentationUrl to set. + * @return This builder for chaining. + */ + public Builder setDocumentationUrlBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + documentationUrl_ = value; + bitField0_ |= 0x00000100; + onChanged(); + return this; + } + + private org.a2aproject.sdk.compat03.grpc.AgentCapabilities capabilities_; + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AgentCapabilities, org.a2aproject.sdk.compat03.grpc.AgentCapabilities.Builder, org.a2aproject.sdk.compat03.grpc.AgentCapabilitiesOrBuilder> capabilitiesBuilder_; + /** + *
+     * A2A Capability set supported by the agent.
+     * 
+ * + * .a2a.v1.AgentCapabilities capabilities = 7; + * @return Whether the capabilities field is set. + */ + public boolean hasCapabilities() { + return ((bitField0_ & 0x00000200) != 0); + } + /** + *
+     * A2A Capability set supported by the agent.
+     * 
+ * + * .a2a.v1.AgentCapabilities capabilities = 7; + * @return The capabilities. + */ + public org.a2aproject.sdk.compat03.grpc.AgentCapabilities getCapabilities() { + if (capabilitiesBuilder_ == null) { + return capabilities_ == null ? org.a2aproject.sdk.compat03.grpc.AgentCapabilities.getDefaultInstance() : capabilities_; + } else { + return capabilitiesBuilder_.getMessage(); + } + } + /** + *
+     * A2A Capability set supported by the agent.
+     * 
+ * + * .a2a.v1.AgentCapabilities capabilities = 7; + */ + public Builder setCapabilities(org.a2aproject.sdk.compat03.grpc.AgentCapabilities value) { + if (capabilitiesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + capabilities_ = value; + } else { + capabilitiesBuilder_.setMessage(value); + } + bitField0_ |= 0x00000200; + onChanged(); + return this; + } + /** + *
+     * A2A Capability set supported by the agent.
+     * 
+ * + * .a2a.v1.AgentCapabilities capabilities = 7; + */ + public Builder setCapabilities( + org.a2aproject.sdk.compat03.grpc.AgentCapabilities.Builder builderForValue) { + if (capabilitiesBuilder_ == null) { + capabilities_ = builderForValue.build(); + } else { + capabilitiesBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000200; + onChanged(); + return this; + } + /** + *
+     * A2A Capability set supported by the agent.
+     * 
+ * + * .a2a.v1.AgentCapabilities capabilities = 7; + */ + public Builder mergeCapabilities(org.a2aproject.sdk.compat03.grpc.AgentCapabilities value) { + if (capabilitiesBuilder_ == null) { + if (((bitField0_ & 0x00000200) != 0) && + capabilities_ != null && + capabilities_ != org.a2aproject.sdk.compat03.grpc.AgentCapabilities.getDefaultInstance()) { + getCapabilitiesBuilder().mergeFrom(value); + } else { + capabilities_ = value; + } + } else { + capabilitiesBuilder_.mergeFrom(value); + } + if (capabilities_ != null) { + bitField0_ |= 0x00000200; + onChanged(); + } + return this; + } + /** + *
+     * A2A Capability set supported by the agent.
+     * 
+ * + * .a2a.v1.AgentCapabilities capabilities = 7; + */ + public Builder clearCapabilities() { + bitField0_ = (bitField0_ & ~0x00000200); + capabilities_ = null; + if (capabilitiesBuilder_ != null) { + capabilitiesBuilder_.dispose(); + capabilitiesBuilder_ = null; + } + onChanged(); + return this; + } + /** + *
+     * A2A Capability set supported by the agent.
+     * 
+ * + * .a2a.v1.AgentCapabilities capabilities = 7; + */ + public org.a2aproject.sdk.compat03.grpc.AgentCapabilities.Builder getCapabilitiesBuilder() { + bitField0_ |= 0x00000200; + onChanged(); + return internalGetCapabilitiesFieldBuilder().getBuilder(); + } + /** + *
+     * A2A Capability set supported by the agent.
+     * 
+ * + * .a2a.v1.AgentCapabilities capabilities = 7; + */ + public org.a2aproject.sdk.compat03.grpc.AgentCapabilitiesOrBuilder getCapabilitiesOrBuilder() { + if (capabilitiesBuilder_ != null) { + return capabilitiesBuilder_.getMessageOrBuilder(); + } else { + return capabilities_ == null ? + org.a2aproject.sdk.compat03.grpc.AgentCapabilities.getDefaultInstance() : capabilities_; + } + } + /** + *
+     * A2A Capability set supported by the agent.
+     * 
+ * + * .a2a.v1.AgentCapabilities capabilities = 7; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AgentCapabilities, org.a2aproject.sdk.compat03.grpc.AgentCapabilities.Builder, org.a2aproject.sdk.compat03.grpc.AgentCapabilitiesOrBuilder> + internalGetCapabilitiesFieldBuilder() { + if (capabilitiesBuilder_ == null) { + capabilitiesBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AgentCapabilities, org.a2aproject.sdk.compat03.grpc.AgentCapabilities.Builder, org.a2aproject.sdk.compat03.grpc.AgentCapabilitiesOrBuilder>( + getCapabilities(), + getParentForChildren(), + isClean()); + capabilities_ = null; + } + return capabilitiesBuilder_; + } + + private static final class SecuritySchemesConverter implements com.google.protobuf.MapFieldBuilder.Converter { + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SecurityScheme build(org.a2aproject.sdk.compat03.grpc.SecuritySchemeOrBuilder val) { + if (val instanceof org.a2aproject.sdk.compat03.grpc.SecurityScheme) { return (org.a2aproject.sdk.compat03.grpc.SecurityScheme) val; } + return ((org.a2aproject.sdk.compat03.grpc.SecurityScheme.Builder) val).build(); + } + + @java.lang.Override + public com.google.protobuf.MapEntry defaultEntry() { + return SecuritySchemesDefaultEntryHolder.defaultEntry; + } + }; + private static final SecuritySchemesConverter securitySchemesConverter = new SecuritySchemesConverter(); + + private com.google.protobuf.MapFieldBuilder< + java.lang.String, org.a2aproject.sdk.compat03.grpc.SecuritySchemeOrBuilder, org.a2aproject.sdk.compat03.grpc.SecurityScheme, org.a2aproject.sdk.compat03.grpc.SecurityScheme.Builder> securitySchemes_; + private com.google.protobuf.MapFieldBuilder + internalGetSecuritySchemes() { + if (securitySchemes_ == null) { + return new com.google.protobuf.MapFieldBuilder<>(securitySchemesConverter); + } + return securitySchemes_; + } + private com.google.protobuf.MapFieldBuilder + internalGetMutableSecuritySchemes() { + if (securitySchemes_ == null) { + securitySchemes_ = new com.google.protobuf.MapFieldBuilder<>(securitySchemesConverter); + } + bitField0_ |= 0x00000400; + onChanged(); + return securitySchemes_; + } + public int getSecuritySchemesCount() { + return internalGetSecuritySchemes().ensureBuilderMap().size(); + } + /** + *
+     * The security scheme details used for authenticating with this agent.
+     * 
+ * + * map<string, .a2a.v1.SecurityScheme> security_schemes = 8; + */ + @java.lang.Override + public boolean containsSecuritySchemes( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + return internalGetSecuritySchemes().ensureBuilderMap().containsKey(key); + } + /** + * Use {@link #getSecuritySchemesMap()} instead. + */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getSecuritySchemes() { + return getSecuritySchemesMap(); + } + /** + *
+     * The security scheme details used for authenticating with this agent.
+     * 
+ * + * map<string, .a2a.v1.SecurityScheme> security_schemes = 8; + */ + @java.lang.Override + public java.util.Map getSecuritySchemesMap() { + return internalGetSecuritySchemes().getImmutableMap(); + } + /** + *
+     * The security scheme details used for authenticating with this agent.
+     * 
+ * + * map<string, .a2a.v1.SecurityScheme> security_schemes = 8; + */ + @java.lang.Override + public /* nullable */ +org.a2aproject.sdk.compat03.grpc.SecurityScheme getSecuritySchemesOrDefault( + java.lang.String key, + /* nullable */ +org.a2aproject.sdk.compat03.grpc.SecurityScheme defaultValue) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = internalGetMutableSecuritySchemes().ensureBuilderMap(); + return map.containsKey(key) ? securitySchemesConverter.build(map.get(key)) : defaultValue; + } + /** + *
+     * The security scheme details used for authenticating with this agent.
+     * 
+ * + * map<string, .a2a.v1.SecurityScheme> security_schemes = 8; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SecurityScheme getSecuritySchemesOrThrow( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = internalGetMutableSecuritySchemes().ensureBuilderMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return securitySchemesConverter.build(map.get(key)); + } + public Builder clearSecuritySchemes() { + bitField0_ = (bitField0_ & ~0x00000400); + internalGetMutableSecuritySchemes().clear(); + return this; + } + /** + *
+     * The security scheme details used for authenticating with this agent.
+     * 
+ * + * map<string, .a2a.v1.SecurityScheme> security_schemes = 8; + */ + public Builder removeSecuritySchemes( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + internalGetMutableSecuritySchemes().ensureBuilderMap() + .remove(key); + return this; + } + /** + * Use alternate mutation accessors instead. + */ + @java.lang.Deprecated + public java.util.Map + getMutableSecuritySchemes() { + bitField0_ |= 0x00000400; + return internalGetMutableSecuritySchemes().ensureMessageMap(); + } + /** + *
+     * The security scheme details used for authenticating with this agent.
+     * 
+ * + * map<string, .a2a.v1.SecurityScheme> security_schemes = 8; + */ + public Builder putSecuritySchemes( + java.lang.String key, + org.a2aproject.sdk.compat03.grpc.SecurityScheme value) { + if (key == null) { throw new NullPointerException("map key"); } + if (value == null) { throw new NullPointerException("map value"); } + internalGetMutableSecuritySchemes().ensureBuilderMap() + .put(key, value); + bitField0_ |= 0x00000400; + return this; + } + /** + *
+     * The security scheme details used for authenticating with this agent.
+     * 
+ * + * map<string, .a2a.v1.SecurityScheme> security_schemes = 8; + */ + public Builder putAllSecuritySchemes( + java.util.Map values) { + for (java.util.Map.Entry e : values.entrySet()) { + if (e.getKey() == null || e.getValue() == null) { + throw new NullPointerException(); + } + } + internalGetMutableSecuritySchemes().ensureBuilderMap() + .putAll(values); + bitField0_ |= 0x00000400; + return this; + } + /** + *
+     * The security scheme details used for authenticating with this agent.
+     * 
+ * + * map<string, .a2a.v1.SecurityScheme> security_schemes = 8; + */ + public org.a2aproject.sdk.compat03.grpc.SecurityScheme.Builder putSecuritySchemesBuilderIfAbsent( + java.lang.String key) { + java.util.Map builderMap = internalGetMutableSecuritySchemes().ensureBuilderMap(); + org.a2aproject.sdk.compat03.grpc.SecuritySchemeOrBuilder entry = builderMap.get(key); + if (entry == null) { + entry = org.a2aproject.sdk.compat03.grpc.SecurityScheme.newBuilder(); + builderMap.put(key, entry); + } + if (entry instanceof org.a2aproject.sdk.compat03.grpc.SecurityScheme) { + entry = ((org.a2aproject.sdk.compat03.grpc.SecurityScheme) entry).toBuilder(); + builderMap.put(key, entry); + } + return (org.a2aproject.sdk.compat03.grpc.SecurityScheme.Builder) entry; + } + + private java.util.List security_ = + java.util.Collections.emptyList(); + private void ensureSecurityIsMutable() { + if (!((bitField0_ & 0x00000800) != 0)) { + security_ = new java.util.ArrayList(security_); + bitField0_ |= 0x00000800; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Security, org.a2aproject.sdk.compat03.grpc.Security.Builder, org.a2aproject.sdk.compat03.grpc.SecurityOrBuilder> securityBuilder_; + + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security requirements for contacting the agent.
+     * This list can be seen as an OR of ANDs. Each object in the list describes
+     * one possible set of security requirements that must be present on a
+     * request. This allows specifying, for example, "callers must either use
+     * OAuth OR an API Key AND mTLS."
+     * Example:
+     * security {
+     * schemes { key: "oauth" value { list: ["read"] } }
+     * }
+     * security {
+     * schemes { key: "api-key" }
+     * schemes { key: "mtls" }
+     * }
+     * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + public java.util.List getSecurityList() { + if (securityBuilder_ == null) { + return java.util.Collections.unmodifiableList(security_); + } else { + return securityBuilder_.getMessageList(); + } + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security requirements for contacting the agent.
+     * This list can be seen as an OR of ANDs. Each object in the list describes
+     * one possible set of security requirements that must be present on a
+     * request. This allows specifying, for example, "callers must either use
+     * OAuth OR an API Key AND mTLS."
+     * Example:
+     * security {
+     * schemes { key: "oauth" value { list: ["read"] } }
+     * }
+     * security {
+     * schemes { key: "api-key" }
+     * schemes { key: "mtls" }
+     * }
+     * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + public int getSecurityCount() { + if (securityBuilder_ == null) { + return security_.size(); + } else { + return securityBuilder_.getCount(); + } + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security requirements for contacting the agent.
+     * This list can be seen as an OR of ANDs. Each object in the list describes
+     * one possible set of security requirements that must be present on a
+     * request. This allows specifying, for example, "callers must either use
+     * OAuth OR an API Key AND mTLS."
+     * Example:
+     * security {
+     * schemes { key: "oauth" value { list: ["read"] } }
+     * }
+     * security {
+     * schemes { key: "api-key" }
+     * schemes { key: "mtls" }
+     * }
+     * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + public org.a2aproject.sdk.compat03.grpc.Security getSecurity(int index) { + if (securityBuilder_ == null) { + return security_.get(index); + } else { + return securityBuilder_.getMessage(index); + } + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security requirements for contacting the agent.
+     * This list can be seen as an OR of ANDs. Each object in the list describes
+     * one possible set of security requirements that must be present on a
+     * request. This allows specifying, for example, "callers must either use
+     * OAuth OR an API Key AND mTLS."
+     * Example:
+     * security {
+     * schemes { key: "oauth" value { list: ["read"] } }
+     * }
+     * security {
+     * schemes { key: "api-key" }
+     * schemes { key: "mtls" }
+     * }
+     * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + public Builder setSecurity( + int index, org.a2aproject.sdk.compat03.grpc.Security value) { + if (securityBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSecurityIsMutable(); + security_.set(index, value); + onChanged(); + } else { + securityBuilder_.setMessage(index, value); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security requirements for contacting the agent.
+     * This list can be seen as an OR of ANDs. Each object in the list describes
+     * one possible set of security requirements that must be present on a
+     * request. This allows specifying, for example, "callers must either use
+     * OAuth OR an API Key AND mTLS."
+     * Example:
+     * security {
+     * schemes { key: "oauth" value { list: ["read"] } }
+     * }
+     * security {
+     * schemes { key: "api-key" }
+     * schemes { key: "mtls" }
+     * }
+     * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + public Builder setSecurity( + int index, org.a2aproject.sdk.compat03.grpc.Security.Builder builderForValue) { + if (securityBuilder_ == null) { + ensureSecurityIsMutable(); + security_.set(index, builderForValue.build()); + onChanged(); + } else { + securityBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security requirements for contacting the agent.
+     * This list can be seen as an OR of ANDs. Each object in the list describes
+     * one possible set of security requirements that must be present on a
+     * request. This allows specifying, for example, "callers must either use
+     * OAuth OR an API Key AND mTLS."
+     * Example:
+     * security {
+     * schemes { key: "oauth" value { list: ["read"] } }
+     * }
+     * security {
+     * schemes { key: "api-key" }
+     * schemes { key: "mtls" }
+     * }
+     * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + public Builder addSecurity(org.a2aproject.sdk.compat03.grpc.Security value) { + if (securityBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSecurityIsMutable(); + security_.add(value); + onChanged(); + } else { + securityBuilder_.addMessage(value); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security requirements for contacting the agent.
+     * This list can be seen as an OR of ANDs. Each object in the list describes
+     * one possible set of security requirements that must be present on a
+     * request. This allows specifying, for example, "callers must either use
+     * OAuth OR an API Key AND mTLS."
+     * Example:
+     * security {
+     * schemes { key: "oauth" value { list: ["read"] } }
+     * }
+     * security {
+     * schemes { key: "api-key" }
+     * schemes { key: "mtls" }
+     * }
+     * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + public Builder addSecurity( + int index, org.a2aproject.sdk.compat03.grpc.Security value) { + if (securityBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSecurityIsMutable(); + security_.add(index, value); + onChanged(); + } else { + securityBuilder_.addMessage(index, value); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security requirements for contacting the agent.
+     * This list can be seen as an OR of ANDs. Each object in the list describes
+     * one possible set of security requirements that must be present on a
+     * request. This allows specifying, for example, "callers must either use
+     * OAuth OR an API Key AND mTLS."
+     * Example:
+     * security {
+     * schemes { key: "oauth" value { list: ["read"] } }
+     * }
+     * security {
+     * schemes { key: "api-key" }
+     * schemes { key: "mtls" }
+     * }
+     * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + public Builder addSecurity( + org.a2aproject.sdk.compat03.grpc.Security.Builder builderForValue) { + if (securityBuilder_ == null) { + ensureSecurityIsMutable(); + security_.add(builderForValue.build()); + onChanged(); + } else { + securityBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security requirements for contacting the agent.
+     * This list can be seen as an OR of ANDs. Each object in the list describes
+     * one possible set of security requirements that must be present on a
+     * request. This allows specifying, for example, "callers must either use
+     * OAuth OR an API Key AND mTLS."
+     * Example:
+     * security {
+     * schemes { key: "oauth" value { list: ["read"] } }
+     * }
+     * security {
+     * schemes { key: "api-key" }
+     * schemes { key: "mtls" }
+     * }
+     * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + public Builder addSecurity( + int index, org.a2aproject.sdk.compat03.grpc.Security.Builder builderForValue) { + if (securityBuilder_ == null) { + ensureSecurityIsMutable(); + security_.add(index, builderForValue.build()); + onChanged(); + } else { + securityBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security requirements for contacting the agent.
+     * This list can be seen as an OR of ANDs. Each object in the list describes
+     * one possible set of security requirements that must be present on a
+     * request. This allows specifying, for example, "callers must either use
+     * OAuth OR an API Key AND mTLS."
+     * Example:
+     * security {
+     * schemes { key: "oauth" value { list: ["read"] } }
+     * }
+     * security {
+     * schemes { key: "api-key" }
+     * schemes { key: "mtls" }
+     * }
+     * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + public Builder addAllSecurity( + java.lang.Iterable values) { + if (securityBuilder_ == null) { + ensureSecurityIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, security_); + onChanged(); + } else { + securityBuilder_.addAllMessages(values); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security requirements for contacting the agent.
+     * This list can be seen as an OR of ANDs. Each object in the list describes
+     * one possible set of security requirements that must be present on a
+     * request. This allows specifying, for example, "callers must either use
+     * OAuth OR an API Key AND mTLS."
+     * Example:
+     * security {
+     * schemes { key: "oauth" value { list: ["read"] } }
+     * }
+     * security {
+     * schemes { key: "api-key" }
+     * schemes { key: "mtls" }
+     * }
+     * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + public Builder clearSecurity() { + if (securityBuilder_ == null) { + security_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000800); + onChanged(); + } else { + securityBuilder_.clear(); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security requirements for contacting the agent.
+     * This list can be seen as an OR of ANDs. Each object in the list describes
+     * one possible set of security requirements that must be present on a
+     * request. This allows specifying, for example, "callers must either use
+     * OAuth OR an API Key AND mTLS."
+     * Example:
+     * security {
+     * schemes { key: "oauth" value { list: ["read"] } }
+     * }
+     * security {
+     * schemes { key: "api-key" }
+     * schemes { key: "mtls" }
+     * }
+     * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + public Builder removeSecurity(int index) { + if (securityBuilder_ == null) { + ensureSecurityIsMutable(); + security_.remove(index); + onChanged(); + } else { + securityBuilder_.remove(index); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security requirements for contacting the agent.
+     * This list can be seen as an OR of ANDs. Each object in the list describes
+     * one possible set of security requirements that must be present on a
+     * request. This allows specifying, for example, "callers must either use
+     * OAuth OR an API Key AND mTLS."
+     * Example:
+     * security {
+     * schemes { key: "oauth" value { list: ["read"] } }
+     * }
+     * security {
+     * schemes { key: "api-key" }
+     * schemes { key: "mtls" }
+     * }
+     * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + public org.a2aproject.sdk.compat03.grpc.Security.Builder getSecurityBuilder( + int index) { + return internalGetSecurityFieldBuilder().getBuilder(index); + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security requirements for contacting the agent.
+     * This list can be seen as an OR of ANDs. Each object in the list describes
+     * one possible set of security requirements that must be present on a
+     * request. This allows specifying, for example, "callers must either use
+     * OAuth OR an API Key AND mTLS."
+     * Example:
+     * security {
+     * schemes { key: "oauth" value { list: ["read"] } }
+     * }
+     * security {
+     * schemes { key: "api-key" }
+     * schemes { key: "mtls" }
+     * }
+     * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + public org.a2aproject.sdk.compat03.grpc.SecurityOrBuilder getSecurityOrBuilder( + int index) { + if (securityBuilder_ == null) { + return security_.get(index); } else { + return securityBuilder_.getMessageOrBuilder(index); + } + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security requirements for contacting the agent.
+     * This list can be seen as an OR of ANDs. Each object in the list describes
+     * one possible set of security requirements that must be present on a
+     * request. This allows specifying, for example, "callers must either use
+     * OAuth OR an API Key AND mTLS."
+     * Example:
+     * security {
+     * schemes { key: "oauth" value { list: ["read"] } }
+     * }
+     * security {
+     * schemes { key: "api-key" }
+     * schemes { key: "mtls" }
+     * }
+     * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + public java.util.List + getSecurityOrBuilderList() { + if (securityBuilder_ != null) { + return securityBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(security_); + } + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security requirements for contacting the agent.
+     * This list can be seen as an OR of ANDs. Each object in the list describes
+     * one possible set of security requirements that must be present on a
+     * request. This allows specifying, for example, "callers must either use
+     * OAuth OR an API Key AND mTLS."
+     * Example:
+     * security {
+     * schemes { key: "oauth" value { list: ["read"] } }
+     * }
+     * security {
+     * schemes { key: "api-key" }
+     * schemes { key: "mtls" }
+     * }
+     * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + public org.a2aproject.sdk.compat03.grpc.Security.Builder addSecurityBuilder() { + return internalGetSecurityFieldBuilder().addBuilder( + org.a2aproject.sdk.compat03.grpc.Security.getDefaultInstance()); + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security requirements for contacting the agent.
+     * This list can be seen as an OR of ANDs. Each object in the list describes
+     * one possible set of security requirements that must be present on a
+     * request. This allows specifying, for example, "callers must either use
+     * OAuth OR an API Key AND mTLS."
+     * Example:
+     * security {
+     * schemes { key: "oauth" value { list: ["read"] } }
+     * }
+     * security {
+     * schemes { key: "api-key" }
+     * schemes { key: "mtls" }
+     * }
+     * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + public org.a2aproject.sdk.compat03.grpc.Security.Builder addSecurityBuilder( + int index) { + return internalGetSecurityFieldBuilder().addBuilder( + index, org.a2aproject.sdk.compat03.grpc.Security.getDefaultInstance()); + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security requirements for contacting the agent.
+     * This list can be seen as an OR of ANDs. Each object in the list describes
+     * one possible set of security requirements that must be present on a
+     * request. This allows specifying, for example, "callers must either use
+     * OAuth OR an API Key AND mTLS."
+     * Example:
+     * security {
+     * schemes { key: "oauth" value { list: ["read"] } }
+     * }
+     * security {
+     * schemes { key: "api-key" }
+     * schemes { key: "mtls" }
+     * }
+     * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + public java.util.List + getSecurityBuilderList() { + return internalGetSecurityFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Security, org.a2aproject.sdk.compat03.grpc.Security.Builder, org.a2aproject.sdk.compat03.grpc.SecurityOrBuilder> + internalGetSecurityFieldBuilder() { + if (securityBuilder_ == null) { + securityBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Security, org.a2aproject.sdk.compat03.grpc.Security.Builder, org.a2aproject.sdk.compat03.grpc.SecurityOrBuilder>( + security_, + ((bitField0_ & 0x00000800) != 0), + getParentForChildren(), + isClean()); + security_ = null; + } + return securityBuilder_; + } + + private com.google.protobuf.LazyStringArrayList defaultInputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + private void ensureDefaultInputModesIsMutable() { + if (!defaultInputModes_.isModifiable()) { + defaultInputModes_ = new com.google.protobuf.LazyStringArrayList(defaultInputModes_); + } + bitField0_ |= 0x00001000; + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * The set of interaction modes that the agent supports across all skills.
+     * This can be overridden per skill. Defined as mime types.
+     * 
+ * + * repeated string default_input_modes = 10; + * @return A list containing the defaultInputModes. + */ + public com.google.protobuf.ProtocolStringList + getDefaultInputModesList() { + defaultInputModes_.makeImmutable(); + return defaultInputModes_; + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * The set of interaction modes that the agent supports across all skills.
+     * This can be overridden per skill. Defined as mime types.
+     * 
+ * + * repeated string default_input_modes = 10; + * @return The count of defaultInputModes. + */ + public int getDefaultInputModesCount() { + return defaultInputModes_.size(); + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * The set of interaction modes that the agent supports across all skills.
+     * This can be overridden per skill. Defined as mime types.
+     * 
+ * + * repeated string default_input_modes = 10; + * @param index The index of the element to return. + * @return The defaultInputModes at the given index. + */ + public java.lang.String getDefaultInputModes(int index) { + return defaultInputModes_.get(index); + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * The set of interaction modes that the agent supports across all skills.
+     * This can be overridden per skill. Defined as mime types.
+     * 
+ * + * repeated string default_input_modes = 10; + * @param index The index of the value to return. + * @return The bytes of the defaultInputModes at the given index. + */ + public com.google.protobuf.ByteString + getDefaultInputModesBytes(int index) { + return defaultInputModes_.getByteString(index); + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * The set of interaction modes that the agent supports across all skills.
+     * This can be overridden per skill. Defined as mime types.
+     * 
+ * + * repeated string default_input_modes = 10; + * @param index The index to set the value at. + * @param value The defaultInputModes to set. + * @return This builder for chaining. + */ + public Builder setDefaultInputModes( + int index, java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureDefaultInputModesIsMutable(); + defaultInputModes_.set(index, value); + bitField0_ |= 0x00001000; + onChanged(); + return this; + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * The set of interaction modes that the agent supports across all skills.
+     * This can be overridden per skill. Defined as mime types.
+     * 
+ * + * repeated string default_input_modes = 10; + * @param value The defaultInputModes to add. + * @return This builder for chaining. + */ + public Builder addDefaultInputModes( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureDefaultInputModesIsMutable(); + defaultInputModes_.add(value); + bitField0_ |= 0x00001000; + onChanged(); + return this; + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * The set of interaction modes that the agent supports across all skills.
+     * This can be overridden per skill. Defined as mime types.
+     * 
+ * + * repeated string default_input_modes = 10; + * @param values The defaultInputModes to add. + * @return This builder for chaining. + */ + public Builder addAllDefaultInputModes( + java.lang.Iterable values) { + ensureDefaultInputModesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, defaultInputModes_); + bitField0_ |= 0x00001000; + onChanged(); + return this; + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * The set of interaction modes that the agent supports across all skills.
+     * This can be overridden per skill. Defined as mime types.
+     * 
+ * + * repeated string default_input_modes = 10; + * @return This builder for chaining. + */ + public Builder clearDefaultInputModes() { + defaultInputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00001000);; + onChanged(); + return this; + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * The set of interaction modes that the agent supports across all skills.
+     * This can be overridden per skill. Defined as mime types.
+     * 
+ * + * repeated string default_input_modes = 10; + * @param value The bytes of the defaultInputModes to add. + * @return This builder for chaining. + */ + public Builder addDefaultInputModesBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + ensureDefaultInputModesIsMutable(); + defaultInputModes_.add(value); + bitField0_ |= 0x00001000; + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringArrayList defaultOutputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + private void ensureDefaultOutputModesIsMutable() { + if (!defaultOutputModes_.isModifiable()) { + defaultOutputModes_ = new com.google.protobuf.LazyStringArrayList(defaultOutputModes_); + } + bitField0_ |= 0x00002000; + } + /** + *
+     * The mime types supported as outputs from this agent.
+     * 
+ * + * repeated string default_output_modes = 11; + * @return A list containing the defaultOutputModes. + */ + public com.google.protobuf.ProtocolStringList + getDefaultOutputModesList() { + defaultOutputModes_.makeImmutable(); + return defaultOutputModes_; + } + /** + *
+     * The mime types supported as outputs from this agent.
+     * 
+ * + * repeated string default_output_modes = 11; + * @return The count of defaultOutputModes. + */ + public int getDefaultOutputModesCount() { + return defaultOutputModes_.size(); + } + /** + *
+     * The mime types supported as outputs from this agent.
+     * 
+ * + * repeated string default_output_modes = 11; + * @param index The index of the element to return. + * @return The defaultOutputModes at the given index. + */ + public java.lang.String getDefaultOutputModes(int index) { + return defaultOutputModes_.get(index); + } + /** + *
+     * The mime types supported as outputs from this agent.
+     * 
+ * + * repeated string default_output_modes = 11; + * @param index The index of the value to return. + * @return The bytes of the defaultOutputModes at the given index. + */ + public com.google.protobuf.ByteString + getDefaultOutputModesBytes(int index) { + return defaultOutputModes_.getByteString(index); + } + /** + *
+     * The mime types supported as outputs from this agent.
+     * 
+ * + * repeated string default_output_modes = 11; + * @param index The index to set the value at. + * @param value The defaultOutputModes to set. + * @return This builder for chaining. + */ + public Builder setDefaultOutputModes( + int index, java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureDefaultOutputModesIsMutable(); + defaultOutputModes_.set(index, value); + bitField0_ |= 0x00002000; + onChanged(); + return this; + } + /** + *
+     * The mime types supported as outputs from this agent.
+     * 
+ * + * repeated string default_output_modes = 11; + * @param value The defaultOutputModes to add. + * @return This builder for chaining. + */ + public Builder addDefaultOutputModes( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureDefaultOutputModesIsMutable(); + defaultOutputModes_.add(value); + bitField0_ |= 0x00002000; + onChanged(); + return this; + } + /** + *
+     * The mime types supported as outputs from this agent.
+     * 
+ * + * repeated string default_output_modes = 11; + * @param values The defaultOutputModes to add. + * @return This builder for chaining. + */ + public Builder addAllDefaultOutputModes( + java.lang.Iterable values) { + ensureDefaultOutputModesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, defaultOutputModes_); + bitField0_ |= 0x00002000; + onChanged(); + return this; + } + /** + *
+     * The mime types supported as outputs from this agent.
+     * 
+ * + * repeated string default_output_modes = 11; + * @return This builder for chaining. + */ + public Builder clearDefaultOutputModes() { + defaultOutputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00002000);; + onChanged(); + return this; + } + /** + *
+     * The mime types supported as outputs from this agent.
+     * 
+ * + * repeated string default_output_modes = 11; + * @param value The bytes of the defaultOutputModes to add. + * @return This builder for chaining. + */ + public Builder addDefaultOutputModesBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + ensureDefaultOutputModesIsMutable(); + defaultOutputModes_.add(value); + bitField0_ |= 0x00002000; + onChanged(); + return this; + } + + private java.util.List skills_ = + java.util.Collections.emptyList(); + private void ensureSkillsIsMutable() { + if (!((bitField0_ & 0x00004000) != 0)) { + skills_ = new java.util.ArrayList(skills_); + bitField0_ |= 0x00004000; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AgentSkill, org.a2aproject.sdk.compat03.grpc.AgentSkill.Builder, org.a2aproject.sdk.compat03.grpc.AgentSkillOrBuilder> skillsBuilder_; + + /** + *
+     * Skills represent a unit of ability an agent can perform. This may
+     * somewhat abstract but represents a more focused set of actions that the
+     * agent is highly likely to succeed at.
+     * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + public java.util.List getSkillsList() { + if (skillsBuilder_ == null) { + return java.util.Collections.unmodifiableList(skills_); + } else { + return skillsBuilder_.getMessageList(); + } + } + /** + *
+     * Skills represent a unit of ability an agent can perform. This may
+     * somewhat abstract but represents a more focused set of actions that the
+     * agent is highly likely to succeed at.
+     * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + public int getSkillsCount() { + if (skillsBuilder_ == null) { + return skills_.size(); + } else { + return skillsBuilder_.getCount(); + } + } + /** + *
+     * Skills represent a unit of ability an agent can perform. This may
+     * somewhat abstract but represents a more focused set of actions that the
+     * agent is highly likely to succeed at.
+     * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + public org.a2aproject.sdk.compat03.grpc.AgentSkill getSkills(int index) { + if (skillsBuilder_ == null) { + return skills_.get(index); + } else { + return skillsBuilder_.getMessage(index); + } + } + /** + *
+     * Skills represent a unit of ability an agent can perform. This may
+     * somewhat abstract but represents a more focused set of actions that the
+     * agent is highly likely to succeed at.
+     * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + public Builder setSkills( + int index, org.a2aproject.sdk.compat03.grpc.AgentSkill value) { + if (skillsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSkillsIsMutable(); + skills_.set(index, value); + onChanged(); + } else { + skillsBuilder_.setMessage(index, value); + } + return this; + } + /** + *
+     * Skills represent a unit of ability an agent can perform. This may
+     * somewhat abstract but represents a more focused set of actions that the
+     * agent is highly likely to succeed at.
+     * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + public Builder setSkills( + int index, org.a2aproject.sdk.compat03.grpc.AgentSkill.Builder builderForValue) { + if (skillsBuilder_ == null) { + ensureSkillsIsMutable(); + skills_.set(index, builderForValue.build()); + onChanged(); + } else { + skillsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * Skills represent a unit of ability an agent can perform. This may
+     * somewhat abstract but represents a more focused set of actions that the
+     * agent is highly likely to succeed at.
+     * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + public Builder addSkills(org.a2aproject.sdk.compat03.grpc.AgentSkill value) { + if (skillsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSkillsIsMutable(); + skills_.add(value); + onChanged(); + } else { + skillsBuilder_.addMessage(value); + } + return this; + } + /** + *
+     * Skills represent a unit of ability an agent can perform. This may
+     * somewhat abstract but represents a more focused set of actions that the
+     * agent is highly likely to succeed at.
+     * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + public Builder addSkills( + int index, org.a2aproject.sdk.compat03.grpc.AgentSkill value) { + if (skillsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSkillsIsMutable(); + skills_.add(index, value); + onChanged(); + } else { + skillsBuilder_.addMessage(index, value); + } + return this; + } + /** + *
+     * Skills represent a unit of ability an agent can perform. This may
+     * somewhat abstract but represents a more focused set of actions that the
+     * agent is highly likely to succeed at.
+     * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + public Builder addSkills( + org.a2aproject.sdk.compat03.grpc.AgentSkill.Builder builderForValue) { + if (skillsBuilder_ == null) { + ensureSkillsIsMutable(); + skills_.add(builderForValue.build()); + onChanged(); + } else { + skillsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + *
+     * Skills represent a unit of ability an agent can perform. This may
+     * somewhat abstract but represents a more focused set of actions that the
+     * agent is highly likely to succeed at.
+     * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + public Builder addSkills( + int index, org.a2aproject.sdk.compat03.grpc.AgentSkill.Builder builderForValue) { + if (skillsBuilder_ == null) { + ensureSkillsIsMutable(); + skills_.add(index, builderForValue.build()); + onChanged(); + } else { + skillsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * Skills represent a unit of ability an agent can perform. This may
+     * somewhat abstract but represents a more focused set of actions that the
+     * agent is highly likely to succeed at.
+     * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + public Builder addAllSkills( + java.lang.Iterable values) { + if (skillsBuilder_ == null) { + ensureSkillsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, skills_); + onChanged(); + } else { + skillsBuilder_.addAllMessages(values); + } + return this; + } + /** + *
+     * Skills represent a unit of ability an agent can perform. This may
+     * somewhat abstract but represents a more focused set of actions that the
+     * agent is highly likely to succeed at.
+     * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + public Builder clearSkills() { + if (skillsBuilder_ == null) { + skills_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00004000); + onChanged(); + } else { + skillsBuilder_.clear(); + } + return this; + } + /** + *
+     * Skills represent a unit of ability an agent can perform. This may
+     * somewhat abstract but represents a more focused set of actions that the
+     * agent is highly likely to succeed at.
+     * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + public Builder removeSkills(int index) { + if (skillsBuilder_ == null) { + ensureSkillsIsMutable(); + skills_.remove(index); + onChanged(); + } else { + skillsBuilder_.remove(index); + } + return this; + } + /** + *
+     * Skills represent a unit of ability an agent can perform. This may
+     * somewhat abstract but represents a more focused set of actions that the
+     * agent is highly likely to succeed at.
+     * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + public org.a2aproject.sdk.compat03.grpc.AgentSkill.Builder getSkillsBuilder( + int index) { + return internalGetSkillsFieldBuilder().getBuilder(index); + } + /** + *
+     * Skills represent a unit of ability an agent can perform. This may
+     * somewhat abstract but represents a more focused set of actions that the
+     * agent is highly likely to succeed at.
+     * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + public org.a2aproject.sdk.compat03.grpc.AgentSkillOrBuilder getSkillsOrBuilder( + int index) { + if (skillsBuilder_ == null) { + return skills_.get(index); } else { + return skillsBuilder_.getMessageOrBuilder(index); + } + } + /** + *
+     * Skills represent a unit of ability an agent can perform. This may
+     * somewhat abstract but represents a more focused set of actions that the
+     * agent is highly likely to succeed at.
+     * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + public java.util.List + getSkillsOrBuilderList() { + if (skillsBuilder_ != null) { + return skillsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(skills_); + } + } + /** + *
+     * Skills represent a unit of ability an agent can perform. This may
+     * somewhat abstract but represents a more focused set of actions that the
+     * agent is highly likely to succeed at.
+     * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + public org.a2aproject.sdk.compat03.grpc.AgentSkill.Builder addSkillsBuilder() { + return internalGetSkillsFieldBuilder().addBuilder( + org.a2aproject.sdk.compat03.grpc.AgentSkill.getDefaultInstance()); + } + /** + *
+     * Skills represent a unit of ability an agent can perform. This may
+     * somewhat abstract but represents a more focused set of actions that the
+     * agent is highly likely to succeed at.
+     * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + public org.a2aproject.sdk.compat03.grpc.AgentSkill.Builder addSkillsBuilder( + int index) { + return internalGetSkillsFieldBuilder().addBuilder( + index, org.a2aproject.sdk.compat03.grpc.AgentSkill.getDefaultInstance()); + } + /** + *
+     * Skills represent a unit of ability an agent can perform. This may
+     * somewhat abstract but represents a more focused set of actions that the
+     * agent is highly likely to succeed at.
+     * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + public java.util.List + getSkillsBuilderList() { + return internalGetSkillsFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AgentSkill, org.a2aproject.sdk.compat03.grpc.AgentSkill.Builder, org.a2aproject.sdk.compat03.grpc.AgentSkillOrBuilder> + internalGetSkillsFieldBuilder() { + if (skillsBuilder_ == null) { + skillsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AgentSkill, org.a2aproject.sdk.compat03.grpc.AgentSkill.Builder, org.a2aproject.sdk.compat03.grpc.AgentSkillOrBuilder>( + skills_, + ((bitField0_ & 0x00004000) != 0), + getParentForChildren(), + isClean()); + skills_ = null; + } + return skillsBuilder_; + } + + private boolean supportsAuthenticatedExtendedCard_ ; + /** + *
+     * Whether the agent supports providing an extended agent card when
+     * the user is authenticated, i.e. is the card from .well-known
+     * different than the card from GetAgentCard.
+     * 
+ * + * bool supports_authenticated_extended_card = 13; + * @return The supportsAuthenticatedExtendedCard. + */ + @java.lang.Override + public boolean getSupportsAuthenticatedExtendedCard() { + return supportsAuthenticatedExtendedCard_; + } + /** + *
+     * Whether the agent supports providing an extended agent card when
+     * the user is authenticated, i.e. is the card from .well-known
+     * different than the card from GetAgentCard.
+     * 
+ * + * bool supports_authenticated_extended_card = 13; + * @param value The supportsAuthenticatedExtendedCard to set. + * @return This builder for chaining. + */ + public Builder setSupportsAuthenticatedExtendedCard(boolean value) { + + supportsAuthenticatedExtendedCard_ = value; + bitField0_ |= 0x00008000; + onChanged(); + return this; + } + /** + *
+     * Whether the agent supports providing an extended agent card when
+     * the user is authenticated, i.e. is the card from .well-known
+     * different than the card from GetAgentCard.
+     * 
+ * + * bool supports_authenticated_extended_card = 13; + * @return This builder for chaining. + */ + public Builder clearSupportsAuthenticatedExtendedCard() { + bitField0_ = (bitField0_ & ~0x00008000); + supportsAuthenticatedExtendedCard_ = false; + onChanged(); + return this; + } + + private java.util.List signatures_ = + java.util.Collections.emptyList(); + private void ensureSignaturesIsMutable() { + if (!((bitField0_ & 0x00010000) != 0)) { + signatures_ = new java.util.ArrayList(signatures_); + bitField0_ |= 0x00010000; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AgentCardSignature, org.a2aproject.sdk.compat03.grpc.AgentCardSignature.Builder, org.a2aproject.sdk.compat03.grpc.AgentCardSignatureOrBuilder> signaturesBuilder_; + + /** + *
+     * JSON Web Signatures computed for this AgentCard.
+     * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + public java.util.List getSignaturesList() { + if (signaturesBuilder_ == null) { + return java.util.Collections.unmodifiableList(signatures_); + } else { + return signaturesBuilder_.getMessageList(); + } + } + /** + *
+     * JSON Web Signatures computed for this AgentCard.
+     * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + public int getSignaturesCount() { + if (signaturesBuilder_ == null) { + return signatures_.size(); + } else { + return signaturesBuilder_.getCount(); + } + } + /** + *
+     * JSON Web Signatures computed for this AgentCard.
+     * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + public org.a2aproject.sdk.compat03.grpc.AgentCardSignature getSignatures(int index) { + if (signaturesBuilder_ == null) { + return signatures_.get(index); + } else { + return signaturesBuilder_.getMessage(index); + } + } + /** + *
+     * JSON Web Signatures computed for this AgentCard.
+     * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + public Builder setSignatures( + int index, org.a2aproject.sdk.compat03.grpc.AgentCardSignature value) { + if (signaturesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSignaturesIsMutable(); + signatures_.set(index, value); + onChanged(); + } else { + signaturesBuilder_.setMessage(index, value); + } + return this; + } + /** + *
+     * JSON Web Signatures computed for this AgentCard.
+     * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + public Builder setSignatures( + int index, org.a2aproject.sdk.compat03.grpc.AgentCardSignature.Builder builderForValue) { + if (signaturesBuilder_ == null) { + ensureSignaturesIsMutable(); + signatures_.set(index, builderForValue.build()); + onChanged(); + } else { + signaturesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * JSON Web Signatures computed for this AgentCard.
+     * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + public Builder addSignatures(org.a2aproject.sdk.compat03.grpc.AgentCardSignature value) { + if (signaturesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSignaturesIsMutable(); + signatures_.add(value); + onChanged(); + } else { + signaturesBuilder_.addMessage(value); + } + return this; + } + /** + *
+     * JSON Web Signatures computed for this AgentCard.
+     * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + public Builder addSignatures( + int index, org.a2aproject.sdk.compat03.grpc.AgentCardSignature value) { + if (signaturesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSignaturesIsMutable(); + signatures_.add(index, value); + onChanged(); + } else { + signaturesBuilder_.addMessage(index, value); + } + return this; + } + /** + *
+     * JSON Web Signatures computed for this AgentCard.
+     * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + public Builder addSignatures( + org.a2aproject.sdk.compat03.grpc.AgentCardSignature.Builder builderForValue) { + if (signaturesBuilder_ == null) { + ensureSignaturesIsMutable(); + signatures_.add(builderForValue.build()); + onChanged(); + } else { + signaturesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + *
+     * JSON Web Signatures computed for this AgentCard.
+     * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + public Builder addSignatures( + int index, org.a2aproject.sdk.compat03.grpc.AgentCardSignature.Builder builderForValue) { + if (signaturesBuilder_ == null) { + ensureSignaturesIsMutable(); + signatures_.add(index, builderForValue.build()); + onChanged(); + } else { + signaturesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * JSON Web Signatures computed for this AgentCard.
+     * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + public Builder addAllSignatures( + java.lang.Iterable values) { + if (signaturesBuilder_ == null) { + ensureSignaturesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, signatures_); + onChanged(); + } else { + signaturesBuilder_.addAllMessages(values); + } + return this; + } + /** + *
+     * JSON Web Signatures computed for this AgentCard.
+     * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + public Builder clearSignatures() { + if (signaturesBuilder_ == null) { + signatures_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00010000); + onChanged(); + } else { + signaturesBuilder_.clear(); + } + return this; + } + /** + *
+     * JSON Web Signatures computed for this AgentCard.
+     * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + public Builder removeSignatures(int index) { + if (signaturesBuilder_ == null) { + ensureSignaturesIsMutable(); + signatures_.remove(index); + onChanged(); + } else { + signaturesBuilder_.remove(index); + } + return this; + } + /** + *
+     * JSON Web Signatures computed for this AgentCard.
+     * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + public org.a2aproject.sdk.compat03.grpc.AgentCardSignature.Builder getSignaturesBuilder( + int index) { + return internalGetSignaturesFieldBuilder().getBuilder(index); + } + /** + *
+     * JSON Web Signatures computed for this AgentCard.
+     * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + public org.a2aproject.sdk.compat03.grpc.AgentCardSignatureOrBuilder getSignaturesOrBuilder( + int index) { + if (signaturesBuilder_ == null) { + return signatures_.get(index); } else { + return signaturesBuilder_.getMessageOrBuilder(index); + } + } + /** + *
+     * JSON Web Signatures computed for this AgentCard.
+     * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + public java.util.List + getSignaturesOrBuilderList() { + if (signaturesBuilder_ != null) { + return signaturesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(signatures_); + } + } + /** + *
+     * JSON Web Signatures computed for this AgentCard.
+     * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + public org.a2aproject.sdk.compat03.grpc.AgentCardSignature.Builder addSignaturesBuilder() { + return internalGetSignaturesFieldBuilder().addBuilder( + org.a2aproject.sdk.compat03.grpc.AgentCardSignature.getDefaultInstance()); + } + /** + *
+     * JSON Web Signatures computed for this AgentCard.
+     * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + public org.a2aproject.sdk.compat03.grpc.AgentCardSignature.Builder addSignaturesBuilder( + int index) { + return internalGetSignaturesFieldBuilder().addBuilder( + index, org.a2aproject.sdk.compat03.grpc.AgentCardSignature.getDefaultInstance()); + } + /** + *
+     * JSON Web Signatures computed for this AgentCard.
+     * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + public java.util.List + getSignaturesBuilderList() { + return internalGetSignaturesFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AgentCardSignature, org.a2aproject.sdk.compat03.grpc.AgentCardSignature.Builder, org.a2aproject.sdk.compat03.grpc.AgentCardSignatureOrBuilder> + internalGetSignaturesFieldBuilder() { + if (signaturesBuilder_ == null) { + signaturesBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AgentCardSignature, org.a2aproject.sdk.compat03.grpc.AgentCardSignature.Builder, org.a2aproject.sdk.compat03.grpc.AgentCardSignatureOrBuilder>( + signatures_, + ((bitField0_ & 0x00010000) != 0), + getParentForChildren(), + isClean()); + signatures_ = null; + } + return signaturesBuilder_; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.AgentCard) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.AgentCard) + private static final org.a2aproject.sdk.compat03.grpc.AgentCard DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.AgentCard(); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentCard getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AgentCard parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentCard getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentCardOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentCardOrBuilder.java new file mode 100644 index 000000000..43a03abd3 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentCardOrBuilder.java @@ -0,0 +1,626 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface AgentCardOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.AgentCard) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The version of the A2A protocol this agent supports.
+   * 
+ * + * string protocol_version = 16; + * @return The protocolVersion. + */ + java.lang.String getProtocolVersion(); + /** + *
+   * The version of the A2A protocol this agent supports.
+   * 
+ * + * string protocol_version = 16; + * @return The bytes for protocolVersion. + */ + com.google.protobuf.ByteString + getProtocolVersionBytes(); + + /** + *
+   * A human readable name for the agent.
+   * Example: "Recipe Agent"
+   * 
+ * + * string name = 1; + * @return The name. + */ + java.lang.String getName(); + /** + *
+   * A human readable name for the agent.
+   * Example: "Recipe Agent"
+   * 
+ * + * string name = 1; + * @return The bytes for name. + */ + com.google.protobuf.ByteString + getNameBytes(); + + /** + *
+   * A description of the agent's domain of action/solution space.
+   * Example: "Agent that helps users with recipes and cooking."
+   * 
+ * + * string description = 2; + * @return The description. + */ + java.lang.String getDescription(); + /** + *
+   * A description of the agent's domain of action/solution space.
+   * Example: "Agent that helps users with recipes and cooking."
+   * 
+ * + * string description = 2; + * @return The bytes for description. + */ + com.google.protobuf.ByteString + getDescriptionBytes(); + + /** + *
+   * A URL to the address the agent is hosted at. This represents the
+   * preferred endpoint as declared by the agent.
+   * 
+ * + * string url = 3; + * @return The url. + */ + java.lang.String getUrl(); + /** + *
+   * A URL to the address the agent is hosted at. This represents the
+   * preferred endpoint as declared by the agent.
+   * 
+ * + * string url = 3; + * @return The bytes for url. + */ + com.google.protobuf.ByteString + getUrlBytes(); + + /** + *
+   * The transport of the preferred endpoint. If empty, defaults to JSONRPC.
+   * 
+ * + * string preferred_transport = 14; + * @return The preferredTransport. + */ + java.lang.String getPreferredTransport(); + /** + *
+   * The transport of the preferred endpoint. If empty, defaults to JSONRPC.
+   * 
+ * + * string preferred_transport = 14; + * @return The bytes for preferredTransport. + */ + com.google.protobuf.ByteString + getPreferredTransportBytes(); + + /** + *
+   * Announcement of additional supported transports. Client can use any of
+   * the supported transports.
+   * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + java.util.List + getAdditionalInterfacesList(); + /** + *
+   * Announcement of additional supported transports. Client can use any of
+   * the supported transports.
+   * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + org.a2aproject.sdk.compat03.grpc.AgentInterface getAdditionalInterfaces(int index); + /** + *
+   * Announcement of additional supported transports. Client can use any of
+   * the supported transports.
+   * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + int getAdditionalInterfacesCount(); + /** + *
+   * Announcement of additional supported transports. Client can use any of
+   * the supported transports.
+   * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + java.util.List + getAdditionalInterfacesOrBuilderList(); + /** + *
+   * Announcement of additional supported transports. Client can use any of
+   * the supported transports.
+   * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + org.a2aproject.sdk.compat03.grpc.AgentInterfaceOrBuilder getAdditionalInterfacesOrBuilder( + int index); + + /** + *
+   * The service provider of the agent.
+   * 
+ * + * .a2a.v1.AgentProvider provider = 4; + * @return Whether the provider field is set. + */ + boolean hasProvider(); + /** + *
+   * The service provider of the agent.
+   * 
+ * + * .a2a.v1.AgentProvider provider = 4; + * @return The provider. + */ + org.a2aproject.sdk.compat03.grpc.AgentProvider getProvider(); + /** + *
+   * The service provider of the agent.
+   * 
+ * + * .a2a.v1.AgentProvider provider = 4; + */ + org.a2aproject.sdk.compat03.grpc.AgentProviderOrBuilder getProviderOrBuilder(); + + /** + *
+   * The version of the agent.
+   * Example: "1.0.0"
+   * 
+ * + * string version = 5; + * @return The version. + */ + java.lang.String getVersion(); + /** + *
+   * The version of the agent.
+   * Example: "1.0.0"
+   * 
+ * + * string version = 5; + * @return The bytes for version. + */ + com.google.protobuf.ByteString + getVersionBytes(); + + /** + *
+   * A url to provide additional documentation about the agent.
+   * 
+ * + * string documentation_url = 6; + * @return The documentationUrl. + */ + java.lang.String getDocumentationUrl(); + /** + *
+   * A url to provide additional documentation about the agent.
+   * 
+ * + * string documentation_url = 6; + * @return The bytes for documentationUrl. + */ + com.google.protobuf.ByteString + getDocumentationUrlBytes(); + + /** + *
+   * A2A Capability set supported by the agent.
+   * 
+ * + * .a2a.v1.AgentCapabilities capabilities = 7; + * @return Whether the capabilities field is set. + */ + boolean hasCapabilities(); + /** + *
+   * A2A Capability set supported by the agent.
+   * 
+ * + * .a2a.v1.AgentCapabilities capabilities = 7; + * @return The capabilities. + */ + org.a2aproject.sdk.compat03.grpc.AgentCapabilities getCapabilities(); + /** + *
+   * A2A Capability set supported by the agent.
+   * 
+ * + * .a2a.v1.AgentCapabilities capabilities = 7; + */ + org.a2aproject.sdk.compat03.grpc.AgentCapabilitiesOrBuilder getCapabilitiesOrBuilder(); + + /** + *
+   * The security scheme details used for authenticating with this agent.
+   * 
+ * + * map<string, .a2a.v1.SecurityScheme> security_schemes = 8; + */ + int getSecuritySchemesCount(); + /** + *
+   * The security scheme details used for authenticating with this agent.
+   * 
+ * + * map<string, .a2a.v1.SecurityScheme> security_schemes = 8; + */ + boolean containsSecuritySchemes( + java.lang.String key); + /** + * Use {@link #getSecuritySchemesMap()} instead. + */ + @java.lang.Deprecated + java.util.Map + getSecuritySchemes(); + /** + *
+   * The security scheme details used for authenticating with this agent.
+   * 
+ * + * map<string, .a2a.v1.SecurityScheme> security_schemes = 8; + */ + java.util.Map + getSecuritySchemesMap(); + /** + *
+   * The security scheme details used for authenticating with this agent.
+   * 
+ * + * map<string, .a2a.v1.SecurityScheme> security_schemes = 8; + */ + /* nullable */ +org.a2aproject.sdk.compat03.grpc.SecurityScheme getSecuritySchemesOrDefault( + java.lang.String key, + /* nullable */ +org.a2aproject.sdk.compat03.grpc.SecurityScheme defaultValue); + /** + *
+   * The security scheme details used for authenticating with this agent.
+   * 
+ * + * map<string, .a2a.v1.SecurityScheme> security_schemes = 8; + */ + org.a2aproject.sdk.compat03.grpc.SecurityScheme getSecuritySchemesOrThrow( + java.lang.String key); + + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Security requirements for contacting the agent.
+   * This list can be seen as an OR of ANDs. Each object in the list describes
+   * one possible set of security requirements that must be present on a
+   * request. This allows specifying, for example, "callers must either use
+   * OAuth OR an API Key AND mTLS."
+   * Example:
+   * security {
+   * schemes { key: "oauth" value { list: ["read"] } }
+   * }
+   * security {
+   * schemes { key: "api-key" }
+   * schemes { key: "mtls" }
+   * }
+   * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + java.util.List + getSecurityList(); + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Security requirements for contacting the agent.
+   * This list can be seen as an OR of ANDs. Each object in the list describes
+   * one possible set of security requirements that must be present on a
+   * request. This allows specifying, for example, "callers must either use
+   * OAuth OR an API Key AND mTLS."
+   * Example:
+   * security {
+   * schemes { key: "oauth" value { list: ["read"] } }
+   * }
+   * security {
+   * schemes { key: "api-key" }
+   * schemes { key: "mtls" }
+   * }
+   * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + org.a2aproject.sdk.compat03.grpc.Security getSecurity(int index); + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Security requirements for contacting the agent.
+   * This list can be seen as an OR of ANDs. Each object in the list describes
+   * one possible set of security requirements that must be present on a
+   * request. This allows specifying, for example, "callers must either use
+   * OAuth OR an API Key AND mTLS."
+   * Example:
+   * security {
+   * schemes { key: "oauth" value { list: ["read"] } }
+   * }
+   * security {
+   * schemes { key: "api-key" }
+   * schemes { key: "mtls" }
+   * }
+   * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + int getSecurityCount(); + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Security requirements for contacting the agent.
+   * This list can be seen as an OR of ANDs. Each object in the list describes
+   * one possible set of security requirements that must be present on a
+   * request. This allows specifying, for example, "callers must either use
+   * OAuth OR an API Key AND mTLS."
+   * Example:
+   * security {
+   * schemes { key: "oauth" value { list: ["read"] } }
+   * }
+   * security {
+   * schemes { key: "api-key" }
+   * schemes { key: "mtls" }
+   * }
+   * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + java.util.List + getSecurityOrBuilderList(); + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Security requirements for contacting the agent.
+   * This list can be seen as an OR of ANDs. Each object in the list describes
+   * one possible set of security requirements that must be present on a
+   * request. This allows specifying, for example, "callers must either use
+   * OAuth OR an API Key AND mTLS."
+   * Example:
+   * security {
+   * schemes { key: "oauth" value { list: ["read"] } }
+   * }
+   * security {
+   * schemes { key: "api-key" }
+   * schemes { key: "mtls" }
+   * }
+   * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + org.a2aproject.sdk.compat03.grpc.SecurityOrBuilder getSecurityOrBuilder( + int index); + + /** + *
+   * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+   * The set of interaction modes that the agent supports across all skills.
+   * This can be overridden per skill. Defined as mime types.
+   * 
+ * + * repeated string default_input_modes = 10; + * @return A list containing the defaultInputModes. + */ + java.util.List + getDefaultInputModesList(); + /** + *
+   * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+   * The set of interaction modes that the agent supports across all skills.
+   * This can be overridden per skill. Defined as mime types.
+   * 
+ * + * repeated string default_input_modes = 10; + * @return The count of defaultInputModes. + */ + int getDefaultInputModesCount(); + /** + *
+   * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+   * The set of interaction modes that the agent supports across all skills.
+   * This can be overridden per skill. Defined as mime types.
+   * 
+ * + * repeated string default_input_modes = 10; + * @param index The index of the element to return. + * @return The defaultInputModes at the given index. + */ + java.lang.String getDefaultInputModes(int index); + /** + *
+   * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+   * The set of interaction modes that the agent supports across all skills.
+   * This can be overridden per skill. Defined as mime types.
+   * 
+ * + * repeated string default_input_modes = 10; + * @param index The index of the value to return. + * @return The bytes of the defaultInputModes at the given index. + */ + com.google.protobuf.ByteString + getDefaultInputModesBytes(int index); + + /** + *
+   * The mime types supported as outputs from this agent.
+   * 
+ * + * repeated string default_output_modes = 11; + * @return A list containing the defaultOutputModes. + */ + java.util.List + getDefaultOutputModesList(); + /** + *
+   * The mime types supported as outputs from this agent.
+   * 
+ * + * repeated string default_output_modes = 11; + * @return The count of defaultOutputModes. + */ + int getDefaultOutputModesCount(); + /** + *
+   * The mime types supported as outputs from this agent.
+   * 
+ * + * repeated string default_output_modes = 11; + * @param index The index of the element to return. + * @return The defaultOutputModes at the given index. + */ + java.lang.String getDefaultOutputModes(int index); + /** + *
+   * The mime types supported as outputs from this agent.
+   * 
+ * + * repeated string default_output_modes = 11; + * @param index The index of the value to return. + * @return The bytes of the defaultOutputModes at the given index. + */ + com.google.protobuf.ByteString + getDefaultOutputModesBytes(int index); + + /** + *
+   * Skills represent a unit of ability an agent can perform. This may
+   * somewhat abstract but represents a more focused set of actions that the
+   * agent is highly likely to succeed at.
+   * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + java.util.List + getSkillsList(); + /** + *
+   * Skills represent a unit of ability an agent can perform. This may
+   * somewhat abstract but represents a more focused set of actions that the
+   * agent is highly likely to succeed at.
+   * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + org.a2aproject.sdk.compat03.grpc.AgentSkill getSkills(int index); + /** + *
+   * Skills represent a unit of ability an agent can perform. This may
+   * somewhat abstract but represents a more focused set of actions that the
+   * agent is highly likely to succeed at.
+   * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + int getSkillsCount(); + /** + *
+   * Skills represent a unit of ability an agent can perform. This may
+   * somewhat abstract but represents a more focused set of actions that the
+   * agent is highly likely to succeed at.
+   * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + java.util.List + getSkillsOrBuilderList(); + /** + *
+   * Skills represent a unit of ability an agent can perform. This may
+   * somewhat abstract but represents a more focused set of actions that the
+   * agent is highly likely to succeed at.
+   * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + org.a2aproject.sdk.compat03.grpc.AgentSkillOrBuilder getSkillsOrBuilder( + int index); + + /** + *
+   * Whether the agent supports providing an extended agent card when
+   * the user is authenticated, i.e. is the card from .well-known
+   * different than the card from GetAgentCard.
+   * 
+ * + * bool supports_authenticated_extended_card = 13; + * @return The supportsAuthenticatedExtendedCard. + */ + boolean getSupportsAuthenticatedExtendedCard(); + + /** + *
+   * JSON Web Signatures computed for this AgentCard.
+   * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + java.util.List + getSignaturesList(); + /** + *
+   * JSON Web Signatures computed for this AgentCard.
+   * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + org.a2aproject.sdk.compat03.grpc.AgentCardSignature getSignatures(int index); + /** + *
+   * JSON Web Signatures computed for this AgentCard.
+   * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + int getSignaturesCount(); + /** + *
+   * JSON Web Signatures computed for this AgentCard.
+   * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + java.util.List + getSignaturesOrBuilderList(); + /** + *
+   * JSON Web Signatures computed for this AgentCard.
+   * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + org.a2aproject.sdk.compat03.grpc.AgentCardSignatureOrBuilder getSignaturesOrBuilder( + int index); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentCardSignature.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentCardSignature.java new file mode 100644 index 000000000..8fa5c42dc --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentCardSignature.java @@ -0,0 +1,952 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * AgentCardSignature represents a JWS signature of an AgentCard.
+ * This follows the JSON format of an RFC 7515 JSON Web Signature (JWS).
+ * 
+ * + * Protobuf type {@code a2a.v1.AgentCardSignature} + */ +@com.google.protobuf.Generated +public final class AgentCardSignature extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.AgentCardSignature) + AgentCardSignatureOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "AgentCardSignature"); + } + // Use AgentCardSignature.newBuilder() to construct. + private AgentCardSignature(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private AgentCardSignature() { + protected_ = ""; + signature_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_AgentCardSignature_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_AgentCardSignature_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.AgentCardSignature.class, org.a2aproject.sdk.compat03.grpc.AgentCardSignature.Builder.class); + } + + private int bitField0_; + public static final int PROTECTED_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object protected_ = ""; + /** + *
+   * The protected JWS header for the signature. This is always a
+   * base64url-encoded JSON object. Required.
+   * 
+ * + * string protected = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The protected. + */ + @java.lang.Override + public java.lang.String getProtected() { + java.lang.Object ref = protected_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + protected_ = s; + return s; + } + } + /** + *
+   * The protected JWS header for the signature. This is always a
+   * base64url-encoded JSON object. Required.
+   * 
+ * + * string protected = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The bytes for protected. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getProtectedBytes() { + java.lang.Object ref = protected_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + protected_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SIGNATURE_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object signature_ = ""; + /** + *
+   * The computed signature, base64url-encoded. Required.
+   * 
+ * + * string signature = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return The signature. + */ + @java.lang.Override + public java.lang.String getSignature() { + java.lang.Object ref = signature_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + signature_ = s; + return s; + } + } + /** + *
+   * The computed signature, base64url-encoded. Required.
+   * 
+ * + * string signature = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return The bytes for signature. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getSignatureBytes() { + java.lang.Object ref = signature_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + signature_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int HEADER_FIELD_NUMBER = 3; + private com.google.protobuf.Struct header_; + /** + *
+   * The unprotected JWS header values.
+   * 
+ * + * .google.protobuf.Struct header = 3; + * @return Whether the header field is set. + */ + @java.lang.Override + public boolean hasHeader() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + *
+   * The unprotected JWS header values.
+   * 
+ * + * .google.protobuf.Struct header = 3; + * @return The header. + */ + @java.lang.Override + public com.google.protobuf.Struct getHeader() { + return header_ == null ? com.google.protobuf.Struct.getDefaultInstance() : header_; + } + /** + *
+   * The unprotected JWS header values.
+   * 
+ * + * .google.protobuf.Struct header = 3; + */ + @java.lang.Override + public com.google.protobuf.StructOrBuilder getHeaderOrBuilder() { + return header_ == null ? com.google.protobuf.Struct.getDefaultInstance() : header_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(protected_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, protected_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(signature_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, signature_); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(3, getHeader()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(protected_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, protected_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(signature_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, signature_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, getHeader()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.AgentCardSignature)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.AgentCardSignature other = (org.a2aproject.sdk.compat03.grpc.AgentCardSignature) obj; + + if (!getProtected() + .equals(other.getProtected())) return false; + if (!getSignature() + .equals(other.getSignature())) return false; + if (hasHeader() != other.hasHeader()) return false; + if (hasHeader()) { + if (!getHeader() + .equals(other.getHeader())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PROTECTED_FIELD_NUMBER; + hash = (53 * hash) + getProtected().hashCode(); + hash = (37 * hash) + SIGNATURE_FIELD_NUMBER; + hash = (53 * hash) + getSignature().hashCode(); + if (hasHeader()) { + hash = (37 * hash) + HEADER_FIELD_NUMBER; + hash = (53 * hash) + getHeader().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.AgentCardSignature parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCardSignature parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCardSignature parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCardSignature parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCardSignature parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCardSignature parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCardSignature parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCardSignature parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentCardSignature parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentCardSignature parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCardSignature parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCardSignature parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.AgentCardSignature prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * AgentCardSignature represents a JWS signature of an AgentCard.
+   * This follows the JSON format of an RFC 7515 JSON Web Signature (JWS).
+   * 
+ * + * Protobuf type {@code a2a.v1.AgentCardSignature} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.AgentCardSignature) + org.a2aproject.sdk.compat03.grpc.AgentCardSignatureOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_AgentCardSignature_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_AgentCardSignature_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.AgentCardSignature.class, org.a2aproject.sdk.compat03.grpc.AgentCardSignature.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.AgentCardSignature.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage + .alwaysUseFieldBuilders) { + internalGetHeaderFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + protected_ = ""; + signature_ = ""; + header_ = null; + if (headerBuilder_ != null) { + headerBuilder_.dispose(); + headerBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_AgentCardSignature_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentCardSignature getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.AgentCardSignature.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentCardSignature build() { + org.a2aproject.sdk.compat03.grpc.AgentCardSignature result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentCardSignature buildPartial() { + org.a2aproject.sdk.compat03.grpc.AgentCardSignature result = new org.a2aproject.sdk.compat03.grpc.AgentCardSignature(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.AgentCardSignature result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.protected_ = protected_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.signature_ = signature_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000004) != 0)) { + result.header_ = headerBuilder_ == null + ? header_ + : headerBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.AgentCardSignature) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.AgentCardSignature)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.AgentCardSignature other) { + if (other == org.a2aproject.sdk.compat03.grpc.AgentCardSignature.getDefaultInstance()) return this; + if (!other.getProtected().isEmpty()) { + protected_ = other.protected_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getSignature().isEmpty()) { + signature_ = other.signature_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (other.hasHeader()) { + mergeHeader(other.getHeader()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + protected_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + signature_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: { + input.readMessage( + internalGetHeaderFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object protected_ = ""; + /** + *
+     * The protected JWS header for the signature. This is always a
+     * base64url-encoded JSON object. Required.
+     * 
+ * + * string protected = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The protected. + */ + public java.lang.String getProtected() { + java.lang.Object ref = protected_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + protected_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The protected JWS header for the signature. This is always a
+     * base64url-encoded JSON object. Required.
+     * 
+ * + * string protected = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The bytes for protected. + */ + public com.google.protobuf.ByteString + getProtectedBytes() { + java.lang.Object ref = protected_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + protected_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The protected JWS header for the signature. This is always a
+     * base64url-encoded JSON object. Required.
+     * 
+ * + * string protected = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param value The protected to set. + * @return This builder for chaining. + */ + public Builder setProtected( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + protected_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * The protected JWS header for the signature. This is always a
+     * base64url-encoded JSON object. Required.
+     * 
+ * + * string protected = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return This builder for chaining. + */ + public Builder clearProtected() { + protected_ = getDefaultInstance().getProtected(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * The protected JWS header for the signature. This is always a
+     * base64url-encoded JSON object. Required.
+     * 
+ * + * string protected = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param value The bytes for protected to set. + * @return This builder for chaining. + */ + public Builder setProtectedBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + protected_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object signature_ = ""; + /** + *
+     * The computed signature, base64url-encoded. Required.
+     * 
+ * + * string signature = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return The signature. + */ + public java.lang.String getSignature() { + java.lang.Object ref = signature_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + signature_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The computed signature, base64url-encoded. Required.
+     * 
+ * + * string signature = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return The bytes for signature. + */ + public com.google.protobuf.ByteString + getSignatureBytes() { + java.lang.Object ref = signature_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + signature_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The computed signature, base64url-encoded. Required.
+     * 
+ * + * string signature = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param value The signature to set. + * @return This builder for chaining. + */ + public Builder setSignature( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + signature_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * The computed signature, base64url-encoded. Required.
+     * 
+ * + * string signature = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return This builder for chaining. + */ + public Builder clearSignature() { + signature_ = getDefaultInstance().getSignature(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * The computed signature, base64url-encoded. Required.
+     * 
+ * + * string signature = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param value The bytes for signature to set. + * @return This builder for chaining. + */ + public Builder setSignatureBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + signature_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private com.google.protobuf.Struct header_; + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> headerBuilder_; + /** + *
+     * The unprotected JWS header values.
+     * 
+ * + * .google.protobuf.Struct header = 3; + * @return Whether the header field is set. + */ + public boolean hasHeader() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + *
+     * The unprotected JWS header values.
+     * 
+ * + * .google.protobuf.Struct header = 3; + * @return The header. + */ + public com.google.protobuf.Struct getHeader() { + if (headerBuilder_ == null) { + return header_ == null ? com.google.protobuf.Struct.getDefaultInstance() : header_; + } else { + return headerBuilder_.getMessage(); + } + } + /** + *
+     * The unprotected JWS header values.
+     * 
+ * + * .google.protobuf.Struct header = 3; + */ + public Builder setHeader(com.google.protobuf.Struct value) { + if (headerBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + header_ = value; + } else { + headerBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * The unprotected JWS header values.
+     * 
+ * + * .google.protobuf.Struct header = 3; + */ + public Builder setHeader( + com.google.protobuf.Struct.Builder builderForValue) { + if (headerBuilder_ == null) { + header_ = builderForValue.build(); + } else { + headerBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * The unprotected JWS header values.
+     * 
+ * + * .google.protobuf.Struct header = 3; + */ + public Builder mergeHeader(com.google.protobuf.Struct value) { + if (headerBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0) && + header_ != null && + header_ != com.google.protobuf.Struct.getDefaultInstance()) { + getHeaderBuilder().mergeFrom(value); + } else { + header_ = value; + } + } else { + headerBuilder_.mergeFrom(value); + } + if (header_ != null) { + bitField0_ |= 0x00000004; + onChanged(); + } + return this; + } + /** + *
+     * The unprotected JWS header values.
+     * 
+ * + * .google.protobuf.Struct header = 3; + */ + public Builder clearHeader() { + bitField0_ = (bitField0_ & ~0x00000004); + header_ = null; + if (headerBuilder_ != null) { + headerBuilder_.dispose(); + headerBuilder_ = null; + } + onChanged(); + return this; + } + /** + *
+     * The unprotected JWS header values.
+     * 
+ * + * .google.protobuf.Struct header = 3; + */ + public com.google.protobuf.Struct.Builder getHeaderBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return internalGetHeaderFieldBuilder().getBuilder(); + } + /** + *
+     * The unprotected JWS header values.
+     * 
+ * + * .google.protobuf.Struct header = 3; + */ + public com.google.protobuf.StructOrBuilder getHeaderOrBuilder() { + if (headerBuilder_ != null) { + return headerBuilder_.getMessageOrBuilder(); + } else { + return header_ == null ? + com.google.protobuf.Struct.getDefaultInstance() : header_; + } + } + /** + *
+     * The unprotected JWS header values.
+     * 
+ * + * .google.protobuf.Struct header = 3; + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> + internalGetHeaderFieldBuilder() { + if (headerBuilder_ == null) { + headerBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder>( + getHeader(), + getParentForChildren(), + isClean()); + header_ = null; + } + return headerBuilder_; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.AgentCardSignature) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.AgentCardSignature) + private static final org.a2aproject.sdk.compat03.grpc.AgentCardSignature DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.AgentCardSignature(); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentCardSignature getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AgentCardSignature parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentCardSignature getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentCardSignatureOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentCardSignatureOrBuilder.java new file mode 100644 index 000000000..eb40168b0 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentCardSignatureOrBuilder.java @@ -0,0 +1,81 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface AgentCardSignatureOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.AgentCardSignature) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The protected JWS header for the signature. This is always a
+   * base64url-encoded JSON object. Required.
+   * 
+ * + * string protected = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The protected. + */ + java.lang.String getProtected(); + /** + *
+   * The protected JWS header for the signature. This is always a
+   * base64url-encoded JSON object. Required.
+   * 
+ * + * string protected = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The bytes for protected. + */ + com.google.protobuf.ByteString + getProtectedBytes(); + + /** + *
+   * The computed signature, base64url-encoded. Required.
+   * 
+ * + * string signature = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return The signature. + */ + java.lang.String getSignature(); + /** + *
+   * The computed signature, base64url-encoded. Required.
+   * 
+ * + * string signature = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return The bytes for signature. + */ + com.google.protobuf.ByteString + getSignatureBytes(); + + /** + *
+   * The unprotected JWS header values.
+   * 
+ * + * .google.protobuf.Struct header = 3; + * @return Whether the header field is set. + */ + boolean hasHeader(); + /** + *
+   * The unprotected JWS header values.
+   * 
+ * + * .google.protobuf.Struct header = 3; + * @return The header. + */ + com.google.protobuf.Struct getHeader(); + /** + *
+   * The unprotected JWS header values.
+   * 
+ * + * .google.protobuf.Struct header = 3; + */ + com.google.protobuf.StructOrBuilder getHeaderOrBuilder(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentExtension.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentExtension.java new file mode 100644 index 000000000..a378d85b9 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentExtension.java @@ -0,0 +1,1044 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * A declaration of an extension supported by an Agent.
+ * 
+ * + * Protobuf type {@code a2a.v1.AgentExtension} + */ +@com.google.protobuf.Generated +public final class AgentExtension extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.AgentExtension) + AgentExtensionOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "AgentExtension"); + } + // Use AgentExtension.newBuilder() to construct. + private AgentExtension(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private AgentExtension() { + uri_ = ""; + description_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_AgentExtension_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_AgentExtension_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.AgentExtension.class, org.a2aproject.sdk.compat03.grpc.AgentExtension.Builder.class); + } + + private int bitField0_; + public static final int URI_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object uri_ = ""; + /** + *
+   * The URI of the extension.
+   * Example: "https://developers.google.com/identity/protocols/oauth2"
+   * 
+ * + * string uri = 1; + * @return The uri. + */ + @java.lang.Override + public java.lang.String getUri() { + java.lang.Object ref = uri_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uri_ = s; + return s; + } + } + /** + *
+   * The URI of the extension.
+   * Example: "https://developers.google.com/identity/protocols/oauth2"
+   * 
+ * + * string uri = 1; + * @return The bytes for uri. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getUriBytes() { + java.lang.Object ref = uri_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + uri_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DESCRIPTION_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object description_ = ""; + /** + *
+   * A description of how this agent uses this extension.
+   * Example: "Google OAuth 2.0 authentication"
+   * 
+ * + * string description = 2; + * @return The description. + */ + @java.lang.Override + public java.lang.String getDescription() { + java.lang.Object ref = description_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + description_ = s; + return s; + } + } + /** + *
+   * A description of how this agent uses this extension.
+   * Example: "Google OAuth 2.0 authentication"
+   * 
+ * + * string description = 2; + * @return The bytes for description. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int REQUIRED_FIELD_NUMBER = 3; + private boolean required_ = false; + /** + *
+   * Whether the client must follow specific requirements of the extension.
+   * Example: false
+   * 
+ * + * bool required = 3; + * @return The required. + */ + @java.lang.Override + public boolean getRequired() { + return required_; + } + + public static final int PARAMS_FIELD_NUMBER = 4; + private com.google.protobuf.Struct params_; + /** + *
+   * Optional configuration for the extension.
+   * 
+ * + * .google.protobuf.Struct params = 4; + * @return Whether the params field is set. + */ + @java.lang.Override + public boolean hasParams() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + *
+   * Optional configuration for the extension.
+   * 
+ * + * .google.protobuf.Struct params = 4; + * @return The params. + */ + @java.lang.Override + public com.google.protobuf.Struct getParams() { + return params_ == null ? com.google.protobuf.Struct.getDefaultInstance() : params_; + } + /** + *
+   * Optional configuration for the extension.
+   * 
+ * + * .google.protobuf.Struct params = 4; + */ + @java.lang.Override + public com.google.protobuf.StructOrBuilder getParamsOrBuilder() { + return params_ == null ? com.google.protobuf.Struct.getDefaultInstance() : params_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(uri_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, uri_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(description_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, description_); + } + if (required_ != false) { + output.writeBool(3, required_); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(4, getParams()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(uri_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, uri_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(description_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, description_); + } + if (required_ != false) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(3, required_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, getParams()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.AgentExtension)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.AgentExtension other = (org.a2aproject.sdk.compat03.grpc.AgentExtension) obj; + + if (!getUri() + .equals(other.getUri())) return false; + if (!getDescription() + .equals(other.getDescription())) return false; + if (getRequired() + != other.getRequired()) return false; + if (hasParams() != other.hasParams()) return false; + if (hasParams()) { + if (!getParams() + .equals(other.getParams())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + URI_FIELD_NUMBER; + hash = (53 * hash) + getUri().hashCode(); + hash = (37 * hash) + DESCRIPTION_FIELD_NUMBER; + hash = (53 * hash) + getDescription().hashCode(); + hash = (37 * hash) + REQUIRED_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( + getRequired()); + if (hasParams()) { + hash = (37 * hash) + PARAMS_FIELD_NUMBER; + hash = (53 * hash) + getParams().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.AgentExtension parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentExtension parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentExtension parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentExtension parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentExtension parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentExtension parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentExtension parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.AgentExtension parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentExtension parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentExtension parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentExtension parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.AgentExtension parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.AgentExtension prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * A declaration of an extension supported by an Agent.
+   * 
+ * + * Protobuf type {@code a2a.v1.AgentExtension} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.AgentExtension) + org.a2aproject.sdk.compat03.grpc.AgentExtensionOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_AgentExtension_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_AgentExtension_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.AgentExtension.class, org.a2aproject.sdk.compat03.grpc.AgentExtension.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.AgentExtension.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage + .alwaysUseFieldBuilders) { + internalGetParamsFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + uri_ = ""; + description_ = ""; + required_ = false; + params_ = null; + if (paramsBuilder_ != null) { + paramsBuilder_.dispose(); + paramsBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_AgentExtension_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentExtension getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.AgentExtension.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentExtension build() { + org.a2aproject.sdk.compat03.grpc.AgentExtension result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentExtension buildPartial() { + org.a2aproject.sdk.compat03.grpc.AgentExtension result = new org.a2aproject.sdk.compat03.grpc.AgentExtension(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.AgentExtension result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.uri_ = uri_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.description_ = description_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.required_ = required_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000008) != 0)) { + result.params_ = paramsBuilder_ == null + ? params_ + : paramsBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.AgentExtension) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.AgentExtension)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.AgentExtension other) { + if (other == org.a2aproject.sdk.compat03.grpc.AgentExtension.getDefaultInstance()) return this; + if (!other.getUri().isEmpty()) { + uri_ = other.uri_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getDescription().isEmpty()) { + description_ = other.description_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (other.getRequired() != false) { + setRequired(other.getRequired()); + } + if (other.hasParams()) { + mergeParams(other.getParams()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + uri_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + description_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 24: { + required_ = input.readBool(); + bitField0_ |= 0x00000004; + break; + } // case 24 + case 34: { + input.readMessage( + internalGetParamsFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000008; + break; + } // case 34 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object uri_ = ""; + /** + *
+     * The URI of the extension.
+     * Example: "https://developers.google.com/identity/protocols/oauth2"
+     * 
+ * + * string uri = 1; + * @return The uri. + */ + public java.lang.String getUri() { + java.lang.Object ref = uri_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uri_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The URI of the extension.
+     * Example: "https://developers.google.com/identity/protocols/oauth2"
+     * 
+ * + * string uri = 1; + * @return The bytes for uri. + */ + public com.google.protobuf.ByteString + getUriBytes() { + java.lang.Object ref = uri_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + uri_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The URI of the extension.
+     * Example: "https://developers.google.com/identity/protocols/oauth2"
+     * 
+ * + * string uri = 1; + * @param value The uri to set. + * @return This builder for chaining. + */ + public Builder setUri( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + uri_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * The URI of the extension.
+     * Example: "https://developers.google.com/identity/protocols/oauth2"
+     * 
+ * + * string uri = 1; + * @return This builder for chaining. + */ + public Builder clearUri() { + uri_ = getDefaultInstance().getUri(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * The URI of the extension.
+     * Example: "https://developers.google.com/identity/protocols/oauth2"
+     * 
+ * + * string uri = 1; + * @param value The bytes for uri to set. + * @return This builder for chaining. + */ + public Builder setUriBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + uri_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object description_ = ""; + /** + *
+     * A description of how this agent uses this extension.
+     * Example: "Google OAuth 2.0 authentication"
+     * 
+ * + * string description = 2; + * @return The description. + */ + public java.lang.String getDescription() { + java.lang.Object ref = description_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + description_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * A description of how this agent uses this extension.
+     * Example: "Google OAuth 2.0 authentication"
+     * 
+ * + * string description = 2; + * @return The bytes for description. + */ + public com.google.protobuf.ByteString + getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * A description of how this agent uses this extension.
+     * Example: "Google OAuth 2.0 authentication"
+     * 
+ * + * string description = 2; + * @param value The description to set. + * @return This builder for chaining. + */ + public Builder setDescription( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + description_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * A description of how this agent uses this extension.
+     * Example: "Google OAuth 2.0 authentication"
+     * 
+ * + * string description = 2; + * @return This builder for chaining. + */ + public Builder clearDescription() { + description_ = getDefaultInstance().getDescription(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * A description of how this agent uses this extension.
+     * Example: "Google OAuth 2.0 authentication"
+     * 
+ * + * string description = 2; + * @param value The bytes for description to set. + * @return This builder for chaining. + */ + public Builder setDescriptionBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + description_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private boolean required_ ; + /** + *
+     * Whether the client must follow specific requirements of the extension.
+     * Example: false
+     * 
+ * + * bool required = 3; + * @return The required. + */ + @java.lang.Override + public boolean getRequired() { + return required_; + } + /** + *
+     * Whether the client must follow specific requirements of the extension.
+     * Example: false
+     * 
+ * + * bool required = 3; + * @param value The required to set. + * @return This builder for chaining. + */ + public Builder setRequired(boolean value) { + + required_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * Whether the client must follow specific requirements of the extension.
+     * Example: false
+     * 
+ * + * bool required = 3; + * @return This builder for chaining. + */ + public Builder clearRequired() { + bitField0_ = (bitField0_ & ~0x00000004); + required_ = false; + onChanged(); + return this; + } + + private com.google.protobuf.Struct params_; + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> paramsBuilder_; + /** + *
+     * Optional configuration for the extension.
+     * 
+ * + * .google.protobuf.Struct params = 4; + * @return Whether the params field is set. + */ + public boolean hasParams() { + return ((bitField0_ & 0x00000008) != 0); + } + /** + *
+     * Optional configuration for the extension.
+     * 
+ * + * .google.protobuf.Struct params = 4; + * @return The params. + */ + public com.google.protobuf.Struct getParams() { + if (paramsBuilder_ == null) { + return params_ == null ? com.google.protobuf.Struct.getDefaultInstance() : params_; + } else { + return paramsBuilder_.getMessage(); + } + } + /** + *
+     * Optional configuration for the extension.
+     * 
+ * + * .google.protobuf.Struct params = 4; + */ + public Builder setParams(com.google.protobuf.Struct value) { + if (paramsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + params_ = value; + } else { + paramsBuilder_.setMessage(value); + } + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + *
+     * Optional configuration for the extension.
+     * 
+ * + * .google.protobuf.Struct params = 4; + */ + public Builder setParams( + com.google.protobuf.Struct.Builder builderForValue) { + if (paramsBuilder_ == null) { + params_ = builderForValue.build(); + } else { + paramsBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + *
+     * Optional configuration for the extension.
+     * 
+ * + * .google.protobuf.Struct params = 4; + */ + public Builder mergeParams(com.google.protobuf.Struct value) { + if (paramsBuilder_ == null) { + if (((bitField0_ & 0x00000008) != 0) && + params_ != null && + params_ != com.google.protobuf.Struct.getDefaultInstance()) { + getParamsBuilder().mergeFrom(value); + } else { + params_ = value; + } + } else { + paramsBuilder_.mergeFrom(value); + } + if (params_ != null) { + bitField0_ |= 0x00000008; + onChanged(); + } + return this; + } + /** + *
+     * Optional configuration for the extension.
+     * 
+ * + * .google.protobuf.Struct params = 4; + */ + public Builder clearParams() { + bitField0_ = (bitField0_ & ~0x00000008); + params_ = null; + if (paramsBuilder_ != null) { + paramsBuilder_.dispose(); + paramsBuilder_ = null; + } + onChanged(); + return this; + } + /** + *
+     * Optional configuration for the extension.
+     * 
+ * + * .google.protobuf.Struct params = 4; + */ + public com.google.protobuf.Struct.Builder getParamsBuilder() { + bitField0_ |= 0x00000008; + onChanged(); + return internalGetParamsFieldBuilder().getBuilder(); + } + /** + *
+     * Optional configuration for the extension.
+     * 
+ * + * .google.protobuf.Struct params = 4; + */ + public com.google.protobuf.StructOrBuilder getParamsOrBuilder() { + if (paramsBuilder_ != null) { + return paramsBuilder_.getMessageOrBuilder(); + } else { + return params_ == null ? + com.google.protobuf.Struct.getDefaultInstance() : params_; + } + } + /** + *
+     * Optional configuration for the extension.
+     * 
+ * + * .google.protobuf.Struct params = 4; + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> + internalGetParamsFieldBuilder() { + if (paramsBuilder_ == null) { + paramsBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder>( + getParams(), + getParentForChildren(), + isClean()); + params_ = null; + } + return paramsBuilder_; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.AgentExtension) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.AgentExtension) + private static final org.a2aproject.sdk.compat03.grpc.AgentExtension DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.AgentExtension(); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentExtension getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AgentExtension parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentExtension getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentExtensionOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentExtensionOrBuilder.java new file mode 100644 index 000000000..bbd435191 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentExtensionOrBuilder.java @@ -0,0 +1,94 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface AgentExtensionOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.AgentExtension) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The URI of the extension.
+   * Example: "https://developers.google.com/identity/protocols/oauth2"
+   * 
+ * + * string uri = 1; + * @return The uri. + */ + java.lang.String getUri(); + /** + *
+   * The URI of the extension.
+   * Example: "https://developers.google.com/identity/protocols/oauth2"
+   * 
+ * + * string uri = 1; + * @return The bytes for uri. + */ + com.google.protobuf.ByteString + getUriBytes(); + + /** + *
+   * A description of how this agent uses this extension.
+   * Example: "Google OAuth 2.0 authentication"
+   * 
+ * + * string description = 2; + * @return The description. + */ + java.lang.String getDescription(); + /** + *
+   * A description of how this agent uses this extension.
+   * Example: "Google OAuth 2.0 authentication"
+   * 
+ * + * string description = 2; + * @return The bytes for description. + */ + com.google.protobuf.ByteString + getDescriptionBytes(); + + /** + *
+   * Whether the client must follow specific requirements of the extension.
+   * Example: false
+   * 
+ * + * bool required = 3; + * @return The required. + */ + boolean getRequired(); + + /** + *
+   * Optional configuration for the extension.
+   * 
+ * + * .google.protobuf.Struct params = 4; + * @return Whether the params field is set. + */ + boolean hasParams(); + /** + *
+   * Optional configuration for the extension.
+   * 
+ * + * .google.protobuf.Struct params = 4; + * @return The params. + */ + com.google.protobuf.Struct getParams(); + /** + *
+   * Optional configuration for the extension.
+   * 
+ * + * .google.protobuf.Struct params = 4; + */ + com.google.protobuf.StructOrBuilder getParamsOrBuilder(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentInterface.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentInterface.java new file mode 100644 index 000000000..cb918a27e --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentInterface.java @@ -0,0 +1,716 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * Defines additional transport information for the agent.
+ * 
+ * + * Protobuf type {@code a2a.v1.AgentInterface} + */ +@com.google.protobuf.Generated +public final class AgentInterface extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.AgentInterface) + AgentInterfaceOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "AgentInterface"); + } + // Use AgentInterface.newBuilder() to construct. + private AgentInterface(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private AgentInterface() { + url_ = ""; + transport_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_AgentInterface_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_AgentInterface_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.AgentInterface.class, org.a2aproject.sdk.compat03.grpc.AgentInterface.Builder.class); + } + + public static final int URL_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object url_ = ""; + /** + *
+   * The url this interface is found at.
+   * 
+ * + * string url = 1; + * @return The url. + */ + @java.lang.Override + public java.lang.String getUrl() { + java.lang.Object ref = url_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + url_ = s; + return s; + } + } + /** + *
+   * The url this interface is found at.
+   * 
+ * + * string url = 1; + * @return The bytes for url. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getUrlBytes() { + java.lang.Object ref = url_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + url_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int TRANSPORT_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object transport_ = ""; + /** + *
+   * The transport supported this url. This is an open form string, to be
+   * easily extended for many transport protocols. The core ones officially
+   * supported are JSONRPC, GRPC and HTTP+JSON.
+   * 
+ * + * string transport = 2; + * @return The transport. + */ + @java.lang.Override + public java.lang.String getTransport() { + java.lang.Object ref = transport_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + transport_ = s; + return s; + } + } + /** + *
+   * The transport supported this url. This is an open form string, to be
+   * easily extended for many transport protocols. The core ones officially
+   * supported are JSONRPC, GRPC and HTTP+JSON.
+   * 
+ * + * string transport = 2; + * @return The bytes for transport. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getTransportBytes() { + java.lang.Object ref = transport_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + transport_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(url_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, url_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(transport_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, transport_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(url_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, url_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(transport_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, transport_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.AgentInterface)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.AgentInterface other = (org.a2aproject.sdk.compat03.grpc.AgentInterface) obj; + + if (!getUrl() + .equals(other.getUrl())) return false; + if (!getTransport() + .equals(other.getTransport())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + URL_FIELD_NUMBER; + hash = (53 * hash) + getUrl().hashCode(); + hash = (37 * hash) + TRANSPORT_FIELD_NUMBER; + hash = (53 * hash) + getTransport().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.AgentInterface parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentInterface parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentInterface parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentInterface parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentInterface parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentInterface parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentInterface parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.AgentInterface parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentInterface parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentInterface parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentInterface parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.AgentInterface parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.AgentInterface prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * Defines additional transport information for the agent.
+   * 
+ * + * Protobuf type {@code a2a.v1.AgentInterface} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.AgentInterface) + org.a2aproject.sdk.compat03.grpc.AgentInterfaceOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_AgentInterface_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_AgentInterface_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.AgentInterface.class, org.a2aproject.sdk.compat03.grpc.AgentInterface.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.AgentInterface.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + url_ = ""; + transport_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_AgentInterface_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentInterface getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.AgentInterface.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentInterface build() { + org.a2aproject.sdk.compat03.grpc.AgentInterface result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentInterface buildPartial() { + org.a2aproject.sdk.compat03.grpc.AgentInterface result = new org.a2aproject.sdk.compat03.grpc.AgentInterface(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.AgentInterface result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.url_ = url_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.transport_ = transport_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.AgentInterface) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.AgentInterface)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.AgentInterface other) { + if (other == org.a2aproject.sdk.compat03.grpc.AgentInterface.getDefaultInstance()) return this; + if (!other.getUrl().isEmpty()) { + url_ = other.url_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getTransport().isEmpty()) { + transport_ = other.transport_; + bitField0_ |= 0x00000002; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + url_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + transport_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object url_ = ""; + /** + *
+     * The url this interface is found at.
+     * 
+ * + * string url = 1; + * @return The url. + */ + public java.lang.String getUrl() { + java.lang.Object ref = url_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + url_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The url this interface is found at.
+     * 
+ * + * string url = 1; + * @return The bytes for url. + */ + public com.google.protobuf.ByteString + getUrlBytes() { + java.lang.Object ref = url_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + url_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The url this interface is found at.
+     * 
+ * + * string url = 1; + * @param value The url to set. + * @return This builder for chaining. + */ + public Builder setUrl( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + url_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * The url this interface is found at.
+     * 
+ * + * string url = 1; + * @return This builder for chaining. + */ + public Builder clearUrl() { + url_ = getDefaultInstance().getUrl(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * The url this interface is found at.
+     * 
+ * + * string url = 1; + * @param value The bytes for url to set. + * @return This builder for chaining. + */ + public Builder setUrlBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + url_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object transport_ = ""; + /** + *
+     * The transport supported this url. This is an open form string, to be
+     * easily extended for many transport protocols. The core ones officially
+     * supported are JSONRPC, GRPC and HTTP+JSON.
+     * 
+ * + * string transport = 2; + * @return The transport. + */ + public java.lang.String getTransport() { + java.lang.Object ref = transport_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + transport_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The transport supported this url. This is an open form string, to be
+     * easily extended for many transport protocols. The core ones officially
+     * supported are JSONRPC, GRPC and HTTP+JSON.
+     * 
+ * + * string transport = 2; + * @return The bytes for transport. + */ + public com.google.protobuf.ByteString + getTransportBytes() { + java.lang.Object ref = transport_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + transport_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The transport supported this url. This is an open form string, to be
+     * easily extended for many transport protocols. The core ones officially
+     * supported are JSONRPC, GRPC and HTTP+JSON.
+     * 
+ * + * string transport = 2; + * @param value The transport to set. + * @return This builder for chaining. + */ + public Builder setTransport( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + transport_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * The transport supported this url. This is an open form string, to be
+     * easily extended for many transport protocols. The core ones officially
+     * supported are JSONRPC, GRPC and HTTP+JSON.
+     * 
+ * + * string transport = 2; + * @return This builder for chaining. + */ + public Builder clearTransport() { + transport_ = getDefaultInstance().getTransport(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * The transport supported this url. This is an open form string, to be
+     * easily extended for many transport protocols. The core ones officially
+     * supported are JSONRPC, GRPC and HTTP+JSON.
+     * 
+ * + * string transport = 2; + * @param value The bytes for transport to set. + * @return This builder for chaining. + */ + public Builder setTransportBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + transport_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.AgentInterface) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.AgentInterface) + private static final org.a2aproject.sdk.compat03.grpc.AgentInterface DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.AgentInterface(); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentInterface getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AgentInterface parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentInterface getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentInterfaceOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentInterfaceOrBuilder.java new file mode 100644 index 000000000..261794711 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentInterfaceOrBuilder.java @@ -0,0 +1,56 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface AgentInterfaceOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.AgentInterface) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The url this interface is found at.
+   * 
+ * + * string url = 1; + * @return The url. + */ + java.lang.String getUrl(); + /** + *
+   * The url this interface is found at.
+   * 
+ * + * string url = 1; + * @return The bytes for url. + */ + com.google.protobuf.ByteString + getUrlBytes(); + + /** + *
+   * The transport supported this url. This is an open form string, to be
+   * easily extended for many transport protocols. The core ones officially
+   * supported are JSONRPC, GRPC and HTTP+JSON.
+   * 
+ * + * string transport = 2; + * @return The transport. + */ + java.lang.String getTransport(); + /** + *
+   * The transport supported this url. This is an open form string, to be
+   * easily extended for many transport protocols. The core ones officially
+   * supported are JSONRPC, GRPC and HTTP+JSON.
+   * 
+ * + * string transport = 2; + * @return The bytes for transport. + */ + com.google.protobuf.ByteString + getTransportBytes(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentProvider.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentProvider.java new file mode 100644 index 000000000..c77d6fdd2 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentProvider.java @@ -0,0 +1,716 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * Represents information about the service provider of an agent.
+ * 
+ * + * Protobuf type {@code a2a.v1.AgentProvider} + */ +@com.google.protobuf.Generated +public final class AgentProvider extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.AgentProvider) + AgentProviderOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "AgentProvider"); + } + // Use AgentProvider.newBuilder() to construct. + private AgentProvider(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private AgentProvider() { + url_ = ""; + organization_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_AgentProvider_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_AgentProvider_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.AgentProvider.class, org.a2aproject.sdk.compat03.grpc.AgentProvider.Builder.class); + } + + public static final int URL_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object url_ = ""; + /** + *
+   * The providers reference url
+   * Example: "https://ai.google.dev"
+   * 
+ * + * string url = 1; + * @return The url. + */ + @java.lang.Override + public java.lang.String getUrl() { + java.lang.Object ref = url_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + url_ = s; + return s; + } + } + /** + *
+   * The providers reference url
+   * Example: "https://ai.google.dev"
+   * 
+ * + * string url = 1; + * @return The bytes for url. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getUrlBytes() { + java.lang.Object ref = url_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + url_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int ORGANIZATION_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object organization_ = ""; + /** + *
+   * The providers organization name
+   * Example: "Google"
+   * 
+ * + * string organization = 2; + * @return The organization. + */ + @java.lang.Override + public java.lang.String getOrganization() { + java.lang.Object ref = organization_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + organization_ = s; + return s; + } + } + /** + *
+   * The providers organization name
+   * Example: "Google"
+   * 
+ * + * string organization = 2; + * @return The bytes for organization. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getOrganizationBytes() { + java.lang.Object ref = organization_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + organization_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(url_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, url_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(organization_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, organization_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(url_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, url_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(organization_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, organization_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.AgentProvider)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.AgentProvider other = (org.a2aproject.sdk.compat03.grpc.AgentProvider) obj; + + if (!getUrl() + .equals(other.getUrl())) return false; + if (!getOrganization() + .equals(other.getOrganization())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + URL_FIELD_NUMBER; + hash = (53 * hash) + getUrl().hashCode(); + hash = (37 * hash) + ORGANIZATION_FIELD_NUMBER; + hash = (53 * hash) + getOrganization().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.AgentProvider parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentProvider parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentProvider parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentProvider parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentProvider parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentProvider parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentProvider parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.AgentProvider parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentProvider parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentProvider parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentProvider parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.AgentProvider parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.AgentProvider prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * Represents information about the service provider of an agent.
+   * 
+ * + * Protobuf type {@code a2a.v1.AgentProvider} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.AgentProvider) + org.a2aproject.sdk.compat03.grpc.AgentProviderOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_AgentProvider_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_AgentProvider_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.AgentProvider.class, org.a2aproject.sdk.compat03.grpc.AgentProvider.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.AgentProvider.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + url_ = ""; + organization_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_AgentProvider_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentProvider getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.AgentProvider.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentProvider build() { + org.a2aproject.sdk.compat03.grpc.AgentProvider result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentProvider buildPartial() { + org.a2aproject.sdk.compat03.grpc.AgentProvider result = new org.a2aproject.sdk.compat03.grpc.AgentProvider(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.AgentProvider result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.url_ = url_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.organization_ = organization_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.AgentProvider) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.AgentProvider)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.AgentProvider other) { + if (other == org.a2aproject.sdk.compat03.grpc.AgentProvider.getDefaultInstance()) return this; + if (!other.getUrl().isEmpty()) { + url_ = other.url_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getOrganization().isEmpty()) { + organization_ = other.organization_; + bitField0_ |= 0x00000002; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + url_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + organization_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object url_ = ""; + /** + *
+     * The providers reference url
+     * Example: "https://ai.google.dev"
+     * 
+ * + * string url = 1; + * @return The url. + */ + public java.lang.String getUrl() { + java.lang.Object ref = url_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + url_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The providers reference url
+     * Example: "https://ai.google.dev"
+     * 
+ * + * string url = 1; + * @return The bytes for url. + */ + public com.google.protobuf.ByteString + getUrlBytes() { + java.lang.Object ref = url_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + url_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The providers reference url
+     * Example: "https://ai.google.dev"
+     * 
+ * + * string url = 1; + * @param value The url to set. + * @return This builder for chaining. + */ + public Builder setUrl( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + url_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * The providers reference url
+     * Example: "https://ai.google.dev"
+     * 
+ * + * string url = 1; + * @return This builder for chaining. + */ + public Builder clearUrl() { + url_ = getDefaultInstance().getUrl(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * The providers reference url
+     * Example: "https://ai.google.dev"
+     * 
+ * + * string url = 1; + * @param value The bytes for url to set. + * @return This builder for chaining. + */ + public Builder setUrlBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + url_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object organization_ = ""; + /** + *
+     * The providers organization name
+     * Example: "Google"
+     * 
+ * + * string organization = 2; + * @return The organization. + */ + public java.lang.String getOrganization() { + java.lang.Object ref = organization_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + organization_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The providers organization name
+     * Example: "Google"
+     * 
+ * + * string organization = 2; + * @return The bytes for organization. + */ + public com.google.protobuf.ByteString + getOrganizationBytes() { + java.lang.Object ref = organization_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + organization_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The providers organization name
+     * Example: "Google"
+     * 
+ * + * string organization = 2; + * @param value The organization to set. + * @return This builder for chaining. + */ + public Builder setOrganization( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + organization_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * The providers organization name
+     * Example: "Google"
+     * 
+ * + * string organization = 2; + * @return This builder for chaining. + */ + public Builder clearOrganization() { + organization_ = getDefaultInstance().getOrganization(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * The providers organization name
+     * Example: "Google"
+     * 
+ * + * string organization = 2; + * @param value The bytes for organization to set. + * @return This builder for chaining. + */ + public Builder setOrganizationBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + organization_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.AgentProvider) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.AgentProvider) + private static final org.a2aproject.sdk.compat03.grpc.AgentProvider DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.AgentProvider(); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentProvider getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AgentProvider parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentProvider getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentProviderOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentProviderOrBuilder.java new file mode 100644 index 000000000..7335191a6 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentProviderOrBuilder.java @@ -0,0 +1,56 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface AgentProviderOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.AgentProvider) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The providers reference url
+   * Example: "https://ai.google.dev"
+   * 
+ * + * string url = 1; + * @return The url. + */ + java.lang.String getUrl(); + /** + *
+   * The providers reference url
+   * Example: "https://ai.google.dev"
+   * 
+ * + * string url = 1; + * @return The bytes for url. + */ + com.google.protobuf.ByteString + getUrlBytes(); + + /** + *
+   * The providers organization name
+   * Example: "Google"
+   * 
+ * + * string organization = 2; + * @return The organization. + */ + java.lang.String getOrganization(); + /** + *
+   * The providers organization name
+   * Example: "Google"
+   * 
+ * + * string organization = 2; + * @return The bytes for organization. + */ + com.google.protobuf.ByteString + getOrganizationBytes(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentSkill.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentSkill.java new file mode 100644 index 000000000..58832f364 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentSkill.java @@ -0,0 +1,2435 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * AgentSkill represents a unit of action/solution that the agent can perform.
+ * One can think of this as a type of highly reliable solution that an agent
+ * can be tasked to provide. Agents have the autonomy to choose how and when
+ * to use specific skills, but clients should have confidence that if the
+ * skill is defined that unit of action can be reliably performed.
+ * 
+ * + * Protobuf type {@code a2a.v1.AgentSkill} + */ +@com.google.protobuf.Generated +public final class AgentSkill extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.AgentSkill) + AgentSkillOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "AgentSkill"); + } + // Use AgentSkill.newBuilder() to construct. + private AgentSkill(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private AgentSkill() { + id_ = ""; + name_ = ""; + description_ = ""; + tags_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + examples_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + inputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + outputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + security_ = java.util.Collections.emptyList(); + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_AgentSkill_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_AgentSkill_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.AgentSkill.class, org.a2aproject.sdk.compat03.grpc.AgentSkill.Builder.class); + } + + public static final int ID_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object id_ = ""; + /** + *
+   * Unique id of the skill within this agent.
+   * 
+ * + * string id = 1; + * @return The id. + */ + @java.lang.Override + public java.lang.String getId() { + java.lang.Object ref = id_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + id_ = s; + return s; + } + } + /** + *
+   * Unique id of the skill within this agent.
+   * 
+ * + * string id = 1; + * @return The bytes for id. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getIdBytes() { + java.lang.Object ref = id_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + id_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int NAME_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + *
+   * A human readable name for the skill.
+   * 
+ * + * string name = 2; + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + *
+   * A human readable name for the skill.
+   * 
+ * + * string name = 2; + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DESCRIPTION_FIELD_NUMBER = 3; + @SuppressWarnings("serial") + private volatile java.lang.Object description_ = ""; + /** + *
+   * A human (or llm) readable description of the skill
+   * details and behaviors.
+   * 
+ * + * string description = 3; + * @return The description. + */ + @java.lang.Override + public java.lang.String getDescription() { + java.lang.Object ref = description_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + description_ = s; + return s; + } + } + /** + *
+   * A human (or llm) readable description of the skill
+   * details and behaviors.
+   * 
+ * + * string description = 3; + * @return The bytes for description. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int TAGS_FIELD_NUMBER = 4; + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList tags_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + /** + *
+   * A set of tags for the skill to enhance categorization/utilization.
+   * Example: ["cooking", "customer support", "billing"]
+   * 
+ * + * repeated string tags = 4; + * @return A list containing the tags. + */ + public com.google.protobuf.ProtocolStringList + getTagsList() { + return tags_; + } + /** + *
+   * A set of tags for the skill to enhance categorization/utilization.
+   * Example: ["cooking", "customer support", "billing"]
+   * 
+ * + * repeated string tags = 4; + * @return The count of tags. + */ + public int getTagsCount() { + return tags_.size(); + } + /** + *
+   * A set of tags for the skill to enhance categorization/utilization.
+   * Example: ["cooking", "customer support", "billing"]
+   * 
+ * + * repeated string tags = 4; + * @param index The index of the element to return. + * @return The tags at the given index. + */ + public java.lang.String getTags(int index) { + return tags_.get(index); + } + /** + *
+   * A set of tags for the skill to enhance categorization/utilization.
+   * Example: ["cooking", "customer support", "billing"]
+   * 
+ * + * repeated string tags = 4; + * @param index The index of the value to return. + * @return The bytes of the tags at the given index. + */ + public com.google.protobuf.ByteString + getTagsBytes(int index) { + return tags_.getByteString(index); + } + + public static final int EXAMPLES_FIELD_NUMBER = 5; + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList examples_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + /** + *
+   * A set of example queries that this skill is designed to address.
+   * These examples should help the caller to understand how to craft requests
+   * to the agent to achieve specific goals.
+   * Example: ["I need a recipe for bread"]
+   * 
+ * + * repeated string examples = 5; + * @return A list containing the examples. + */ + public com.google.protobuf.ProtocolStringList + getExamplesList() { + return examples_; + } + /** + *
+   * A set of example queries that this skill is designed to address.
+   * These examples should help the caller to understand how to craft requests
+   * to the agent to achieve specific goals.
+   * Example: ["I need a recipe for bread"]
+   * 
+ * + * repeated string examples = 5; + * @return The count of examples. + */ + public int getExamplesCount() { + return examples_.size(); + } + /** + *
+   * A set of example queries that this skill is designed to address.
+   * These examples should help the caller to understand how to craft requests
+   * to the agent to achieve specific goals.
+   * Example: ["I need a recipe for bread"]
+   * 
+ * + * repeated string examples = 5; + * @param index The index of the element to return. + * @return The examples at the given index. + */ + public java.lang.String getExamples(int index) { + return examples_.get(index); + } + /** + *
+   * A set of example queries that this skill is designed to address.
+   * These examples should help the caller to understand how to craft requests
+   * to the agent to achieve specific goals.
+   * Example: ["I need a recipe for bread"]
+   * 
+ * + * repeated string examples = 5; + * @param index The index of the value to return. + * @return The bytes of the examples at the given index. + */ + public com.google.protobuf.ByteString + getExamplesBytes(int index) { + return examples_.getByteString(index); + } + + public static final int INPUT_MODES_FIELD_NUMBER = 6; + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList inputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + /** + *
+   * Possible input modalities supported.
+   * 
+ * + * repeated string input_modes = 6; + * @return A list containing the inputModes. + */ + public com.google.protobuf.ProtocolStringList + getInputModesList() { + return inputModes_; + } + /** + *
+   * Possible input modalities supported.
+   * 
+ * + * repeated string input_modes = 6; + * @return The count of inputModes. + */ + public int getInputModesCount() { + return inputModes_.size(); + } + /** + *
+   * Possible input modalities supported.
+   * 
+ * + * repeated string input_modes = 6; + * @param index The index of the element to return. + * @return The inputModes at the given index. + */ + public java.lang.String getInputModes(int index) { + return inputModes_.get(index); + } + /** + *
+   * Possible input modalities supported.
+   * 
+ * + * repeated string input_modes = 6; + * @param index The index of the value to return. + * @return The bytes of the inputModes at the given index. + */ + public com.google.protobuf.ByteString + getInputModesBytes(int index) { + return inputModes_.getByteString(index); + } + + public static final int OUTPUT_MODES_FIELD_NUMBER = 7; + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList outputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + /** + *
+   * Possible output modalities produced
+   * 
+ * + * repeated string output_modes = 7; + * @return A list containing the outputModes. + */ + public com.google.protobuf.ProtocolStringList + getOutputModesList() { + return outputModes_; + } + /** + *
+   * Possible output modalities produced
+   * 
+ * + * repeated string output_modes = 7; + * @return The count of outputModes. + */ + public int getOutputModesCount() { + return outputModes_.size(); + } + /** + *
+   * Possible output modalities produced
+   * 
+ * + * repeated string output_modes = 7; + * @param index The index of the element to return. + * @return The outputModes at the given index. + */ + public java.lang.String getOutputModes(int index) { + return outputModes_.get(index); + } + /** + *
+   * Possible output modalities produced
+   * 
+ * + * repeated string output_modes = 7; + * @param index The index of the value to return. + * @return The bytes of the outputModes at the given index. + */ + public com.google.protobuf.ByteString + getOutputModesBytes(int index) { + return outputModes_.getByteString(index); + } + + public static final int SECURITY_FIELD_NUMBER = 8; + @SuppressWarnings("serial") + private java.util.List security_; + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Security schemes necessary for the agent to leverage this skill.
+   * As in the overall AgentCard.security, this list represents a logical OR of
+   * security requirement objects. Each object is a set of security schemes
+   * that must be used together (a logical AND).
+   * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + @java.lang.Override + public java.util.List getSecurityList() { + return security_; + } + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Security schemes necessary for the agent to leverage this skill.
+   * As in the overall AgentCard.security, this list represents a logical OR of
+   * security requirement objects. Each object is a set of security schemes
+   * that must be used together (a logical AND).
+   * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + @java.lang.Override + public java.util.List + getSecurityOrBuilderList() { + return security_; + } + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Security schemes necessary for the agent to leverage this skill.
+   * As in the overall AgentCard.security, this list represents a logical OR of
+   * security requirement objects. Each object is a set of security schemes
+   * that must be used together (a logical AND).
+   * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + @java.lang.Override + public int getSecurityCount() { + return security_.size(); + } + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Security schemes necessary for the agent to leverage this skill.
+   * As in the overall AgentCard.security, this list represents a logical OR of
+   * security requirement objects. Each object is a set of security schemes
+   * that must be used together (a logical AND).
+   * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Security getSecurity(int index) { + return security_.get(index); + } + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Security schemes necessary for the agent to leverage this skill.
+   * As in the overall AgentCard.security, this list represents a logical OR of
+   * security requirement objects. Each object is a set of security schemes
+   * that must be used together (a logical AND).
+   * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SecurityOrBuilder getSecurityOrBuilder( + int index) { + return security_.get(index); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(id_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, id_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, name_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(description_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 3, description_); + } + for (int i = 0; i < tags_.size(); i++) { + com.google.protobuf.GeneratedMessage.writeString(output, 4, tags_.getRaw(i)); + } + for (int i = 0; i < examples_.size(); i++) { + com.google.protobuf.GeneratedMessage.writeString(output, 5, examples_.getRaw(i)); + } + for (int i = 0; i < inputModes_.size(); i++) { + com.google.protobuf.GeneratedMessage.writeString(output, 6, inputModes_.getRaw(i)); + } + for (int i = 0; i < outputModes_.size(); i++) { + com.google.protobuf.GeneratedMessage.writeString(output, 7, outputModes_.getRaw(i)); + } + for (int i = 0; i < security_.size(); i++) { + output.writeMessage(8, security_.get(i)); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(id_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, id_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, name_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(description_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(3, description_); + } + { + int dataSize = 0; + for (int i = 0; i < tags_.size(); i++) { + dataSize += computeStringSizeNoTag(tags_.getRaw(i)); + } + size += dataSize; + size += 1 * getTagsList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < examples_.size(); i++) { + dataSize += computeStringSizeNoTag(examples_.getRaw(i)); + } + size += dataSize; + size += 1 * getExamplesList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < inputModes_.size(); i++) { + dataSize += computeStringSizeNoTag(inputModes_.getRaw(i)); + } + size += dataSize; + size += 1 * getInputModesList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < outputModes_.size(); i++) { + dataSize += computeStringSizeNoTag(outputModes_.getRaw(i)); + } + size += dataSize; + size += 1 * getOutputModesList().size(); + } + for (int i = 0; i < security_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(8, security_.get(i)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.AgentSkill)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.AgentSkill other = (org.a2aproject.sdk.compat03.grpc.AgentSkill) obj; + + if (!getId() + .equals(other.getId())) return false; + if (!getName() + .equals(other.getName())) return false; + if (!getDescription() + .equals(other.getDescription())) return false; + if (!getTagsList() + .equals(other.getTagsList())) return false; + if (!getExamplesList() + .equals(other.getExamplesList())) return false; + if (!getInputModesList() + .equals(other.getInputModesList())) return false; + if (!getOutputModesList() + .equals(other.getOutputModesList())) return false; + if (!getSecurityList() + .equals(other.getSecurityList())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + ID_FIELD_NUMBER; + hash = (53 * hash) + getId().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + DESCRIPTION_FIELD_NUMBER; + hash = (53 * hash) + getDescription().hashCode(); + if (getTagsCount() > 0) { + hash = (37 * hash) + TAGS_FIELD_NUMBER; + hash = (53 * hash) + getTagsList().hashCode(); + } + if (getExamplesCount() > 0) { + hash = (37 * hash) + EXAMPLES_FIELD_NUMBER; + hash = (53 * hash) + getExamplesList().hashCode(); + } + if (getInputModesCount() > 0) { + hash = (37 * hash) + INPUT_MODES_FIELD_NUMBER; + hash = (53 * hash) + getInputModesList().hashCode(); + } + if (getOutputModesCount() > 0) { + hash = (37 * hash) + OUTPUT_MODES_FIELD_NUMBER; + hash = (53 * hash) + getOutputModesList().hashCode(); + } + if (getSecurityCount() > 0) { + hash = (37 * hash) + SECURITY_FIELD_NUMBER; + hash = (53 * hash) + getSecurityList().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.AgentSkill parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentSkill parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentSkill parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentSkill parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentSkill parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentSkill parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentSkill parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.AgentSkill parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentSkill parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentSkill parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentSkill parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.AgentSkill parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.AgentSkill prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * AgentSkill represents a unit of action/solution that the agent can perform.
+   * One can think of this as a type of highly reliable solution that an agent
+   * can be tasked to provide. Agents have the autonomy to choose how and when
+   * to use specific skills, but clients should have confidence that if the
+   * skill is defined that unit of action can be reliably performed.
+   * 
+ * + * Protobuf type {@code a2a.v1.AgentSkill} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.AgentSkill) + org.a2aproject.sdk.compat03.grpc.AgentSkillOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_AgentSkill_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_AgentSkill_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.AgentSkill.class, org.a2aproject.sdk.compat03.grpc.AgentSkill.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.AgentSkill.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + id_ = ""; + name_ = ""; + description_ = ""; + tags_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + examples_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + inputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + outputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + if (securityBuilder_ == null) { + security_ = java.util.Collections.emptyList(); + } else { + security_ = null; + securityBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000080); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_AgentSkill_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentSkill getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.AgentSkill.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentSkill build() { + org.a2aproject.sdk.compat03.grpc.AgentSkill result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentSkill buildPartial() { + org.a2aproject.sdk.compat03.grpc.AgentSkill result = new org.a2aproject.sdk.compat03.grpc.AgentSkill(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields(org.a2aproject.sdk.compat03.grpc.AgentSkill result) { + if (securityBuilder_ == null) { + if (((bitField0_ & 0x00000080) != 0)) { + security_ = java.util.Collections.unmodifiableList(security_); + bitField0_ = (bitField0_ & ~0x00000080); + } + result.security_ = security_; + } else { + result.security_ = securityBuilder_.build(); + } + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.AgentSkill result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.id_ = id_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.name_ = name_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.description_ = description_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + tags_.makeImmutable(); + result.tags_ = tags_; + } + if (((from_bitField0_ & 0x00000010) != 0)) { + examples_.makeImmutable(); + result.examples_ = examples_; + } + if (((from_bitField0_ & 0x00000020) != 0)) { + inputModes_.makeImmutable(); + result.inputModes_ = inputModes_; + } + if (((from_bitField0_ & 0x00000040) != 0)) { + outputModes_.makeImmutable(); + result.outputModes_ = outputModes_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.AgentSkill) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.AgentSkill)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.AgentSkill other) { + if (other == org.a2aproject.sdk.compat03.grpc.AgentSkill.getDefaultInstance()) return this; + if (!other.getId().isEmpty()) { + id_ = other.id_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (!other.getDescription().isEmpty()) { + description_ = other.description_; + bitField0_ |= 0x00000004; + onChanged(); + } + if (!other.tags_.isEmpty()) { + if (tags_.isEmpty()) { + tags_ = other.tags_; + bitField0_ |= 0x00000008; + } else { + ensureTagsIsMutable(); + tags_.addAll(other.tags_); + } + onChanged(); + } + if (!other.examples_.isEmpty()) { + if (examples_.isEmpty()) { + examples_ = other.examples_; + bitField0_ |= 0x00000010; + } else { + ensureExamplesIsMutable(); + examples_.addAll(other.examples_); + } + onChanged(); + } + if (!other.inputModes_.isEmpty()) { + if (inputModes_.isEmpty()) { + inputModes_ = other.inputModes_; + bitField0_ |= 0x00000020; + } else { + ensureInputModesIsMutable(); + inputModes_.addAll(other.inputModes_); + } + onChanged(); + } + if (!other.outputModes_.isEmpty()) { + if (outputModes_.isEmpty()) { + outputModes_ = other.outputModes_; + bitField0_ |= 0x00000040; + } else { + ensureOutputModesIsMutable(); + outputModes_.addAll(other.outputModes_); + } + onChanged(); + } + if (securityBuilder_ == null) { + if (!other.security_.isEmpty()) { + if (security_.isEmpty()) { + security_ = other.security_; + bitField0_ = (bitField0_ & ~0x00000080); + } else { + ensureSecurityIsMutable(); + security_.addAll(other.security_); + } + onChanged(); + } + } else { + if (!other.security_.isEmpty()) { + if (securityBuilder_.isEmpty()) { + securityBuilder_.dispose(); + securityBuilder_ = null; + security_ = other.security_; + bitField0_ = (bitField0_ & ~0x00000080); + securityBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + internalGetSecurityFieldBuilder() : null; + } else { + securityBuilder_.addAllMessages(other.security_); + } + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + id_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: { + description_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + case 34: { + java.lang.String s = input.readStringRequireUtf8(); + ensureTagsIsMutable(); + tags_.add(s); + break; + } // case 34 + case 42: { + java.lang.String s = input.readStringRequireUtf8(); + ensureExamplesIsMutable(); + examples_.add(s); + break; + } // case 42 + case 50: { + java.lang.String s = input.readStringRequireUtf8(); + ensureInputModesIsMutable(); + inputModes_.add(s); + break; + } // case 50 + case 58: { + java.lang.String s = input.readStringRequireUtf8(); + ensureOutputModesIsMutable(); + outputModes_.add(s); + break; + } // case 58 + case 66: { + org.a2aproject.sdk.compat03.grpc.Security m = + input.readMessage( + org.a2aproject.sdk.compat03.grpc.Security.parser(), + extensionRegistry); + if (securityBuilder_ == null) { + ensureSecurityIsMutable(); + security_.add(m); + } else { + securityBuilder_.addMessage(m); + } + break; + } // case 66 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object id_ = ""; + /** + *
+     * Unique id of the skill within this agent.
+     * 
+ * + * string id = 1; + * @return The id. + */ + public java.lang.String getId() { + java.lang.Object ref = id_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + id_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Unique id of the skill within this agent.
+     * 
+ * + * string id = 1; + * @return The bytes for id. + */ + public com.google.protobuf.ByteString + getIdBytes() { + java.lang.Object ref = id_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + id_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Unique id of the skill within this agent.
+     * 
+ * + * string id = 1; + * @param value The id to set. + * @return This builder for chaining. + */ + public Builder setId( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + id_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * Unique id of the skill within this agent.
+     * 
+ * + * string id = 1; + * @return This builder for chaining. + */ + public Builder clearId() { + id_ = getDefaultInstance().getId(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * Unique id of the skill within this agent.
+     * 
+ * + * string id = 1; + * @param value The bytes for id to set. + * @return This builder for chaining. + */ + public Builder setIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + id_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object name_ = ""; + /** + *
+     * A human readable name for the skill.
+     * 
+ * + * string name = 2; + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * A human readable name for the skill.
+     * 
+ * + * string name = 2; + * @return The bytes for name. + */ + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * A human readable name for the skill.
+     * 
+ * + * string name = 2; + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + name_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * A human readable name for the skill.
+     * 
+ * + * string name = 2; + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * A human readable name for the skill.
+     * 
+ * + * string name = 2; + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private java.lang.Object description_ = ""; + /** + *
+     * A human (or llm) readable description of the skill
+     * details and behaviors.
+     * 
+ * + * string description = 3; + * @return The description. + */ + public java.lang.String getDescription() { + java.lang.Object ref = description_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + description_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * A human (or llm) readable description of the skill
+     * details and behaviors.
+     * 
+ * + * string description = 3; + * @return The bytes for description. + */ + public com.google.protobuf.ByteString + getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * A human (or llm) readable description of the skill
+     * details and behaviors.
+     * 
+ * + * string description = 3; + * @param value The description to set. + * @return This builder for chaining. + */ + public Builder setDescription( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + description_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * A human (or llm) readable description of the skill
+     * details and behaviors.
+     * 
+ * + * string description = 3; + * @return This builder for chaining. + */ + public Builder clearDescription() { + description_ = getDefaultInstance().getDescription(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + *
+     * A human (or llm) readable description of the skill
+     * details and behaviors.
+     * 
+ * + * string description = 3; + * @param value The bytes for description to set. + * @return This builder for chaining. + */ + public Builder setDescriptionBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + description_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringArrayList tags_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + private void ensureTagsIsMutable() { + if (!tags_.isModifiable()) { + tags_ = new com.google.protobuf.LazyStringArrayList(tags_); + } + bitField0_ |= 0x00000008; + } + /** + *
+     * A set of tags for the skill to enhance categorization/utilization.
+     * Example: ["cooking", "customer support", "billing"]
+     * 
+ * + * repeated string tags = 4; + * @return A list containing the tags. + */ + public com.google.protobuf.ProtocolStringList + getTagsList() { + tags_.makeImmutable(); + return tags_; + } + /** + *
+     * A set of tags for the skill to enhance categorization/utilization.
+     * Example: ["cooking", "customer support", "billing"]
+     * 
+ * + * repeated string tags = 4; + * @return The count of tags. + */ + public int getTagsCount() { + return tags_.size(); + } + /** + *
+     * A set of tags for the skill to enhance categorization/utilization.
+     * Example: ["cooking", "customer support", "billing"]
+     * 
+ * + * repeated string tags = 4; + * @param index The index of the element to return. + * @return The tags at the given index. + */ + public java.lang.String getTags(int index) { + return tags_.get(index); + } + /** + *
+     * A set of tags for the skill to enhance categorization/utilization.
+     * Example: ["cooking", "customer support", "billing"]
+     * 
+ * + * repeated string tags = 4; + * @param index The index of the value to return. + * @return The bytes of the tags at the given index. + */ + public com.google.protobuf.ByteString + getTagsBytes(int index) { + return tags_.getByteString(index); + } + /** + *
+     * A set of tags for the skill to enhance categorization/utilization.
+     * Example: ["cooking", "customer support", "billing"]
+     * 
+ * + * repeated string tags = 4; + * @param index The index to set the value at. + * @param value The tags to set. + * @return This builder for chaining. + */ + public Builder setTags( + int index, java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureTagsIsMutable(); + tags_.set(index, value); + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + *
+     * A set of tags for the skill to enhance categorization/utilization.
+     * Example: ["cooking", "customer support", "billing"]
+     * 
+ * + * repeated string tags = 4; + * @param value The tags to add. + * @return This builder for chaining. + */ + public Builder addTags( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureTagsIsMutable(); + tags_.add(value); + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + *
+     * A set of tags for the skill to enhance categorization/utilization.
+     * Example: ["cooking", "customer support", "billing"]
+     * 
+ * + * repeated string tags = 4; + * @param values The tags to add. + * @return This builder for chaining. + */ + public Builder addAllTags( + java.lang.Iterable values) { + ensureTagsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, tags_); + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + *
+     * A set of tags for the skill to enhance categorization/utilization.
+     * Example: ["cooking", "customer support", "billing"]
+     * 
+ * + * repeated string tags = 4; + * @return This builder for chaining. + */ + public Builder clearTags() { + tags_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00000008);; + onChanged(); + return this; + } + /** + *
+     * A set of tags for the skill to enhance categorization/utilization.
+     * Example: ["cooking", "customer support", "billing"]
+     * 
+ * + * repeated string tags = 4; + * @param value The bytes of the tags to add. + * @return This builder for chaining. + */ + public Builder addTagsBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + ensureTagsIsMutable(); + tags_.add(value); + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringArrayList examples_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + private void ensureExamplesIsMutable() { + if (!examples_.isModifiable()) { + examples_ = new com.google.protobuf.LazyStringArrayList(examples_); + } + bitField0_ |= 0x00000010; + } + /** + *
+     * A set of example queries that this skill is designed to address.
+     * These examples should help the caller to understand how to craft requests
+     * to the agent to achieve specific goals.
+     * Example: ["I need a recipe for bread"]
+     * 
+ * + * repeated string examples = 5; + * @return A list containing the examples. + */ + public com.google.protobuf.ProtocolStringList + getExamplesList() { + examples_.makeImmutable(); + return examples_; + } + /** + *
+     * A set of example queries that this skill is designed to address.
+     * These examples should help the caller to understand how to craft requests
+     * to the agent to achieve specific goals.
+     * Example: ["I need a recipe for bread"]
+     * 
+ * + * repeated string examples = 5; + * @return The count of examples. + */ + public int getExamplesCount() { + return examples_.size(); + } + /** + *
+     * A set of example queries that this skill is designed to address.
+     * These examples should help the caller to understand how to craft requests
+     * to the agent to achieve specific goals.
+     * Example: ["I need a recipe for bread"]
+     * 
+ * + * repeated string examples = 5; + * @param index The index of the element to return. + * @return The examples at the given index. + */ + public java.lang.String getExamples(int index) { + return examples_.get(index); + } + /** + *
+     * A set of example queries that this skill is designed to address.
+     * These examples should help the caller to understand how to craft requests
+     * to the agent to achieve specific goals.
+     * Example: ["I need a recipe for bread"]
+     * 
+ * + * repeated string examples = 5; + * @param index The index of the value to return. + * @return The bytes of the examples at the given index. + */ + public com.google.protobuf.ByteString + getExamplesBytes(int index) { + return examples_.getByteString(index); + } + /** + *
+     * A set of example queries that this skill is designed to address.
+     * These examples should help the caller to understand how to craft requests
+     * to the agent to achieve specific goals.
+     * Example: ["I need a recipe for bread"]
+     * 
+ * + * repeated string examples = 5; + * @param index The index to set the value at. + * @param value The examples to set. + * @return This builder for chaining. + */ + public Builder setExamples( + int index, java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureExamplesIsMutable(); + examples_.set(index, value); + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + *
+     * A set of example queries that this skill is designed to address.
+     * These examples should help the caller to understand how to craft requests
+     * to the agent to achieve specific goals.
+     * Example: ["I need a recipe for bread"]
+     * 
+ * + * repeated string examples = 5; + * @param value The examples to add. + * @return This builder for chaining. + */ + public Builder addExamples( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureExamplesIsMutable(); + examples_.add(value); + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + *
+     * A set of example queries that this skill is designed to address.
+     * These examples should help the caller to understand how to craft requests
+     * to the agent to achieve specific goals.
+     * Example: ["I need a recipe for bread"]
+     * 
+ * + * repeated string examples = 5; + * @param values The examples to add. + * @return This builder for chaining. + */ + public Builder addAllExamples( + java.lang.Iterable values) { + ensureExamplesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, examples_); + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + *
+     * A set of example queries that this skill is designed to address.
+     * These examples should help the caller to understand how to craft requests
+     * to the agent to achieve specific goals.
+     * Example: ["I need a recipe for bread"]
+     * 
+ * + * repeated string examples = 5; + * @return This builder for chaining. + */ + public Builder clearExamples() { + examples_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00000010);; + onChanged(); + return this; + } + /** + *
+     * A set of example queries that this skill is designed to address.
+     * These examples should help the caller to understand how to craft requests
+     * to the agent to achieve specific goals.
+     * Example: ["I need a recipe for bread"]
+     * 
+ * + * repeated string examples = 5; + * @param value The bytes of the examples to add. + * @return This builder for chaining. + */ + public Builder addExamplesBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + ensureExamplesIsMutable(); + examples_.add(value); + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringArrayList inputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + private void ensureInputModesIsMutable() { + if (!inputModes_.isModifiable()) { + inputModes_ = new com.google.protobuf.LazyStringArrayList(inputModes_); + } + bitField0_ |= 0x00000020; + } + /** + *
+     * Possible input modalities supported.
+     * 
+ * + * repeated string input_modes = 6; + * @return A list containing the inputModes. + */ + public com.google.protobuf.ProtocolStringList + getInputModesList() { + inputModes_.makeImmutable(); + return inputModes_; + } + /** + *
+     * Possible input modalities supported.
+     * 
+ * + * repeated string input_modes = 6; + * @return The count of inputModes. + */ + public int getInputModesCount() { + return inputModes_.size(); + } + /** + *
+     * Possible input modalities supported.
+     * 
+ * + * repeated string input_modes = 6; + * @param index The index of the element to return. + * @return The inputModes at the given index. + */ + public java.lang.String getInputModes(int index) { + return inputModes_.get(index); + } + /** + *
+     * Possible input modalities supported.
+     * 
+ * + * repeated string input_modes = 6; + * @param index The index of the value to return. + * @return The bytes of the inputModes at the given index. + */ + public com.google.protobuf.ByteString + getInputModesBytes(int index) { + return inputModes_.getByteString(index); + } + /** + *
+     * Possible input modalities supported.
+     * 
+ * + * repeated string input_modes = 6; + * @param index The index to set the value at. + * @param value The inputModes to set. + * @return This builder for chaining. + */ + public Builder setInputModes( + int index, java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureInputModesIsMutable(); + inputModes_.set(index, value); + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + *
+     * Possible input modalities supported.
+     * 
+ * + * repeated string input_modes = 6; + * @param value The inputModes to add. + * @return This builder for chaining. + */ + public Builder addInputModes( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureInputModesIsMutable(); + inputModes_.add(value); + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + *
+     * Possible input modalities supported.
+     * 
+ * + * repeated string input_modes = 6; + * @param values The inputModes to add. + * @return This builder for chaining. + */ + public Builder addAllInputModes( + java.lang.Iterable values) { + ensureInputModesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, inputModes_); + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + *
+     * Possible input modalities supported.
+     * 
+ * + * repeated string input_modes = 6; + * @return This builder for chaining. + */ + public Builder clearInputModes() { + inputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00000020);; + onChanged(); + return this; + } + /** + *
+     * Possible input modalities supported.
+     * 
+ * + * repeated string input_modes = 6; + * @param value The bytes of the inputModes to add. + * @return This builder for chaining. + */ + public Builder addInputModesBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + ensureInputModesIsMutable(); + inputModes_.add(value); + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringArrayList outputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + private void ensureOutputModesIsMutable() { + if (!outputModes_.isModifiable()) { + outputModes_ = new com.google.protobuf.LazyStringArrayList(outputModes_); + } + bitField0_ |= 0x00000040; + } + /** + *
+     * Possible output modalities produced
+     * 
+ * + * repeated string output_modes = 7; + * @return A list containing the outputModes. + */ + public com.google.protobuf.ProtocolStringList + getOutputModesList() { + outputModes_.makeImmutable(); + return outputModes_; + } + /** + *
+     * Possible output modalities produced
+     * 
+ * + * repeated string output_modes = 7; + * @return The count of outputModes. + */ + public int getOutputModesCount() { + return outputModes_.size(); + } + /** + *
+     * Possible output modalities produced
+     * 
+ * + * repeated string output_modes = 7; + * @param index The index of the element to return. + * @return The outputModes at the given index. + */ + public java.lang.String getOutputModes(int index) { + return outputModes_.get(index); + } + /** + *
+     * Possible output modalities produced
+     * 
+ * + * repeated string output_modes = 7; + * @param index The index of the value to return. + * @return The bytes of the outputModes at the given index. + */ + public com.google.protobuf.ByteString + getOutputModesBytes(int index) { + return outputModes_.getByteString(index); + } + /** + *
+     * Possible output modalities produced
+     * 
+ * + * repeated string output_modes = 7; + * @param index The index to set the value at. + * @param value The outputModes to set. + * @return This builder for chaining. + */ + public Builder setOutputModes( + int index, java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureOutputModesIsMutable(); + outputModes_.set(index, value); + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + *
+     * Possible output modalities produced
+     * 
+ * + * repeated string output_modes = 7; + * @param value The outputModes to add. + * @return This builder for chaining. + */ + public Builder addOutputModes( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureOutputModesIsMutable(); + outputModes_.add(value); + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + *
+     * Possible output modalities produced
+     * 
+ * + * repeated string output_modes = 7; + * @param values The outputModes to add. + * @return This builder for chaining. + */ + public Builder addAllOutputModes( + java.lang.Iterable values) { + ensureOutputModesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, outputModes_); + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + *
+     * Possible output modalities produced
+     * 
+ * + * repeated string output_modes = 7; + * @return This builder for chaining. + */ + public Builder clearOutputModes() { + outputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00000040);; + onChanged(); + return this; + } + /** + *
+     * Possible output modalities produced
+     * 
+ * + * repeated string output_modes = 7; + * @param value The bytes of the outputModes to add. + * @return This builder for chaining. + */ + public Builder addOutputModesBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + ensureOutputModesIsMutable(); + outputModes_.add(value); + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + + private java.util.List security_ = + java.util.Collections.emptyList(); + private void ensureSecurityIsMutable() { + if (!((bitField0_ & 0x00000080) != 0)) { + security_ = new java.util.ArrayList(security_); + bitField0_ |= 0x00000080; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Security, org.a2aproject.sdk.compat03.grpc.Security.Builder, org.a2aproject.sdk.compat03.grpc.SecurityOrBuilder> securityBuilder_; + + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security schemes necessary for the agent to leverage this skill.
+     * As in the overall AgentCard.security, this list represents a logical OR of
+     * security requirement objects. Each object is a set of security schemes
+     * that must be used together (a logical AND).
+     * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + public java.util.List getSecurityList() { + if (securityBuilder_ == null) { + return java.util.Collections.unmodifiableList(security_); + } else { + return securityBuilder_.getMessageList(); + } + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security schemes necessary for the agent to leverage this skill.
+     * As in the overall AgentCard.security, this list represents a logical OR of
+     * security requirement objects. Each object is a set of security schemes
+     * that must be used together (a logical AND).
+     * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + public int getSecurityCount() { + if (securityBuilder_ == null) { + return security_.size(); + } else { + return securityBuilder_.getCount(); + } + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security schemes necessary for the agent to leverage this skill.
+     * As in the overall AgentCard.security, this list represents a logical OR of
+     * security requirement objects. Each object is a set of security schemes
+     * that must be used together (a logical AND).
+     * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + public org.a2aproject.sdk.compat03.grpc.Security getSecurity(int index) { + if (securityBuilder_ == null) { + return security_.get(index); + } else { + return securityBuilder_.getMessage(index); + } + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security schemes necessary for the agent to leverage this skill.
+     * As in the overall AgentCard.security, this list represents a logical OR of
+     * security requirement objects. Each object is a set of security schemes
+     * that must be used together (a logical AND).
+     * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + public Builder setSecurity( + int index, org.a2aproject.sdk.compat03.grpc.Security value) { + if (securityBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSecurityIsMutable(); + security_.set(index, value); + onChanged(); + } else { + securityBuilder_.setMessage(index, value); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security schemes necessary for the agent to leverage this skill.
+     * As in the overall AgentCard.security, this list represents a logical OR of
+     * security requirement objects. Each object is a set of security schemes
+     * that must be used together (a logical AND).
+     * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + public Builder setSecurity( + int index, org.a2aproject.sdk.compat03.grpc.Security.Builder builderForValue) { + if (securityBuilder_ == null) { + ensureSecurityIsMutable(); + security_.set(index, builderForValue.build()); + onChanged(); + } else { + securityBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security schemes necessary for the agent to leverage this skill.
+     * As in the overall AgentCard.security, this list represents a logical OR of
+     * security requirement objects. Each object is a set of security schemes
+     * that must be used together (a logical AND).
+     * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + public Builder addSecurity(org.a2aproject.sdk.compat03.grpc.Security value) { + if (securityBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSecurityIsMutable(); + security_.add(value); + onChanged(); + } else { + securityBuilder_.addMessage(value); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security schemes necessary for the agent to leverage this skill.
+     * As in the overall AgentCard.security, this list represents a logical OR of
+     * security requirement objects. Each object is a set of security schemes
+     * that must be used together (a logical AND).
+     * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + public Builder addSecurity( + int index, org.a2aproject.sdk.compat03.grpc.Security value) { + if (securityBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSecurityIsMutable(); + security_.add(index, value); + onChanged(); + } else { + securityBuilder_.addMessage(index, value); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security schemes necessary for the agent to leverage this skill.
+     * As in the overall AgentCard.security, this list represents a logical OR of
+     * security requirement objects. Each object is a set of security schemes
+     * that must be used together (a logical AND).
+     * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + public Builder addSecurity( + org.a2aproject.sdk.compat03.grpc.Security.Builder builderForValue) { + if (securityBuilder_ == null) { + ensureSecurityIsMutable(); + security_.add(builderForValue.build()); + onChanged(); + } else { + securityBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security schemes necessary for the agent to leverage this skill.
+     * As in the overall AgentCard.security, this list represents a logical OR of
+     * security requirement objects. Each object is a set of security schemes
+     * that must be used together (a logical AND).
+     * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + public Builder addSecurity( + int index, org.a2aproject.sdk.compat03.grpc.Security.Builder builderForValue) { + if (securityBuilder_ == null) { + ensureSecurityIsMutable(); + security_.add(index, builderForValue.build()); + onChanged(); + } else { + securityBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security schemes necessary for the agent to leverage this skill.
+     * As in the overall AgentCard.security, this list represents a logical OR of
+     * security requirement objects. Each object is a set of security schemes
+     * that must be used together (a logical AND).
+     * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + public Builder addAllSecurity( + java.lang.Iterable values) { + if (securityBuilder_ == null) { + ensureSecurityIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, security_); + onChanged(); + } else { + securityBuilder_.addAllMessages(values); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security schemes necessary for the agent to leverage this skill.
+     * As in the overall AgentCard.security, this list represents a logical OR of
+     * security requirement objects. Each object is a set of security schemes
+     * that must be used together (a logical AND).
+     * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + public Builder clearSecurity() { + if (securityBuilder_ == null) { + security_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000080); + onChanged(); + } else { + securityBuilder_.clear(); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security schemes necessary for the agent to leverage this skill.
+     * As in the overall AgentCard.security, this list represents a logical OR of
+     * security requirement objects. Each object is a set of security schemes
+     * that must be used together (a logical AND).
+     * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + public Builder removeSecurity(int index) { + if (securityBuilder_ == null) { + ensureSecurityIsMutable(); + security_.remove(index); + onChanged(); + } else { + securityBuilder_.remove(index); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security schemes necessary for the agent to leverage this skill.
+     * As in the overall AgentCard.security, this list represents a logical OR of
+     * security requirement objects. Each object is a set of security schemes
+     * that must be used together (a logical AND).
+     * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + public org.a2aproject.sdk.compat03.grpc.Security.Builder getSecurityBuilder( + int index) { + return internalGetSecurityFieldBuilder().getBuilder(index); + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security schemes necessary for the agent to leverage this skill.
+     * As in the overall AgentCard.security, this list represents a logical OR of
+     * security requirement objects. Each object is a set of security schemes
+     * that must be used together (a logical AND).
+     * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + public org.a2aproject.sdk.compat03.grpc.SecurityOrBuilder getSecurityOrBuilder( + int index) { + if (securityBuilder_ == null) { + return security_.get(index); } else { + return securityBuilder_.getMessageOrBuilder(index); + } + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security schemes necessary for the agent to leverage this skill.
+     * As in the overall AgentCard.security, this list represents a logical OR of
+     * security requirement objects. Each object is a set of security schemes
+     * that must be used together (a logical AND).
+     * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + public java.util.List + getSecurityOrBuilderList() { + if (securityBuilder_ != null) { + return securityBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(security_); + } + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security schemes necessary for the agent to leverage this skill.
+     * As in the overall AgentCard.security, this list represents a logical OR of
+     * security requirement objects. Each object is a set of security schemes
+     * that must be used together (a logical AND).
+     * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + public org.a2aproject.sdk.compat03.grpc.Security.Builder addSecurityBuilder() { + return internalGetSecurityFieldBuilder().addBuilder( + org.a2aproject.sdk.compat03.grpc.Security.getDefaultInstance()); + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security schemes necessary for the agent to leverage this skill.
+     * As in the overall AgentCard.security, this list represents a logical OR of
+     * security requirement objects. Each object is a set of security schemes
+     * that must be used together (a logical AND).
+     * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + public org.a2aproject.sdk.compat03.grpc.Security.Builder addSecurityBuilder( + int index) { + return internalGetSecurityFieldBuilder().addBuilder( + index, org.a2aproject.sdk.compat03.grpc.Security.getDefaultInstance()); + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security schemes necessary for the agent to leverage this skill.
+     * As in the overall AgentCard.security, this list represents a logical OR of
+     * security requirement objects. Each object is a set of security schemes
+     * that must be used together (a logical AND).
+     * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + public java.util.List + getSecurityBuilderList() { + return internalGetSecurityFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Security, org.a2aproject.sdk.compat03.grpc.Security.Builder, org.a2aproject.sdk.compat03.grpc.SecurityOrBuilder> + internalGetSecurityFieldBuilder() { + if (securityBuilder_ == null) { + securityBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Security, org.a2aproject.sdk.compat03.grpc.Security.Builder, org.a2aproject.sdk.compat03.grpc.SecurityOrBuilder>( + security_, + ((bitField0_ & 0x00000080) != 0), + getParentForChildren(), + isClean()); + security_ = null; + } + return securityBuilder_; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.AgentSkill) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.AgentSkill) + private static final org.a2aproject.sdk.compat03.grpc.AgentSkill DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.AgentSkill(); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentSkill getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AgentSkill parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentSkill getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentSkillOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentSkillOrBuilder.java new file mode 100644 index 000000000..0a61179db --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentSkillOrBuilder.java @@ -0,0 +1,318 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface AgentSkillOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.AgentSkill) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Unique id of the skill within this agent.
+   * 
+ * + * string id = 1; + * @return The id. + */ + java.lang.String getId(); + /** + *
+   * Unique id of the skill within this agent.
+   * 
+ * + * string id = 1; + * @return The bytes for id. + */ + com.google.protobuf.ByteString + getIdBytes(); + + /** + *
+   * A human readable name for the skill.
+   * 
+ * + * string name = 2; + * @return The name. + */ + java.lang.String getName(); + /** + *
+   * A human readable name for the skill.
+   * 
+ * + * string name = 2; + * @return The bytes for name. + */ + com.google.protobuf.ByteString + getNameBytes(); + + /** + *
+   * A human (or llm) readable description of the skill
+   * details and behaviors.
+   * 
+ * + * string description = 3; + * @return The description. + */ + java.lang.String getDescription(); + /** + *
+   * A human (or llm) readable description of the skill
+   * details and behaviors.
+   * 
+ * + * string description = 3; + * @return The bytes for description. + */ + com.google.protobuf.ByteString + getDescriptionBytes(); + + /** + *
+   * A set of tags for the skill to enhance categorization/utilization.
+   * Example: ["cooking", "customer support", "billing"]
+   * 
+ * + * repeated string tags = 4; + * @return A list containing the tags. + */ + java.util.List + getTagsList(); + /** + *
+   * A set of tags for the skill to enhance categorization/utilization.
+   * Example: ["cooking", "customer support", "billing"]
+   * 
+ * + * repeated string tags = 4; + * @return The count of tags. + */ + int getTagsCount(); + /** + *
+   * A set of tags for the skill to enhance categorization/utilization.
+   * Example: ["cooking", "customer support", "billing"]
+   * 
+ * + * repeated string tags = 4; + * @param index The index of the element to return. + * @return The tags at the given index. + */ + java.lang.String getTags(int index); + /** + *
+   * A set of tags for the skill to enhance categorization/utilization.
+   * Example: ["cooking", "customer support", "billing"]
+   * 
+ * + * repeated string tags = 4; + * @param index The index of the value to return. + * @return The bytes of the tags at the given index. + */ + com.google.protobuf.ByteString + getTagsBytes(int index); + + /** + *
+   * A set of example queries that this skill is designed to address.
+   * These examples should help the caller to understand how to craft requests
+   * to the agent to achieve specific goals.
+   * Example: ["I need a recipe for bread"]
+   * 
+ * + * repeated string examples = 5; + * @return A list containing the examples. + */ + java.util.List + getExamplesList(); + /** + *
+   * A set of example queries that this skill is designed to address.
+   * These examples should help the caller to understand how to craft requests
+   * to the agent to achieve specific goals.
+   * Example: ["I need a recipe for bread"]
+   * 
+ * + * repeated string examples = 5; + * @return The count of examples. + */ + int getExamplesCount(); + /** + *
+   * A set of example queries that this skill is designed to address.
+   * These examples should help the caller to understand how to craft requests
+   * to the agent to achieve specific goals.
+   * Example: ["I need a recipe for bread"]
+   * 
+ * + * repeated string examples = 5; + * @param index The index of the element to return. + * @return The examples at the given index. + */ + java.lang.String getExamples(int index); + /** + *
+   * A set of example queries that this skill is designed to address.
+   * These examples should help the caller to understand how to craft requests
+   * to the agent to achieve specific goals.
+   * Example: ["I need a recipe for bread"]
+   * 
+ * + * repeated string examples = 5; + * @param index The index of the value to return. + * @return The bytes of the examples at the given index. + */ + com.google.protobuf.ByteString + getExamplesBytes(int index); + + /** + *
+   * Possible input modalities supported.
+   * 
+ * + * repeated string input_modes = 6; + * @return A list containing the inputModes. + */ + java.util.List + getInputModesList(); + /** + *
+   * Possible input modalities supported.
+   * 
+ * + * repeated string input_modes = 6; + * @return The count of inputModes. + */ + int getInputModesCount(); + /** + *
+   * Possible input modalities supported.
+   * 
+ * + * repeated string input_modes = 6; + * @param index The index of the element to return. + * @return The inputModes at the given index. + */ + java.lang.String getInputModes(int index); + /** + *
+   * Possible input modalities supported.
+   * 
+ * + * repeated string input_modes = 6; + * @param index The index of the value to return. + * @return The bytes of the inputModes at the given index. + */ + com.google.protobuf.ByteString + getInputModesBytes(int index); + + /** + *
+   * Possible output modalities produced
+   * 
+ * + * repeated string output_modes = 7; + * @return A list containing the outputModes. + */ + java.util.List + getOutputModesList(); + /** + *
+   * Possible output modalities produced
+   * 
+ * + * repeated string output_modes = 7; + * @return The count of outputModes. + */ + int getOutputModesCount(); + /** + *
+   * Possible output modalities produced
+   * 
+ * + * repeated string output_modes = 7; + * @param index The index of the element to return. + * @return The outputModes at the given index. + */ + java.lang.String getOutputModes(int index); + /** + *
+   * Possible output modalities produced
+   * 
+ * + * repeated string output_modes = 7; + * @param index The index of the value to return. + * @return The bytes of the outputModes at the given index. + */ + com.google.protobuf.ByteString + getOutputModesBytes(int index); + + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Security schemes necessary for the agent to leverage this skill.
+   * As in the overall AgentCard.security, this list represents a logical OR of
+   * security requirement objects. Each object is a set of security schemes
+   * that must be used together (a logical AND).
+   * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + java.util.List + getSecurityList(); + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Security schemes necessary for the agent to leverage this skill.
+   * As in the overall AgentCard.security, this list represents a logical OR of
+   * security requirement objects. Each object is a set of security schemes
+   * that must be used together (a logical AND).
+   * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + org.a2aproject.sdk.compat03.grpc.Security getSecurity(int index); + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Security schemes necessary for the agent to leverage this skill.
+   * As in the overall AgentCard.security, this list represents a logical OR of
+   * security requirement objects. Each object is a set of security schemes
+   * that must be used together (a logical AND).
+   * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + int getSecurityCount(); + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Security schemes necessary for the agent to leverage this skill.
+   * As in the overall AgentCard.security, this list represents a logical OR of
+   * security requirement objects. Each object is a set of security schemes
+   * that must be used together (a logical AND).
+   * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + java.util.List + getSecurityOrBuilderList(); + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Security schemes necessary for the agent to leverage this skill.
+   * As in the overall AgentCard.security, this list represents a logical OR of
+   * security requirement objects. Each object is a set of security schemes
+   * that must be used together (a logical AND).
+   * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + org.a2aproject.sdk.compat03.grpc.SecurityOrBuilder getSecurityOrBuilder( + int index); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/Artifact.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/Artifact.java new file mode 100644 index 000000000..e45a33300 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/Artifact.java @@ -0,0 +1,1799 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * Artifacts are the container for task completed results. These are similar
+ * to Messages but are intended to be the product of a task, as opposed to
+ * point-to-point communication.
+ * 
+ * + * Protobuf type {@code a2a.v1.Artifact} + */ +@com.google.protobuf.Generated +public final class Artifact extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.Artifact) + ArtifactOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "Artifact"); + } + // Use Artifact.newBuilder() to construct. + private Artifact(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private Artifact() { + artifactId_ = ""; + name_ = ""; + description_ = ""; + parts_ = java.util.Collections.emptyList(); + extensions_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_Artifact_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_Artifact_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.Artifact.class, org.a2aproject.sdk.compat03.grpc.Artifact.Builder.class); + } + + private int bitField0_; + public static final int ARTIFACT_ID_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object artifactId_ = ""; + /** + *
+   * Unique id for the artifact. It must be at least unique within a task.
+   * 
+ * + * string artifact_id = 1; + * @return The artifactId. + */ + @java.lang.Override + public java.lang.String getArtifactId() { + java.lang.Object ref = artifactId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + artifactId_ = s; + return s; + } + } + /** + *
+   * Unique id for the artifact. It must be at least unique within a task.
+   * 
+ * + * string artifact_id = 1; + * @return The bytes for artifactId. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getArtifactIdBytes() { + java.lang.Object ref = artifactId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + artifactId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int NAME_FIELD_NUMBER = 3; + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + *
+   * A human readable name for the artifact.
+   * 
+ * + * string name = 3; + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + *
+   * A human readable name for the artifact.
+   * 
+ * + * string name = 3; + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DESCRIPTION_FIELD_NUMBER = 4; + @SuppressWarnings("serial") + private volatile java.lang.Object description_ = ""; + /** + *
+   * A human readable description of the artifact, optional.
+   * 
+ * + * string description = 4; + * @return The description. + */ + @java.lang.Override + public java.lang.String getDescription() { + java.lang.Object ref = description_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + description_ = s; + return s; + } + } + /** + *
+   * A human readable description of the artifact, optional.
+   * 
+ * + * string description = 4; + * @return The bytes for description. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PARTS_FIELD_NUMBER = 5; + @SuppressWarnings("serial") + private java.util.List parts_; + /** + *
+   * The content of the artifact.
+   * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + @java.lang.Override + public java.util.List getPartsList() { + return parts_; + } + /** + *
+   * The content of the artifact.
+   * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + @java.lang.Override + public java.util.List + getPartsOrBuilderList() { + return parts_; + } + /** + *
+   * The content of the artifact.
+   * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + @java.lang.Override + public int getPartsCount() { + return parts_.size(); + } + /** + *
+   * The content of the artifact.
+   * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Part getParts(int index) { + return parts_.get(index); + } + /** + *
+   * The content of the artifact.
+   * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.PartOrBuilder getPartsOrBuilder( + int index) { + return parts_.get(index); + } + + public static final int METADATA_FIELD_NUMBER = 6; + private com.google.protobuf.Struct metadata_; + /** + *
+   * Optional metadata included with the artifact.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return Whether the metadata field is set. + */ + @java.lang.Override + public boolean hasMetadata() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + *
+   * Optional metadata included with the artifact.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return The metadata. + */ + @java.lang.Override + public com.google.protobuf.Struct getMetadata() { + return metadata_ == null ? com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } + /** + *
+   * Optional metadata included with the artifact.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + @java.lang.Override + public com.google.protobuf.StructOrBuilder getMetadataOrBuilder() { + return metadata_ == null ? com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } + + public static final int EXTENSIONS_FIELD_NUMBER = 7; + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList extensions_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + /** + *
+   * The URIs of extensions that are present or contributed to this Artifact.
+   * 
+ * + * repeated string extensions = 7; + * @return A list containing the extensions. + */ + public com.google.protobuf.ProtocolStringList + getExtensionsList() { + return extensions_; + } + /** + *
+   * The URIs of extensions that are present or contributed to this Artifact.
+   * 
+ * + * repeated string extensions = 7; + * @return The count of extensions. + */ + public int getExtensionsCount() { + return extensions_.size(); + } + /** + *
+   * The URIs of extensions that are present or contributed to this Artifact.
+   * 
+ * + * repeated string extensions = 7; + * @param index The index of the element to return. + * @return The extensions at the given index. + */ + public java.lang.String getExtensions(int index) { + return extensions_.get(index); + } + /** + *
+   * The URIs of extensions that are present or contributed to this Artifact.
+   * 
+ * + * repeated string extensions = 7; + * @param index The index of the value to return. + * @return The bytes of the extensions at the given index. + */ + public com.google.protobuf.ByteString + getExtensionsBytes(int index) { + return extensions_.getByteString(index); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(artifactId_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, artifactId_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 3, name_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(description_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 4, description_); + } + for (int i = 0; i < parts_.size(); i++) { + output.writeMessage(5, parts_.get(i)); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(6, getMetadata()); + } + for (int i = 0; i < extensions_.size(); i++) { + com.google.protobuf.GeneratedMessage.writeString(output, 7, extensions_.getRaw(i)); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(artifactId_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, artifactId_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(3, name_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(description_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(4, description_); + } + for (int i = 0; i < parts_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(5, parts_.get(i)); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(6, getMetadata()); + } + { + int dataSize = 0; + for (int i = 0; i < extensions_.size(); i++) { + dataSize += computeStringSizeNoTag(extensions_.getRaw(i)); + } + size += dataSize; + size += 1 * getExtensionsList().size(); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.Artifact)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.Artifact other = (org.a2aproject.sdk.compat03.grpc.Artifact) obj; + + if (!getArtifactId() + .equals(other.getArtifactId())) return false; + if (!getName() + .equals(other.getName())) return false; + if (!getDescription() + .equals(other.getDescription())) return false; + if (!getPartsList() + .equals(other.getPartsList())) return false; + if (hasMetadata() != other.hasMetadata()) return false; + if (hasMetadata()) { + if (!getMetadata() + .equals(other.getMetadata())) return false; + } + if (!getExtensionsList() + .equals(other.getExtensionsList())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + ARTIFACT_ID_FIELD_NUMBER; + hash = (53 * hash) + getArtifactId().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + DESCRIPTION_FIELD_NUMBER; + hash = (53 * hash) + getDescription().hashCode(); + if (getPartsCount() > 0) { + hash = (37 * hash) + PARTS_FIELD_NUMBER; + hash = (53 * hash) + getPartsList().hashCode(); + } + if (hasMetadata()) { + hash = (37 * hash) + METADATA_FIELD_NUMBER; + hash = (53 * hash) + getMetadata().hashCode(); + } + if (getExtensionsCount() > 0) { + hash = (37 * hash) + EXTENSIONS_FIELD_NUMBER; + hash = (53 * hash) + getExtensionsList().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.Artifact parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.Artifact parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.Artifact parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.Artifact parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.Artifact parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.Artifact parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.Artifact parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.Artifact parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.Artifact parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.Artifact parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.Artifact parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.Artifact parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.Artifact prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * Artifacts are the container for task completed results. These are similar
+   * to Messages but are intended to be the product of a task, as opposed to
+   * point-to-point communication.
+   * 
+ * + * Protobuf type {@code a2a.v1.Artifact} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.Artifact) + org.a2aproject.sdk.compat03.grpc.ArtifactOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_Artifact_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_Artifact_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.Artifact.class, org.a2aproject.sdk.compat03.grpc.Artifact.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.Artifact.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage + .alwaysUseFieldBuilders) { + internalGetPartsFieldBuilder(); + internalGetMetadataFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + artifactId_ = ""; + name_ = ""; + description_ = ""; + if (partsBuilder_ == null) { + parts_ = java.util.Collections.emptyList(); + } else { + parts_ = null; + partsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000008); + metadata_ = null; + if (metadataBuilder_ != null) { + metadataBuilder_.dispose(); + metadataBuilder_ = null; + } + extensions_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_Artifact_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Artifact getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.Artifact.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Artifact build() { + org.a2aproject.sdk.compat03.grpc.Artifact result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Artifact buildPartial() { + org.a2aproject.sdk.compat03.grpc.Artifact result = new org.a2aproject.sdk.compat03.grpc.Artifact(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields(org.a2aproject.sdk.compat03.grpc.Artifact result) { + if (partsBuilder_ == null) { + if (((bitField0_ & 0x00000008) != 0)) { + parts_ = java.util.Collections.unmodifiableList(parts_); + bitField0_ = (bitField0_ & ~0x00000008); + } + result.parts_ = parts_; + } else { + result.parts_ = partsBuilder_.build(); + } + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.Artifact result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.artifactId_ = artifactId_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.name_ = name_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.description_ = description_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000010) != 0)) { + result.metadata_ = metadataBuilder_ == null + ? metadata_ + : metadataBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000020) != 0)) { + extensions_.makeImmutable(); + result.extensions_ = extensions_; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.Artifact) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.Artifact)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.Artifact other) { + if (other == org.a2aproject.sdk.compat03.grpc.Artifact.getDefaultInstance()) return this; + if (!other.getArtifactId().isEmpty()) { + artifactId_ = other.artifactId_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (!other.getDescription().isEmpty()) { + description_ = other.description_; + bitField0_ |= 0x00000004; + onChanged(); + } + if (partsBuilder_ == null) { + if (!other.parts_.isEmpty()) { + if (parts_.isEmpty()) { + parts_ = other.parts_; + bitField0_ = (bitField0_ & ~0x00000008); + } else { + ensurePartsIsMutable(); + parts_.addAll(other.parts_); + } + onChanged(); + } + } else { + if (!other.parts_.isEmpty()) { + if (partsBuilder_.isEmpty()) { + partsBuilder_.dispose(); + partsBuilder_ = null; + parts_ = other.parts_; + bitField0_ = (bitField0_ & ~0x00000008); + partsBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + internalGetPartsFieldBuilder() : null; + } else { + partsBuilder_.addAllMessages(other.parts_); + } + } + } + if (other.hasMetadata()) { + mergeMetadata(other.getMetadata()); + } + if (!other.extensions_.isEmpty()) { + if (extensions_.isEmpty()) { + extensions_ = other.extensions_; + bitField0_ |= 0x00000020; + } else { + ensureExtensionsIsMutable(); + extensions_.addAll(other.extensions_); + } + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + artifactId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 26: { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 26 + case 34: { + description_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 34 + case 42: { + org.a2aproject.sdk.compat03.grpc.Part m = + input.readMessage( + org.a2aproject.sdk.compat03.grpc.Part.parser(), + extensionRegistry); + if (partsBuilder_ == null) { + ensurePartsIsMutable(); + parts_.add(m); + } else { + partsBuilder_.addMessage(m); + } + break; + } // case 42 + case 50: { + input.readMessage( + internalGetMetadataFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000010; + break; + } // case 50 + case 58: { + java.lang.String s = input.readStringRequireUtf8(); + ensureExtensionsIsMutable(); + extensions_.add(s); + break; + } // case 58 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object artifactId_ = ""; + /** + *
+     * Unique id for the artifact. It must be at least unique within a task.
+     * 
+ * + * string artifact_id = 1; + * @return The artifactId. + */ + public java.lang.String getArtifactId() { + java.lang.Object ref = artifactId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + artifactId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Unique id for the artifact. It must be at least unique within a task.
+     * 
+ * + * string artifact_id = 1; + * @return The bytes for artifactId. + */ + public com.google.protobuf.ByteString + getArtifactIdBytes() { + java.lang.Object ref = artifactId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + artifactId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Unique id for the artifact. It must be at least unique within a task.
+     * 
+ * + * string artifact_id = 1; + * @param value The artifactId to set. + * @return This builder for chaining. + */ + public Builder setArtifactId( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + artifactId_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * Unique id for the artifact. It must be at least unique within a task.
+     * 
+ * + * string artifact_id = 1; + * @return This builder for chaining. + */ + public Builder clearArtifactId() { + artifactId_ = getDefaultInstance().getArtifactId(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * Unique id for the artifact. It must be at least unique within a task.
+     * 
+ * + * string artifact_id = 1; + * @param value The bytes for artifactId to set. + * @return This builder for chaining. + */ + public Builder setArtifactIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + artifactId_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object name_ = ""; + /** + *
+     * A human readable name for the artifact.
+     * 
+ * + * string name = 3; + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * A human readable name for the artifact.
+     * 
+ * + * string name = 3; + * @return The bytes for name. + */ + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * A human readable name for the artifact.
+     * 
+ * + * string name = 3; + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + name_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * A human readable name for the artifact.
+     * 
+ * + * string name = 3; + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * A human readable name for the artifact.
+     * 
+ * + * string name = 3; + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private java.lang.Object description_ = ""; + /** + *
+     * A human readable description of the artifact, optional.
+     * 
+ * + * string description = 4; + * @return The description. + */ + public java.lang.String getDescription() { + java.lang.Object ref = description_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + description_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * A human readable description of the artifact, optional.
+     * 
+ * + * string description = 4; + * @return The bytes for description. + */ + public com.google.protobuf.ByteString + getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * A human readable description of the artifact, optional.
+     * 
+ * + * string description = 4; + * @param value The description to set. + * @return This builder for chaining. + */ + public Builder setDescription( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + description_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * A human readable description of the artifact, optional.
+     * 
+ * + * string description = 4; + * @return This builder for chaining. + */ + public Builder clearDescription() { + description_ = getDefaultInstance().getDescription(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + *
+     * A human readable description of the artifact, optional.
+     * 
+ * + * string description = 4; + * @param value The bytes for description to set. + * @return This builder for chaining. + */ + public Builder setDescriptionBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + description_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + private java.util.List parts_ = + java.util.Collections.emptyList(); + private void ensurePartsIsMutable() { + if (!((bitField0_ & 0x00000008) != 0)) { + parts_ = new java.util.ArrayList(parts_); + bitField0_ |= 0x00000008; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Part, org.a2aproject.sdk.compat03.grpc.Part.Builder, org.a2aproject.sdk.compat03.grpc.PartOrBuilder> partsBuilder_; + + /** + *
+     * The content of the artifact.
+     * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + public java.util.List getPartsList() { + if (partsBuilder_ == null) { + return java.util.Collections.unmodifiableList(parts_); + } else { + return partsBuilder_.getMessageList(); + } + } + /** + *
+     * The content of the artifact.
+     * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + public int getPartsCount() { + if (partsBuilder_ == null) { + return parts_.size(); + } else { + return partsBuilder_.getCount(); + } + } + /** + *
+     * The content of the artifact.
+     * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + public org.a2aproject.sdk.compat03.grpc.Part getParts(int index) { + if (partsBuilder_ == null) { + return parts_.get(index); + } else { + return partsBuilder_.getMessage(index); + } + } + /** + *
+     * The content of the artifact.
+     * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + public Builder setParts( + int index, org.a2aproject.sdk.compat03.grpc.Part value) { + if (partsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensurePartsIsMutable(); + parts_.set(index, value); + onChanged(); + } else { + partsBuilder_.setMessage(index, value); + } + return this; + } + /** + *
+     * The content of the artifact.
+     * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + public Builder setParts( + int index, org.a2aproject.sdk.compat03.grpc.Part.Builder builderForValue) { + if (partsBuilder_ == null) { + ensurePartsIsMutable(); + parts_.set(index, builderForValue.build()); + onChanged(); + } else { + partsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * The content of the artifact.
+     * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + public Builder addParts(org.a2aproject.sdk.compat03.grpc.Part value) { + if (partsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensurePartsIsMutable(); + parts_.add(value); + onChanged(); + } else { + partsBuilder_.addMessage(value); + } + return this; + } + /** + *
+     * The content of the artifact.
+     * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + public Builder addParts( + int index, org.a2aproject.sdk.compat03.grpc.Part value) { + if (partsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensurePartsIsMutable(); + parts_.add(index, value); + onChanged(); + } else { + partsBuilder_.addMessage(index, value); + } + return this; + } + /** + *
+     * The content of the artifact.
+     * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + public Builder addParts( + org.a2aproject.sdk.compat03.grpc.Part.Builder builderForValue) { + if (partsBuilder_ == null) { + ensurePartsIsMutable(); + parts_.add(builderForValue.build()); + onChanged(); + } else { + partsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + *
+     * The content of the artifact.
+     * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + public Builder addParts( + int index, org.a2aproject.sdk.compat03.grpc.Part.Builder builderForValue) { + if (partsBuilder_ == null) { + ensurePartsIsMutable(); + parts_.add(index, builderForValue.build()); + onChanged(); + } else { + partsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * The content of the artifact.
+     * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + public Builder addAllParts( + java.lang.Iterable values) { + if (partsBuilder_ == null) { + ensurePartsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, parts_); + onChanged(); + } else { + partsBuilder_.addAllMessages(values); + } + return this; + } + /** + *
+     * The content of the artifact.
+     * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + public Builder clearParts() { + if (partsBuilder_ == null) { + parts_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000008); + onChanged(); + } else { + partsBuilder_.clear(); + } + return this; + } + /** + *
+     * The content of the artifact.
+     * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + public Builder removeParts(int index) { + if (partsBuilder_ == null) { + ensurePartsIsMutable(); + parts_.remove(index); + onChanged(); + } else { + partsBuilder_.remove(index); + } + return this; + } + /** + *
+     * The content of the artifact.
+     * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + public org.a2aproject.sdk.compat03.grpc.Part.Builder getPartsBuilder( + int index) { + return internalGetPartsFieldBuilder().getBuilder(index); + } + /** + *
+     * The content of the artifact.
+     * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + public org.a2aproject.sdk.compat03.grpc.PartOrBuilder getPartsOrBuilder( + int index) { + if (partsBuilder_ == null) { + return parts_.get(index); } else { + return partsBuilder_.getMessageOrBuilder(index); + } + } + /** + *
+     * The content of the artifact.
+     * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + public java.util.List + getPartsOrBuilderList() { + if (partsBuilder_ != null) { + return partsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(parts_); + } + } + /** + *
+     * The content of the artifact.
+     * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + public org.a2aproject.sdk.compat03.grpc.Part.Builder addPartsBuilder() { + return internalGetPartsFieldBuilder().addBuilder( + org.a2aproject.sdk.compat03.grpc.Part.getDefaultInstance()); + } + /** + *
+     * The content of the artifact.
+     * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + public org.a2aproject.sdk.compat03.grpc.Part.Builder addPartsBuilder( + int index) { + return internalGetPartsFieldBuilder().addBuilder( + index, org.a2aproject.sdk.compat03.grpc.Part.getDefaultInstance()); + } + /** + *
+     * The content of the artifact.
+     * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + public java.util.List + getPartsBuilderList() { + return internalGetPartsFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Part, org.a2aproject.sdk.compat03.grpc.Part.Builder, org.a2aproject.sdk.compat03.grpc.PartOrBuilder> + internalGetPartsFieldBuilder() { + if (partsBuilder_ == null) { + partsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Part, org.a2aproject.sdk.compat03.grpc.Part.Builder, org.a2aproject.sdk.compat03.grpc.PartOrBuilder>( + parts_, + ((bitField0_ & 0x00000008) != 0), + getParentForChildren(), + isClean()); + parts_ = null; + } + return partsBuilder_; + } + + private com.google.protobuf.Struct metadata_; + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> metadataBuilder_; + /** + *
+     * Optional metadata included with the artifact.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return Whether the metadata field is set. + */ + public boolean hasMetadata() { + return ((bitField0_ & 0x00000010) != 0); + } + /** + *
+     * Optional metadata included with the artifact.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return The metadata. + */ + public com.google.protobuf.Struct getMetadata() { + if (metadataBuilder_ == null) { + return metadata_ == null ? com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } else { + return metadataBuilder_.getMessage(); + } + } + /** + *
+     * Optional metadata included with the artifact.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public Builder setMetadata(com.google.protobuf.Struct value) { + if (metadataBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + metadata_ = value; + } else { + metadataBuilder_.setMessage(value); + } + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + *
+     * Optional metadata included with the artifact.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public Builder setMetadata( + com.google.protobuf.Struct.Builder builderForValue) { + if (metadataBuilder_ == null) { + metadata_ = builderForValue.build(); + } else { + metadataBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + *
+     * Optional metadata included with the artifact.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public Builder mergeMetadata(com.google.protobuf.Struct value) { + if (metadataBuilder_ == null) { + if (((bitField0_ & 0x00000010) != 0) && + metadata_ != null && + metadata_ != com.google.protobuf.Struct.getDefaultInstance()) { + getMetadataBuilder().mergeFrom(value); + } else { + metadata_ = value; + } + } else { + metadataBuilder_.mergeFrom(value); + } + if (metadata_ != null) { + bitField0_ |= 0x00000010; + onChanged(); + } + return this; + } + /** + *
+     * Optional metadata included with the artifact.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public Builder clearMetadata() { + bitField0_ = (bitField0_ & ~0x00000010); + metadata_ = null; + if (metadataBuilder_ != null) { + metadataBuilder_.dispose(); + metadataBuilder_ = null; + } + onChanged(); + return this; + } + /** + *
+     * Optional metadata included with the artifact.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public com.google.protobuf.Struct.Builder getMetadataBuilder() { + bitField0_ |= 0x00000010; + onChanged(); + return internalGetMetadataFieldBuilder().getBuilder(); + } + /** + *
+     * Optional metadata included with the artifact.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public com.google.protobuf.StructOrBuilder getMetadataOrBuilder() { + if (metadataBuilder_ != null) { + return metadataBuilder_.getMessageOrBuilder(); + } else { + return metadata_ == null ? + com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } + } + /** + *
+     * Optional metadata included with the artifact.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> + internalGetMetadataFieldBuilder() { + if (metadataBuilder_ == null) { + metadataBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder>( + getMetadata(), + getParentForChildren(), + isClean()); + metadata_ = null; + } + return metadataBuilder_; + } + + private com.google.protobuf.LazyStringArrayList extensions_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + private void ensureExtensionsIsMutable() { + if (!extensions_.isModifiable()) { + extensions_ = new com.google.protobuf.LazyStringArrayList(extensions_); + } + bitField0_ |= 0x00000020; + } + /** + *
+     * The URIs of extensions that are present or contributed to this Artifact.
+     * 
+ * + * repeated string extensions = 7; + * @return A list containing the extensions. + */ + public com.google.protobuf.ProtocolStringList + getExtensionsList() { + extensions_.makeImmutable(); + return extensions_; + } + /** + *
+     * The URIs of extensions that are present or contributed to this Artifact.
+     * 
+ * + * repeated string extensions = 7; + * @return The count of extensions. + */ + public int getExtensionsCount() { + return extensions_.size(); + } + /** + *
+     * The URIs of extensions that are present or contributed to this Artifact.
+     * 
+ * + * repeated string extensions = 7; + * @param index The index of the element to return. + * @return The extensions at the given index. + */ + public java.lang.String getExtensions(int index) { + return extensions_.get(index); + } + /** + *
+     * The URIs of extensions that are present or contributed to this Artifact.
+     * 
+ * + * repeated string extensions = 7; + * @param index The index of the value to return. + * @return The bytes of the extensions at the given index. + */ + public com.google.protobuf.ByteString + getExtensionsBytes(int index) { + return extensions_.getByteString(index); + } + /** + *
+     * The URIs of extensions that are present or contributed to this Artifact.
+     * 
+ * + * repeated string extensions = 7; + * @param index The index to set the value at. + * @param value The extensions to set. + * @return This builder for chaining. + */ + public Builder setExtensions( + int index, java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureExtensionsIsMutable(); + extensions_.set(index, value); + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + *
+     * The URIs of extensions that are present or contributed to this Artifact.
+     * 
+ * + * repeated string extensions = 7; + * @param value The extensions to add. + * @return This builder for chaining. + */ + public Builder addExtensions( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureExtensionsIsMutable(); + extensions_.add(value); + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + *
+     * The URIs of extensions that are present or contributed to this Artifact.
+     * 
+ * + * repeated string extensions = 7; + * @param values The extensions to add. + * @return This builder for chaining. + */ + public Builder addAllExtensions( + java.lang.Iterable values) { + ensureExtensionsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, extensions_); + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + *
+     * The URIs of extensions that are present or contributed to this Artifact.
+     * 
+ * + * repeated string extensions = 7; + * @return This builder for chaining. + */ + public Builder clearExtensions() { + extensions_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00000020);; + onChanged(); + return this; + } + /** + *
+     * The URIs of extensions that are present or contributed to this Artifact.
+     * 
+ * + * repeated string extensions = 7; + * @param value The bytes of the extensions to add. + * @return This builder for chaining. + */ + public Builder addExtensionsBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + ensureExtensionsIsMutable(); + extensions_.add(value); + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.Artifact) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.Artifact) + private static final org.a2aproject.sdk.compat03.grpc.Artifact DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.Artifact(); + } + + public static org.a2aproject.sdk.compat03.grpc.Artifact getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Artifact parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Artifact getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ArtifactOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ArtifactOrBuilder.java new file mode 100644 index 000000000..eeedc6acd --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ArtifactOrBuilder.java @@ -0,0 +1,184 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface ArtifactOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.Artifact) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Unique id for the artifact. It must be at least unique within a task.
+   * 
+ * + * string artifact_id = 1; + * @return The artifactId. + */ + java.lang.String getArtifactId(); + /** + *
+   * Unique id for the artifact. It must be at least unique within a task.
+   * 
+ * + * string artifact_id = 1; + * @return The bytes for artifactId. + */ + com.google.protobuf.ByteString + getArtifactIdBytes(); + + /** + *
+   * A human readable name for the artifact.
+   * 
+ * + * string name = 3; + * @return The name. + */ + java.lang.String getName(); + /** + *
+   * A human readable name for the artifact.
+   * 
+ * + * string name = 3; + * @return The bytes for name. + */ + com.google.protobuf.ByteString + getNameBytes(); + + /** + *
+   * A human readable description of the artifact, optional.
+   * 
+ * + * string description = 4; + * @return The description. + */ + java.lang.String getDescription(); + /** + *
+   * A human readable description of the artifact, optional.
+   * 
+ * + * string description = 4; + * @return The bytes for description. + */ + com.google.protobuf.ByteString + getDescriptionBytes(); + + /** + *
+   * The content of the artifact.
+   * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + java.util.List + getPartsList(); + /** + *
+   * The content of the artifact.
+   * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + org.a2aproject.sdk.compat03.grpc.Part getParts(int index); + /** + *
+   * The content of the artifact.
+   * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + int getPartsCount(); + /** + *
+   * The content of the artifact.
+   * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + java.util.List + getPartsOrBuilderList(); + /** + *
+   * The content of the artifact.
+   * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + org.a2aproject.sdk.compat03.grpc.PartOrBuilder getPartsOrBuilder( + int index); + + /** + *
+   * Optional metadata included with the artifact.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return Whether the metadata field is set. + */ + boolean hasMetadata(); + /** + *
+   * Optional metadata included with the artifact.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return The metadata. + */ + com.google.protobuf.Struct getMetadata(); + /** + *
+   * Optional metadata included with the artifact.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + com.google.protobuf.StructOrBuilder getMetadataOrBuilder(); + + /** + *
+   * The URIs of extensions that are present or contributed to this Artifact.
+   * 
+ * + * repeated string extensions = 7; + * @return A list containing the extensions. + */ + java.util.List + getExtensionsList(); + /** + *
+   * The URIs of extensions that are present or contributed to this Artifact.
+   * 
+ * + * repeated string extensions = 7; + * @return The count of extensions. + */ + int getExtensionsCount(); + /** + *
+   * The URIs of extensions that are present or contributed to this Artifact.
+   * 
+ * + * repeated string extensions = 7; + * @param index The index of the element to return. + * @return The extensions at the given index. + */ + java.lang.String getExtensions(int index); + /** + *
+   * The URIs of extensions that are present or contributed to this Artifact.
+   * 
+ * + * repeated string extensions = 7; + * @param index The index of the value to return. + * @return The bytes of the extensions at the given index. + */ + com.google.protobuf.ByteString + getExtensionsBytes(int index); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AuthenticationInfo.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AuthenticationInfo.java new file mode 100644 index 000000000..d2b3d4f1a --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AuthenticationInfo.java @@ -0,0 +1,779 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * Defines authentication details, used for push notifications.
+ * 
+ * + * Protobuf type {@code a2a.v1.AuthenticationInfo} + */ +@com.google.protobuf.Generated +public final class AuthenticationInfo extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.AuthenticationInfo) + AuthenticationInfoOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "AuthenticationInfo"); + } + // Use AuthenticationInfo.newBuilder() to construct. + private AuthenticationInfo(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private AuthenticationInfo() { + schemes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + credentials_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_AuthenticationInfo_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_AuthenticationInfo_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.AuthenticationInfo.class, org.a2aproject.sdk.compat03.grpc.AuthenticationInfo.Builder.class); + } + + public static final int SCHEMES_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList schemes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + /** + *
+   * Supported authentication schemes - e.g. Basic, Bearer, etc
+   * 
+ * + * repeated string schemes = 1; + * @return A list containing the schemes. + */ + public com.google.protobuf.ProtocolStringList + getSchemesList() { + return schemes_; + } + /** + *
+   * Supported authentication schemes - e.g. Basic, Bearer, etc
+   * 
+ * + * repeated string schemes = 1; + * @return The count of schemes. + */ + public int getSchemesCount() { + return schemes_.size(); + } + /** + *
+   * Supported authentication schemes - e.g. Basic, Bearer, etc
+   * 
+ * + * repeated string schemes = 1; + * @param index The index of the element to return. + * @return The schemes at the given index. + */ + public java.lang.String getSchemes(int index) { + return schemes_.get(index); + } + /** + *
+   * Supported authentication schemes - e.g. Basic, Bearer, etc
+   * 
+ * + * repeated string schemes = 1; + * @param index The index of the value to return. + * @return The bytes of the schemes at the given index. + */ + public com.google.protobuf.ByteString + getSchemesBytes(int index) { + return schemes_.getByteString(index); + } + + public static final int CREDENTIALS_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object credentials_ = ""; + /** + *
+   * Optional credentials
+   * 
+ * + * string credentials = 2; + * @return The credentials. + */ + @java.lang.Override + public java.lang.String getCredentials() { + java.lang.Object ref = credentials_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + credentials_ = s; + return s; + } + } + /** + *
+   * Optional credentials
+   * 
+ * + * string credentials = 2; + * @return The bytes for credentials. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getCredentialsBytes() { + java.lang.Object ref = credentials_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + credentials_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + for (int i = 0; i < schemes_.size(); i++) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, schemes_.getRaw(i)); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(credentials_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, credentials_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + for (int i = 0; i < schemes_.size(); i++) { + dataSize += computeStringSizeNoTag(schemes_.getRaw(i)); + } + size += dataSize; + size += 1 * getSchemesList().size(); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(credentials_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, credentials_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.AuthenticationInfo)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.AuthenticationInfo other = (org.a2aproject.sdk.compat03.grpc.AuthenticationInfo) obj; + + if (!getSchemesList() + .equals(other.getSchemesList())) return false; + if (!getCredentials() + .equals(other.getCredentials())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getSchemesCount() > 0) { + hash = (37 * hash) + SCHEMES_FIELD_NUMBER; + hash = (53 * hash) + getSchemesList().hashCode(); + } + hash = (37 * hash) + CREDENTIALS_FIELD_NUMBER; + hash = (53 * hash) + getCredentials().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.AuthenticationInfo parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AuthenticationInfo parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AuthenticationInfo parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AuthenticationInfo parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AuthenticationInfo parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AuthenticationInfo parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AuthenticationInfo parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.AuthenticationInfo parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.AuthenticationInfo parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.AuthenticationInfo parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AuthenticationInfo parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.AuthenticationInfo parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.AuthenticationInfo prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * Defines authentication details, used for push notifications.
+   * 
+ * + * Protobuf type {@code a2a.v1.AuthenticationInfo} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.AuthenticationInfo) + org.a2aproject.sdk.compat03.grpc.AuthenticationInfoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_AuthenticationInfo_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_AuthenticationInfo_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.AuthenticationInfo.class, org.a2aproject.sdk.compat03.grpc.AuthenticationInfo.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.AuthenticationInfo.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + schemes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + credentials_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_AuthenticationInfo_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AuthenticationInfo getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.AuthenticationInfo.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AuthenticationInfo build() { + org.a2aproject.sdk.compat03.grpc.AuthenticationInfo result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AuthenticationInfo buildPartial() { + org.a2aproject.sdk.compat03.grpc.AuthenticationInfo result = new org.a2aproject.sdk.compat03.grpc.AuthenticationInfo(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.AuthenticationInfo result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + schemes_.makeImmutable(); + result.schemes_ = schemes_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.credentials_ = credentials_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.AuthenticationInfo) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.AuthenticationInfo)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.AuthenticationInfo other) { + if (other == org.a2aproject.sdk.compat03.grpc.AuthenticationInfo.getDefaultInstance()) return this; + if (!other.schemes_.isEmpty()) { + if (schemes_.isEmpty()) { + schemes_ = other.schemes_; + bitField0_ |= 0x00000001; + } else { + ensureSchemesIsMutable(); + schemes_.addAll(other.schemes_); + } + onChanged(); + } + if (!other.getCredentials().isEmpty()) { + credentials_ = other.credentials_; + bitField0_ |= 0x00000002; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + ensureSchemesIsMutable(); + schemes_.add(s); + break; + } // case 10 + case 18: { + credentials_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private com.google.protobuf.LazyStringArrayList schemes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + private void ensureSchemesIsMutable() { + if (!schemes_.isModifiable()) { + schemes_ = new com.google.protobuf.LazyStringArrayList(schemes_); + } + bitField0_ |= 0x00000001; + } + /** + *
+     * Supported authentication schemes - e.g. Basic, Bearer, etc
+     * 
+ * + * repeated string schemes = 1; + * @return A list containing the schemes. + */ + public com.google.protobuf.ProtocolStringList + getSchemesList() { + schemes_.makeImmutable(); + return schemes_; + } + /** + *
+     * Supported authentication schemes - e.g. Basic, Bearer, etc
+     * 
+ * + * repeated string schemes = 1; + * @return The count of schemes. + */ + public int getSchemesCount() { + return schemes_.size(); + } + /** + *
+     * Supported authentication schemes - e.g. Basic, Bearer, etc
+     * 
+ * + * repeated string schemes = 1; + * @param index The index of the element to return. + * @return The schemes at the given index. + */ + public java.lang.String getSchemes(int index) { + return schemes_.get(index); + } + /** + *
+     * Supported authentication schemes - e.g. Basic, Bearer, etc
+     * 
+ * + * repeated string schemes = 1; + * @param index The index of the value to return. + * @return The bytes of the schemes at the given index. + */ + public com.google.protobuf.ByteString + getSchemesBytes(int index) { + return schemes_.getByteString(index); + } + /** + *
+     * Supported authentication schemes - e.g. Basic, Bearer, etc
+     * 
+ * + * repeated string schemes = 1; + * @param index The index to set the value at. + * @param value The schemes to set. + * @return This builder for chaining. + */ + public Builder setSchemes( + int index, java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureSchemesIsMutable(); + schemes_.set(index, value); + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * Supported authentication schemes - e.g. Basic, Bearer, etc
+     * 
+ * + * repeated string schemes = 1; + * @param value The schemes to add. + * @return This builder for chaining. + */ + public Builder addSchemes( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureSchemesIsMutable(); + schemes_.add(value); + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * Supported authentication schemes - e.g. Basic, Bearer, etc
+     * 
+ * + * repeated string schemes = 1; + * @param values The schemes to add. + * @return This builder for chaining. + */ + public Builder addAllSchemes( + java.lang.Iterable values) { + ensureSchemesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, schemes_); + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * Supported authentication schemes - e.g. Basic, Bearer, etc
+     * 
+ * + * repeated string schemes = 1; + * @return This builder for chaining. + */ + public Builder clearSchemes() { + schemes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001);; + onChanged(); + return this; + } + /** + *
+     * Supported authentication schemes - e.g. Basic, Bearer, etc
+     * 
+ * + * repeated string schemes = 1; + * @param value The bytes of the schemes to add. + * @return This builder for chaining. + */ + public Builder addSchemesBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + ensureSchemesIsMutable(); + schemes_.add(value); + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object credentials_ = ""; + /** + *
+     * Optional credentials
+     * 
+ * + * string credentials = 2; + * @return The credentials. + */ + public java.lang.String getCredentials() { + java.lang.Object ref = credentials_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + credentials_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Optional credentials
+     * 
+ * + * string credentials = 2; + * @return The bytes for credentials. + */ + public com.google.protobuf.ByteString + getCredentialsBytes() { + java.lang.Object ref = credentials_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + credentials_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Optional credentials
+     * 
+ * + * string credentials = 2; + * @param value The credentials to set. + * @return This builder for chaining. + */ + public Builder setCredentials( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + credentials_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * Optional credentials
+     * 
+ * + * string credentials = 2; + * @return This builder for chaining. + */ + public Builder clearCredentials() { + credentials_ = getDefaultInstance().getCredentials(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * Optional credentials
+     * 
+ * + * string credentials = 2; + * @param value The bytes for credentials to set. + * @return This builder for chaining. + */ + public Builder setCredentialsBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + credentials_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.AuthenticationInfo) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.AuthenticationInfo) + private static final org.a2aproject.sdk.compat03.grpc.AuthenticationInfo DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.AuthenticationInfo(); + } + + public static org.a2aproject.sdk.compat03.grpc.AuthenticationInfo getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AuthenticationInfo parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AuthenticationInfo getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AuthenticationInfoOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AuthenticationInfoOrBuilder.java new file mode 100644 index 000000000..6b25b7358 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AuthenticationInfoOrBuilder.java @@ -0,0 +1,73 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface AuthenticationInfoOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.AuthenticationInfo) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Supported authentication schemes - e.g. Basic, Bearer, etc
+   * 
+ * + * repeated string schemes = 1; + * @return A list containing the schemes. + */ + java.util.List + getSchemesList(); + /** + *
+   * Supported authentication schemes - e.g. Basic, Bearer, etc
+   * 
+ * + * repeated string schemes = 1; + * @return The count of schemes. + */ + int getSchemesCount(); + /** + *
+   * Supported authentication schemes - e.g. Basic, Bearer, etc
+   * 
+ * + * repeated string schemes = 1; + * @param index The index of the element to return. + * @return The schemes at the given index. + */ + java.lang.String getSchemes(int index); + /** + *
+   * Supported authentication schemes - e.g. Basic, Bearer, etc
+   * 
+ * + * repeated string schemes = 1; + * @param index The index of the value to return. + * @return The bytes of the schemes at the given index. + */ + com.google.protobuf.ByteString + getSchemesBytes(int index); + + /** + *
+   * Optional credentials
+   * 
+ * + * string credentials = 2; + * @return The credentials. + */ + java.lang.String getCredentials(); + /** + *
+   * Optional credentials
+   * 
+ * + * string credentials = 2; + * @return The bytes for credentials. + */ + com.google.protobuf.ByteString + getCredentialsBytes(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AuthorizationCodeOAuthFlow.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AuthorizationCodeOAuthFlow.java new file mode 100644 index 000000000..4c971f31e --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AuthorizationCodeOAuthFlow.java @@ -0,0 +1,1213 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.AuthorizationCodeOAuthFlow} + */ +@com.google.protobuf.Generated +public final class AuthorizationCodeOAuthFlow extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.AuthorizationCodeOAuthFlow) + AuthorizationCodeOAuthFlowOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "AuthorizationCodeOAuthFlow"); + } + // Use AuthorizationCodeOAuthFlow.newBuilder() to construct. + private AuthorizationCodeOAuthFlow(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private AuthorizationCodeOAuthFlow() { + authorizationUrl_ = ""; + tokenUrl_ = ""; + refreshUrl_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_AuthorizationCodeOAuthFlow_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { + switch (number) { + case 4: + return internalGetScopes(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_AuthorizationCodeOAuthFlow_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.class, org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.Builder.class); + } + + public static final int AUTHORIZATION_URL_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object authorizationUrl_ = ""; + /** + *
+   * The authorization URL to be used for this flow. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS
+   * 
+ * + * string authorization_url = 1; + * @return The authorizationUrl. + */ + @java.lang.Override + public java.lang.String getAuthorizationUrl() { + java.lang.Object ref = authorizationUrl_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + authorizationUrl_ = s; + return s; + } + } + /** + *
+   * The authorization URL to be used for this flow. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS
+   * 
+ * + * string authorization_url = 1; + * @return The bytes for authorizationUrl. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getAuthorizationUrlBytes() { + java.lang.Object ref = authorizationUrl_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + authorizationUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int TOKEN_URL_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object tokenUrl_ = ""; + /** + *
+   * The token URL to be used for this flow. This MUST be in the form of a URL.
+   * The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string token_url = 2; + * @return The tokenUrl. + */ + @java.lang.Override + public java.lang.String getTokenUrl() { + java.lang.Object ref = tokenUrl_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + tokenUrl_ = s; + return s; + } + } + /** + *
+   * The token URL to be used for this flow. This MUST be in the form of a URL.
+   * The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string token_url = 2; + * @return The bytes for tokenUrl. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getTokenUrlBytes() { + java.lang.Object ref = tokenUrl_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + tokenUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int REFRESH_URL_FIELD_NUMBER = 3; + @SuppressWarnings("serial") + private volatile java.lang.Object refreshUrl_ = ""; + /** + *
+   * The URL to be used for obtaining refresh tokens. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string refresh_url = 3; + * @return The refreshUrl. + */ + @java.lang.Override + public java.lang.String getRefreshUrl() { + java.lang.Object ref = refreshUrl_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + refreshUrl_ = s; + return s; + } + } + /** + *
+   * The URL to be used for obtaining refresh tokens. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string refresh_url = 3; + * @return The bytes for refreshUrl. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getRefreshUrlBytes() { + java.lang.Object ref = refreshUrl_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + refreshUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SCOPES_FIELD_NUMBER = 4; + private static final class ScopesDefaultEntryHolder { + static final com.google.protobuf.MapEntry< + java.lang.String, java.lang.String> defaultEntry = + com.google.protobuf.MapEntry + .newDefaultInstance( + A2A.internal_static_a2a_v1_AuthorizationCodeOAuthFlow_ScopesEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + @SuppressWarnings("serial") + private com.google.protobuf.MapField< + java.lang.String, java.lang.String> scopes_; + private com.google.protobuf.MapField + internalGetScopes() { + if (scopes_ == null) { + return com.google.protobuf.MapField.emptyMapField( + ScopesDefaultEntryHolder.defaultEntry); + } + return scopes_; + } + public int getScopesCount() { + return internalGetScopes().getMap().size(); + } + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 4; + */ + @java.lang.Override + public boolean containsScopes( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + return internalGetScopes().getMap().containsKey(key); + } + /** + * Use {@link #getScopesMap()} instead. + */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getScopes() { + return getScopesMap(); + } + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 4; + */ + @java.lang.Override + public java.util.Map getScopesMap() { + return internalGetScopes().getMap(); + } + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 4; + */ + @java.lang.Override + public /* nullable */ +java.lang.String getScopesOrDefault( + java.lang.String key, + /* nullable */ +java.lang.String defaultValue) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetScopes().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 4; + */ + @java.lang.Override + public java.lang.String getScopesOrThrow( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetScopes().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(authorizationUrl_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, authorizationUrl_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(tokenUrl_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, tokenUrl_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(refreshUrl_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 3, refreshUrl_); + } + com.google.protobuf.GeneratedMessage + .serializeStringMapTo( + output, + internalGetScopes(), + ScopesDefaultEntryHolder.defaultEntry, + 4); + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(authorizationUrl_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, authorizationUrl_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(tokenUrl_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, tokenUrl_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(refreshUrl_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(3, refreshUrl_); + } + for (java.util.Map.Entry entry + : internalGetScopes().getMap().entrySet()) { + com.google.protobuf.MapEntry + scopes__ = ScopesDefaultEntryHolder.defaultEntry.newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, scopes__); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow other = (org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow) obj; + + if (!getAuthorizationUrl() + .equals(other.getAuthorizationUrl())) return false; + if (!getTokenUrl() + .equals(other.getTokenUrl())) return false; + if (!getRefreshUrl() + .equals(other.getRefreshUrl())) return false; + if (!internalGetScopes().equals( + other.internalGetScopes())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + AUTHORIZATION_URL_FIELD_NUMBER; + hash = (53 * hash) + getAuthorizationUrl().hashCode(); + hash = (37 * hash) + TOKEN_URL_FIELD_NUMBER; + hash = (53 * hash) + getTokenUrl().hashCode(); + hash = (37 * hash) + REFRESH_URL_FIELD_NUMBER; + hash = (53 * hash) + getRefreshUrl().hashCode(); + if (!internalGetScopes().getMap().isEmpty()) { + hash = (37 * hash) + SCOPES_FIELD_NUMBER; + hash = (53 * hash) + internalGetScopes().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.AuthorizationCodeOAuthFlow} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.AuthorizationCodeOAuthFlow) + org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlowOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_AuthorizationCodeOAuthFlow_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { + switch (number) { + case 4: + return internalGetScopes(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMutableMapFieldReflection( + int number) { + switch (number) { + case 4: + return internalGetMutableScopes(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_AuthorizationCodeOAuthFlow_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.class, org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + authorizationUrl_ = ""; + tokenUrl_ = ""; + refreshUrl_ = ""; + internalGetMutableScopes().clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_AuthorizationCodeOAuthFlow_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow build() { + org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow buildPartial() { + org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow result = new org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.authorizationUrl_ = authorizationUrl_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.tokenUrl_ = tokenUrl_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.refreshUrl_ = refreshUrl_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.scopes_ = internalGetScopes(); + result.scopes_.makeImmutable(); + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow other) { + if (other == org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.getDefaultInstance()) return this; + if (!other.getAuthorizationUrl().isEmpty()) { + authorizationUrl_ = other.authorizationUrl_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getTokenUrl().isEmpty()) { + tokenUrl_ = other.tokenUrl_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (!other.getRefreshUrl().isEmpty()) { + refreshUrl_ = other.refreshUrl_; + bitField0_ |= 0x00000004; + onChanged(); + } + internalGetMutableScopes().mergeFrom( + other.internalGetScopes()); + bitField0_ |= 0x00000008; + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + authorizationUrl_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + tokenUrl_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: { + refreshUrl_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + case 34: { + com.google.protobuf.MapEntry + scopes__ = input.readMessage( + ScopesDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); + internalGetMutableScopes().getMutableMap().put( + scopes__.getKey(), scopes__.getValue()); + bitField0_ |= 0x00000008; + break; + } // case 34 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object authorizationUrl_ = ""; + /** + *
+     * The authorization URL to be used for this flow. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS
+     * 
+ * + * string authorization_url = 1; + * @return The authorizationUrl. + */ + public java.lang.String getAuthorizationUrl() { + java.lang.Object ref = authorizationUrl_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + authorizationUrl_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The authorization URL to be used for this flow. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS
+     * 
+ * + * string authorization_url = 1; + * @return The bytes for authorizationUrl. + */ + public com.google.protobuf.ByteString + getAuthorizationUrlBytes() { + java.lang.Object ref = authorizationUrl_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + authorizationUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The authorization URL to be used for this flow. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS
+     * 
+ * + * string authorization_url = 1; + * @param value The authorizationUrl to set. + * @return This builder for chaining. + */ + public Builder setAuthorizationUrl( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + authorizationUrl_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * The authorization URL to be used for this flow. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS
+     * 
+ * + * string authorization_url = 1; + * @return This builder for chaining. + */ + public Builder clearAuthorizationUrl() { + authorizationUrl_ = getDefaultInstance().getAuthorizationUrl(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * The authorization URL to be used for this flow. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS
+     * 
+ * + * string authorization_url = 1; + * @param value The bytes for authorizationUrl to set. + * @return This builder for chaining. + */ + public Builder setAuthorizationUrlBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + authorizationUrl_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object tokenUrl_ = ""; + /** + *
+     * The token URL to be used for this flow. This MUST be in the form of a URL.
+     * The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string token_url = 2; + * @return The tokenUrl. + */ + public java.lang.String getTokenUrl() { + java.lang.Object ref = tokenUrl_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + tokenUrl_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The token URL to be used for this flow. This MUST be in the form of a URL.
+     * The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string token_url = 2; + * @return The bytes for tokenUrl. + */ + public com.google.protobuf.ByteString + getTokenUrlBytes() { + java.lang.Object ref = tokenUrl_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + tokenUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The token URL to be used for this flow. This MUST be in the form of a URL.
+     * The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string token_url = 2; + * @param value The tokenUrl to set. + * @return This builder for chaining. + */ + public Builder setTokenUrl( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + tokenUrl_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * The token URL to be used for this flow. This MUST be in the form of a URL.
+     * The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string token_url = 2; + * @return This builder for chaining. + */ + public Builder clearTokenUrl() { + tokenUrl_ = getDefaultInstance().getTokenUrl(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * The token URL to be used for this flow. This MUST be in the form of a URL.
+     * The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string token_url = 2; + * @param value The bytes for tokenUrl to set. + * @return This builder for chaining. + */ + public Builder setTokenUrlBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + tokenUrl_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private java.lang.Object refreshUrl_ = ""; + /** + *
+     * The URL to be used for obtaining refresh tokens. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string refresh_url = 3; + * @return The refreshUrl. + */ + public java.lang.String getRefreshUrl() { + java.lang.Object ref = refreshUrl_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + refreshUrl_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The URL to be used for obtaining refresh tokens. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string refresh_url = 3; + * @return The bytes for refreshUrl. + */ + public com.google.protobuf.ByteString + getRefreshUrlBytes() { + java.lang.Object ref = refreshUrl_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + refreshUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The URL to be used for obtaining refresh tokens. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string refresh_url = 3; + * @param value The refreshUrl to set. + * @return This builder for chaining. + */ + public Builder setRefreshUrl( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + refreshUrl_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * The URL to be used for obtaining refresh tokens. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string refresh_url = 3; + * @return This builder for chaining. + */ + public Builder clearRefreshUrl() { + refreshUrl_ = getDefaultInstance().getRefreshUrl(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + *
+     * The URL to be used for obtaining refresh tokens. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string refresh_url = 3; + * @param value The bytes for refreshUrl to set. + * @return This builder for chaining. + */ + public Builder setRefreshUrlBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + refreshUrl_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + private com.google.protobuf.MapField< + java.lang.String, java.lang.String> scopes_; + private com.google.protobuf.MapField + internalGetScopes() { + if (scopes_ == null) { + return com.google.protobuf.MapField.emptyMapField( + ScopesDefaultEntryHolder.defaultEntry); + } + return scopes_; + } + private com.google.protobuf.MapField + internalGetMutableScopes() { + if (scopes_ == null) { + scopes_ = com.google.protobuf.MapField.newMapField( + ScopesDefaultEntryHolder.defaultEntry); + } + if (!scopes_.isMutable()) { + scopes_ = scopes_.copy(); + } + bitField0_ |= 0x00000008; + onChanged(); + return scopes_; + } + public int getScopesCount() { + return internalGetScopes().getMap().size(); + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 4; + */ + @java.lang.Override + public boolean containsScopes( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + return internalGetScopes().getMap().containsKey(key); + } + /** + * Use {@link #getScopesMap()} instead. + */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getScopes() { + return getScopesMap(); + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 4; + */ + @java.lang.Override + public java.util.Map getScopesMap() { + return internalGetScopes().getMap(); + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 4; + */ + @java.lang.Override + public /* nullable */ +java.lang.String getScopesOrDefault( + java.lang.String key, + /* nullable */ +java.lang.String defaultValue) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetScopes().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 4; + */ + @java.lang.Override + public java.lang.String getScopesOrThrow( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetScopes().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + public Builder clearScopes() { + bitField0_ = (bitField0_ & ~0x00000008); + internalGetMutableScopes().getMutableMap() + .clear(); + return this; + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 4; + */ + public Builder removeScopes( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + internalGetMutableScopes().getMutableMap() + .remove(key); + return this; + } + /** + * Use alternate mutation accessors instead. + */ + @java.lang.Deprecated + public java.util.Map + getMutableScopes() { + bitField0_ |= 0x00000008; + return internalGetMutableScopes().getMutableMap(); + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 4; + */ + public Builder putScopes( + java.lang.String key, + java.lang.String value) { + if (key == null) { throw new NullPointerException("map key"); } + if (value == null) { throw new NullPointerException("map value"); } + internalGetMutableScopes().getMutableMap() + .put(key, value); + bitField0_ |= 0x00000008; + return this; + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 4; + */ + public Builder putAllScopes( + java.util.Map values) { + internalGetMutableScopes().getMutableMap() + .putAll(values); + bitField0_ |= 0x00000008; + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.AuthorizationCodeOAuthFlow) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.AuthorizationCodeOAuthFlow) + private static final org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow(); + } + + public static org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AuthorizationCodeOAuthFlow parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AuthorizationCodeOAuthFlowOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AuthorizationCodeOAuthFlowOrBuilder.java new file mode 100644 index 000000000..399a78bcb --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AuthorizationCodeOAuthFlowOrBuilder.java @@ -0,0 +1,137 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface AuthorizationCodeOAuthFlowOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.AuthorizationCodeOAuthFlow) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The authorization URL to be used for this flow. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS
+   * 
+ * + * string authorization_url = 1; + * @return The authorizationUrl. + */ + java.lang.String getAuthorizationUrl(); + /** + *
+   * The authorization URL to be used for this flow. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS
+   * 
+ * + * string authorization_url = 1; + * @return The bytes for authorizationUrl. + */ + com.google.protobuf.ByteString + getAuthorizationUrlBytes(); + + /** + *
+   * The token URL to be used for this flow. This MUST be in the form of a URL.
+   * The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string token_url = 2; + * @return The tokenUrl. + */ + java.lang.String getTokenUrl(); + /** + *
+   * The token URL to be used for this flow. This MUST be in the form of a URL.
+   * The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string token_url = 2; + * @return The bytes for tokenUrl. + */ + com.google.protobuf.ByteString + getTokenUrlBytes(); + + /** + *
+   * The URL to be used for obtaining refresh tokens. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string refresh_url = 3; + * @return The refreshUrl. + */ + java.lang.String getRefreshUrl(); + /** + *
+   * The URL to be used for obtaining refresh tokens. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string refresh_url = 3; + * @return The bytes for refreshUrl. + */ + com.google.protobuf.ByteString + getRefreshUrlBytes(); + + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 4; + */ + int getScopesCount(); + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 4; + */ + boolean containsScopes( + java.lang.String key); + /** + * Use {@link #getScopesMap()} instead. + */ + @java.lang.Deprecated + java.util.Map + getScopes(); + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 4; + */ + java.util.Map + getScopesMap(); + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 4; + */ + /* nullable */ +java.lang.String getScopesOrDefault( + java.lang.String key, + /* nullable */ +java.lang.String defaultValue); + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 4; + */ + java.lang.String getScopesOrThrow( + java.lang.String key); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/CancelTaskRequest.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/CancelTaskRequest.java new file mode 100644 index 000000000..397dd9977 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/CancelTaskRequest.java @@ -0,0 +1,530 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.CancelTaskRequest} + */ +@com.google.protobuf.Generated +public final class CancelTaskRequest extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.CancelTaskRequest) + CancelTaskRequestOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "CancelTaskRequest"); + } + // Use CancelTaskRequest.newBuilder() to construct. + private CancelTaskRequest(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private CancelTaskRequest() { + name_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_CancelTaskRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_CancelTaskRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.CancelTaskRequest.class, org.a2aproject.sdk.compat03.grpc.CancelTaskRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + *
+   * name=tasks/{id}
+   * 
+ * + * string name = 1; + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + *
+   * name=tasks/{id}
+   * 
+ * + * string name = 1; + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, name_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, name_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.CancelTaskRequest)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.CancelTaskRequest other = (org.a2aproject.sdk.compat03.grpc.CancelTaskRequest) obj; + + if (!getName() + .equals(other.getName())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.CancelTaskRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.CancelTaskRequest parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.CancelTaskRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.CancelTaskRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.CancelTaskRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.CancelTaskRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.CancelTaskRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.CancelTaskRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.CancelTaskRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.CancelTaskRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.CancelTaskRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.CancelTaskRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.CancelTaskRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.CancelTaskRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.CancelTaskRequest) + org.a2aproject.sdk.compat03.grpc.CancelTaskRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_CancelTaskRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_CancelTaskRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.CancelTaskRequest.class, org.a2aproject.sdk.compat03.grpc.CancelTaskRequest.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.CancelTaskRequest.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + name_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_CancelTaskRequest_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.CancelTaskRequest getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.CancelTaskRequest.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.CancelTaskRequest build() { + org.a2aproject.sdk.compat03.grpc.CancelTaskRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.CancelTaskRequest buildPartial() { + org.a2aproject.sdk.compat03.grpc.CancelTaskRequest result = new org.a2aproject.sdk.compat03.grpc.CancelTaskRequest(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.CancelTaskRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.CancelTaskRequest) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.CancelTaskRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.CancelTaskRequest other) { + if (other == org.a2aproject.sdk.compat03.grpc.CancelTaskRequest.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000001; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + *
+     * name=tasks/{id}
+     * 
+ * + * string name = 1; + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * name=tasks/{id}
+     * 
+ * + * string name = 1; + * @return The bytes for name. + */ + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * name=tasks/{id}
+     * 
+ * + * string name = 1; + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * name=tasks/{id}
+     * 
+ * + * string name = 1; + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * name=tasks/{id}
+     * 
+ * + * string name = 1; + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.CancelTaskRequest) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.CancelTaskRequest) + private static final org.a2aproject.sdk.compat03.grpc.CancelTaskRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.CancelTaskRequest(); + } + + public static org.a2aproject.sdk.compat03.grpc.CancelTaskRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CancelTaskRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.CancelTaskRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/CancelTaskRequestOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/CancelTaskRequestOrBuilder.java new file mode 100644 index 000000000..f46dc46c2 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/CancelTaskRequestOrBuilder.java @@ -0,0 +1,32 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface CancelTaskRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.CancelTaskRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * name=tasks/{id}
+   * 
+ * + * string name = 1; + * @return The name. + */ + java.lang.String getName(); + /** + *
+   * name=tasks/{id}
+   * 
+ * + * string name = 1; + * @return The bytes for name. + */ + com.google.protobuf.ByteString + getNameBytes(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ClientCredentialsOAuthFlow.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ClientCredentialsOAuthFlow.java new file mode 100644 index 000000000..79000ab25 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ClientCredentialsOAuthFlow.java @@ -0,0 +1,1042 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.ClientCredentialsOAuthFlow} + */ +@com.google.protobuf.Generated +public final class ClientCredentialsOAuthFlow extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.ClientCredentialsOAuthFlow) + ClientCredentialsOAuthFlowOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "ClientCredentialsOAuthFlow"); + } + // Use ClientCredentialsOAuthFlow.newBuilder() to construct. + private ClientCredentialsOAuthFlow(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private ClientCredentialsOAuthFlow() { + tokenUrl_ = ""; + refreshUrl_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_ClientCredentialsOAuthFlow_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { + switch (number) { + case 3: + return internalGetScopes(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_ClientCredentialsOAuthFlow_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.class, org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.Builder.class); + } + + public static final int TOKEN_URL_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object tokenUrl_ = ""; + /** + *
+   * The token URL to be used for this flow. This MUST be in the form of a URL.
+   * The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string token_url = 1; + * @return The tokenUrl. + */ + @java.lang.Override + public java.lang.String getTokenUrl() { + java.lang.Object ref = tokenUrl_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + tokenUrl_ = s; + return s; + } + } + /** + *
+   * The token URL to be used for this flow. This MUST be in the form of a URL.
+   * The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string token_url = 1; + * @return The bytes for tokenUrl. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getTokenUrlBytes() { + java.lang.Object ref = tokenUrl_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + tokenUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int REFRESH_URL_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object refreshUrl_ = ""; + /** + *
+   * The URL to be used for obtaining refresh tokens. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string refresh_url = 2; + * @return The refreshUrl. + */ + @java.lang.Override + public java.lang.String getRefreshUrl() { + java.lang.Object ref = refreshUrl_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + refreshUrl_ = s; + return s; + } + } + /** + *
+   * The URL to be used for obtaining refresh tokens. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string refresh_url = 2; + * @return The bytes for refreshUrl. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getRefreshUrlBytes() { + java.lang.Object ref = refreshUrl_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + refreshUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SCOPES_FIELD_NUMBER = 3; + private static final class ScopesDefaultEntryHolder { + static final com.google.protobuf.MapEntry< + java.lang.String, java.lang.String> defaultEntry = + com.google.protobuf.MapEntry + .newDefaultInstance( + A2A.internal_static_a2a_v1_ClientCredentialsOAuthFlow_ScopesEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + @SuppressWarnings("serial") + private com.google.protobuf.MapField< + java.lang.String, java.lang.String> scopes_; + private com.google.protobuf.MapField + internalGetScopes() { + if (scopes_ == null) { + return com.google.protobuf.MapField.emptyMapField( + ScopesDefaultEntryHolder.defaultEntry); + } + return scopes_; + } + public int getScopesCount() { + return internalGetScopes().getMap().size(); + } + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public boolean containsScopes( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + return internalGetScopes().getMap().containsKey(key); + } + /** + * Use {@link #getScopesMap()} instead. + */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getScopes() { + return getScopesMap(); + } + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public java.util.Map getScopesMap() { + return internalGetScopes().getMap(); + } + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public /* nullable */ +java.lang.String getScopesOrDefault( + java.lang.String key, + /* nullable */ +java.lang.String defaultValue) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetScopes().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public java.lang.String getScopesOrThrow( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetScopes().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(tokenUrl_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, tokenUrl_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(refreshUrl_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, refreshUrl_); + } + com.google.protobuf.GeneratedMessage + .serializeStringMapTo( + output, + internalGetScopes(), + ScopesDefaultEntryHolder.defaultEntry, + 3); + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(tokenUrl_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, tokenUrl_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(refreshUrl_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, refreshUrl_); + } + for (java.util.Map.Entry entry + : internalGetScopes().getMap().entrySet()) { + com.google.protobuf.MapEntry + scopes__ = ScopesDefaultEntryHolder.defaultEntry.newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, scopes__); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow other = (org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow) obj; + + if (!getTokenUrl() + .equals(other.getTokenUrl())) return false; + if (!getRefreshUrl() + .equals(other.getRefreshUrl())) return false; + if (!internalGetScopes().equals( + other.internalGetScopes())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + TOKEN_URL_FIELD_NUMBER; + hash = (53 * hash) + getTokenUrl().hashCode(); + hash = (37 * hash) + REFRESH_URL_FIELD_NUMBER; + hash = (53 * hash) + getRefreshUrl().hashCode(); + if (!internalGetScopes().getMap().isEmpty()) { + hash = (37 * hash) + SCOPES_FIELD_NUMBER; + hash = (53 * hash) + internalGetScopes().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.ClientCredentialsOAuthFlow} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.ClientCredentialsOAuthFlow) + org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlowOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_ClientCredentialsOAuthFlow_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { + switch (number) { + case 3: + return internalGetScopes(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMutableMapFieldReflection( + int number) { + switch (number) { + case 3: + return internalGetMutableScopes(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_ClientCredentialsOAuthFlow_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.class, org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + tokenUrl_ = ""; + refreshUrl_ = ""; + internalGetMutableScopes().clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_ClientCredentialsOAuthFlow_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow build() { + org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow buildPartial() { + org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow result = new org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.tokenUrl_ = tokenUrl_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.refreshUrl_ = refreshUrl_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.scopes_ = internalGetScopes(); + result.scopes_.makeImmutable(); + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow other) { + if (other == org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.getDefaultInstance()) return this; + if (!other.getTokenUrl().isEmpty()) { + tokenUrl_ = other.tokenUrl_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getRefreshUrl().isEmpty()) { + refreshUrl_ = other.refreshUrl_; + bitField0_ |= 0x00000002; + onChanged(); + } + internalGetMutableScopes().mergeFrom( + other.internalGetScopes()); + bitField0_ |= 0x00000004; + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + tokenUrl_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + refreshUrl_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: { + com.google.protobuf.MapEntry + scopes__ = input.readMessage( + ScopesDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); + internalGetMutableScopes().getMutableMap().put( + scopes__.getKey(), scopes__.getValue()); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object tokenUrl_ = ""; + /** + *
+     * The token URL to be used for this flow. This MUST be in the form of a URL.
+     * The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string token_url = 1; + * @return The tokenUrl. + */ + public java.lang.String getTokenUrl() { + java.lang.Object ref = tokenUrl_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + tokenUrl_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The token URL to be used for this flow. This MUST be in the form of a URL.
+     * The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string token_url = 1; + * @return The bytes for tokenUrl. + */ + public com.google.protobuf.ByteString + getTokenUrlBytes() { + java.lang.Object ref = tokenUrl_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + tokenUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The token URL to be used for this flow. This MUST be in the form of a URL.
+     * The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string token_url = 1; + * @param value The tokenUrl to set. + * @return This builder for chaining. + */ + public Builder setTokenUrl( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + tokenUrl_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * The token URL to be used for this flow. This MUST be in the form of a URL.
+     * The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string token_url = 1; + * @return This builder for chaining. + */ + public Builder clearTokenUrl() { + tokenUrl_ = getDefaultInstance().getTokenUrl(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * The token URL to be used for this flow. This MUST be in the form of a URL.
+     * The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string token_url = 1; + * @param value The bytes for tokenUrl to set. + * @return This builder for chaining. + */ + public Builder setTokenUrlBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + tokenUrl_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object refreshUrl_ = ""; + /** + *
+     * The URL to be used for obtaining refresh tokens. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string refresh_url = 2; + * @return The refreshUrl. + */ + public java.lang.String getRefreshUrl() { + java.lang.Object ref = refreshUrl_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + refreshUrl_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The URL to be used for obtaining refresh tokens. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string refresh_url = 2; + * @return The bytes for refreshUrl. + */ + public com.google.protobuf.ByteString + getRefreshUrlBytes() { + java.lang.Object ref = refreshUrl_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + refreshUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The URL to be used for obtaining refresh tokens. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string refresh_url = 2; + * @param value The refreshUrl to set. + * @return This builder for chaining. + */ + public Builder setRefreshUrl( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + refreshUrl_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * The URL to be used for obtaining refresh tokens. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string refresh_url = 2; + * @return This builder for chaining. + */ + public Builder clearRefreshUrl() { + refreshUrl_ = getDefaultInstance().getRefreshUrl(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * The URL to be used for obtaining refresh tokens. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string refresh_url = 2; + * @param value The bytes for refreshUrl to set. + * @return This builder for chaining. + */ + public Builder setRefreshUrlBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + refreshUrl_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private com.google.protobuf.MapField< + java.lang.String, java.lang.String> scopes_; + private com.google.protobuf.MapField + internalGetScopes() { + if (scopes_ == null) { + return com.google.protobuf.MapField.emptyMapField( + ScopesDefaultEntryHolder.defaultEntry); + } + return scopes_; + } + private com.google.protobuf.MapField + internalGetMutableScopes() { + if (scopes_ == null) { + scopes_ = com.google.protobuf.MapField.newMapField( + ScopesDefaultEntryHolder.defaultEntry); + } + if (!scopes_.isMutable()) { + scopes_ = scopes_.copy(); + } + bitField0_ |= 0x00000004; + onChanged(); + return scopes_; + } + public int getScopesCount() { + return internalGetScopes().getMap().size(); + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public boolean containsScopes( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + return internalGetScopes().getMap().containsKey(key); + } + /** + * Use {@link #getScopesMap()} instead. + */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getScopes() { + return getScopesMap(); + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public java.util.Map getScopesMap() { + return internalGetScopes().getMap(); + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public /* nullable */ +java.lang.String getScopesOrDefault( + java.lang.String key, + /* nullable */ +java.lang.String defaultValue) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetScopes().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public java.lang.String getScopesOrThrow( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetScopes().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + public Builder clearScopes() { + bitField0_ = (bitField0_ & ~0x00000004); + internalGetMutableScopes().getMutableMap() + .clear(); + return this; + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + public Builder removeScopes( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + internalGetMutableScopes().getMutableMap() + .remove(key); + return this; + } + /** + * Use alternate mutation accessors instead. + */ + @java.lang.Deprecated + public java.util.Map + getMutableScopes() { + bitField0_ |= 0x00000004; + return internalGetMutableScopes().getMutableMap(); + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + public Builder putScopes( + java.lang.String key, + java.lang.String value) { + if (key == null) { throw new NullPointerException("map key"); } + if (value == null) { throw new NullPointerException("map value"); } + internalGetMutableScopes().getMutableMap() + .put(key, value); + bitField0_ |= 0x00000004; + return this; + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + public Builder putAllScopes( + java.util.Map values) { + internalGetMutableScopes().getMutableMap() + .putAll(values); + bitField0_ |= 0x00000004; + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.ClientCredentialsOAuthFlow) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.ClientCredentialsOAuthFlow) + private static final org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow(); + } + + public static org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ClientCredentialsOAuthFlow parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ClientCredentialsOAuthFlowOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ClientCredentialsOAuthFlowOrBuilder.java new file mode 100644 index 000000000..11ce5b1e2 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ClientCredentialsOAuthFlowOrBuilder.java @@ -0,0 +1,115 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface ClientCredentialsOAuthFlowOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.ClientCredentialsOAuthFlow) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The token URL to be used for this flow. This MUST be in the form of a URL.
+   * The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string token_url = 1; + * @return The tokenUrl. + */ + java.lang.String getTokenUrl(); + /** + *
+   * The token URL to be used for this flow. This MUST be in the form of a URL.
+   * The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string token_url = 1; + * @return The bytes for tokenUrl. + */ + com.google.protobuf.ByteString + getTokenUrlBytes(); + + /** + *
+   * The URL to be used for obtaining refresh tokens. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string refresh_url = 2; + * @return The refreshUrl. + */ + java.lang.String getRefreshUrl(); + /** + *
+   * The URL to be used for obtaining refresh tokens. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string refresh_url = 2; + * @return The bytes for refreshUrl. + */ + com.google.protobuf.ByteString + getRefreshUrlBytes(); + + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + int getScopesCount(); + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + boolean containsScopes( + java.lang.String key); + /** + * Use {@link #getScopesMap()} instead. + */ + @java.lang.Deprecated + java.util.Map + getScopes(); + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + java.util.Map + getScopesMap(); + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + /* nullable */ +java.lang.String getScopesOrDefault( + java.lang.String key, + /* nullable */ +java.lang.String defaultValue); + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + java.lang.String getScopesOrThrow( + java.lang.String key); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/CreateTaskPushNotificationConfigRequest.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/CreateTaskPushNotificationConfigRequest.java new file mode 100644 index 000000000..ff6d73815 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/CreateTaskPushNotificationConfigRequest.java @@ -0,0 +1,866 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.CreateTaskPushNotificationConfigRequest} + */ +@com.google.protobuf.Generated +public final class CreateTaskPushNotificationConfigRequest extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.CreateTaskPushNotificationConfigRequest) + CreateTaskPushNotificationConfigRequestOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "CreateTaskPushNotificationConfigRequest"); + } + // Use CreateTaskPushNotificationConfigRequest.newBuilder() to construct. + private CreateTaskPushNotificationConfigRequest(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private CreateTaskPushNotificationConfigRequest() { + parent_ = ""; + configId_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_CreateTaskPushNotificationConfigRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_CreateTaskPushNotificationConfigRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest.class, org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest.Builder.class); + } + + private int bitField0_; + public static final int PARENT_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object parent_ = ""; + /** + *
+   * The task resource for this config.
+   * Format: tasks/{id}
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + *
+   * The task resource for this config.
+   * Format: tasks/{id}
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CONFIG_ID_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object configId_ = ""; + /** + * string config_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return The configId. + */ + @java.lang.Override + public java.lang.String getConfigId() { + java.lang.Object ref = configId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + configId_ = s; + return s; + } + } + /** + * string config_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return The bytes for configId. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getConfigIdBytes() { + java.lang.Object ref = configId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + configId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CONFIG_FIELD_NUMBER = 3; + private org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig config_; + /** + * .a2a.v1.TaskPushNotificationConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return Whether the config field is set. + */ + @java.lang.Override + public boolean hasConfig() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * .a2a.v1.TaskPushNotificationConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return The config. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig getConfig() { + return config_ == null ? org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.getDefaultInstance() : config_; + } + /** + * .a2a.v1.TaskPushNotificationConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfigOrBuilder getConfigOrBuilder() { + return config_ == null ? org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.getDefaultInstance() : config_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(parent_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, parent_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(configId_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, configId_); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(3, getConfig()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(parent_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, parent_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(configId_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, configId_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, getConfig()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest other = (org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest) obj; + + if (!getParent() + .equals(other.getParent())) return false; + if (!getConfigId() + .equals(other.getConfigId())) return false; + if (hasConfig() != other.hasConfig()) return false; + if (hasConfig()) { + if (!getConfig() + .equals(other.getConfig())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (37 * hash) + CONFIG_ID_FIELD_NUMBER; + hash = (53 * hash) + getConfigId().hashCode(); + if (hasConfig()) { + hash = (37 * hash) + CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getConfig().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.CreateTaskPushNotificationConfigRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.CreateTaskPushNotificationConfigRequest) + org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_CreateTaskPushNotificationConfigRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_CreateTaskPushNotificationConfigRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest.class, org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage + .alwaysUseFieldBuilders) { + internalGetConfigFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + parent_ = ""; + configId_ = ""; + config_ = null; + if (configBuilder_ != null) { + configBuilder_.dispose(); + configBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_CreateTaskPushNotificationConfigRequest_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest build() { + org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest buildPartial() { + org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest result = new org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.parent_ = parent_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.configId_ = configId_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000004) != 0)) { + result.config_ = configBuilder_ == null + ? config_ + : configBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest other) { + if (other == org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest.getDefaultInstance()) return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getConfigId().isEmpty()) { + configId_ = other.configId_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (other.hasConfig()) { + mergeConfig(other.getConfig()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + parent_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + configId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: { + input.readMessage( + internalGetConfigFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object parent_ = ""; + /** + *
+     * The task resource for this config.
+     * Format: tasks/{id}
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The task resource for this config.
+     * Format: tasks/{id}
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString + getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The task resource for this config.
+     * Format: tasks/{id}
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + parent_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * The task resource for this config.
+     * Format: tasks/{id}
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return This builder for chaining. + */ + public Builder clearParent() { + parent_ = getDefaultInstance().getParent(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * The task resource for this config.
+     * Format: tasks/{id}
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + parent_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object configId_ = ""; + /** + * string config_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return The configId. + */ + public java.lang.String getConfigId() { + java.lang.Object ref = configId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + configId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string config_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return The bytes for configId. + */ + public com.google.protobuf.ByteString + getConfigIdBytes() { + java.lang.Object ref = configId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + configId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string config_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param value The configId to set. + * @return This builder for chaining. + */ + public Builder setConfigId( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + configId_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * string config_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return This builder for chaining. + */ + public Builder clearConfigId() { + configId_ = getDefaultInstance().getConfigId(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * string config_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param value The bytes for configId to set. + * @return This builder for chaining. + */ + public Builder setConfigIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + configId_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig config_; + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.Builder, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfigOrBuilder> configBuilder_; + /** + * .a2a.v1.TaskPushNotificationConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return Whether the config field is set. + */ + public boolean hasConfig() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * .a2a.v1.TaskPushNotificationConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return The config. + */ + public org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig getConfig() { + if (configBuilder_ == null) { + return config_ == null ? org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.getDefaultInstance() : config_; + } else { + return configBuilder_.getMessage(); + } + } + /** + * .a2a.v1.TaskPushNotificationConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setConfig(org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig value) { + if (configBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + config_ = value; + } else { + configBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * .a2a.v1.TaskPushNotificationConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setConfig( + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.Builder builderForValue) { + if (configBuilder_ == null) { + config_ = builderForValue.build(); + } else { + configBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * .a2a.v1.TaskPushNotificationConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder mergeConfig(org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig value) { + if (configBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0) && + config_ != null && + config_ != org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.getDefaultInstance()) { + getConfigBuilder().mergeFrom(value); + } else { + config_ = value; + } + } else { + configBuilder_.mergeFrom(value); + } + if (config_ != null) { + bitField0_ |= 0x00000004; + onChanged(); + } + return this; + } + /** + * .a2a.v1.TaskPushNotificationConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder clearConfig() { + bitField0_ = (bitField0_ & ~0x00000004); + config_ = null; + if (configBuilder_ != null) { + configBuilder_.dispose(); + configBuilder_ = null; + } + onChanged(); + return this; + } + /** + * .a2a.v1.TaskPushNotificationConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + public org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.Builder getConfigBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return internalGetConfigFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.TaskPushNotificationConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + public org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfigOrBuilder getConfigOrBuilder() { + if (configBuilder_ != null) { + return configBuilder_.getMessageOrBuilder(); + } else { + return config_ == null ? + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.getDefaultInstance() : config_; + } + } + /** + * .a2a.v1.TaskPushNotificationConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.Builder, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfigOrBuilder> + internalGetConfigFieldBuilder() { + if (configBuilder_ == null) { + configBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.Builder, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfigOrBuilder>( + getConfig(), + getParentForChildren(), + isClean()); + config_ = null; + } + return configBuilder_; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.CreateTaskPushNotificationConfigRequest) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.CreateTaskPushNotificationConfigRequest) + private static final org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest(); + } + + public static org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CreateTaskPushNotificationConfigRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/CreateTaskPushNotificationConfigRequestOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/CreateTaskPushNotificationConfigRequestOrBuilder.java new file mode 100644 index 000000000..ce25ef2c4 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/CreateTaskPushNotificationConfigRequestOrBuilder.java @@ -0,0 +1,61 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface CreateTaskPushNotificationConfigRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.CreateTaskPushNotificationConfigRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The task resource for this config.
+   * Format: tasks/{id}
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The parent. + */ + java.lang.String getParent(); + /** + *
+   * The task resource for this config.
+   * Format: tasks/{id}
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The bytes for parent. + */ + com.google.protobuf.ByteString + getParentBytes(); + + /** + * string config_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return The configId. + */ + java.lang.String getConfigId(); + /** + * string config_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return The bytes for configId. + */ + com.google.protobuf.ByteString + getConfigIdBytes(); + + /** + * .a2a.v1.TaskPushNotificationConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return Whether the config field is set. + */ + boolean hasConfig(); + /** + * .a2a.v1.TaskPushNotificationConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return The config. + */ + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig getConfig(); + /** + * .a2a.v1.TaskPushNotificationConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfigOrBuilder getConfigOrBuilder(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/DataPart.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/DataPart.java new file mode 100644 index 000000000..7aefff18a --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/DataPart.java @@ -0,0 +1,567 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * DataPart represents a structured blob. This is most commonly a JSON payload.
+ * 
+ * + * Protobuf type {@code a2a.v1.DataPart} + */ +@com.google.protobuf.Generated +public final class DataPart extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.DataPart) + DataPartOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "DataPart"); + } + // Use DataPart.newBuilder() to construct. + private DataPart(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private DataPart() { + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_DataPart_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_DataPart_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.DataPart.class, org.a2aproject.sdk.compat03.grpc.DataPart.Builder.class); + } + + private int bitField0_; + public static final int DATA_FIELD_NUMBER = 1; + private com.google.protobuf.Struct data_; + /** + * .google.protobuf.Struct data = 1; + * @return Whether the data field is set. + */ + @java.lang.Override + public boolean hasData() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * .google.protobuf.Struct data = 1; + * @return The data. + */ + @java.lang.Override + public com.google.protobuf.Struct getData() { + return data_ == null ? com.google.protobuf.Struct.getDefaultInstance() : data_; + } + /** + * .google.protobuf.Struct data = 1; + */ + @java.lang.Override + public com.google.protobuf.StructOrBuilder getDataOrBuilder() { + return data_ == null ? com.google.protobuf.Struct.getDefaultInstance() : data_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(1, getData()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, getData()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.DataPart)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.DataPart other = (org.a2aproject.sdk.compat03.grpc.DataPart) obj; + + if (hasData() != other.hasData()) return false; + if (hasData()) { + if (!getData() + .equals(other.getData())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasData()) { + hash = (37 * hash) + DATA_FIELD_NUMBER; + hash = (53 * hash) + getData().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.DataPart parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.DataPart parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.DataPart parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.DataPart parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.DataPart parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.DataPart parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.DataPart parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.DataPart parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.DataPart parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.DataPart parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.DataPart parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.DataPart parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.DataPart prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * DataPart represents a structured blob. This is most commonly a JSON payload.
+   * 
+ * + * Protobuf type {@code a2a.v1.DataPart} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.DataPart) + org.a2aproject.sdk.compat03.grpc.DataPartOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_DataPart_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_DataPart_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.DataPart.class, org.a2aproject.sdk.compat03.grpc.DataPart.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.DataPart.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage + .alwaysUseFieldBuilders) { + internalGetDataFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + data_ = null; + if (dataBuilder_ != null) { + dataBuilder_.dispose(); + dataBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_DataPart_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.DataPart getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.DataPart.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.DataPart build() { + org.a2aproject.sdk.compat03.grpc.DataPart result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.DataPart buildPartial() { + org.a2aproject.sdk.compat03.grpc.DataPart result = new org.a2aproject.sdk.compat03.grpc.DataPart(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.DataPart result) { + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.data_ = dataBuilder_ == null + ? data_ + : dataBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.DataPart) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.DataPart)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.DataPart other) { + if (other == org.a2aproject.sdk.compat03.grpc.DataPart.getDefaultInstance()) return this; + if (other.hasData()) { + mergeData(other.getData()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + input.readMessage( + internalGetDataFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private com.google.protobuf.Struct data_; + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> dataBuilder_; + /** + * .google.protobuf.Struct data = 1; + * @return Whether the data field is set. + */ + public boolean hasData() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * .google.protobuf.Struct data = 1; + * @return The data. + */ + public com.google.protobuf.Struct getData() { + if (dataBuilder_ == null) { + return data_ == null ? com.google.protobuf.Struct.getDefaultInstance() : data_; + } else { + return dataBuilder_.getMessage(); + } + } + /** + * .google.protobuf.Struct data = 1; + */ + public Builder setData(com.google.protobuf.Struct value) { + if (dataBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + data_ = value; + } else { + dataBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * .google.protobuf.Struct data = 1; + */ + public Builder setData( + com.google.protobuf.Struct.Builder builderForValue) { + if (dataBuilder_ == null) { + data_ = builderForValue.build(); + } else { + dataBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * .google.protobuf.Struct data = 1; + */ + public Builder mergeData(com.google.protobuf.Struct value) { + if (dataBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0) && + data_ != null && + data_ != com.google.protobuf.Struct.getDefaultInstance()) { + getDataBuilder().mergeFrom(value); + } else { + data_ = value; + } + } else { + dataBuilder_.mergeFrom(value); + } + if (data_ != null) { + bitField0_ |= 0x00000001; + onChanged(); + } + return this; + } + /** + * .google.protobuf.Struct data = 1; + */ + public Builder clearData() { + bitField0_ = (bitField0_ & ~0x00000001); + data_ = null; + if (dataBuilder_ != null) { + dataBuilder_.dispose(); + dataBuilder_ = null; + } + onChanged(); + return this; + } + /** + * .google.protobuf.Struct data = 1; + */ + public com.google.protobuf.Struct.Builder getDataBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return internalGetDataFieldBuilder().getBuilder(); + } + /** + * .google.protobuf.Struct data = 1; + */ + public com.google.protobuf.StructOrBuilder getDataOrBuilder() { + if (dataBuilder_ != null) { + return dataBuilder_.getMessageOrBuilder(); + } else { + return data_ == null ? + com.google.protobuf.Struct.getDefaultInstance() : data_; + } + } + /** + * .google.protobuf.Struct data = 1; + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> + internalGetDataFieldBuilder() { + if (dataBuilder_ == null) { + dataBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder>( + getData(), + getParentForChildren(), + isClean()); + data_ = null; + } + return dataBuilder_; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.DataPart) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.DataPart) + private static final org.a2aproject.sdk.compat03.grpc.DataPart DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.DataPart(); + } + + public static org.a2aproject.sdk.compat03.grpc.DataPart getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public DataPart parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.DataPart getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/DataPartOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/DataPartOrBuilder.java new file mode 100644 index 000000000..cf387c020 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/DataPartOrBuilder.java @@ -0,0 +1,27 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface DataPartOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.DataPart) + com.google.protobuf.MessageOrBuilder { + + /** + * .google.protobuf.Struct data = 1; + * @return Whether the data field is set. + */ + boolean hasData(); + /** + * .google.protobuf.Struct data = 1; + * @return The data. + */ + com.google.protobuf.Struct getData(); + /** + * .google.protobuf.Struct data = 1; + */ + com.google.protobuf.StructOrBuilder getDataOrBuilder(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/DeleteTaskPushNotificationConfigRequest.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/DeleteTaskPushNotificationConfigRequest.java new file mode 100644 index 000000000..369c55560 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/DeleteTaskPushNotificationConfigRequest.java @@ -0,0 +1,530 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.DeleteTaskPushNotificationConfigRequest} + */ +@com.google.protobuf.Generated +public final class DeleteTaskPushNotificationConfigRequest extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.DeleteTaskPushNotificationConfigRequest) + DeleteTaskPushNotificationConfigRequestOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "DeleteTaskPushNotificationConfigRequest"); + } + // Use DeleteTaskPushNotificationConfigRequest.newBuilder() to construct. + private DeleteTaskPushNotificationConfigRequest(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private DeleteTaskPushNotificationConfigRequest() { + name_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_DeleteTaskPushNotificationConfigRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_DeleteTaskPushNotificationConfigRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest.class, org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + *
+   * name=tasks/{id}/pushNotificationConfigs/{push_id}
+   * 
+ * + * string name = 1; + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + *
+   * name=tasks/{id}/pushNotificationConfigs/{push_id}
+   * 
+ * + * string name = 1; + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, name_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, name_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest other = (org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest) obj; + + if (!getName() + .equals(other.getName())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.DeleteTaskPushNotificationConfigRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.DeleteTaskPushNotificationConfigRequest) + org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_DeleteTaskPushNotificationConfigRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_DeleteTaskPushNotificationConfigRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest.class, org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + name_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_DeleteTaskPushNotificationConfigRequest_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest build() { + org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest buildPartial() { + org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest result = new org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest other) { + if (other == org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000001; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + *
+     * name=tasks/{id}/pushNotificationConfigs/{push_id}
+     * 
+ * + * string name = 1; + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * name=tasks/{id}/pushNotificationConfigs/{push_id}
+     * 
+ * + * string name = 1; + * @return The bytes for name. + */ + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * name=tasks/{id}/pushNotificationConfigs/{push_id}
+     * 
+ * + * string name = 1; + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * name=tasks/{id}/pushNotificationConfigs/{push_id}
+     * 
+ * + * string name = 1; + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * name=tasks/{id}/pushNotificationConfigs/{push_id}
+     * 
+ * + * string name = 1; + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.DeleteTaskPushNotificationConfigRequest) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.DeleteTaskPushNotificationConfigRequest) + private static final org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest(); + } + + public static org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public DeleteTaskPushNotificationConfigRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/DeleteTaskPushNotificationConfigRequestOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/DeleteTaskPushNotificationConfigRequestOrBuilder.java new file mode 100644 index 000000000..574779a54 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/DeleteTaskPushNotificationConfigRequestOrBuilder.java @@ -0,0 +1,32 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface DeleteTaskPushNotificationConfigRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.DeleteTaskPushNotificationConfigRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * name=tasks/{id}/pushNotificationConfigs/{push_id}
+   * 
+ * + * string name = 1; + * @return The name. + */ + java.lang.String getName(); + /** + *
+   * name=tasks/{id}/pushNotificationConfigs/{push_id}
+   * 
+ * + * string name = 1; + * @return The bytes for name. + */ + com.google.protobuf.ByteString + getNameBytes(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/FilePart.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/FilePart.java new file mode 100644 index 000000000..ca9369dbb --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/FilePart.java @@ -0,0 +1,855 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * FilePart represents the different ways files can be provided. If files are
+ * small, directly feeding the bytes is supported via file_with_bytes. If the
+ * file is large, the agent should read the content as appropriate directly
+ * from the file_with_uri source.
+ * 
+ * + * Protobuf type {@code a2a.v1.FilePart} + */ +@com.google.protobuf.Generated +public final class FilePart extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.FilePart) + FilePartOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "FilePart"); + } + // Use FilePart.newBuilder() to construct. + private FilePart(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private FilePart() { + mimeType_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_FilePart_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_FilePart_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.FilePart.class, org.a2aproject.sdk.compat03.grpc.FilePart.Builder.class); + } + + private int fileCase_ = 0; + @SuppressWarnings("serial") + private java.lang.Object file_; + public enum FileCase + implements com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + FILE_WITH_URI(1), + FILE_WITH_BYTES(2), + FILE_NOT_SET(0); + private final int value; + private FileCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static FileCase valueOf(int value) { + return forNumber(value); + } + + public static FileCase forNumber(int value) { + switch (value) { + case 1: return FILE_WITH_URI; + case 2: return FILE_WITH_BYTES; + case 0: return FILE_NOT_SET; + default: return null; + } + } + public int getNumber() { + return this.value; + } + }; + + public FileCase + getFileCase() { + return FileCase.forNumber( + fileCase_); + } + + public static final int FILE_WITH_URI_FIELD_NUMBER = 1; + /** + * string file_with_uri = 1; + * @return Whether the fileWithUri field is set. + */ + public boolean hasFileWithUri() { + return fileCase_ == 1; + } + /** + * string file_with_uri = 1; + * @return The fileWithUri. + */ + public java.lang.String getFileWithUri() { + java.lang.Object ref = ""; + if (fileCase_ == 1) { + ref = file_; + } + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (fileCase_ == 1) { + file_ = s; + } + return s; + } + } + /** + * string file_with_uri = 1; + * @return The bytes for fileWithUri. + */ + public com.google.protobuf.ByteString + getFileWithUriBytes() { + java.lang.Object ref = ""; + if (fileCase_ == 1) { + ref = file_; + } + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + if (fileCase_ == 1) { + file_ = b; + } + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int FILE_WITH_BYTES_FIELD_NUMBER = 2; + /** + * bytes file_with_bytes = 2; + * @return Whether the fileWithBytes field is set. + */ + @java.lang.Override + public boolean hasFileWithBytes() { + return fileCase_ == 2; + } + /** + * bytes file_with_bytes = 2; + * @return The fileWithBytes. + */ + @java.lang.Override + public com.google.protobuf.ByteString getFileWithBytes() { + if (fileCase_ == 2) { + return (com.google.protobuf.ByteString) file_; + } + return com.google.protobuf.ByteString.EMPTY; + } + + public static final int MIME_TYPE_FIELD_NUMBER = 3; + @SuppressWarnings("serial") + private volatile java.lang.Object mimeType_ = ""; + /** + * string mime_type = 3; + * @return The mimeType. + */ + @java.lang.Override + public java.lang.String getMimeType() { + java.lang.Object ref = mimeType_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + mimeType_ = s; + return s; + } + } + /** + * string mime_type = 3; + * @return The bytes for mimeType. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getMimeTypeBytes() { + java.lang.Object ref = mimeType_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + mimeType_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (fileCase_ == 1) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, file_); + } + if (fileCase_ == 2) { + output.writeBytes( + 2, (com.google.protobuf.ByteString) file_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(mimeType_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 3, mimeType_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (fileCase_ == 1) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, file_); + } + if (fileCase_ == 2) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize( + 2, (com.google.protobuf.ByteString) file_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(mimeType_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(3, mimeType_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.FilePart)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.FilePart other = (org.a2aproject.sdk.compat03.grpc.FilePart) obj; + + if (!getMimeType() + .equals(other.getMimeType())) return false; + if (!getFileCase().equals(other.getFileCase())) return false; + switch (fileCase_) { + case 1: + if (!getFileWithUri() + .equals(other.getFileWithUri())) return false; + break; + case 2: + if (!getFileWithBytes() + .equals(other.getFileWithBytes())) return false; + break; + case 0: + default: + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + MIME_TYPE_FIELD_NUMBER; + hash = (53 * hash) + getMimeType().hashCode(); + switch (fileCase_) { + case 1: + hash = (37 * hash) + FILE_WITH_URI_FIELD_NUMBER; + hash = (53 * hash) + getFileWithUri().hashCode(); + break; + case 2: + hash = (37 * hash) + FILE_WITH_BYTES_FIELD_NUMBER; + hash = (53 * hash) + getFileWithBytes().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.FilePart parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.FilePart parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.FilePart parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.FilePart parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.FilePart parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.FilePart parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.FilePart parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.FilePart parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.FilePart parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.FilePart parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.FilePart parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.FilePart parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.FilePart prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * FilePart represents the different ways files can be provided. If files are
+   * small, directly feeding the bytes is supported via file_with_bytes. If the
+   * file is large, the agent should read the content as appropriate directly
+   * from the file_with_uri source.
+   * 
+ * + * Protobuf type {@code a2a.v1.FilePart} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.FilePart) + org.a2aproject.sdk.compat03.grpc.FilePartOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_FilePart_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_FilePart_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.FilePart.class, org.a2aproject.sdk.compat03.grpc.FilePart.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.FilePart.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + mimeType_ = ""; + fileCase_ = 0; + file_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_FilePart_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.FilePart getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.FilePart.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.FilePart build() { + org.a2aproject.sdk.compat03.grpc.FilePart result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.FilePart buildPartial() { + org.a2aproject.sdk.compat03.grpc.FilePart result = new org.a2aproject.sdk.compat03.grpc.FilePart(this); + if (bitField0_ != 0) { buildPartial0(result); } + buildPartialOneofs(result); + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.FilePart result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000004) != 0)) { + result.mimeType_ = mimeType_; + } + } + + private void buildPartialOneofs(org.a2aproject.sdk.compat03.grpc.FilePart result) { + result.fileCase_ = fileCase_; + result.file_ = this.file_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.FilePart) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.FilePart)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.FilePart other) { + if (other == org.a2aproject.sdk.compat03.grpc.FilePart.getDefaultInstance()) return this; + if (!other.getMimeType().isEmpty()) { + mimeType_ = other.mimeType_; + bitField0_ |= 0x00000004; + onChanged(); + } + switch (other.getFileCase()) { + case FILE_WITH_URI: { + fileCase_ = 1; + file_ = other.file_; + onChanged(); + break; + } + case FILE_WITH_BYTES: { + setFileWithBytes(other.getFileWithBytes()); + break; + } + case FILE_NOT_SET: { + break; + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + fileCase_ = 1; + file_ = s; + break; + } // case 10 + case 18: { + file_ = input.readBytes(); + fileCase_ = 2; + break; + } // case 18 + case 26: { + mimeType_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int fileCase_ = 0; + private java.lang.Object file_; + public FileCase + getFileCase() { + return FileCase.forNumber( + fileCase_); + } + + public Builder clearFile() { + fileCase_ = 0; + file_ = null; + onChanged(); + return this; + } + + private int bitField0_; + + /** + * string file_with_uri = 1; + * @return Whether the fileWithUri field is set. + */ + @java.lang.Override + public boolean hasFileWithUri() { + return fileCase_ == 1; + } + /** + * string file_with_uri = 1; + * @return The fileWithUri. + */ + @java.lang.Override + public java.lang.String getFileWithUri() { + java.lang.Object ref = ""; + if (fileCase_ == 1) { + ref = file_; + } + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (fileCase_ == 1) { + file_ = s; + } + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string file_with_uri = 1; + * @return The bytes for fileWithUri. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getFileWithUriBytes() { + java.lang.Object ref = ""; + if (fileCase_ == 1) { + ref = file_; + } + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + if (fileCase_ == 1) { + file_ = b; + } + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string file_with_uri = 1; + * @param value The fileWithUri to set. + * @return This builder for chaining. + */ + public Builder setFileWithUri( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + fileCase_ = 1; + file_ = value; + onChanged(); + return this; + } + /** + * string file_with_uri = 1; + * @return This builder for chaining. + */ + public Builder clearFileWithUri() { + if (fileCase_ == 1) { + fileCase_ = 0; + file_ = null; + onChanged(); + } + return this; + } + /** + * string file_with_uri = 1; + * @param value The bytes for fileWithUri to set. + * @return This builder for chaining. + */ + public Builder setFileWithUriBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + fileCase_ = 1; + file_ = value; + onChanged(); + return this; + } + + /** + * bytes file_with_bytes = 2; + * @return Whether the fileWithBytes field is set. + */ + public boolean hasFileWithBytes() { + return fileCase_ == 2; + } + /** + * bytes file_with_bytes = 2; + * @return The fileWithBytes. + */ + public com.google.protobuf.ByteString getFileWithBytes() { + if (fileCase_ == 2) { + return (com.google.protobuf.ByteString) file_; + } + return com.google.protobuf.ByteString.EMPTY; + } + /** + * bytes file_with_bytes = 2; + * @param value The fileWithBytes to set. + * @return This builder for chaining. + */ + public Builder setFileWithBytes(com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + fileCase_ = 2; + file_ = value; + onChanged(); + return this; + } + /** + * bytes file_with_bytes = 2; + * @return This builder for chaining. + */ + public Builder clearFileWithBytes() { + if (fileCase_ == 2) { + fileCase_ = 0; + file_ = null; + onChanged(); + } + return this; + } + + private java.lang.Object mimeType_ = ""; + /** + * string mime_type = 3; + * @return The mimeType. + */ + public java.lang.String getMimeType() { + java.lang.Object ref = mimeType_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + mimeType_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string mime_type = 3; + * @return The bytes for mimeType. + */ + public com.google.protobuf.ByteString + getMimeTypeBytes() { + java.lang.Object ref = mimeType_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + mimeType_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string mime_type = 3; + * @param value The mimeType to set. + * @return This builder for chaining. + */ + public Builder setMimeType( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + mimeType_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * string mime_type = 3; + * @return This builder for chaining. + */ + public Builder clearMimeType() { + mimeType_ = getDefaultInstance().getMimeType(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + * string mime_type = 3; + * @param value The bytes for mimeType to set. + * @return This builder for chaining. + */ + public Builder setMimeTypeBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + mimeType_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.FilePart) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.FilePart) + private static final org.a2aproject.sdk.compat03.grpc.FilePart DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.FilePart(); + } + + public static org.a2aproject.sdk.compat03.grpc.FilePart getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public FilePart parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.FilePart getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/FilePartOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/FilePartOrBuilder.java new file mode 100644 index 000000000..8ce37ca51 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/FilePartOrBuilder.java @@ -0,0 +1,54 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface FilePartOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.FilePart) + com.google.protobuf.MessageOrBuilder { + + /** + * string file_with_uri = 1; + * @return Whether the fileWithUri field is set. + */ + boolean hasFileWithUri(); + /** + * string file_with_uri = 1; + * @return The fileWithUri. + */ + java.lang.String getFileWithUri(); + /** + * string file_with_uri = 1; + * @return The bytes for fileWithUri. + */ + com.google.protobuf.ByteString + getFileWithUriBytes(); + + /** + * bytes file_with_bytes = 2; + * @return Whether the fileWithBytes field is set. + */ + boolean hasFileWithBytes(); + /** + * bytes file_with_bytes = 2; + * @return The fileWithBytes. + */ + com.google.protobuf.ByteString getFileWithBytes(); + + /** + * string mime_type = 3; + * @return The mimeType. + */ + java.lang.String getMimeType(); + /** + * string mime_type = 3; + * @return The bytes for mimeType. + */ + com.google.protobuf.ByteString + getMimeTypeBytes(); + + org.a2aproject.sdk.compat03.grpc.FilePart.FileCase getFileCase(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/GetAgentCardRequest.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/GetAgentCardRequest.java new file mode 100644 index 000000000..16bdee653 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/GetAgentCardRequest.java @@ -0,0 +1,367 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * Empty. Added to fix linter violation.
+ * 
+ * + * Protobuf type {@code a2a.v1.GetAgentCardRequest} + */ +@com.google.protobuf.Generated +public final class GetAgentCardRequest extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.GetAgentCardRequest) + GetAgentCardRequestOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "GetAgentCardRequest"); + } + // Use GetAgentCardRequest.newBuilder() to construct. + private GetAgentCardRequest(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private GetAgentCardRequest() { + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_GetAgentCardRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_GetAgentCardRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest.class, org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest.Builder.class); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest other = (org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest) obj; + + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * Empty. Added to fix linter violation.
+   * 
+ * + * Protobuf type {@code a2a.v1.GetAgentCardRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.GetAgentCardRequest) + org.a2aproject.sdk.compat03.grpc.GetAgentCardRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_GetAgentCardRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_GetAgentCardRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest.class, org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_GetAgentCardRequest_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest build() { + org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest buildPartial() { + org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest result = new org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest(this); + onBuilt(); + return result; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest other) { + if (other == org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest.getDefaultInstance()) return this; + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.GetAgentCardRequest) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.GetAgentCardRequest) + private static final org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest(); + } + + public static org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GetAgentCardRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/GetAgentCardRequestOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/GetAgentCardRequestOrBuilder.java new file mode 100644 index 000000000..0edb8f504 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/GetAgentCardRequestOrBuilder.java @@ -0,0 +1,12 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface GetAgentCardRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.GetAgentCardRequest) + com.google.protobuf.MessageOrBuilder { +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/GetTaskPushNotificationConfigRequest.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/GetTaskPushNotificationConfigRequest.java new file mode 100644 index 000000000..cf0ad5d1e --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/GetTaskPushNotificationConfigRequest.java @@ -0,0 +1,530 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.GetTaskPushNotificationConfigRequest} + */ +@com.google.protobuf.Generated +public final class GetTaskPushNotificationConfigRequest extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.GetTaskPushNotificationConfigRequest) + GetTaskPushNotificationConfigRequestOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "GetTaskPushNotificationConfigRequest"); + } + // Use GetTaskPushNotificationConfigRequest.newBuilder() to construct. + private GetTaskPushNotificationConfigRequest(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private GetTaskPushNotificationConfigRequest() { + name_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_GetTaskPushNotificationConfigRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_GetTaskPushNotificationConfigRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest.class, org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + *
+   * name=tasks/{id}/pushNotificationConfigs/{push_id}
+   * 
+ * + * string name = 1; + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + *
+   * name=tasks/{id}/pushNotificationConfigs/{push_id}
+   * 
+ * + * string name = 1; + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, name_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, name_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest other = (org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest) obj; + + if (!getName() + .equals(other.getName())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.GetTaskPushNotificationConfigRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.GetTaskPushNotificationConfigRequest) + org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_GetTaskPushNotificationConfigRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_GetTaskPushNotificationConfigRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest.class, org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + name_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_GetTaskPushNotificationConfigRequest_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest build() { + org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest buildPartial() { + org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest result = new org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest other) { + if (other == org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000001; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + *
+     * name=tasks/{id}/pushNotificationConfigs/{push_id}
+     * 
+ * + * string name = 1; + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * name=tasks/{id}/pushNotificationConfigs/{push_id}
+     * 
+ * + * string name = 1; + * @return The bytes for name. + */ + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * name=tasks/{id}/pushNotificationConfigs/{push_id}
+     * 
+ * + * string name = 1; + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * name=tasks/{id}/pushNotificationConfigs/{push_id}
+     * 
+ * + * string name = 1; + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * name=tasks/{id}/pushNotificationConfigs/{push_id}
+     * 
+ * + * string name = 1; + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.GetTaskPushNotificationConfigRequest) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.GetTaskPushNotificationConfigRequest) + private static final org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest(); + } + + public static org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GetTaskPushNotificationConfigRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/GetTaskPushNotificationConfigRequestOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/GetTaskPushNotificationConfigRequestOrBuilder.java new file mode 100644 index 000000000..9cbc1a224 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/GetTaskPushNotificationConfigRequestOrBuilder.java @@ -0,0 +1,32 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface GetTaskPushNotificationConfigRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.GetTaskPushNotificationConfigRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * name=tasks/{id}/pushNotificationConfigs/{push_id}
+   * 
+ * + * string name = 1; + * @return The name. + */ + java.lang.String getName(); + /** + *
+   * name=tasks/{id}/pushNotificationConfigs/{push_id}
+   * 
+ * + * string name = 1; + * @return The bytes for name. + */ + com.google.protobuf.ByteString + getNameBytes(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/GetTaskRequest.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/GetTaskRequest.java new file mode 100644 index 000000000..35c8c97e3 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/GetTaskRequest.java @@ -0,0 +1,596 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.GetTaskRequest} + */ +@com.google.protobuf.Generated +public final class GetTaskRequest extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.GetTaskRequest) + GetTaskRequestOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "GetTaskRequest"); + } + // Use GetTaskRequest.newBuilder() to construct. + private GetTaskRequest(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private GetTaskRequest() { + name_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_GetTaskRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_GetTaskRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.GetTaskRequest.class, org.a2aproject.sdk.compat03.grpc.GetTaskRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + *
+   * name=tasks/{id}
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + *
+   * name=tasks/{id}
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int HISTORY_LENGTH_FIELD_NUMBER = 2; + private int historyLength_ = 0; + /** + * int32 history_length = 2; + * @return The historyLength. + */ + @java.lang.Override + public int getHistoryLength() { + return historyLength_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, name_); + } + if (historyLength_ != 0) { + output.writeInt32(2, historyLength_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, name_); + } + if (historyLength_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(2, historyLength_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.GetTaskRequest)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.GetTaskRequest other = (org.a2aproject.sdk.compat03.grpc.GetTaskRequest) obj; + + if (!getName() + .equals(other.getName())) return false; + if (getHistoryLength() + != other.getHistoryLength()) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + HISTORY_LENGTH_FIELD_NUMBER; + hash = (53 * hash) + getHistoryLength(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.GetTaskRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.GetTaskRequest parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.GetTaskRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.GetTaskRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.GetTaskRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.GetTaskRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.GetTaskRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.GetTaskRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.GetTaskRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.GetTaskRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.GetTaskRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.GetTaskRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.GetTaskRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.GetTaskRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.GetTaskRequest) + org.a2aproject.sdk.compat03.grpc.GetTaskRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_GetTaskRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_GetTaskRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.GetTaskRequest.class, org.a2aproject.sdk.compat03.grpc.GetTaskRequest.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.GetTaskRequest.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + name_ = ""; + historyLength_ = 0; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_GetTaskRequest_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.GetTaskRequest getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.GetTaskRequest.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.GetTaskRequest build() { + org.a2aproject.sdk.compat03.grpc.GetTaskRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.GetTaskRequest buildPartial() { + org.a2aproject.sdk.compat03.grpc.GetTaskRequest result = new org.a2aproject.sdk.compat03.grpc.GetTaskRequest(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.GetTaskRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.historyLength_ = historyLength_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.GetTaskRequest) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.GetTaskRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.GetTaskRequest other) { + if (other == org.a2aproject.sdk.compat03.grpc.GetTaskRequest.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (other.getHistoryLength() != 0) { + setHistoryLength(other.getHistoryLength()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 16: { + historyLength_ = input.readInt32(); + bitField0_ |= 0x00000002; + break; + } // case 16 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + *
+     * name=tasks/{id}
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * name=tasks/{id}
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The bytes for name. + */ + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * name=tasks/{id}
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * name=tasks/{id}
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * name=tasks/{id}
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private int historyLength_ ; + /** + * int32 history_length = 2; + * @return The historyLength. + */ + @java.lang.Override + public int getHistoryLength() { + return historyLength_; + } + /** + * int32 history_length = 2; + * @param value The historyLength to set. + * @return This builder for chaining. + */ + public Builder setHistoryLength(int value) { + + historyLength_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * int32 history_length = 2; + * @return This builder for chaining. + */ + public Builder clearHistoryLength() { + bitField0_ = (bitField0_ & ~0x00000002); + historyLength_ = 0; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.GetTaskRequest) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.GetTaskRequest) + private static final org.a2aproject.sdk.compat03.grpc.GetTaskRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.GetTaskRequest(); + } + + public static org.a2aproject.sdk.compat03.grpc.GetTaskRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GetTaskRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.GetTaskRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/GetTaskRequestOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/GetTaskRequestOrBuilder.java new file mode 100644 index 000000000..d694fa444 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/GetTaskRequestOrBuilder.java @@ -0,0 +1,38 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface GetTaskRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.GetTaskRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * name=tasks/{id}
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The name. + */ + java.lang.String getName(); + /** + *
+   * name=tasks/{id}
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The bytes for name. + */ + com.google.protobuf.ByteString + getNameBytes(); + + /** + * int32 history_length = 2; + * @return The historyLength. + */ + int getHistoryLength(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/HTTPAuthSecurityScheme.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/HTTPAuthSecurityScheme.java new file mode 100644 index 000000000..dfec514a1 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/HTTPAuthSecurityScheme.java @@ -0,0 +1,893 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.HTTPAuthSecurityScheme} + */ +@com.google.protobuf.Generated +public final class HTTPAuthSecurityScheme extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.HTTPAuthSecurityScheme) + HTTPAuthSecuritySchemeOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "HTTPAuthSecurityScheme"); + } + // Use HTTPAuthSecurityScheme.newBuilder() to construct. + private HTTPAuthSecurityScheme(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private HTTPAuthSecurityScheme() { + description_ = ""; + scheme_ = ""; + bearerFormat_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_HTTPAuthSecurityScheme_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_HTTPAuthSecurityScheme_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.class, org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.Builder.class); + } + + public static final int DESCRIPTION_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object description_ = ""; + /** + *
+   * Description of this security scheme.
+   * 
+ * + * string description = 1; + * @return The description. + */ + @java.lang.Override + public java.lang.String getDescription() { + java.lang.Object ref = description_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + description_ = s; + return s; + } + } + /** + *
+   * Description of this security scheme.
+   * 
+ * + * string description = 1; + * @return The bytes for description. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SCHEME_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object scheme_ = ""; + /** + *
+   * The name of the HTTP Authentication scheme to be used in the
+   * Authorization header as defined in RFC7235. The values used SHOULD be
+   * registered in the IANA Authentication Scheme registry.
+   * The value is case-insensitive, as defined in RFC7235.
+   * 
+ * + * string scheme = 2; + * @return The scheme. + */ + @java.lang.Override + public java.lang.String getScheme() { + java.lang.Object ref = scheme_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + scheme_ = s; + return s; + } + } + /** + *
+   * The name of the HTTP Authentication scheme to be used in the
+   * Authorization header as defined in RFC7235. The values used SHOULD be
+   * registered in the IANA Authentication Scheme registry.
+   * The value is case-insensitive, as defined in RFC7235.
+   * 
+ * + * string scheme = 2; + * @return The bytes for scheme. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getSchemeBytes() { + java.lang.Object ref = scheme_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + scheme_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int BEARER_FORMAT_FIELD_NUMBER = 3; + @SuppressWarnings("serial") + private volatile java.lang.Object bearerFormat_ = ""; + /** + *
+   * A hint to the client to identify how the bearer token is formatted.
+   * Bearer tokens are usually generated by an authorization server, so
+   * this information is primarily for documentation purposes.
+   * 
+ * + * string bearer_format = 3; + * @return The bearerFormat. + */ + @java.lang.Override + public java.lang.String getBearerFormat() { + java.lang.Object ref = bearerFormat_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + bearerFormat_ = s; + return s; + } + } + /** + *
+   * A hint to the client to identify how the bearer token is formatted.
+   * Bearer tokens are usually generated by an authorization server, so
+   * this information is primarily for documentation purposes.
+   * 
+ * + * string bearer_format = 3; + * @return The bytes for bearerFormat. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getBearerFormatBytes() { + java.lang.Object ref = bearerFormat_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + bearerFormat_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(description_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, description_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(scheme_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, scheme_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(bearerFormat_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 3, bearerFormat_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(description_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, description_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(scheme_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, scheme_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(bearerFormat_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(3, bearerFormat_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme other = (org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme) obj; + + if (!getDescription() + .equals(other.getDescription())) return false; + if (!getScheme() + .equals(other.getScheme())) return false; + if (!getBearerFormat() + .equals(other.getBearerFormat())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + DESCRIPTION_FIELD_NUMBER; + hash = (53 * hash) + getDescription().hashCode(); + hash = (37 * hash) + SCHEME_FIELD_NUMBER; + hash = (53 * hash) + getScheme().hashCode(); + hash = (37 * hash) + BEARER_FORMAT_FIELD_NUMBER; + hash = (53 * hash) + getBearerFormat().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.HTTPAuthSecurityScheme} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.HTTPAuthSecurityScheme) + org.a2aproject.sdk.compat03.grpc.HTTPAuthSecuritySchemeOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_HTTPAuthSecurityScheme_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_HTTPAuthSecurityScheme_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.class, org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + description_ = ""; + scheme_ = ""; + bearerFormat_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_HTTPAuthSecurityScheme_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme build() { + org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme buildPartial() { + org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme result = new org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.description_ = description_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.scheme_ = scheme_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.bearerFormat_ = bearerFormat_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme other) { + if (other == org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.getDefaultInstance()) return this; + if (!other.getDescription().isEmpty()) { + description_ = other.description_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getScheme().isEmpty()) { + scheme_ = other.scheme_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (!other.getBearerFormat().isEmpty()) { + bearerFormat_ = other.bearerFormat_; + bitField0_ |= 0x00000004; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + description_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + scheme_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: { + bearerFormat_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object description_ = ""; + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @return The description. + */ + public java.lang.String getDescription() { + java.lang.Object ref = description_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + description_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @return The bytes for description. + */ + public com.google.protobuf.ByteString + getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @param value The description to set. + * @return This builder for chaining. + */ + public Builder setDescription( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + description_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @return This builder for chaining. + */ + public Builder clearDescription() { + description_ = getDefaultInstance().getDescription(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @param value The bytes for description to set. + * @return This builder for chaining. + */ + public Builder setDescriptionBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + description_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object scheme_ = ""; + /** + *
+     * The name of the HTTP Authentication scheme to be used in the
+     * Authorization header as defined in RFC7235. The values used SHOULD be
+     * registered in the IANA Authentication Scheme registry.
+     * The value is case-insensitive, as defined in RFC7235.
+     * 
+ * + * string scheme = 2; + * @return The scheme. + */ + public java.lang.String getScheme() { + java.lang.Object ref = scheme_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + scheme_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The name of the HTTP Authentication scheme to be used in the
+     * Authorization header as defined in RFC7235. The values used SHOULD be
+     * registered in the IANA Authentication Scheme registry.
+     * The value is case-insensitive, as defined in RFC7235.
+     * 
+ * + * string scheme = 2; + * @return The bytes for scheme. + */ + public com.google.protobuf.ByteString + getSchemeBytes() { + java.lang.Object ref = scheme_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + scheme_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The name of the HTTP Authentication scheme to be used in the
+     * Authorization header as defined in RFC7235. The values used SHOULD be
+     * registered in the IANA Authentication Scheme registry.
+     * The value is case-insensitive, as defined in RFC7235.
+     * 
+ * + * string scheme = 2; + * @param value The scheme to set. + * @return This builder for chaining. + */ + public Builder setScheme( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + scheme_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * The name of the HTTP Authentication scheme to be used in the
+     * Authorization header as defined in RFC7235. The values used SHOULD be
+     * registered in the IANA Authentication Scheme registry.
+     * The value is case-insensitive, as defined in RFC7235.
+     * 
+ * + * string scheme = 2; + * @return This builder for chaining. + */ + public Builder clearScheme() { + scheme_ = getDefaultInstance().getScheme(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * The name of the HTTP Authentication scheme to be used in the
+     * Authorization header as defined in RFC7235. The values used SHOULD be
+     * registered in the IANA Authentication Scheme registry.
+     * The value is case-insensitive, as defined in RFC7235.
+     * 
+ * + * string scheme = 2; + * @param value The bytes for scheme to set. + * @return This builder for chaining. + */ + public Builder setSchemeBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + scheme_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private java.lang.Object bearerFormat_ = ""; + /** + *
+     * A hint to the client to identify how the bearer token is formatted.
+     * Bearer tokens are usually generated by an authorization server, so
+     * this information is primarily for documentation purposes.
+     * 
+ * + * string bearer_format = 3; + * @return The bearerFormat. + */ + public java.lang.String getBearerFormat() { + java.lang.Object ref = bearerFormat_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + bearerFormat_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * A hint to the client to identify how the bearer token is formatted.
+     * Bearer tokens are usually generated by an authorization server, so
+     * this information is primarily for documentation purposes.
+     * 
+ * + * string bearer_format = 3; + * @return The bytes for bearerFormat. + */ + public com.google.protobuf.ByteString + getBearerFormatBytes() { + java.lang.Object ref = bearerFormat_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + bearerFormat_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * A hint to the client to identify how the bearer token is formatted.
+     * Bearer tokens are usually generated by an authorization server, so
+     * this information is primarily for documentation purposes.
+     * 
+ * + * string bearer_format = 3; + * @param value The bearerFormat to set. + * @return This builder for chaining. + */ + public Builder setBearerFormat( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + bearerFormat_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * A hint to the client to identify how the bearer token is formatted.
+     * Bearer tokens are usually generated by an authorization server, so
+     * this information is primarily for documentation purposes.
+     * 
+ * + * string bearer_format = 3; + * @return This builder for chaining. + */ + public Builder clearBearerFormat() { + bearerFormat_ = getDefaultInstance().getBearerFormat(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + *
+     * A hint to the client to identify how the bearer token is formatted.
+     * Bearer tokens are usually generated by an authorization server, so
+     * this information is primarily for documentation purposes.
+     * 
+ * + * string bearer_format = 3; + * @param value The bytes for bearerFormat to set. + * @return This builder for chaining. + */ + public Builder setBearerFormatBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + bearerFormat_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.HTTPAuthSecurityScheme) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.HTTPAuthSecurityScheme) + private static final org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme(); + } + + public static org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public HTTPAuthSecurityScheme parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/HTTPAuthSecuritySchemeOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/HTTPAuthSecuritySchemeOrBuilder.java new file mode 100644 index 000000000..93fff9618 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/HTTPAuthSecuritySchemeOrBuilder.java @@ -0,0 +1,82 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface HTTPAuthSecuritySchemeOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.HTTPAuthSecurityScheme) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Description of this security scheme.
+   * 
+ * + * string description = 1; + * @return The description. + */ + java.lang.String getDescription(); + /** + *
+   * Description of this security scheme.
+   * 
+ * + * string description = 1; + * @return The bytes for description. + */ + com.google.protobuf.ByteString + getDescriptionBytes(); + + /** + *
+   * The name of the HTTP Authentication scheme to be used in the
+   * Authorization header as defined in RFC7235. The values used SHOULD be
+   * registered in the IANA Authentication Scheme registry.
+   * The value is case-insensitive, as defined in RFC7235.
+   * 
+ * + * string scheme = 2; + * @return The scheme. + */ + java.lang.String getScheme(); + /** + *
+   * The name of the HTTP Authentication scheme to be used in the
+   * Authorization header as defined in RFC7235. The values used SHOULD be
+   * registered in the IANA Authentication Scheme registry.
+   * The value is case-insensitive, as defined in RFC7235.
+   * 
+ * + * string scheme = 2; + * @return The bytes for scheme. + */ + com.google.protobuf.ByteString + getSchemeBytes(); + + /** + *
+   * A hint to the client to identify how the bearer token is formatted.
+   * Bearer tokens are usually generated by an authorization server, so
+   * this information is primarily for documentation purposes.
+   * 
+ * + * string bearer_format = 3; + * @return The bearerFormat. + */ + java.lang.String getBearerFormat(); + /** + *
+   * A hint to the client to identify how the bearer token is formatted.
+   * Bearer tokens are usually generated by an authorization server, so
+   * this information is primarily for documentation purposes.
+   * 
+ * + * string bearer_format = 3; + * @return The bytes for bearerFormat. + */ + com.google.protobuf.ByteString + getBearerFormatBytes(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ImplicitOAuthFlow.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ImplicitOAuthFlow.java new file mode 100644 index 000000000..c12b93bfc --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ImplicitOAuthFlow.java @@ -0,0 +1,1042 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.ImplicitOAuthFlow} + */ +@com.google.protobuf.Generated +public final class ImplicitOAuthFlow extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.ImplicitOAuthFlow) + ImplicitOAuthFlowOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "ImplicitOAuthFlow"); + } + // Use ImplicitOAuthFlow.newBuilder() to construct. + private ImplicitOAuthFlow(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private ImplicitOAuthFlow() { + authorizationUrl_ = ""; + refreshUrl_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_ImplicitOAuthFlow_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { + switch (number) { + case 3: + return internalGetScopes(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_ImplicitOAuthFlow_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.class, org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.Builder.class); + } + + public static final int AUTHORIZATION_URL_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object authorizationUrl_ = ""; + /** + *
+   * The authorization URL to be used for this flow. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS
+   * 
+ * + * string authorization_url = 1; + * @return The authorizationUrl. + */ + @java.lang.Override + public java.lang.String getAuthorizationUrl() { + java.lang.Object ref = authorizationUrl_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + authorizationUrl_ = s; + return s; + } + } + /** + *
+   * The authorization URL to be used for this flow. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS
+   * 
+ * + * string authorization_url = 1; + * @return The bytes for authorizationUrl. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getAuthorizationUrlBytes() { + java.lang.Object ref = authorizationUrl_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + authorizationUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int REFRESH_URL_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object refreshUrl_ = ""; + /** + *
+   * The URL to be used for obtaining refresh tokens. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string refresh_url = 2; + * @return The refreshUrl. + */ + @java.lang.Override + public java.lang.String getRefreshUrl() { + java.lang.Object ref = refreshUrl_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + refreshUrl_ = s; + return s; + } + } + /** + *
+   * The URL to be used for obtaining refresh tokens. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string refresh_url = 2; + * @return The bytes for refreshUrl. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getRefreshUrlBytes() { + java.lang.Object ref = refreshUrl_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + refreshUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SCOPES_FIELD_NUMBER = 3; + private static final class ScopesDefaultEntryHolder { + static final com.google.protobuf.MapEntry< + java.lang.String, java.lang.String> defaultEntry = + com.google.protobuf.MapEntry + .newDefaultInstance( + A2A.internal_static_a2a_v1_ImplicitOAuthFlow_ScopesEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + @SuppressWarnings("serial") + private com.google.protobuf.MapField< + java.lang.String, java.lang.String> scopes_; + private com.google.protobuf.MapField + internalGetScopes() { + if (scopes_ == null) { + return com.google.protobuf.MapField.emptyMapField( + ScopesDefaultEntryHolder.defaultEntry); + } + return scopes_; + } + public int getScopesCount() { + return internalGetScopes().getMap().size(); + } + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public boolean containsScopes( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + return internalGetScopes().getMap().containsKey(key); + } + /** + * Use {@link #getScopesMap()} instead. + */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getScopes() { + return getScopesMap(); + } + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public java.util.Map getScopesMap() { + return internalGetScopes().getMap(); + } + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public /* nullable */ +java.lang.String getScopesOrDefault( + java.lang.String key, + /* nullable */ +java.lang.String defaultValue) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetScopes().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public java.lang.String getScopesOrThrow( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetScopes().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(authorizationUrl_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, authorizationUrl_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(refreshUrl_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, refreshUrl_); + } + com.google.protobuf.GeneratedMessage + .serializeStringMapTo( + output, + internalGetScopes(), + ScopesDefaultEntryHolder.defaultEntry, + 3); + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(authorizationUrl_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, authorizationUrl_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(refreshUrl_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, refreshUrl_); + } + for (java.util.Map.Entry entry + : internalGetScopes().getMap().entrySet()) { + com.google.protobuf.MapEntry + scopes__ = ScopesDefaultEntryHolder.defaultEntry.newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, scopes__); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow other = (org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow) obj; + + if (!getAuthorizationUrl() + .equals(other.getAuthorizationUrl())) return false; + if (!getRefreshUrl() + .equals(other.getRefreshUrl())) return false; + if (!internalGetScopes().equals( + other.internalGetScopes())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + AUTHORIZATION_URL_FIELD_NUMBER; + hash = (53 * hash) + getAuthorizationUrl().hashCode(); + hash = (37 * hash) + REFRESH_URL_FIELD_NUMBER; + hash = (53 * hash) + getRefreshUrl().hashCode(); + if (!internalGetScopes().getMap().isEmpty()) { + hash = (37 * hash) + SCOPES_FIELD_NUMBER; + hash = (53 * hash) + internalGetScopes().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.ImplicitOAuthFlow} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.ImplicitOAuthFlow) + org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlowOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_ImplicitOAuthFlow_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { + switch (number) { + case 3: + return internalGetScopes(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMutableMapFieldReflection( + int number) { + switch (number) { + case 3: + return internalGetMutableScopes(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_ImplicitOAuthFlow_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.class, org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + authorizationUrl_ = ""; + refreshUrl_ = ""; + internalGetMutableScopes().clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_ImplicitOAuthFlow_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow build() { + org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow buildPartial() { + org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow result = new org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.authorizationUrl_ = authorizationUrl_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.refreshUrl_ = refreshUrl_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.scopes_ = internalGetScopes(); + result.scopes_.makeImmutable(); + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow other) { + if (other == org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.getDefaultInstance()) return this; + if (!other.getAuthorizationUrl().isEmpty()) { + authorizationUrl_ = other.authorizationUrl_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getRefreshUrl().isEmpty()) { + refreshUrl_ = other.refreshUrl_; + bitField0_ |= 0x00000002; + onChanged(); + } + internalGetMutableScopes().mergeFrom( + other.internalGetScopes()); + bitField0_ |= 0x00000004; + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + authorizationUrl_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + refreshUrl_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: { + com.google.protobuf.MapEntry + scopes__ = input.readMessage( + ScopesDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); + internalGetMutableScopes().getMutableMap().put( + scopes__.getKey(), scopes__.getValue()); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object authorizationUrl_ = ""; + /** + *
+     * The authorization URL to be used for this flow. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS
+     * 
+ * + * string authorization_url = 1; + * @return The authorizationUrl. + */ + public java.lang.String getAuthorizationUrl() { + java.lang.Object ref = authorizationUrl_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + authorizationUrl_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The authorization URL to be used for this flow. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS
+     * 
+ * + * string authorization_url = 1; + * @return The bytes for authorizationUrl. + */ + public com.google.protobuf.ByteString + getAuthorizationUrlBytes() { + java.lang.Object ref = authorizationUrl_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + authorizationUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The authorization URL to be used for this flow. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS
+     * 
+ * + * string authorization_url = 1; + * @param value The authorizationUrl to set. + * @return This builder for chaining. + */ + public Builder setAuthorizationUrl( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + authorizationUrl_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * The authorization URL to be used for this flow. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS
+     * 
+ * + * string authorization_url = 1; + * @return This builder for chaining. + */ + public Builder clearAuthorizationUrl() { + authorizationUrl_ = getDefaultInstance().getAuthorizationUrl(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * The authorization URL to be used for this flow. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS
+     * 
+ * + * string authorization_url = 1; + * @param value The bytes for authorizationUrl to set. + * @return This builder for chaining. + */ + public Builder setAuthorizationUrlBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + authorizationUrl_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object refreshUrl_ = ""; + /** + *
+     * The URL to be used for obtaining refresh tokens. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string refresh_url = 2; + * @return The refreshUrl. + */ + public java.lang.String getRefreshUrl() { + java.lang.Object ref = refreshUrl_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + refreshUrl_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The URL to be used for obtaining refresh tokens. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string refresh_url = 2; + * @return The bytes for refreshUrl. + */ + public com.google.protobuf.ByteString + getRefreshUrlBytes() { + java.lang.Object ref = refreshUrl_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + refreshUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The URL to be used for obtaining refresh tokens. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string refresh_url = 2; + * @param value The refreshUrl to set. + * @return This builder for chaining. + */ + public Builder setRefreshUrl( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + refreshUrl_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * The URL to be used for obtaining refresh tokens. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string refresh_url = 2; + * @return This builder for chaining. + */ + public Builder clearRefreshUrl() { + refreshUrl_ = getDefaultInstance().getRefreshUrl(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * The URL to be used for obtaining refresh tokens. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string refresh_url = 2; + * @param value The bytes for refreshUrl to set. + * @return This builder for chaining. + */ + public Builder setRefreshUrlBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + refreshUrl_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private com.google.protobuf.MapField< + java.lang.String, java.lang.String> scopes_; + private com.google.protobuf.MapField + internalGetScopes() { + if (scopes_ == null) { + return com.google.protobuf.MapField.emptyMapField( + ScopesDefaultEntryHolder.defaultEntry); + } + return scopes_; + } + private com.google.protobuf.MapField + internalGetMutableScopes() { + if (scopes_ == null) { + scopes_ = com.google.protobuf.MapField.newMapField( + ScopesDefaultEntryHolder.defaultEntry); + } + if (!scopes_.isMutable()) { + scopes_ = scopes_.copy(); + } + bitField0_ |= 0x00000004; + onChanged(); + return scopes_; + } + public int getScopesCount() { + return internalGetScopes().getMap().size(); + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public boolean containsScopes( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + return internalGetScopes().getMap().containsKey(key); + } + /** + * Use {@link #getScopesMap()} instead. + */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getScopes() { + return getScopesMap(); + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public java.util.Map getScopesMap() { + return internalGetScopes().getMap(); + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public /* nullable */ +java.lang.String getScopesOrDefault( + java.lang.String key, + /* nullable */ +java.lang.String defaultValue) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetScopes().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public java.lang.String getScopesOrThrow( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetScopes().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + public Builder clearScopes() { + bitField0_ = (bitField0_ & ~0x00000004); + internalGetMutableScopes().getMutableMap() + .clear(); + return this; + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + public Builder removeScopes( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + internalGetMutableScopes().getMutableMap() + .remove(key); + return this; + } + /** + * Use alternate mutation accessors instead. + */ + @java.lang.Deprecated + public java.util.Map + getMutableScopes() { + bitField0_ |= 0x00000004; + return internalGetMutableScopes().getMutableMap(); + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + public Builder putScopes( + java.lang.String key, + java.lang.String value) { + if (key == null) { throw new NullPointerException("map key"); } + if (value == null) { throw new NullPointerException("map value"); } + internalGetMutableScopes().getMutableMap() + .put(key, value); + bitField0_ |= 0x00000004; + return this; + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + public Builder putAllScopes( + java.util.Map values) { + internalGetMutableScopes().getMutableMap() + .putAll(values); + bitField0_ |= 0x00000004; + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.ImplicitOAuthFlow) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.ImplicitOAuthFlow) + private static final org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow(); + } + + public static org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ImplicitOAuthFlow parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ImplicitOAuthFlowOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ImplicitOAuthFlowOrBuilder.java new file mode 100644 index 000000000..47a7e6670 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ImplicitOAuthFlowOrBuilder.java @@ -0,0 +1,115 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface ImplicitOAuthFlowOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.ImplicitOAuthFlow) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The authorization URL to be used for this flow. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS
+   * 
+ * + * string authorization_url = 1; + * @return The authorizationUrl. + */ + java.lang.String getAuthorizationUrl(); + /** + *
+   * The authorization URL to be used for this flow. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS
+   * 
+ * + * string authorization_url = 1; + * @return The bytes for authorizationUrl. + */ + com.google.protobuf.ByteString + getAuthorizationUrlBytes(); + + /** + *
+   * The URL to be used for obtaining refresh tokens. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string refresh_url = 2; + * @return The refreshUrl. + */ + java.lang.String getRefreshUrl(); + /** + *
+   * The URL to be used for obtaining refresh tokens. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string refresh_url = 2; + * @return The bytes for refreshUrl. + */ + com.google.protobuf.ByteString + getRefreshUrlBytes(); + + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + int getScopesCount(); + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + boolean containsScopes( + java.lang.String key); + /** + * Use {@link #getScopesMap()} instead. + */ + @java.lang.Deprecated + java.util.Map + getScopes(); + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + java.util.Map + getScopesMap(); + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + /* nullable */ +java.lang.String getScopesOrDefault( + java.lang.String key, + /* nullable */ +java.lang.String defaultValue); + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + java.lang.String getScopesOrThrow( + java.lang.String key); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ListTaskPushNotificationConfigRequest.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ListTaskPushNotificationConfigRequest.java new file mode 100644 index 000000000..a18bebdb7 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ListTaskPushNotificationConfigRequest.java @@ -0,0 +1,819 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.ListTaskPushNotificationConfigRequest} + */ +@com.google.protobuf.Generated +public final class ListTaskPushNotificationConfigRequest extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.ListTaskPushNotificationConfigRequest) + ListTaskPushNotificationConfigRequestOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "ListTaskPushNotificationConfigRequest"); + } + // Use ListTaskPushNotificationConfigRequest.newBuilder() to construct. + private ListTaskPushNotificationConfigRequest(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private ListTaskPushNotificationConfigRequest() { + parent_ = ""; + pageToken_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_ListTaskPushNotificationConfigRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_ListTaskPushNotificationConfigRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest.class, org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object parent_ = ""; + /** + *
+   * parent=tasks/{id}
+   * 
+ * + * string parent = 1; + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + *
+   * parent=tasks/{id}
+   * 
+ * + * string parent = 1; + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PAGE_SIZE_FIELD_NUMBER = 2; + private int pageSize_ = 0; + /** + *
+   * For AIP-158 these fields are present. Usually not used/needed.
+   * The maximum number of configurations to return.
+   * If unspecified, all configs will be returned.
+   * 
+ * + * int32 page_size = 2; + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + + public static final int PAGE_TOKEN_FIELD_NUMBER = 3; + @SuppressWarnings("serial") + private volatile java.lang.Object pageToken_ = ""; + /** + *
+   * A page token received from a previous
+   * ListTaskPushNotificationConfigRequest call.
+   * Provide this to retrieve the subsequent page.
+   * When paginating, all other parameters provided to
+   * `ListTaskPushNotificationConfigRequest` must match the call that provided
+   * the page token.
+   * 
+ * + * string page_token = 3; + * @return The pageToken. + */ + @java.lang.Override + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } + } + /** + *
+   * A page token received from a previous
+   * ListTaskPushNotificationConfigRequest call.
+   * Provide this to retrieve the subsequent page.
+   * When paginating, all other parameters provided to
+   * `ListTaskPushNotificationConfigRequest` must match the call that provided
+   * the page token.
+   * 
+ * + * string page_token = 3; + * @return The bytes for pageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(parent_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, parent_); + } + if (pageSize_ != 0) { + output.writeInt32(2, pageSize_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(pageToken_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 3, pageToken_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(parent_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, parent_); + } + if (pageSize_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(2, pageSize_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(pageToken_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(3, pageToken_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest other = (org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest) obj; + + if (!getParent() + .equals(other.getParent())) return false; + if (getPageSize() + != other.getPageSize()) return false; + if (!getPageToken() + .equals(other.getPageToken())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (37 * hash) + PAGE_SIZE_FIELD_NUMBER; + hash = (53 * hash) + getPageSize(); + hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPageToken().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.ListTaskPushNotificationConfigRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.ListTaskPushNotificationConfigRequest) + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_ListTaskPushNotificationConfigRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_ListTaskPushNotificationConfigRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest.class, org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + parent_ = ""; + pageSize_ = 0; + pageToken_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_ListTaskPushNotificationConfigRequest_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest build() { + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest buildPartial() { + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest result = new org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.parent_ = parent_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.pageSize_ = pageSize_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.pageToken_ = pageToken_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest other) { + if (other == org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest.getDefaultInstance()) return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (other.getPageSize() != 0) { + setPageSize(other.getPageSize()); + } + if (!other.getPageToken().isEmpty()) { + pageToken_ = other.pageToken_; + bitField0_ |= 0x00000004; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + parent_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 16: { + pageSize_ = input.readInt32(); + bitField0_ |= 0x00000002; + break; + } // case 16 + case 26: { + pageToken_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object parent_ = ""; + /** + *
+     * parent=tasks/{id}
+     * 
+ * + * string parent = 1; + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * parent=tasks/{id}
+     * 
+ * + * string parent = 1; + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString + getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * parent=tasks/{id}
+     * 
+ * + * string parent = 1; + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + parent_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * parent=tasks/{id}
+     * 
+ * + * string parent = 1; + * @return This builder for chaining. + */ + public Builder clearParent() { + parent_ = getDefaultInstance().getParent(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * parent=tasks/{id}
+     * 
+ * + * string parent = 1; + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + parent_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private int pageSize_ ; + /** + *
+     * For AIP-158 these fields are present. Usually not used/needed.
+     * The maximum number of configurations to return.
+     * If unspecified, all configs will be returned.
+     * 
+ * + * int32 page_size = 2; + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + /** + *
+     * For AIP-158 these fields are present. Usually not used/needed.
+     * The maximum number of configurations to return.
+     * If unspecified, all configs will be returned.
+     * 
+ * + * int32 page_size = 2; + * @param value The pageSize to set. + * @return This builder for chaining. + */ + public Builder setPageSize(int value) { + + pageSize_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * For AIP-158 these fields are present. Usually not used/needed.
+     * The maximum number of configurations to return.
+     * If unspecified, all configs will be returned.
+     * 
+ * + * int32 page_size = 2; + * @return This builder for chaining. + */ + public Builder clearPageSize() { + bitField0_ = (bitField0_ & ~0x00000002); + pageSize_ = 0; + onChanged(); + return this; + } + + private java.lang.Object pageToken_ = ""; + /** + *
+     * A page token received from a previous
+     * ListTaskPushNotificationConfigRequest call.
+     * Provide this to retrieve the subsequent page.
+     * When paginating, all other parameters provided to
+     * `ListTaskPushNotificationConfigRequest` must match the call that provided
+     * the page token.
+     * 
+ * + * string page_token = 3; + * @return The pageToken. + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * A page token received from a previous
+     * ListTaskPushNotificationConfigRequest call.
+     * Provide this to retrieve the subsequent page.
+     * When paginating, all other parameters provided to
+     * `ListTaskPushNotificationConfigRequest` must match the call that provided
+     * the page token.
+     * 
+ * + * string page_token = 3; + * @return The bytes for pageToken. + */ + public com.google.protobuf.ByteString + getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * A page token received from a previous
+     * ListTaskPushNotificationConfigRequest call.
+     * Provide this to retrieve the subsequent page.
+     * When paginating, all other parameters provided to
+     * `ListTaskPushNotificationConfigRequest` must match the call that provided
+     * the page token.
+     * 
+ * + * string page_token = 3; + * @param value The pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageToken( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + pageToken_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * A page token received from a previous
+     * ListTaskPushNotificationConfigRequest call.
+     * Provide this to retrieve the subsequent page.
+     * When paginating, all other parameters provided to
+     * `ListTaskPushNotificationConfigRequest` must match the call that provided
+     * the page token.
+     * 
+ * + * string page_token = 3; + * @return This builder for chaining. + */ + public Builder clearPageToken() { + pageToken_ = getDefaultInstance().getPageToken(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + *
+     * A page token received from a previous
+     * ListTaskPushNotificationConfigRequest call.
+     * Provide this to retrieve the subsequent page.
+     * When paginating, all other parameters provided to
+     * `ListTaskPushNotificationConfigRequest` must match the call that provided
+     * the page token.
+     * 
+ * + * string page_token = 3; + * @param value The bytes for pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageTokenBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + pageToken_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.ListTaskPushNotificationConfigRequest) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.ListTaskPushNotificationConfigRequest) + private static final org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest(); + } + + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListTaskPushNotificationConfigRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ListTaskPushNotificationConfigRequestOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ListTaskPushNotificationConfigRequestOrBuilder.java new file mode 100644 index 000000000..d49631f83 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ListTaskPushNotificationConfigRequestOrBuilder.java @@ -0,0 +1,74 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface ListTaskPushNotificationConfigRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.ListTaskPushNotificationConfigRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * parent=tasks/{id}
+   * 
+ * + * string parent = 1; + * @return The parent. + */ + java.lang.String getParent(); + /** + *
+   * parent=tasks/{id}
+   * 
+ * + * string parent = 1; + * @return The bytes for parent. + */ + com.google.protobuf.ByteString + getParentBytes(); + + /** + *
+   * For AIP-158 these fields are present. Usually not used/needed.
+   * The maximum number of configurations to return.
+   * If unspecified, all configs will be returned.
+   * 
+ * + * int32 page_size = 2; + * @return The pageSize. + */ + int getPageSize(); + + /** + *
+   * A page token received from a previous
+   * ListTaskPushNotificationConfigRequest call.
+   * Provide this to retrieve the subsequent page.
+   * When paginating, all other parameters provided to
+   * `ListTaskPushNotificationConfigRequest` must match the call that provided
+   * the page token.
+   * 
+ * + * string page_token = 3; + * @return The pageToken. + */ + java.lang.String getPageToken(); + /** + *
+   * A page token received from a previous
+   * ListTaskPushNotificationConfigRequest call.
+   * Provide this to retrieve the subsequent page.
+   * When paginating, all other parameters provided to
+   * `ListTaskPushNotificationConfigRequest` must match the call that provided
+   * the page token.
+   * 
+ * + * string page_token = 3; + * @return The bytes for pageToken. + */ + com.google.protobuf.ByteString + getPageTokenBytes(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ListTaskPushNotificationConfigResponse.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ListTaskPushNotificationConfigResponse.java new file mode 100644 index 000000000..6a4a4caa7 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ListTaskPushNotificationConfigResponse.java @@ -0,0 +1,891 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.ListTaskPushNotificationConfigResponse} + */ +@com.google.protobuf.Generated +public final class ListTaskPushNotificationConfigResponse extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.ListTaskPushNotificationConfigResponse) + ListTaskPushNotificationConfigResponseOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "ListTaskPushNotificationConfigResponse"); + } + // Use ListTaskPushNotificationConfigResponse.newBuilder() to construct. + private ListTaskPushNotificationConfigResponse(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private ListTaskPushNotificationConfigResponse() { + configs_ = java.util.Collections.emptyList(); + nextPageToken_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_ListTaskPushNotificationConfigResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_ListTaskPushNotificationConfigResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse.class, org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse.Builder.class); + } + + public static final int CONFIGS_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private java.util.List configs_; + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + @java.lang.Override + public java.util.List getConfigsList() { + return configs_; + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + @java.lang.Override + public java.util.List + getConfigsOrBuilderList() { + return configs_; + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + @java.lang.Override + public int getConfigsCount() { + return configs_.size(); + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig getConfigs(int index) { + return configs_.get(index); + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfigOrBuilder getConfigsOrBuilder( + int index) { + return configs_.get(index); + } + + public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object nextPageToken_ = ""; + /** + *
+   * A token, which can be sent as `page_token` to retrieve the next page.
+   * If this field is omitted, there are no subsequent pages.
+   * 
+ * + * string next_page_token = 2; + * @return The nextPageToken. + */ + @java.lang.Override + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } + } + /** + *
+   * A token, which can be sent as `page_token` to retrieve the next page.
+   * If this field is omitted, there are no subsequent pages.
+   * 
+ * + * string next_page_token = 2; + * @return The bytes for nextPageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + for (int i = 0; i < configs_.size(); i++) { + output.writeMessage(1, configs_.get(i)); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(nextPageToken_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, nextPageToken_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < configs_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, configs_.get(i)); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(nextPageToken_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, nextPageToken_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse other = (org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse) obj; + + if (!getConfigsList() + .equals(other.getConfigsList())) return false; + if (!getNextPageToken() + .equals(other.getNextPageToken())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getConfigsCount() > 0) { + hash = (37 * hash) + CONFIGS_FIELD_NUMBER; + hash = (53 * hash) + getConfigsList().hashCode(); + } + hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getNextPageToken().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.ListTaskPushNotificationConfigResponse} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.ListTaskPushNotificationConfigResponse) + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_ListTaskPushNotificationConfigResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_ListTaskPushNotificationConfigResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse.class, org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + if (configsBuilder_ == null) { + configs_ = java.util.Collections.emptyList(); + } else { + configs_ = null; + configsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + nextPageToken_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_ListTaskPushNotificationConfigResponse_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse build() { + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse buildPartial() { + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse result = new org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields(org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse result) { + if (configsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + configs_ = java.util.Collections.unmodifiableList(configs_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.configs_ = configs_; + } else { + result.configs_ = configsBuilder_.build(); + } + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.nextPageToken_ = nextPageToken_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse other) { + if (other == org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse.getDefaultInstance()) return this; + if (configsBuilder_ == null) { + if (!other.configs_.isEmpty()) { + if (configs_.isEmpty()) { + configs_ = other.configs_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureConfigsIsMutable(); + configs_.addAll(other.configs_); + } + onChanged(); + } + } else { + if (!other.configs_.isEmpty()) { + if (configsBuilder_.isEmpty()) { + configsBuilder_.dispose(); + configsBuilder_ = null; + configs_ = other.configs_; + bitField0_ = (bitField0_ & ~0x00000001); + configsBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + internalGetConfigsFieldBuilder() : null; + } else { + configsBuilder_.addAllMessages(other.configs_); + } + } + } + if (!other.getNextPageToken().isEmpty()) { + nextPageToken_ = other.nextPageToken_; + bitField0_ |= 0x00000002; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig m = + input.readMessage( + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.parser(), + extensionRegistry); + if (configsBuilder_ == null) { + ensureConfigsIsMutable(); + configs_.add(m); + } else { + configsBuilder_.addMessage(m); + } + break; + } // case 10 + case 18: { + nextPageToken_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.util.List configs_ = + java.util.Collections.emptyList(); + private void ensureConfigsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + configs_ = new java.util.ArrayList(configs_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.Builder, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfigOrBuilder> configsBuilder_; + + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + public java.util.List getConfigsList() { + if (configsBuilder_ == null) { + return java.util.Collections.unmodifiableList(configs_); + } else { + return configsBuilder_.getMessageList(); + } + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + public int getConfigsCount() { + if (configsBuilder_ == null) { + return configs_.size(); + } else { + return configsBuilder_.getCount(); + } + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + public org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig getConfigs(int index) { + if (configsBuilder_ == null) { + return configs_.get(index); + } else { + return configsBuilder_.getMessage(index); + } + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + public Builder setConfigs( + int index, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig value) { + if (configsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureConfigsIsMutable(); + configs_.set(index, value); + onChanged(); + } else { + configsBuilder_.setMessage(index, value); + } + return this; + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + public Builder setConfigs( + int index, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.Builder builderForValue) { + if (configsBuilder_ == null) { + ensureConfigsIsMutable(); + configs_.set(index, builderForValue.build()); + onChanged(); + } else { + configsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + public Builder addConfigs(org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig value) { + if (configsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureConfigsIsMutable(); + configs_.add(value); + onChanged(); + } else { + configsBuilder_.addMessage(value); + } + return this; + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + public Builder addConfigs( + int index, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig value) { + if (configsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureConfigsIsMutable(); + configs_.add(index, value); + onChanged(); + } else { + configsBuilder_.addMessage(index, value); + } + return this; + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + public Builder addConfigs( + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.Builder builderForValue) { + if (configsBuilder_ == null) { + ensureConfigsIsMutable(); + configs_.add(builderForValue.build()); + onChanged(); + } else { + configsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + public Builder addConfigs( + int index, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.Builder builderForValue) { + if (configsBuilder_ == null) { + ensureConfigsIsMutable(); + configs_.add(index, builderForValue.build()); + onChanged(); + } else { + configsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + public Builder addAllConfigs( + java.lang.Iterable values) { + if (configsBuilder_ == null) { + ensureConfigsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, configs_); + onChanged(); + } else { + configsBuilder_.addAllMessages(values); + } + return this; + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + public Builder clearConfigs() { + if (configsBuilder_ == null) { + configs_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + configsBuilder_.clear(); + } + return this; + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + public Builder removeConfigs(int index) { + if (configsBuilder_ == null) { + ensureConfigsIsMutable(); + configs_.remove(index); + onChanged(); + } else { + configsBuilder_.remove(index); + } + return this; + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + public org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.Builder getConfigsBuilder( + int index) { + return internalGetConfigsFieldBuilder().getBuilder(index); + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + public org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfigOrBuilder getConfigsOrBuilder( + int index) { + if (configsBuilder_ == null) { + return configs_.get(index); } else { + return configsBuilder_.getMessageOrBuilder(index); + } + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + public java.util.List + getConfigsOrBuilderList() { + if (configsBuilder_ != null) { + return configsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(configs_); + } + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + public org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.Builder addConfigsBuilder() { + return internalGetConfigsFieldBuilder().addBuilder( + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.getDefaultInstance()); + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + public org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.Builder addConfigsBuilder( + int index) { + return internalGetConfigsFieldBuilder().addBuilder( + index, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.getDefaultInstance()); + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + public java.util.List + getConfigsBuilderList() { + return internalGetConfigsFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.Builder, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfigOrBuilder> + internalGetConfigsFieldBuilder() { + if (configsBuilder_ == null) { + configsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.Builder, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfigOrBuilder>( + configs_, + ((bitField0_ & 0x00000001) != 0), + getParentForChildren(), + isClean()); + configs_ = null; + } + return configsBuilder_; + } + + private java.lang.Object nextPageToken_ = ""; + /** + *
+     * A token, which can be sent as `page_token` to retrieve the next page.
+     * If this field is omitted, there are no subsequent pages.
+     * 
+ * + * string next_page_token = 2; + * @return The nextPageToken. + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * A token, which can be sent as `page_token` to retrieve the next page.
+     * If this field is omitted, there are no subsequent pages.
+     * 
+ * + * string next_page_token = 2; + * @return The bytes for nextPageToken. + */ + public com.google.protobuf.ByteString + getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * A token, which can be sent as `page_token` to retrieve the next page.
+     * If this field is omitted, there are no subsequent pages.
+     * 
+ * + * string next_page_token = 2; + * @param value The nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageToken( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + nextPageToken_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * A token, which can be sent as `page_token` to retrieve the next page.
+     * If this field is omitted, there are no subsequent pages.
+     * 
+ * + * string next_page_token = 2; + * @return This builder for chaining. + */ + public Builder clearNextPageToken() { + nextPageToken_ = getDefaultInstance().getNextPageToken(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * A token, which can be sent as `page_token` to retrieve the next page.
+     * If this field is omitted, there are no subsequent pages.
+     * 
+ * + * string next_page_token = 2; + * @param value The bytes for nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageTokenBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + nextPageToken_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.ListTaskPushNotificationConfigResponse) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.ListTaskPushNotificationConfigResponse) + private static final org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse(); + } + + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListTaskPushNotificationConfigResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ListTaskPushNotificationConfigResponseOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ListTaskPushNotificationConfigResponseOrBuilder.java new file mode 100644 index 000000000..f952f588d --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ListTaskPushNotificationConfigResponseOrBuilder.java @@ -0,0 +1,58 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface ListTaskPushNotificationConfigResponseOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.ListTaskPushNotificationConfigResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + java.util.List + getConfigsList(); + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig getConfigs(int index); + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + int getConfigsCount(); + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + java.util.List + getConfigsOrBuilderList(); + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfigOrBuilder getConfigsOrBuilder( + int index); + + /** + *
+   * A token, which can be sent as `page_token` to retrieve the next page.
+   * If this field is omitted, there are no subsequent pages.
+   * 
+ * + * string next_page_token = 2; + * @return The nextPageToken. + */ + java.lang.String getNextPageToken(); + /** + *
+   * A token, which can be sent as `page_token` to retrieve the next page.
+   * If this field is omitted, there are no subsequent pages.
+   * 
+ * + * string next_page_token = 2; + * @return The bytes for nextPageToken. + */ + com.google.protobuf.ByteString + getNextPageTokenBytes(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/Message.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/Message.java new file mode 100644 index 000000000..fcbb6d4bd --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/Message.java @@ -0,0 +1,1983 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * Message is one unit of communication between client and server. It is
+ * associated with a context and optionally a task. Since the server is
+ * responsible for the context definition, it must always provide a context_id
+ * in its messages. The client can optionally provide the context_id if it
+ * knows the context to associate the message to. Similarly for task_id,
+ * except the server decides if a task is created and whether to include the
+ * task_id.
+ * 
+ * + * Protobuf type {@code a2a.v1.Message} + */ +@com.google.protobuf.Generated +public final class Message extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.Message) + MessageOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "Message"); + } + // Use Message.newBuilder() to construct. + private Message(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private Message() { + messageId_ = ""; + contextId_ = ""; + taskId_ = ""; + role_ = 0; + content_ = java.util.Collections.emptyList(); + extensions_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_Message_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_Message_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.Message.class, org.a2aproject.sdk.compat03.grpc.Message.Builder.class); + } + + private int bitField0_; + public static final int MESSAGE_ID_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object messageId_ = ""; + /** + *
+   * The message id of the message. This is required and created by the
+   * message creator.
+   * 
+ * + * string message_id = 1; + * @return The messageId. + */ + @java.lang.Override + public java.lang.String getMessageId() { + java.lang.Object ref = messageId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + messageId_ = s; + return s; + } + } + /** + *
+   * The message id of the message. This is required and created by the
+   * message creator.
+   * 
+ * + * string message_id = 1; + * @return The bytes for messageId. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getMessageIdBytes() { + java.lang.Object ref = messageId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + messageId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CONTEXT_ID_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object contextId_ = ""; + /** + *
+   * The context id of the message. This is optional and if set, the message
+   * will be associated with the given context.
+   * 
+ * + * string context_id = 2; + * @return The contextId. + */ + @java.lang.Override + public java.lang.String getContextId() { + java.lang.Object ref = contextId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + contextId_ = s; + return s; + } + } + /** + *
+   * The context id of the message. This is optional and if set, the message
+   * will be associated with the given context.
+   * 
+ * + * string context_id = 2; + * @return The bytes for contextId. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getContextIdBytes() { + java.lang.Object ref = contextId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + contextId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int TASK_ID_FIELD_NUMBER = 3; + @SuppressWarnings("serial") + private volatile java.lang.Object taskId_ = ""; + /** + *
+   * The task id of the message. This is optional and if set, the message
+   * will be associated with the given task.
+   * 
+ * + * string task_id = 3; + * @return The taskId. + */ + @java.lang.Override + public java.lang.String getTaskId() { + java.lang.Object ref = taskId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + taskId_ = s; + return s; + } + } + /** + *
+   * The task id of the message. This is optional and if set, the message
+   * will be associated with the given task.
+   * 
+ * + * string task_id = 3; + * @return The bytes for taskId. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getTaskIdBytes() { + java.lang.Object ref = taskId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + taskId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int ROLE_FIELD_NUMBER = 4; + private int role_ = 0; + /** + *
+   * A role for the message.
+   * 
+ * + * .a2a.v1.Role role = 4; + * @return The enum numeric value on the wire for role. + */ + @java.lang.Override public int getRoleValue() { + return role_; + } + /** + *
+   * A role for the message.
+   * 
+ * + * .a2a.v1.Role role = 4; + * @return The role. + */ + @java.lang.Override public org.a2aproject.sdk.compat03.grpc.Role getRole() { + org.a2aproject.sdk.compat03.grpc.Role result = org.a2aproject.sdk.compat03.grpc.Role.forNumber(role_); + return result == null ? org.a2aproject.sdk.compat03.grpc.Role.UNRECOGNIZED : result; + } + + public static final int CONTENT_FIELD_NUMBER = 5; + @SuppressWarnings("serial") + private java.util.List content_; + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Content is the container of the message content.
+   * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + @java.lang.Override + public java.util.List getContentList() { + return content_; + } + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Content is the container of the message content.
+   * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + @java.lang.Override + public java.util.List + getContentOrBuilderList() { + return content_; + } + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Content is the container of the message content.
+   * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + @java.lang.Override + public int getContentCount() { + return content_.size(); + } + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Content is the container of the message content.
+   * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Part getContent(int index) { + return content_.get(index); + } + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Content is the container of the message content.
+   * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.PartOrBuilder getContentOrBuilder( + int index) { + return content_.get(index); + } + + public static final int METADATA_FIELD_NUMBER = 6; + private com.google.protobuf.Struct metadata_; + /** + *
+   * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+   * Any optional metadata to provide along with the message.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return Whether the metadata field is set. + */ + @java.lang.Override + public boolean hasMetadata() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + *
+   * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+   * Any optional metadata to provide along with the message.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return The metadata. + */ + @java.lang.Override + public com.google.protobuf.Struct getMetadata() { + return metadata_ == null ? com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } + /** + *
+   * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+   * Any optional metadata to provide along with the message.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + @java.lang.Override + public com.google.protobuf.StructOrBuilder getMetadataOrBuilder() { + return metadata_ == null ? com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } + + public static final int EXTENSIONS_FIELD_NUMBER = 7; + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList extensions_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + /** + *
+   * The URIs of extensions that are present or contributed to this Message.
+   * 
+ * + * repeated string extensions = 7; + * @return A list containing the extensions. + */ + public com.google.protobuf.ProtocolStringList + getExtensionsList() { + return extensions_; + } + /** + *
+   * The URIs of extensions that are present or contributed to this Message.
+   * 
+ * + * repeated string extensions = 7; + * @return The count of extensions. + */ + public int getExtensionsCount() { + return extensions_.size(); + } + /** + *
+   * The URIs of extensions that are present or contributed to this Message.
+   * 
+ * + * repeated string extensions = 7; + * @param index The index of the element to return. + * @return The extensions at the given index. + */ + public java.lang.String getExtensions(int index) { + return extensions_.get(index); + } + /** + *
+   * The URIs of extensions that are present or contributed to this Message.
+   * 
+ * + * repeated string extensions = 7; + * @param index The index of the value to return. + * @return The bytes of the extensions at the given index. + */ + public com.google.protobuf.ByteString + getExtensionsBytes(int index) { + return extensions_.getByteString(index); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(messageId_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, messageId_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(contextId_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, contextId_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(taskId_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 3, taskId_); + } + if (role_ != org.a2aproject.sdk.compat03.grpc.Role.ROLE_UNSPECIFIED.getNumber()) { + output.writeEnum(4, role_); + } + for (int i = 0; i < content_.size(); i++) { + output.writeMessage(5, content_.get(i)); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(6, getMetadata()); + } + for (int i = 0; i < extensions_.size(); i++) { + com.google.protobuf.GeneratedMessage.writeString(output, 7, extensions_.getRaw(i)); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(messageId_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, messageId_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(contextId_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, contextId_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(taskId_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(3, taskId_); + } + if (role_ != org.a2aproject.sdk.compat03.grpc.Role.ROLE_UNSPECIFIED.getNumber()) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(4, role_); + } + for (int i = 0; i < content_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(5, content_.get(i)); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(6, getMetadata()); + } + { + int dataSize = 0; + for (int i = 0; i < extensions_.size(); i++) { + dataSize += computeStringSizeNoTag(extensions_.getRaw(i)); + } + size += dataSize; + size += 1 * getExtensionsList().size(); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.Message)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.Message other = (org.a2aproject.sdk.compat03.grpc.Message) obj; + + if (!getMessageId() + .equals(other.getMessageId())) return false; + if (!getContextId() + .equals(other.getContextId())) return false; + if (!getTaskId() + .equals(other.getTaskId())) return false; + if (role_ != other.role_) return false; + if (!getContentList() + .equals(other.getContentList())) return false; + if (hasMetadata() != other.hasMetadata()) return false; + if (hasMetadata()) { + if (!getMetadata() + .equals(other.getMetadata())) return false; + } + if (!getExtensionsList() + .equals(other.getExtensionsList())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + MESSAGE_ID_FIELD_NUMBER; + hash = (53 * hash) + getMessageId().hashCode(); + hash = (37 * hash) + CONTEXT_ID_FIELD_NUMBER; + hash = (53 * hash) + getContextId().hashCode(); + hash = (37 * hash) + TASK_ID_FIELD_NUMBER; + hash = (53 * hash) + getTaskId().hashCode(); + hash = (37 * hash) + ROLE_FIELD_NUMBER; + hash = (53 * hash) + role_; + if (getContentCount() > 0) { + hash = (37 * hash) + CONTENT_FIELD_NUMBER; + hash = (53 * hash) + getContentList().hashCode(); + } + if (hasMetadata()) { + hash = (37 * hash) + METADATA_FIELD_NUMBER; + hash = (53 * hash) + getMetadata().hashCode(); + } + if (getExtensionsCount() > 0) { + hash = (37 * hash) + EXTENSIONS_FIELD_NUMBER; + hash = (53 * hash) + getExtensionsList().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.Message parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.Message parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.Message parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.Message parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.Message parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.Message parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.Message parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.Message parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.Message parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.Message parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.Message parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.Message parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.Message prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * Message is one unit of communication between client and server. It is
+   * associated with a context and optionally a task. Since the server is
+   * responsible for the context definition, it must always provide a context_id
+   * in its messages. The client can optionally provide the context_id if it
+   * knows the context to associate the message to. Similarly for task_id,
+   * except the server decides if a task is created and whether to include the
+   * task_id.
+   * 
+ * + * Protobuf type {@code a2a.v1.Message} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.Message) + org.a2aproject.sdk.compat03.grpc.MessageOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_Message_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_Message_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.Message.class, org.a2aproject.sdk.compat03.grpc.Message.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.Message.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage + .alwaysUseFieldBuilders) { + internalGetContentFieldBuilder(); + internalGetMetadataFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + messageId_ = ""; + contextId_ = ""; + taskId_ = ""; + role_ = 0; + if (contentBuilder_ == null) { + content_ = java.util.Collections.emptyList(); + } else { + content_ = null; + contentBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000010); + metadata_ = null; + if (metadataBuilder_ != null) { + metadataBuilder_.dispose(); + metadataBuilder_ = null; + } + extensions_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_Message_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Message getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Message build() { + org.a2aproject.sdk.compat03.grpc.Message result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Message buildPartial() { + org.a2aproject.sdk.compat03.grpc.Message result = new org.a2aproject.sdk.compat03.grpc.Message(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields(org.a2aproject.sdk.compat03.grpc.Message result) { + if (contentBuilder_ == null) { + if (((bitField0_ & 0x00000010) != 0)) { + content_ = java.util.Collections.unmodifiableList(content_); + bitField0_ = (bitField0_ & ~0x00000010); + } + result.content_ = content_; + } else { + result.content_ = contentBuilder_.build(); + } + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.Message result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.messageId_ = messageId_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.contextId_ = contextId_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.taskId_ = taskId_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.role_ = role_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000020) != 0)) { + result.metadata_ = metadataBuilder_ == null + ? metadata_ + : metadataBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000040) != 0)) { + extensions_.makeImmutable(); + result.extensions_ = extensions_; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.Message) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.Message)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.Message other) { + if (other == org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance()) return this; + if (!other.getMessageId().isEmpty()) { + messageId_ = other.messageId_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getContextId().isEmpty()) { + contextId_ = other.contextId_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (!other.getTaskId().isEmpty()) { + taskId_ = other.taskId_; + bitField0_ |= 0x00000004; + onChanged(); + } + if (other.role_ != 0) { + setRoleValue(other.getRoleValue()); + } + if (contentBuilder_ == null) { + if (!other.content_.isEmpty()) { + if (content_.isEmpty()) { + content_ = other.content_; + bitField0_ = (bitField0_ & ~0x00000010); + } else { + ensureContentIsMutable(); + content_.addAll(other.content_); + } + onChanged(); + } + } else { + if (!other.content_.isEmpty()) { + if (contentBuilder_.isEmpty()) { + contentBuilder_.dispose(); + contentBuilder_ = null; + content_ = other.content_; + bitField0_ = (bitField0_ & ~0x00000010); + contentBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + internalGetContentFieldBuilder() : null; + } else { + contentBuilder_.addAllMessages(other.content_); + } + } + } + if (other.hasMetadata()) { + mergeMetadata(other.getMetadata()); + } + if (!other.extensions_.isEmpty()) { + if (extensions_.isEmpty()) { + extensions_ = other.extensions_; + bitField0_ |= 0x00000040; + } else { + ensureExtensionsIsMutable(); + extensions_.addAll(other.extensions_); + } + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + messageId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + contextId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: { + taskId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + case 32: { + role_ = input.readEnum(); + bitField0_ |= 0x00000008; + break; + } // case 32 + case 42: { + org.a2aproject.sdk.compat03.grpc.Part m = + input.readMessage( + org.a2aproject.sdk.compat03.grpc.Part.parser(), + extensionRegistry); + if (contentBuilder_ == null) { + ensureContentIsMutable(); + content_.add(m); + } else { + contentBuilder_.addMessage(m); + } + break; + } // case 42 + case 50: { + input.readMessage( + internalGetMetadataFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000020; + break; + } // case 50 + case 58: { + java.lang.String s = input.readStringRequireUtf8(); + ensureExtensionsIsMutable(); + extensions_.add(s); + break; + } // case 58 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object messageId_ = ""; + /** + *
+     * The message id of the message. This is required and created by the
+     * message creator.
+     * 
+ * + * string message_id = 1; + * @return The messageId. + */ + public java.lang.String getMessageId() { + java.lang.Object ref = messageId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + messageId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The message id of the message. This is required and created by the
+     * message creator.
+     * 
+ * + * string message_id = 1; + * @return The bytes for messageId. + */ + public com.google.protobuf.ByteString + getMessageIdBytes() { + java.lang.Object ref = messageId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + messageId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The message id of the message. This is required and created by the
+     * message creator.
+     * 
+ * + * string message_id = 1; + * @param value The messageId to set. + * @return This builder for chaining. + */ + public Builder setMessageId( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + messageId_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * The message id of the message. This is required and created by the
+     * message creator.
+     * 
+ * + * string message_id = 1; + * @return This builder for chaining. + */ + public Builder clearMessageId() { + messageId_ = getDefaultInstance().getMessageId(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * The message id of the message. This is required and created by the
+     * message creator.
+     * 
+ * + * string message_id = 1; + * @param value The bytes for messageId to set. + * @return This builder for chaining. + */ + public Builder setMessageIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + messageId_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object contextId_ = ""; + /** + *
+     * The context id of the message. This is optional and if set, the message
+     * will be associated with the given context.
+     * 
+ * + * string context_id = 2; + * @return The contextId. + */ + public java.lang.String getContextId() { + java.lang.Object ref = contextId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + contextId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The context id of the message. This is optional and if set, the message
+     * will be associated with the given context.
+     * 
+ * + * string context_id = 2; + * @return The bytes for contextId. + */ + public com.google.protobuf.ByteString + getContextIdBytes() { + java.lang.Object ref = contextId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + contextId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The context id of the message. This is optional and if set, the message
+     * will be associated with the given context.
+     * 
+ * + * string context_id = 2; + * @param value The contextId to set. + * @return This builder for chaining. + */ + public Builder setContextId( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + contextId_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * The context id of the message. This is optional and if set, the message
+     * will be associated with the given context.
+     * 
+ * + * string context_id = 2; + * @return This builder for chaining. + */ + public Builder clearContextId() { + contextId_ = getDefaultInstance().getContextId(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * The context id of the message. This is optional and if set, the message
+     * will be associated with the given context.
+     * 
+ * + * string context_id = 2; + * @param value The bytes for contextId to set. + * @return This builder for chaining. + */ + public Builder setContextIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + contextId_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private java.lang.Object taskId_ = ""; + /** + *
+     * The task id of the message. This is optional and if set, the message
+     * will be associated with the given task.
+     * 
+ * + * string task_id = 3; + * @return The taskId. + */ + public java.lang.String getTaskId() { + java.lang.Object ref = taskId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + taskId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The task id of the message. This is optional and if set, the message
+     * will be associated with the given task.
+     * 
+ * + * string task_id = 3; + * @return The bytes for taskId. + */ + public com.google.protobuf.ByteString + getTaskIdBytes() { + java.lang.Object ref = taskId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + taskId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The task id of the message. This is optional and if set, the message
+     * will be associated with the given task.
+     * 
+ * + * string task_id = 3; + * @param value The taskId to set. + * @return This builder for chaining. + */ + public Builder setTaskId( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + taskId_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * The task id of the message. This is optional and if set, the message
+     * will be associated with the given task.
+     * 
+ * + * string task_id = 3; + * @return This builder for chaining. + */ + public Builder clearTaskId() { + taskId_ = getDefaultInstance().getTaskId(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + *
+     * The task id of the message. This is optional and if set, the message
+     * will be associated with the given task.
+     * 
+ * + * string task_id = 3; + * @param value The bytes for taskId to set. + * @return This builder for chaining. + */ + public Builder setTaskIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + taskId_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + private int role_ = 0; + /** + *
+     * A role for the message.
+     * 
+ * + * .a2a.v1.Role role = 4; + * @return The enum numeric value on the wire for role. + */ + @java.lang.Override public int getRoleValue() { + return role_; + } + /** + *
+     * A role for the message.
+     * 
+ * + * .a2a.v1.Role role = 4; + * @param value The enum numeric value on the wire for role to set. + * @return This builder for chaining. + */ + public Builder setRoleValue(int value) { + role_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + *
+     * A role for the message.
+     * 
+ * + * .a2a.v1.Role role = 4; + * @return The role. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Role getRole() { + org.a2aproject.sdk.compat03.grpc.Role result = org.a2aproject.sdk.compat03.grpc.Role.forNumber(role_); + return result == null ? org.a2aproject.sdk.compat03.grpc.Role.UNRECOGNIZED : result; + } + /** + *
+     * A role for the message.
+     * 
+ * + * .a2a.v1.Role role = 4; + * @param value The role to set. + * @return This builder for chaining. + */ + public Builder setRole(org.a2aproject.sdk.compat03.grpc.Role value) { + if (value == null) { throw new NullPointerException(); } + bitField0_ |= 0x00000008; + role_ = value.getNumber(); + onChanged(); + return this; + } + /** + *
+     * A role for the message.
+     * 
+ * + * .a2a.v1.Role role = 4; + * @return This builder for chaining. + */ + public Builder clearRole() { + bitField0_ = (bitField0_ & ~0x00000008); + role_ = 0; + onChanged(); + return this; + } + + private java.util.List content_ = + java.util.Collections.emptyList(); + private void ensureContentIsMutable() { + if (!((bitField0_ & 0x00000010) != 0)) { + content_ = new java.util.ArrayList(content_); + bitField0_ |= 0x00000010; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Part, org.a2aproject.sdk.compat03.grpc.Part.Builder, org.a2aproject.sdk.compat03.grpc.PartOrBuilder> contentBuilder_; + + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Content is the container of the message content.
+     * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + public java.util.List getContentList() { + if (contentBuilder_ == null) { + return java.util.Collections.unmodifiableList(content_); + } else { + return contentBuilder_.getMessageList(); + } + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Content is the container of the message content.
+     * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + public int getContentCount() { + if (contentBuilder_ == null) { + return content_.size(); + } else { + return contentBuilder_.getCount(); + } + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Content is the container of the message content.
+     * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + public org.a2aproject.sdk.compat03.grpc.Part getContent(int index) { + if (contentBuilder_ == null) { + return content_.get(index); + } else { + return contentBuilder_.getMessage(index); + } + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Content is the container of the message content.
+     * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + public Builder setContent( + int index, org.a2aproject.sdk.compat03.grpc.Part value) { + if (contentBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureContentIsMutable(); + content_.set(index, value); + onChanged(); + } else { + contentBuilder_.setMessage(index, value); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Content is the container of the message content.
+     * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + public Builder setContent( + int index, org.a2aproject.sdk.compat03.grpc.Part.Builder builderForValue) { + if (contentBuilder_ == null) { + ensureContentIsMutable(); + content_.set(index, builderForValue.build()); + onChanged(); + } else { + contentBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Content is the container of the message content.
+     * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + public Builder addContent(org.a2aproject.sdk.compat03.grpc.Part value) { + if (contentBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureContentIsMutable(); + content_.add(value); + onChanged(); + } else { + contentBuilder_.addMessage(value); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Content is the container of the message content.
+     * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + public Builder addContent( + int index, org.a2aproject.sdk.compat03.grpc.Part value) { + if (contentBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureContentIsMutable(); + content_.add(index, value); + onChanged(); + } else { + contentBuilder_.addMessage(index, value); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Content is the container of the message content.
+     * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + public Builder addContent( + org.a2aproject.sdk.compat03.grpc.Part.Builder builderForValue) { + if (contentBuilder_ == null) { + ensureContentIsMutable(); + content_.add(builderForValue.build()); + onChanged(); + } else { + contentBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Content is the container of the message content.
+     * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + public Builder addContent( + int index, org.a2aproject.sdk.compat03.grpc.Part.Builder builderForValue) { + if (contentBuilder_ == null) { + ensureContentIsMutable(); + content_.add(index, builderForValue.build()); + onChanged(); + } else { + contentBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Content is the container of the message content.
+     * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + public Builder addAllContent( + java.lang.Iterable values) { + if (contentBuilder_ == null) { + ensureContentIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, content_); + onChanged(); + } else { + contentBuilder_.addAllMessages(values); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Content is the container of the message content.
+     * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + public Builder clearContent() { + if (contentBuilder_ == null) { + content_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000010); + onChanged(); + } else { + contentBuilder_.clear(); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Content is the container of the message content.
+     * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + public Builder removeContent(int index) { + if (contentBuilder_ == null) { + ensureContentIsMutable(); + content_.remove(index); + onChanged(); + } else { + contentBuilder_.remove(index); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Content is the container of the message content.
+     * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + public org.a2aproject.sdk.compat03.grpc.Part.Builder getContentBuilder( + int index) { + return internalGetContentFieldBuilder().getBuilder(index); + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Content is the container of the message content.
+     * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + public org.a2aproject.sdk.compat03.grpc.PartOrBuilder getContentOrBuilder( + int index) { + if (contentBuilder_ == null) { + return content_.get(index); } else { + return contentBuilder_.getMessageOrBuilder(index); + } + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Content is the container of the message content.
+     * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + public java.util.List + getContentOrBuilderList() { + if (contentBuilder_ != null) { + return contentBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(content_); + } + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Content is the container of the message content.
+     * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + public org.a2aproject.sdk.compat03.grpc.Part.Builder addContentBuilder() { + return internalGetContentFieldBuilder().addBuilder( + org.a2aproject.sdk.compat03.grpc.Part.getDefaultInstance()); + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Content is the container of the message content.
+     * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + public org.a2aproject.sdk.compat03.grpc.Part.Builder addContentBuilder( + int index) { + return internalGetContentFieldBuilder().addBuilder( + index, org.a2aproject.sdk.compat03.grpc.Part.getDefaultInstance()); + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Content is the container of the message content.
+     * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + public java.util.List + getContentBuilderList() { + return internalGetContentFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Part, org.a2aproject.sdk.compat03.grpc.Part.Builder, org.a2aproject.sdk.compat03.grpc.PartOrBuilder> + internalGetContentFieldBuilder() { + if (contentBuilder_ == null) { + contentBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Part, org.a2aproject.sdk.compat03.grpc.Part.Builder, org.a2aproject.sdk.compat03.grpc.PartOrBuilder>( + content_, + ((bitField0_ & 0x00000010) != 0), + getParentForChildren(), + isClean()); + content_ = null; + } + return contentBuilder_; + } + + private com.google.protobuf.Struct metadata_; + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> metadataBuilder_; + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * Any optional metadata to provide along with the message.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return Whether the metadata field is set. + */ + public boolean hasMetadata() { + return ((bitField0_ & 0x00000020) != 0); + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * Any optional metadata to provide along with the message.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return The metadata. + */ + public com.google.protobuf.Struct getMetadata() { + if (metadataBuilder_ == null) { + return metadata_ == null ? com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } else { + return metadataBuilder_.getMessage(); + } + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * Any optional metadata to provide along with the message.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public Builder setMetadata(com.google.protobuf.Struct value) { + if (metadataBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + metadata_ = value; + } else { + metadataBuilder_.setMessage(value); + } + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * Any optional metadata to provide along with the message.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public Builder setMetadata( + com.google.protobuf.Struct.Builder builderForValue) { + if (metadataBuilder_ == null) { + metadata_ = builderForValue.build(); + } else { + metadataBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * Any optional metadata to provide along with the message.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public Builder mergeMetadata(com.google.protobuf.Struct value) { + if (metadataBuilder_ == null) { + if (((bitField0_ & 0x00000020) != 0) && + metadata_ != null && + metadata_ != com.google.protobuf.Struct.getDefaultInstance()) { + getMetadataBuilder().mergeFrom(value); + } else { + metadata_ = value; + } + } else { + metadataBuilder_.mergeFrom(value); + } + if (metadata_ != null) { + bitField0_ |= 0x00000020; + onChanged(); + } + return this; + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * Any optional metadata to provide along with the message.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public Builder clearMetadata() { + bitField0_ = (bitField0_ & ~0x00000020); + metadata_ = null; + if (metadataBuilder_ != null) { + metadataBuilder_.dispose(); + metadataBuilder_ = null; + } + onChanged(); + return this; + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * Any optional metadata to provide along with the message.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public com.google.protobuf.Struct.Builder getMetadataBuilder() { + bitField0_ |= 0x00000020; + onChanged(); + return internalGetMetadataFieldBuilder().getBuilder(); + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * Any optional metadata to provide along with the message.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public com.google.protobuf.StructOrBuilder getMetadataOrBuilder() { + if (metadataBuilder_ != null) { + return metadataBuilder_.getMessageOrBuilder(); + } else { + return metadata_ == null ? + com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * Any optional metadata to provide along with the message.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> + internalGetMetadataFieldBuilder() { + if (metadataBuilder_ == null) { + metadataBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder>( + getMetadata(), + getParentForChildren(), + isClean()); + metadata_ = null; + } + return metadataBuilder_; + } + + private com.google.protobuf.LazyStringArrayList extensions_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + private void ensureExtensionsIsMutable() { + if (!extensions_.isModifiable()) { + extensions_ = new com.google.protobuf.LazyStringArrayList(extensions_); + } + bitField0_ |= 0x00000040; + } + /** + *
+     * The URIs of extensions that are present or contributed to this Message.
+     * 
+ * + * repeated string extensions = 7; + * @return A list containing the extensions. + */ + public com.google.protobuf.ProtocolStringList + getExtensionsList() { + extensions_.makeImmutable(); + return extensions_; + } + /** + *
+     * The URIs of extensions that are present or contributed to this Message.
+     * 
+ * + * repeated string extensions = 7; + * @return The count of extensions. + */ + public int getExtensionsCount() { + return extensions_.size(); + } + /** + *
+     * The URIs of extensions that are present or contributed to this Message.
+     * 
+ * + * repeated string extensions = 7; + * @param index The index of the element to return. + * @return The extensions at the given index. + */ + public java.lang.String getExtensions(int index) { + return extensions_.get(index); + } + /** + *
+     * The URIs of extensions that are present or contributed to this Message.
+     * 
+ * + * repeated string extensions = 7; + * @param index The index of the value to return. + * @return The bytes of the extensions at the given index. + */ + public com.google.protobuf.ByteString + getExtensionsBytes(int index) { + return extensions_.getByteString(index); + } + /** + *
+     * The URIs of extensions that are present or contributed to this Message.
+     * 
+ * + * repeated string extensions = 7; + * @param index The index to set the value at. + * @param value The extensions to set. + * @return This builder for chaining. + */ + public Builder setExtensions( + int index, java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureExtensionsIsMutable(); + extensions_.set(index, value); + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + *
+     * The URIs of extensions that are present or contributed to this Message.
+     * 
+ * + * repeated string extensions = 7; + * @param value The extensions to add. + * @return This builder for chaining. + */ + public Builder addExtensions( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureExtensionsIsMutable(); + extensions_.add(value); + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + *
+     * The URIs of extensions that are present or contributed to this Message.
+     * 
+ * + * repeated string extensions = 7; + * @param values The extensions to add. + * @return This builder for chaining. + */ + public Builder addAllExtensions( + java.lang.Iterable values) { + ensureExtensionsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, extensions_); + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + *
+     * The URIs of extensions that are present or contributed to this Message.
+     * 
+ * + * repeated string extensions = 7; + * @return This builder for chaining. + */ + public Builder clearExtensions() { + extensions_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00000040);; + onChanged(); + return this; + } + /** + *
+     * The URIs of extensions that are present or contributed to this Message.
+     * 
+ * + * repeated string extensions = 7; + * @param value The bytes of the extensions to add. + * @return This builder for chaining. + */ + public Builder addExtensionsBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + ensureExtensionsIsMutable(); + extensions_.add(value); + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.Message) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.Message) + private static final org.a2aproject.sdk.compat03.grpc.Message DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.Message(); + } + + public static org.a2aproject.sdk.compat03.grpc.Message getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Message parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Message getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/MessageOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/MessageOrBuilder.java new file mode 100644 index 000000000..1c7dd4f27 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/MessageOrBuilder.java @@ -0,0 +1,217 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface MessageOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.Message) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The message id of the message. This is required and created by the
+   * message creator.
+   * 
+ * + * string message_id = 1; + * @return The messageId. + */ + java.lang.String getMessageId(); + /** + *
+   * The message id of the message. This is required and created by the
+   * message creator.
+   * 
+ * + * string message_id = 1; + * @return The bytes for messageId. + */ + com.google.protobuf.ByteString + getMessageIdBytes(); + + /** + *
+   * The context id of the message. This is optional and if set, the message
+   * will be associated with the given context.
+   * 
+ * + * string context_id = 2; + * @return The contextId. + */ + java.lang.String getContextId(); + /** + *
+   * The context id of the message. This is optional and if set, the message
+   * will be associated with the given context.
+   * 
+ * + * string context_id = 2; + * @return The bytes for contextId. + */ + com.google.protobuf.ByteString + getContextIdBytes(); + + /** + *
+   * The task id of the message. This is optional and if set, the message
+   * will be associated with the given task.
+   * 
+ * + * string task_id = 3; + * @return The taskId. + */ + java.lang.String getTaskId(); + /** + *
+   * The task id of the message. This is optional and if set, the message
+   * will be associated with the given task.
+   * 
+ * + * string task_id = 3; + * @return The bytes for taskId. + */ + com.google.protobuf.ByteString + getTaskIdBytes(); + + /** + *
+   * A role for the message.
+   * 
+ * + * .a2a.v1.Role role = 4; + * @return The enum numeric value on the wire for role. + */ + int getRoleValue(); + /** + *
+   * A role for the message.
+   * 
+ * + * .a2a.v1.Role role = 4; + * @return The role. + */ + org.a2aproject.sdk.compat03.grpc.Role getRole(); + + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Content is the container of the message content.
+   * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + java.util.List + getContentList(); + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Content is the container of the message content.
+   * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + org.a2aproject.sdk.compat03.grpc.Part getContent(int index); + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Content is the container of the message content.
+   * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + int getContentCount(); + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Content is the container of the message content.
+   * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + java.util.List + getContentOrBuilderList(); + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Content is the container of the message content.
+   * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + org.a2aproject.sdk.compat03.grpc.PartOrBuilder getContentOrBuilder( + int index); + + /** + *
+   * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+   * Any optional metadata to provide along with the message.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return Whether the metadata field is set. + */ + boolean hasMetadata(); + /** + *
+   * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+   * Any optional metadata to provide along with the message.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return The metadata. + */ + com.google.protobuf.Struct getMetadata(); + /** + *
+   * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+   * Any optional metadata to provide along with the message.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + com.google.protobuf.StructOrBuilder getMetadataOrBuilder(); + + /** + *
+   * The URIs of extensions that are present or contributed to this Message.
+   * 
+ * + * repeated string extensions = 7; + * @return A list containing the extensions. + */ + java.util.List + getExtensionsList(); + /** + *
+   * The URIs of extensions that are present or contributed to this Message.
+   * 
+ * + * repeated string extensions = 7; + * @return The count of extensions. + */ + int getExtensionsCount(); + /** + *
+   * The URIs of extensions that are present or contributed to this Message.
+   * 
+ * + * repeated string extensions = 7; + * @param index The index of the element to return. + * @return The extensions at the given index. + */ + java.lang.String getExtensions(int index); + /** + *
+   * The URIs of extensions that are present or contributed to this Message.
+   * 
+ * + * repeated string extensions = 7; + * @param index The index of the value to return. + * @return The bytes of the extensions at the given index. + */ + com.google.protobuf.ByteString + getExtensionsBytes(int index); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/MutualTlsSecurityScheme.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/MutualTlsSecurityScheme.java new file mode 100644 index 000000000..d9b77af97 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/MutualTlsSecurityScheme.java @@ -0,0 +1,530 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.MutualTlsSecurityScheme} + */ +@com.google.protobuf.Generated +public final class MutualTlsSecurityScheme extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.MutualTlsSecurityScheme) + MutualTlsSecuritySchemeOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "MutualTlsSecurityScheme"); + } + // Use MutualTlsSecurityScheme.newBuilder() to construct. + private MutualTlsSecurityScheme(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private MutualTlsSecurityScheme() { + description_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_MutualTlsSecurityScheme_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_MutualTlsSecurityScheme_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.class, org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.Builder.class); + } + + public static final int DESCRIPTION_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object description_ = ""; + /** + *
+   * Description of this security scheme.
+   * 
+ * + * string description = 1; + * @return The description. + */ + @java.lang.Override + public java.lang.String getDescription() { + java.lang.Object ref = description_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + description_ = s; + return s; + } + } + /** + *
+   * Description of this security scheme.
+   * 
+ * + * string description = 1; + * @return The bytes for description. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(description_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, description_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(description_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, description_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme other = (org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme) obj; + + if (!getDescription() + .equals(other.getDescription())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + DESCRIPTION_FIELD_NUMBER; + hash = (53 * hash) + getDescription().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.MutualTlsSecurityScheme} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.MutualTlsSecurityScheme) + org.a2aproject.sdk.compat03.grpc.MutualTlsSecuritySchemeOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_MutualTlsSecurityScheme_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_MutualTlsSecurityScheme_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.class, org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + description_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_MutualTlsSecurityScheme_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme build() { + org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme buildPartial() { + org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme result = new org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.description_ = description_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme other) { + if (other == org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.getDefaultInstance()) return this; + if (!other.getDescription().isEmpty()) { + description_ = other.description_; + bitField0_ |= 0x00000001; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + description_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object description_ = ""; + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @return The description. + */ + public java.lang.String getDescription() { + java.lang.Object ref = description_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + description_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @return The bytes for description. + */ + public com.google.protobuf.ByteString + getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @param value The description to set. + * @return This builder for chaining. + */ + public Builder setDescription( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + description_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @return This builder for chaining. + */ + public Builder clearDescription() { + description_ = getDefaultInstance().getDescription(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @param value The bytes for description to set. + * @return This builder for chaining. + */ + public Builder setDescriptionBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + description_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.MutualTlsSecurityScheme) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.MutualTlsSecurityScheme) + private static final org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme(); + } + + public static org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public MutualTlsSecurityScheme parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/MutualTlsSecuritySchemeOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/MutualTlsSecuritySchemeOrBuilder.java new file mode 100644 index 000000000..bae87d5d3 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/MutualTlsSecuritySchemeOrBuilder.java @@ -0,0 +1,32 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface MutualTlsSecuritySchemeOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.MutualTlsSecurityScheme) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Description of this security scheme.
+   * 
+ * + * string description = 1; + * @return The description. + */ + java.lang.String getDescription(); + /** + *
+   * Description of this security scheme.
+   * 
+ * + * string description = 1; + * @return The bytes for description. + */ + com.google.protobuf.ByteString + getDescriptionBytes(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/OAuth2SecurityScheme.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/OAuth2SecurityScheme.java new file mode 100644 index 000000000..6fbaeed7b --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/OAuth2SecurityScheme.java @@ -0,0 +1,942 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.OAuth2SecurityScheme} + */ +@com.google.protobuf.Generated +public final class OAuth2SecurityScheme extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.OAuth2SecurityScheme) + OAuth2SecuritySchemeOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "OAuth2SecurityScheme"); + } + // Use OAuth2SecurityScheme.newBuilder() to construct. + private OAuth2SecurityScheme(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private OAuth2SecurityScheme() { + description_ = ""; + oauth2MetadataUrl_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_OAuth2SecurityScheme_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_OAuth2SecurityScheme_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.class, org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.Builder.class); + } + + private int bitField0_; + public static final int DESCRIPTION_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object description_ = ""; + /** + *
+   * Description of this security scheme.
+   * 
+ * + * string description = 1; + * @return The description. + */ + @java.lang.Override + public java.lang.String getDescription() { + java.lang.Object ref = description_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + description_ = s; + return s; + } + } + /** + *
+   * Description of this security scheme.
+   * 
+ * + * string description = 1; + * @return The bytes for description. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int FLOWS_FIELD_NUMBER = 2; + private org.a2aproject.sdk.compat03.grpc.OAuthFlows flows_; + /** + *
+   * An object containing configuration information for the flow types supported
+   * 
+ * + * .a2a.v1.OAuthFlows flows = 2; + * @return Whether the flows field is set. + */ + @java.lang.Override + public boolean hasFlows() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + *
+   * An object containing configuration information for the flow types supported
+   * 
+ * + * .a2a.v1.OAuthFlows flows = 2; + * @return The flows. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OAuthFlows getFlows() { + return flows_ == null ? org.a2aproject.sdk.compat03.grpc.OAuthFlows.getDefaultInstance() : flows_; + } + /** + *
+   * An object containing configuration information for the flow types supported
+   * 
+ * + * .a2a.v1.OAuthFlows flows = 2; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OAuthFlowsOrBuilder getFlowsOrBuilder() { + return flows_ == null ? org.a2aproject.sdk.compat03.grpc.OAuthFlows.getDefaultInstance() : flows_; + } + + public static final int OAUTH2_METADATA_URL_FIELD_NUMBER = 3; + @SuppressWarnings("serial") + private volatile java.lang.Object oauth2MetadataUrl_ = ""; + /** + *
+   * URL to the oauth2 authorization server metadata
+   * [RFC8414](https://datatracker.ietf.org/doc/html/rfc8414). TLS is required.
+   * 
+ * + * string oauth2_metadata_url = 3; + * @return The oauth2MetadataUrl. + */ + @java.lang.Override + public java.lang.String getOauth2MetadataUrl() { + java.lang.Object ref = oauth2MetadataUrl_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + oauth2MetadataUrl_ = s; + return s; + } + } + /** + *
+   * URL to the oauth2 authorization server metadata
+   * [RFC8414](https://datatracker.ietf.org/doc/html/rfc8414). TLS is required.
+   * 
+ * + * string oauth2_metadata_url = 3; + * @return The bytes for oauth2MetadataUrl. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getOauth2MetadataUrlBytes() { + java.lang.Object ref = oauth2MetadataUrl_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + oauth2MetadataUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(description_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, description_); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(2, getFlows()); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(oauth2MetadataUrl_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 3, oauth2MetadataUrl_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(description_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, description_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, getFlows()); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(oauth2MetadataUrl_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(3, oauth2MetadataUrl_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme other = (org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme) obj; + + if (!getDescription() + .equals(other.getDescription())) return false; + if (hasFlows() != other.hasFlows()) return false; + if (hasFlows()) { + if (!getFlows() + .equals(other.getFlows())) return false; + } + if (!getOauth2MetadataUrl() + .equals(other.getOauth2MetadataUrl())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + DESCRIPTION_FIELD_NUMBER; + hash = (53 * hash) + getDescription().hashCode(); + if (hasFlows()) { + hash = (37 * hash) + FLOWS_FIELD_NUMBER; + hash = (53 * hash) + getFlows().hashCode(); + } + hash = (37 * hash) + OAUTH2_METADATA_URL_FIELD_NUMBER; + hash = (53 * hash) + getOauth2MetadataUrl().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.OAuth2SecurityScheme} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.OAuth2SecurityScheme) + org.a2aproject.sdk.compat03.grpc.OAuth2SecuritySchemeOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_OAuth2SecurityScheme_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_OAuth2SecurityScheme_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.class, org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage + .alwaysUseFieldBuilders) { + internalGetFlowsFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + description_ = ""; + flows_ = null; + if (flowsBuilder_ != null) { + flowsBuilder_.dispose(); + flowsBuilder_ = null; + } + oauth2MetadataUrl_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_OAuth2SecurityScheme_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme build() { + org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme buildPartial() { + org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme result = new org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.description_ = description_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.flows_ = flowsBuilder_ == null + ? flows_ + : flowsBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.oauth2MetadataUrl_ = oauth2MetadataUrl_; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme other) { + if (other == org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.getDefaultInstance()) return this; + if (!other.getDescription().isEmpty()) { + description_ = other.description_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (other.hasFlows()) { + mergeFlows(other.getFlows()); + } + if (!other.getOauth2MetadataUrl().isEmpty()) { + oauth2MetadataUrl_ = other.oauth2MetadataUrl_; + bitField0_ |= 0x00000004; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + description_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + input.readMessage( + internalGetFlowsFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: { + oauth2MetadataUrl_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object description_ = ""; + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @return The description. + */ + public java.lang.String getDescription() { + java.lang.Object ref = description_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + description_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @return The bytes for description. + */ + public com.google.protobuf.ByteString + getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @param value The description to set. + * @return This builder for chaining. + */ + public Builder setDescription( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + description_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @return This builder for chaining. + */ + public Builder clearDescription() { + description_ = getDefaultInstance().getDescription(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @param value The bytes for description to set. + * @return This builder for chaining. + */ + public Builder setDescriptionBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + description_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private org.a2aproject.sdk.compat03.grpc.OAuthFlows flows_; + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.OAuthFlows, org.a2aproject.sdk.compat03.grpc.OAuthFlows.Builder, org.a2aproject.sdk.compat03.grpc.OAuthFlowsOrBuilder> flowsBuilder_; + /** + *
+     * An object containing configuration information for the flow types supported
+     * 
+ * + * .a2a.v1.OAuthFlows flows = 2; + * @return Whether the flows field is set. + */ + public boolean hasFlows() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + *
+     * An object containing configuration information for the flow types supported
+     * 
+ * + * .a2a.v1.OAuthFlows flows = 2; + * @return The flows. + */ + public org.a2aproject.sdk.compat03.grpc.OAuthFlows getFlows() { + if (flowsBuilder_ == null) { + return flows_ == null ? org.a2aproject.sdk.compat03.grpc.OAuthFlows.getDefaultInstance() : flows_; + } else { + return flowsBuilder_.getMessage(); + } + } + /** + *
+     * An object containing configuration information for the flow types supported
+     * 
+ * + * .a2a.v1.OAuthFlows flows = 2; + */ + public Builder setFlows(org.a2aproject.sdk.compat03.grpc.OAuthFlows value) { + if (flowsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + flows_ = value; + } else { + flowsBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * An object containing configuration information for the flow types supported
+     * 
+ * + * .a2a.v1.OAuthFlows flows = 2; + */ + public Builder setFlows( + org.a2aproject.sdk.compat03.grpc.OAuthFlows.Builder builderForValue) { + if (flowsBuilder_ == null) { + flows_ = builderForValue.build(); + } else { + flowsBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * An object containing configuration information for the flow types supported
+     * 
+ * + * .a2a.v1.OAuthFlows flows = 2; + */ + public Builder mergeFlows(org.a2aproject.sdk.compat03.grpc.OAuthFlows value) { + if (flowsBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) && + flows_ != null && + flows_ != org.a2aproject.sdk.compat03.grpc.OAuthFlows.getDefaultInstance()) { + getFlowsBuilder().mergeFrom(value); + } else { + flows_ = value; + } + } else { + flowsBuilder_.mergeFrom(value); + } + if (flows_ != null) { + bitField0_ |= 0x00000002; + onChanged(); + } + return this; + } + /** + *
+     * An object containing configuration information for the flow types supported
+     * 
+ * + * .a2a.v1.OAuthFlows flows = 2; + */ + public Builder clearFlows() { + bitField0_ = (bitField0_ & ~0x00000002); + flows_ = null; + if (flowsBuilder_ != null) { + flowsBuilder_.dispose(); + flowsBuilder_ = null; + } + onChanged(); + return this; + } + /** + *
+     * An object containing configuration information for the flow types supported
+     * 
+ * + * .a2a.v1.OAuthFlows flows = 2; + */ + public org.a2aproject.sdk.compat03.grpc.OAuthFlows.Builder getFlowsBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return internalGetFlowsFieldBuilder().getBuilder(); + } + /** + *
+     * An object containing configuration information for the flow types supported
+     * 
+ * + * .a2a.v1.OAuthFlows flows = 2; + */ + public org.a2aproject.sdk.compat03.grpc.OAuthFlowsOrBuilder getFlowsOrBuilder() { + if (flowsBuilder_ != null) { + return flowsBuilder_.getMessageOrBuilder(); + } else { + return flows_ == null ? + org.a2aproject.sdk.compat03.grpc.OAuthFlows.getDefaultInstance() : flows_; + } + } + /** + *
+     * An object containing configuration information for the flow types supported
+     * 
+ * + * .a2a.v1.OAuthFlows flows = 2; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.OAuthFlows, org.a2aproject.sdk.compat03.grpc.OAuthFlows.Builder, org.a2aproject.sdk.compat03.grpc.OAuthFlowsOrBuilder> + internalGetFlowsFieldBuilder() { + if (flowsBuilder_ == null) { + flowsBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.OAuthFlows, org.a2aproject.sdk.compat03.grpc.OAuthFlows.Builder, org.a2aproject.sdk.compat03.grpc.OAuthFlowsOrBuilder>( + getFlows(), + getParentForChildren(), + isClean()); + flows_ = null; + } + return flowsBuilder_; + } + + private java.lang.Object oauth2MetadataUrl_ = ""; + /** + *
+     * URL to the oauth2 authorization server metadata
+     * [RFC8414](https://datatracker.ietf.org/doc/html/rfc8414). TLS is required.
+     * 
+ * + * string oauth2_metadata_url = 3; + * @return The oauth2MetadataUrl. + */ + public java.lang.String getOauth2MetadataUrl() { + java.lang.Object ref = oauth2MetadataUrl_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + oauth2MetadataUrl_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * URL to the oauth2 authorization server metadata
+     * [RFC8414](https://datatracker.ietf.org/doc/html/rfc8414). TLS is required.
+     * 
+ * + * string oauth2_metadata_url = 3; + * @return The bytes for oauth2MetadataUrl. + */ + public com.google.protobuf.ByteString + getOauth2MetadataUrlBytes() { + java.lang.Object ref = oauth2MetadataUrl_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + oauth2MetadataUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * URL to the oauth2 authorization server metadata
+     * [RFC8414](https://datatracker.ietf.org/doc/html/rfc8414). TLS is required.
+     * 
+ * + * string oauth2_metadata_url = 3; + * @param value The oauth2MetadataUrl to set. + * @return This builder for chaining. + */ + public Builder setOauth2MetadataUrl( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + oauth2MetadataUrl_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * URL to the oauth2 authorization server metadata
+     * [RFC8414](https://datatracker.ietf.org/doc/html/rfc8414). TLS is required.
+     * 
+ * + * string oauth2_metadata_url = 3; + * @return This builder for chaining. + */ + public Builder clearOauth2MetadataUrl() { + oauth2MetadataUrl_ = getDefaultInstance().getOauth2MetadataUrl(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + *
+     * URL to the oauth2 authorization server metadata
+     * [RFC8414](https://datatracker.ietf.org/doc/html/rfc8414). TLS is required.
+     * 
+ * + * string oauth2_metadata_url = 3; + * @param value The bytes for oauth2MetadataUrl to set. + * @return This builder for chaining. + */ + public Builder setOauth2MetadataUrlBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + oauth2MetadataUrl_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.OAuth2SecurityScheme) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.OAuth2SecurityScheme) + private static final org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme(); + } + + public static org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public OAuth2SecurityScheme parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/OAuth2SecuritySchemeOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/OAuth2SecuritySchemeOrBuilder.java new file mode 100644 index 000000000..5c70e7de2 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/OAuth2SecuritySchemeOrBuilder.java @@ -0,0 +1,81 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface OAuth2SecuritySchemeOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.OAuth2SecurityScheme) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Description of this security scheme.
+   * 
+ * + * string description = 1; + * @return The description. + */ + java.lang.String getDescription(); + /** + *
+   * Description of this security scheme.
+   * 
+ * + * string description = 1; + * @return The bytes for description. + */ + com.google.protobuf.ByteString + getDescriptionBytes(); + + /** + *
+   * An object containing configuration information for the flow types supported
+   * 
+ * + * .a2a.v1.OAuthFlows flows = 2; + * @return Whether the flows field is set. + */ + boolean hasFlows(); + /** + *
+   * An object containing configuration information for the flow types supported
+   * 
+ * + * .a2a.v1.OAuthFlows flows = 2; + * @return The flows. + */ + org.a2aproject.sdk.compat03.grpc.OAuthFlows getFlows(); + /** + *
+   * An object containing configuration information for the flow types supported
+   * 
+ * + * .a2a.v1.OAuthFlows flows = 2; + */ + org.a2aproject.sdk.compat03.grpc.OAuthFlowsOrBuilder getFlowsOrBuilder(); + + /** + *
+   * URL to the oauth2 authorization server metadata
+   * [RFC8414](https://datatracker.ietf.org/doc/html/rfc8414). TLS is required.
+   * 
+ * + * string oauth2_metadata_url = 3; + * @return The oauth2MetadataUrl. + */ + java.lang.String getOauth2MetadataUrl(); + /** + *
+   * URL to the oauth2 authorization server metadata
+   * [RFC8414](https://datatracker.ietf.org/doc/html/rfc8414). TLS is required.
+   * 
+ * + * string oauth2_metadata_url = 3; + * @return The bytes for oauth2MetadataUrl. + */ + com.google.protobuf.ByteString + getOauth2MetadataUrlBytes(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/OAuthFlows.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/OAuthFlows.java new file mode 100644 index 000000000..26061124c --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/OAuthFlows.java @@ -0,0 +1,1273 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.OAuthFlows} + */ +@com.google.protobuf.Generated +public final class OAuthFlows extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.OAuthFlows) + OAuthFlowsOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "OAuthFlows"); + } + // Use OAuthFlows.newBuilder() to construct. + private OAuthFlows(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private OAuthFlows() { + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_OAuthFlows_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_OAuthFlows_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.OAuthFlows.class, org.a2aproject.sdk.compat03.grpc.OAuthFlows.Builder.class); + } + + private int flowCase_ = 0; + @SuppressWarnings("serial") + private java.lang.Object flow_; + public enum FlowCase + implements com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + AUTHORIZATION_CODE(1), + CLIENT_CREDENTIALS(2), + IMPLICIT(3), + PASSWORD(4), + FLOW_NOT_SET(0); + private final int value; + private FlowCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static FlowCase valueOf(int value) { + return forNumber(value); + } + + public static FlowCase forNumber(int value) { + switch (value) { + case 1: return AUTHORIZATION_CODE; + case 2: return CLIENT_CREDENTIALS; + case 3: return IMPLICIT; + case 4: return PASSWORD; + case 0: return FLOW_NOT_SET; + default: return null; + } + } + public int getNumber() { + return this.value; + } + }; + + public FlowCase + getFlowCase() { + return FlowCase.forNumber( + flowCase_); + } + + public static final int AUTHORIZATION_CODE_FIELD_NUMBER = 1; + /** + * .a2a.v1.AuthorizationCodeOAuthFlow authorization_code = 1; + * @return Whether the authorizationCode field is set. + */ + @java.lang.Override + public boolean hasAuthorizationCode() { + return flowCase_ == 1; + } + /** + * .a2a.v1.AuthorizationCodeOAuthFlow authorization_code = 1; + * @return The authorizationCode. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow getAuthorizationCode() { + if (flowCase_ == 1) { + return (org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow) flow_; + } + return org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.getDefaultInstance(); + } + /** + * .a2a.v1.AuthorizationCodeOAuthFlow authorization_code = 1; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlowOrBuilder getAuthorizationCodeOrBuilder() { + if (flowCase_ == 1) { + return (org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow) flow_; + } + return org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.getDefaultInstance(); + } + + public static final int CLIENT_CREDENTIALS_FIELD_NUMBER = 2; + /** + * .a2a.v1.ClientCredentialsOAuthFlow client_credentials = 2; + * @return Whether the clientCredentials field is set. + */ + @java.lang.Override + public boolean hasClientCredentials() { + return flowCase_ == 2; + } + /** + * .a2a.v1.ClientCredentialsOAuthFlow client_credentials = 2; + * @return The clientCredentials. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow getClientCredentials() { + if (flowCase_ == 2) { + return (org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow) flow_; + } + return org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.getDefaultInstance(); + } + /** + * .a2a.v1.ClientCredentialsOAuthFlow client_credentials = 2; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlowOrBuilder getClientCredentialsOrBuilder() { + if (flowCase_ == 2) { + return (org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow) flow_; + } + return org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.getDefaultInstance(); + } + + public static final int IMPLICIT_FIELD_NUMBER = 3; + /** + * .a2a.v1.ImplicitOAuthFlow implicit = 3; + * @return Whether the implicit field is set. + */ + @java.lang.Override + public boolean hasImplicit() { + return flowCase_ == 3; + } + /** + * .a2a.v1.ImplicitOAuthFlow implicit = 3; + * @return The implicit. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow getImplicit() { + if (flowCase_ == 3) { + return (org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow) flow_; + } + return org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.getDefaultInstance(); + } + /** + * .a2a.v1.ImplicitOAuthFlow implicit = 3; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlowOrBuilder getImplicitOrBuilder() { + if (flowCase_ == 3) { + return (org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow) flow_; + } + return org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.getDefaultInstance(); + } + + public static final int PASSWORD_FIELD_NUMBER = 4; + /** + * .a2a.v1.PasswordOAuthFlow password = 4; + * @return Whether the password field is set. + */ + @java.lang.Override + public boolean hasPassword() { + return flowCase_ == 4; + } + /** + * .a2a.v1.PasswordOAuthFlow password = 4; + * @return The password. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow getPassword() { + if (flowCase_ == 4) { + return (org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow) flow_; + } + return org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.getDefaultInstance(); + } + /** + * .a2a.v1.PasswordOAuthFlow password = 4; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlowOrBuilder getPasswordOrBuilder() { + if (flowCase_ == 4) { + return (org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow) flow_; + } + return org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.getDefaultInstance(); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (flowCase_ == 1) { + output.writeMessage(1, (org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow) flow_); + } + if (flowCase_ == 2) { + output.writeMessage(2, (org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow) flow_); + } + if (flowCase_ == 3) { + output.writeMessage(3, (org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow) flow_); + } + if (flowCase_ == 4) { + output.writeMessage(4, (org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow) flow_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (flowCase_ == 1) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, (org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow) flow_); + } + if (flowCase_ == 2) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, (org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow) flow_); + } + if (flowCase_ == 3) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, (org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow) flow_); + } + if (flowCase_ == 4) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, (org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow) flow_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.OAuthFlows)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.OAuthFlows other = (org.a2aproject.sdk.compat03.grpc.OAuthFlows) obj; + + if (!getFlowCase().equals(other.getFlowCase())) return false; + switch (flowCase_) { + case 1: + if (!getAuthorizationCode() + .equals(other.getAuthorizationCode())) return false; + break; + case 2: + if (!getClientCredentials() + .equals(other.getClientCredentials())) return false; + break; + case 3: + if (!getImplicit() + .equals(other.getImplicit())) return false; + break; + case 4: + if (!getPassword() + .equals(other.getPassword())) return false; + break; + case 0: + default: + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + switch (flowCase_) { + case 1: + hash = (37 * hash) + AUTHORIZATION_CODE_FIELD_NUMBER; + hash = (53 * hash) + getAuthorizationCode().hashCode(); + break; + case 2: + hash = (37 * hash) + CLIENT_CREDENTIALS_FIELD_NUMBER; + hash = (53 * hash) + getClientCredentials().hashCode(); + break; + case 3: + hash = (37 * hash) + IMPLICIT_FIELD_NUMBER; + hash = (53 * hash) + getImplicit().hashCode(); + break; + case 4: + hash = (37 * hash) + PASSWORD_FIELD_NUMBER; + hash = (53 * hash) + getPassword().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.OAuthFlows parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.OAuthFlows parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.OAuthFlows parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.OAuthFlows parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.OAuthFlows parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.OAuthFlows parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.OAuthFlows parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.OAuthFlows parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.OAuthFlows parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.OAuthFlows parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.OAuthFlows parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.OAuthFlows parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.OAuthFlows prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.OAuthFlows} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.OAuthFlows) + org.a2aproject.sdk.compat03.grpc.OAuthFlowsOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_OAuthFlows_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_OAuthFlows_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.OAuthFlows.class, org.a2aproject.sdk.compat03.grpc.OAuthFlows.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.OAuthFlows.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + if (authorizationCodeBuilder_ != null) { + authorizationCodeBuilder_.clear(); + } + if (clientCredentialsBuilder_ != null) { + clientCredentialsBuilder_.clear(); + } + if (implicitBuilder_ != null) { + implicitBuilder_.clear(); + } + if (passwordBuilder_ != null) { + passwordBuilder_.clear(); + } + flowCase_ = 0; + flow_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_OAuthFlows_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OAuthFlows getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.OAuthFlows.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OAuthFlows build() { + org.a2aproject.sdk.compat03.grpc.OAuthFlows result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OAuthFlows buildPartial() { + org.a2aproject.sdk.compat03.grpc.OAuthFlows result = new org.a2aproject.sdk.compat03.grpc.OAuthFlows(this); + if (bitField0_ != 0) { buildPartial0(result); } + buildPartialOneofs(result); + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.OAuthFlows result) { + int from_bitField0_ = bitField0_; + } + + private void buildPartialOneofs(org.a2aproject.sdk.compat03.grpc.OAuthFlows result) { + result.flowCase_ = flowCase_; + result.flow_ = this.flow_; + if (flowCase_ == 1 && + authorizationCodeBuilder_ != null) { + result.flow_ = authorizationCodeBuilder_.build(); + } + if (flowCase_ == 2 && + clientCredentialsBuilder_ != null) { + result.flow_ = clientCredentialsBuilder_.build(); + } + if (flowCase_ == 3 && + implicitBuilder_ != null) { + result.flow_ = implicitBuilder_.build(); + } + if (flowCase_ == 4 && + passwordBuilder_ != null) { + result.flow_ = passwordBuilder_.build(); + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.OAuthFlows) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.OAuthFlows)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.OAuthFlows other) { + if (other == org.a2aproject.sdk.compat03.grpc.OAuthFlows.getDefaultInstance()) return this; + switch (other.getFlowCase()) { + case AUTHORIZATION_CODE: { + mergeAuthorizationCode(other.getAuthorizationCode()); + break; + } + case CLIENT_CREDENTIALS: { + mergeClientCredentials(other.getClientCredentials()); + break; + } + case IMPLICIT: { + mergeImplicit(other.getImplicit()); + break; + } + case PASSWORD: { + mergePassword(other.getPassword()); + break; + } + case FLOW_NOT_SET: { + break; + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + input.readMessage( + internalGetAuthorizationCodeFieldBuilder().getBuilder(), + extensionRegistry); + flowCase_ = 1; + break; + } // case 10 + case 18: { + input.readMessage( + internalGetClientCredentialsFieldBuilder().getBuilder(), + extensionRegistry); + flowCase_ = 2; + break; + } // case 18 + case 26: { + input.readMessage( + internalGetImplicitFieldBuilder().getBuilder(), + extensionRegistry); + flowCase_ = 3; + break; + } // case 26 + case 34: { + input.readMessage( + internalGetPasswordFieldBuilder().getBuilder(), + extensionRegistry); + flowCase_ = 4; + break; + } // case 34 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int flowCase_ = 0; + private java.lang.Object flow_; + public FlowCase + getFlowCase() { + return FlowCase.forNumber( + flowCase_); + } + + public Builder clearFlow() { + flowCase_ = 0; + flow_ = null; + onChanged(); + return this; + } + + private int bitField0_; + + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow, org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.Builder, org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlowOrBuilder> authorizationCodeBuilder_; + /** + * .a2a.v1.AuthorizationCodeOAuthFlow authorization_code = 1; + * @return Whether the authorizationCode field is set. + */ + @java.lang.Override + public boolean hasAuthorizationCode() { + return flowCase_ == 1; + } + /** + * .a2a.v1.AuthorizationCodeOAuthFlow authorization_code = 1; + * @return The authorizationCode. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow getAuthorizationCode() { + if (authorizationCodeBuilder_ == null) { + if (flowCase_ == 1) { + return (org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow) flow_; + } + return org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.getDefaultInstance(); + } else { + if (flowCase_ == 1) { + return authorizationCodeBuilder_.getMessage(); + } + return org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.getDefaultInstance(); + } + } + /** + * .a2a.v1.AuthorizationCodeOAuthFlow authorization_code = 1; + */ + public Builder setAuthorizationCode(org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow value) { + if (authorizationCodeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + flow_ = value; + onChanged(); + } else { + authorizationCodeBuilder_.setMessage(value); + } + flowCase_ = 1; + return this; + } + /** + * .a2a.v1.AuthorizationCodeOAuthFlow authorization_code = 1; + */ + public Builder setAuthorizationCode( + org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.Builder builderForValue) { + if (authorizationCodeBuilder_ == null) { + flow_ = builderForValue.build(); + onChanged(); + } else { + authorizationCodeBuilder_.setMessage(builderForValue.build()); + } + flowCase_ = 1; + return this; + } + /** + * .a2a.v1.AuthorizationCodeOAuthFlow authorization_code = 1; + */ + public Builder mergeAuthorizationCode(org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow value) { + if (authorizationCodeBuilder_ == null) { + if (flowCase_ == 1 && + flow_ != org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.getDefaultInstance()) { + flow_ = org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.newBuilder((org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow) flow_) + .mergeFrom(value).buildPartial(); + } else { + flow_ = value; + } + onChanged(); + } else { + if (flowCase_ == 1) { + authorizationCodeBuilder_.mergeFrom(value); + } else { + authorizationCodeBuilder_.setMessage(value); + } + } + flowCase_ = 1; + return this; + } + /** + * .a2a.v1.AuthorizationCodeOAuthFlow authorization_code = 1; + */ + public Builder clearAuthorizationCode() { + if (authorizationCodeBuilder_ == null) { + if (flowCase_ == 1) { + flowCase_ = 0; + flow_ = null; + onChanged(); + } + } else { + if (flowCase_ == 1) { + flowCase_ = 0; + flow_ = null; + } + authorizationCodeBuilder_.clear(); + } + return this; + } + /** + * .a2a.v1.AuthorizationCodeOAuthFlow authorization_code = 1; + */ + public org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.Builder getAuthorizationCodeBuilder() { + return internalGetAuthorizationCodeFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.AuthorizationCodeOAuthFlow authorization_code = 1; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlowOrBuilder getAuthorizationCodeOrBuilder() { + if ((flowCase_ == 1) && (authorizationCodeBuilder_ != null)) { + return authorizationCodeBuilder_.getMessageOrBuilder(); + } else { + if (flowCase_ == 1) { + return (org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow) flow_; + } + return org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.getDefaultInstance(); + } + } + /** + * .a2a.v1.AuthorizationCodeOAuthFlow authorization_code = 1; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow, org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.Builder, org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlowOrBuilder> + internalGetAuthorizationCodeFieldBuilder() { + if (authorizationCodeBuilder_ == null) { + if (!(flowCase_ == 1)) { + flow_ = org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.getDefaultInstance(); + } + authorizationCodeBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow, org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.Builder, org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlowOrBuilder>( + (org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow) flow_, + getParentForChildren(), + isClean()); + flow_ = null; + } + flowCase_ = 1; + onChanged(); + return authorizationCodeBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow, org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.Builder, org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlowOrBuilder> clientCredentialsBuilder_; + /** + * .a2a.v1.ClientCredentialsOAuthFlow client_credentials = 2; + * @return Whether the clientCredentials field is set. + */ + @java.lang.Override + public boolean hasClientCredentials() { + return flowCase_ == 2; + } + /** + * .a2a.v1.ClientCredentialsOAuthFlow client_credentials = 2; + * @return The clientCredentials. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow getClientCredentials() { + if (clientCredentialsBuilder_ == null) { + if (flowCase_ == 2) { + return (org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow) flow_; + } + return org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.getDefaultInstance(); + } else { + if (flowCase_ == 2) { + return clientCredentialsBuilder_.getMessage(); + } + return org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.getDefaultInstance(); + } + } + /** + * .a2a.v1.ClientCredentialsOAuthFlow client_credentials = 2; + */ + public Builder setClientCredentials(org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow value) { + if (clientCredentialsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + flow_ = value; + onChanged(); + } else { + clientCredentialsBuilder_.setMessage(value); + } + flowCase_ = 2; + return this; + } + /** + * .a2a.v1.ClientCredentialsOAuthFlow client_credentials = 2; + */ + public Builder setClientCredentials( + org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.Builder builderForValue) { + if (clientCredentialsBuilder_ == null) { + flow_ = builderForValue.build(); + onChanged(); + } else { + clientCredentialsBuilder_.setMessage(builderForValue.build()); + } + flowCase_ = 2; + return this; + } + /** + * .a2a.v1.ClientCredentialsOAuthFlow client_credentials = 2; + */ + public Builder mergeClientCredentials(org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow value) { + if (clientCredentialsBuilder_ == null) { + if (flowCase_ == 2 && + flow_ != org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.getDefaultInstance()) { + flow_ = org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.newBuilder((org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow) flow_) + .mergeFrom(value).buildPartial(); + } else { + flow_ = value; + } + onChanged(); + } else { + if (flowCase_ == 2) { + clientCredentialsBuilder_.mergeFrom(value); + } else { + clientCredentialsBuilder_.setMessage(value); + } + } + flowCase_ = 2; + return this; + } + /** + * .a2a.v1.ClientCredentialsOAuthFlow client_credentials = 2; + */ + public Builder clearClientCredentials() { + if (clientCredentialsBuilder_ == null) { + if (flowCase_ == 2) { + flowCase_ = 0; + flow_ = null; + onChanged(); + } + } else { + if (flowCase_ == 2) { + flowCase_ = 0; + flow_ = null; + } + clientCredentialsBuilder_.clear(); + } + return this; + } + /** + * .a2a.v1.ClientCredentialsOAuthFlow client_credentials = 2; + */ + public org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.Builder getClientCredentialsBuilder() { + return internalGetClientCredentialsFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.ClientCredentialsOAuthFlow client_credentials = 2; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlowOrBuilder getClientCredentialsOrBuilder() { + if ((flowCase_ == 2) && (clientCredentialsBuilder_ != null)) { + return clientCredentialsBuilder_.getMessageOrBuilder(); + } else { + if (flowCase_ == 2) { + return (org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow) flow_; + } + return org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.getDefaultInstance(); + } + } + /** + * .a2a.v1.ClientCredentialsOAuthFlow client_credentials = 2; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow, org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.Builder, org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlowOrBuilder> + internalGetClientCredentialsFieldBuilder() { + if (clientCredentialsBuilder_ == null) { + if (!(flowCase_ == 2)) { + flow_ = org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.getDefaultInstance(); + } + clientCredentialsBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow, org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.Builder, org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlowOrBuilder>( + (org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow) flow_, + getParentForChildren(), + isClean()); + flow_ = null; + } + flowCase_ = 2; + onChanged(); + return clientCredentialsBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow, org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.Builder, org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlowOrBuilder> implicitBuilder_; + /** + * .a2a.v1.ImplicitOAuthFlow implicit = 3; + * @return Whether the implicit field is set. + */ + @java.lang.Override + public boolean hasImplicit() { + return flowCase_ == 3; + } + /** + * .a2a.v1.ImplicitOAuthFlow implicit = 3; + * @return The implicit. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow getImplicit() { + if (implicitBuilder_ == null) { + if (flowCase_ == 3) { + return (org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow) flow_; + } + return org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.getDefaultInstance(); + } else { + if (flowCase_ == 3) { + return implicitBuilder_.getMessage(); + } + return org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.getDefaultInstance(); + } + } + /** + * .a2a.v1.ImplicitOAuthFlow implicit = 3; + */ + public Builder setImplicit(org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow value) { + if (implicitBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + flow_ = value; + onChanged(); + } else { + implicitBuilder_.setMessage(value); + } + flowCase_ = 3; + return this; + } + /** + * .a2a.v1.ImplicitOAuthFlow implicit = 3; + */ + public Builder setImplicit( + org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.Builder builderForValue) { + if (implicitBuilder_ == null) { + flow_ = builderForValue.build(); + onChanged(); + } else { + implicitBuilder_.setMessage(builderForValue.build()); + } + flowCase_ = 3; + return this; + } + /** + * .a2a.v1.ImplicitOAuthFlow implicit = 3; + */ + public Builder mergeImplicit(org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow value) { + if (implicitBuilder_ == null) { + if (flowCase_ == 3 && + flow_ != org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.getDefaultInstance()) { + flow_ = org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.newBuilder((org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow) flow_) + .mergeFrom(value).buildPartial(); + } else { + flow_ = value; + } + onChanged(); + } else { + if (flowCase_ == 3) { + implicitBuilder_.mergeFrom(value); + } else { + implicitBuilder_.setMessage(value); + } + } + flowCase_ = 3; + return this; + } + /** + * .a2a.v1.ImplicitOAuthFlow implicit = 3; + */ + public Builder clearImplicit() { + if (implicitBuilder_ == null) { + if (flowCase_ == 3) { + flowCase_ = 0; + flow_ = null; + onChanged(); + } + } else { + if (flowCase_ == 3) { + flowCase_ = 0; + flow_ = null; + } + implicitBuilder_.clear(); + } + return this; + } + /** + * .a2a.v1.ImplicitOAuthFlow implicit = 3; + */ + public org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.Builder getImplicitBuilder() { + return internalGetImplicitFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.ImplicitOAuthFlow implicit = 3; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlowOrBuilder getImplicitOrBuilder() { + if ((flowCase_ == 3) && (implicitBuilder_ != null)) { + return implicitBuilder_.getMessageOrBuilder(); + } else { + if (flowCase_ == 3) { + return (org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow) flow_; + } + return org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.getDefaultInstance(); + } + } + /** + * .a2a.v1.ImplicitOAuthFlow implicit = 3; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow, org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.Builder, org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlowOrBuilder> + internalGetImplicitFieldBuilder() { + if (implicitBuilder_ == null) { + if (!(flowCase_ == 3)) { + flow_ = org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.getDefaultInstance(); + } + implicitBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow, org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.Builder, org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlowOrBuilder>( + (org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow) flow_, + getParentForChildren(), + isClean()); + flow_ = null; + } + flowCase_ = 3; + onChanged(); + return implicitBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow, org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.Builder, org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlowOrBuilder> passwordBuilder_; + /** + * .a2a.v1.PasswordOAuthFlow password = 4; + * @return Whether the password field is set. + */ + @java.lang.Override + public boolean hasPassword() { + return flowCase_ == 4; + } + /** + * .a2a.v1.PasswordOAuthFlow password = 4; + * @return The password. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow getPassword() { + if (passwordBuilder_ == null) { + if (flowCase_ == 4) { + return (org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow) flow_; + } + return org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.getDefaultInstance(); + } else { + if (flowCase_ == 4) { + return passwordBuilder_.getMessage(); + } + return org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.getDefaultInstance(); + } + } + /** + * .a2a.v1.PasswordOAuthFlow password = 4; + */ + public Builder setPassword(org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow value) { + if (passwordBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + flow_ = value; + onChanged(); + } else { + passwordBuilder_.setMessage(value); + } + flowCase_ = 4; + return this; + } + /** + * .a2a.v1.PasswordOAuthFlow password = 4; + */ + public Builder setPassword( + org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.Builder builderForValue) { + if (passwordBuilder_ == null) { + flow_ = builderForValue.build(); + onChanged(); + } else { + passwordBuilder_.setMessage(builderForValue.build()); + } + flowCase_ = 4; + return this; + } + /** + * .a2a.v1.PasswordOAuthFlow password = 4; + */ + public Builder mergePassword(org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow value) { + if (passwordBuilder_ == null) { + if (flowCase_ == 4 && + flow_ != org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.getDefaultInstance()) { + flow_ = org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.newBuilder((org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow) flow_) + .mergeFrom(value).buildPartial(); + } else { + flow_ = value; + } + onChanged(); + } else { + if (flowCase_ == 4) { + passwordBuilder_.mergeFrom(value); + } else { + passwordBuilder_.setMessage(value); + } + } + flowCase_ = 4; + return this; + } + /** + * .a2a.v1.PasswordOAuthFlow password = 4; + */ + public Builder clearPassword() { + if (passwordBuilder_ == null) { + if (flowCase_ == 4) { + flowCase_ = 0; + flow_ = null; + onChanged(); + } + } else { + if (flowCase_ == 4) { + flowCase_ = 0; + flow_ = null; + } + passwordBuilder_.clear(); + } + return this; + } + /** + * .a2a.v1.PasswordOAuthFlow password = 4; + */ + public org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.Builder getPasswordBuilder() { + return internalGetPasswordFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.PasswordOAuthFlow password = 4; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlowOrBuilder getPasswordOrBuilder() { + if ((flowCase_ == 4) && (passwordBuilder_ != null)) { + return passwordBuilder_.getMessageOrBuilder(); + } else { + if (flowCase_ == 4) { + return (org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow) flow_; + } + return org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.getDefaultInstance(); + } + } + /** + * .a2a.v1.PasswordOAuthFlow password = 4; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow, org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.Builder, org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlowOrBuilder> + internalGetPasswordFieldBuilder() { + if (passwordBuilder_ == null) { + if (!(flowCase_ == 4)) { + flow_ = org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.getDefaultInstance(); + } + passwordBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow, org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.Builder, org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlowOrBuilder>( + (org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow) flow_, + getParentForChildren(), + isClean()); + flow_ = null; + } + flowCase_ = 4; + onChanged(); + return passwordBuilder_; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.OAuthFlows) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.OAuthFlows) + private static final org.a2aproject.sdk.compat03.grpc.OAuthFlows DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.OAuthFlows(); + } + + public static org.a2aproject.sdk.compat03.grpc.OAuthFlows getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public OAuthFlows parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OAuthFlows getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/OAuthFlowsOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/OAuthFlowsOrBuilder.java new file mode 100644 index 000000000..1e14dbf55 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/OAuthFlowsOrBuilder.java @@ -0,0 +1,74 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface OAuthFlowsOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.OAuthFlows) + com.google.protobuf.MessageOrBuilder { + + /** + * .a2a.v1.AuthorizationCodeOAuthFlow authorization_code = 1; + * @return Whether the authorizationCode field is set. + */ + boolean hasAuthorizationCode(); + /** + * .a2a.v1.AuthorizationCodeOAuthFlow authorization_code = 1; + * @return The authorizationCode. + */ + org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow getAuthorizationCode(); + /** + * .a2a.v1.AuthorizationCodeOAuthFlow authorization_code = 1; + */ + org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlowOrBuilder getAuthorizationCodeOrBuilder(); + + /** + * .a2a.v1.ClientCredentialsOAuthFlow client_credentials = 2; + * @return Whether the clientCredentials field is set. + */ + boolean hasClientCredentials(); + /** + * .a2a.v1.ClientCredentialsOAuthFlow client_credentials = 2; + * @return The clientCredentials. + */ + org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow getClientCredentials(); + /** + * .a2a.v1.ClientCredentialsOAuthFlow client_credentials = 2; + */ + org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlowOrBuilder getClientCredentialsOrBuilder(); + + /** + * .a2a.v1.ImplicitOAuthFlow implicit = 3; + * @return Whether the implicit field is set. + */ + boolean hasImplicit(); + /** + * .a2a.v1.ImplicitOAuthFlow implicit = 3; + * @return The implicit. + */ + org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow getImplicit(); + /** + * .a2a.v1.ImplicitOAuthFlow implicit = 3; + */ + org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlowOrBuilder getImplicitOrBuilder(); + + /** + * .a2a.v1.PasswordOAuthFlow password = 4; + * @return Whether the password field is set. + */ + boolean hasPassword(); + /** + * .a2a.v1.PasswordOAuthFlow password = 4; + * @return The password. + */ + org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow getPassword(); + /** + * .a2a.v1.PasswordOAuthFlow password = 4; + */ + org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlowOrBuilder getPasswordOrBuilder(); + + org.a2aproject.sdk.compat03.grpc.OAuthFlows.FlowCase getFlowCase(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/OpenIdConnectSecurityScheme.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/OpenIdConnectSecurityScheme.java new file mode 100644 index 000000000..ff9ff9559 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/OpenIdConnectSecurityScheme.java @@ -0,0 +1,701 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.OpenIdConnectSecurityScheme} + */ +@com.google.protobuf.Generated +public final class OpenIdConnectSecurityScheme extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.OpenIdConnectSecurityScheme) + OpenIdConnectSecuritySchemeOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "OpenIdConnectSecurityScheme"); + } + // Use OpenIdConnectSecurityScheme.newBuilder() to construct. + private OpenIdConnectSecurityScheme(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private OpenIdConnectSecurityScheme() { + description_ = ""; + openIdConnectUrl_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_OpenIdConnectSecurityScheme_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_OpenIdConnectSecurityScheme_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.class, org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.Builder.class); + } + + public static final int DESCRIPTION_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object description_ = ""; + /** + *
+   * Description of this security scheme.
+   * 
+ * + * string description = 1; + * @return The description. + */ + @java.lang.Override + public java.lang.String getDescription() { + java.lang.Object ref = description_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + description_ = s; + return s; + } + } + /** + *
+   * Description of this security scheme.
+   * 
+ * + * string description = 1; + * @return The bytes for description. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int OPEN_ID_CONNECT_URL_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object openIdConnectUrl_ = ""; + /** + *
+   * Well-known URL to discover the [[OpenID-Connect-Discovery]] provider
+   * metadata.
+   * 
+ * + * string open_id_connect_url = 2; + * @return The openIdConnectUrl. + */ + @java.lang.Override + public java.lang.String getOpenIdConnectUrl() { + java.lang.Object ref = openIdConnectUrl_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + openIdConnectUrl_ = s; + return s; + } + } + /** + *
+   * Well-known URL to discover the [[OpenID-Connect-Discovery]] provider
+   * metadata.
+   * 
+ * + * string open_id_connect_url = 2; + * @return The bytes for openIdConnectUrl. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getOpenIdConnectUrlBytes() { + java.lang.Object ref = openIdConnectUrl_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + openIdConnectUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(description_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, description_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(openIdConnectUrl_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, openIdConnectUrl_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(description_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, description_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(openIdConnectUrl_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, openIdConnectUrl_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme other = (org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme) obj; + + if (!getDescription() + .equals(other.getDescription())) return false; + if (!getOpenIdConnectUrl() + .equals(other.getOpenIdConnectUrl())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + DESCRIPTION_FIELD_NUMBER; + hash = (53 * hash) + getDescription().hashCode(); + hash = (37 * hash) + OPEN_ID_CONNECT_URL_FIELD_NUMBER; + hash = (53 * hash) + getOpenIdConnectUrl().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.OpenIdConnectSecurityScheme} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.OpenIdConnectSecurityScheme) + org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecuritySchemeOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_OpenIdConnectSecurityScheme_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_OpenIdConnectSecurityScheme_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.class, org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + description_ = ""; + openIdConnectUrl_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_OpenIdConnectSecurityScheme_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme build() { + org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme buildPartial() { + org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme result = new org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.description_ = description_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.openIdConnectUrl_ = openIdConnectUrl_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme other) { + if (other == org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.getDefaultInstance()) return this; + if (!other.getDescription().isEmpty()) { + description_ = other.description_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getOpenIdConnectUrl().isEmpty()) { + openIdConnectUrl_ = other.openIdConnectUrl_; + bitField0_ |= 0x00000002; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + description_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + openIdConnectUrl_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object description_ = ""; + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @return The description. + */ + public java.lang.String getDescription() { + java.lang.Object ref = description_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + description_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @return The bytes for description. + */ + public com.google.protobuf.ByteString + getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @param value The description to set. + * @return This builder for chaining. + */ + public Builder setDescription( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + description_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @return This builder for chaining. + */ + public Builder clearDescription() { + description_ = getDefaultInstance().getDescription(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @param value The bytes for description to set. + * @return This builder for chaining. + */ + public Builder setDescriptionBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + description_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object openIdConnectUrl_ = ""; + /** + *
+     * Well-known URL to discover the [[OpenID-Connect-Discovery]] provider
+     * metadata.
+     * 
+ * + * string open_id_connect_url = 2; + * @return The openIdConnectUrl. + */ + public java.lang.String getOpenIdConnectUrl() { + java.lang.Object ref = openIdConnectUrl_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + openIdConnectUrl_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Well-known URL to discover the [[OpenID-Connect-Discovery]] provider
+     * metadata.
+     * 
+ * + * string open_id_connect_url = 2; + * @return The bytes for openIdConnectUrl. + */ + public com.google.protobuf.ByteString + getOpenIdConnectUrlBytes() { + java.lang.Object ref = openIdConnectUrl_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + openIdConnectUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Well-known URL to discover the [[OpenID-Connect-Discovery]] provider
+     * metadata.
+     * 
+ * + * string open_id_connect_url = 2; + * @param value The openIdConnectUrl to set. + * @return This builder for chaining. + */ + public Builder setOpenIdConnectUrl( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + openIdConnectUrl_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * Well-known URL to discover the [[OpenID-Connect-Discovery]] provider
+     * metadata.
+     * 
+ * + * string open_id_connect_url = 2; + * @return This builder for chaining. + */ + public Builder clearOpenIdConnectUrl() { + openIdConnectUrl_ = getDefaultInstance().getOpenIdConnectUrl(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * Well-known URL to discover the [[OpenID-Connect-Discovery]] provider
+     * metadata.
+     * 
+ * + * string open_id_connect_url = 2; + * @param value The bytes for openIdConnectUrl to set. + * @return This builder for chaining. + */ + public Builder setOpenIdConnectUrlBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + openIdConnectUrl_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.OpenIdConnectSecurityScheme) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.OpenIdConnectSecurityScheme) + private static final org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme(); + } + + public static org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public OpenIdConnectSecurityScheme parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/OpenIdConnectSecuritySchemeOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/OpenIdConnectSecuritySchemeOrBuilder.java new file mode 100644 index 000000000..1f9237cad --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/OpenIdConnectSecuritySchemeOrBuilder.java @@ -0,0 +1,54 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface OpenIdConnectSecuritySchemeOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.OpenIdConnectSecurityScheme) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Description of this security scheme.
+   * 
+ * + * string description = 1; + * @return The description. + */ + java.lang.String getDescription(); + /** + *
+   * Description of this security scheme.
+   * 
+ * + * string description = 1; + * @return The bytes for description. + */ + com.google.protobuf.ByteString + getDescriptionBytes(); + + /** + *
+   * Well-known URL to discover the [[OpenID-Connect-Discovery]] provider
+   * metadata.
+   * 
+ * + * string open_id_connect_url = 2; + * @return The openIdConnectUrl. + */ + java.lang.String getOpenIdConnectUrl(); + /** + *
+   * Well-known URL to discover the [[OpenID-Connect-Discovery]] provider
+   * metadata.
+   * 
+ * + * string open_id_connect_url = 2; + * @return The bytes for openIdConnectUrl. + */ + com.google.protobuf.ByteString + getOpenIdConnectUrlBytes(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/Part.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/Part.java new file mode 100644 index 000000000..fc1133039 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/Part.java @@ -0,0 +1,1042 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * Part represents a container for a section of communication content.
+ * Parts can be purely textual, some sort of file (image, video, etc) or
+ * a structured data blob (i.e. JSON).
+ * 
+ * + * Protobuf type {@code a2a.v1.Part} + */ +@com.google.protobuf.Generated +public final class Part extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.Part) + PartOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "Part"); + } + // Use Part.newBuilder() to construct. + private Part(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private Part() { + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_Part_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_Part_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.Part.class, org.a2aproject.sdk.compat03.grpc.Part.Builder.class); + } + + private int partCase_ = 0; + @SuppressWarnings("serial") + private java.lang.Object part_; + public enum PartCase + implements com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + TEXT(1), + FILE(2), + DATA(3), + PART_NOT_SET(0); + private final int value; + private PartCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static PartCase valueOf(int value) { + return forNumber(value); + } + + public static PartCase forNumber(int value) { + switch (value) { + case 1: return TEXT; + case 2: return FILE; + case 3: return DATA; + case 0: return PART_NOT_SET; + default: return null; + } + } + public int getNumber() { + return this.value; + } + }; + + public PartCase + getPartCase() { + return PartCase.forNumber( + partCase_); + } + + public static final int TEXT_FIELD_NUMBER = 1; + /** + * string text = 1; + * @return Whether the text field is set. + */ + public boolean hasText() { + return partCase_ == 1; + } + /** + * string text = 1; + * @return The text. + */ + public java.lang.String getText() { + java.lang.Object ref = ""; + if (partCase_ == 1) { + ref = part_; + } + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (partCase_ == 1) { + part_ = s; + } + return s; + } + } + /** + * string text = 1; + * @return The bytes for text. + */ + public com.google.protobuf.ByteString + getTextBytes() { + java.lang.Object ref = ""; + if (partCase_ == 1) { + ref = part_; + } + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + if (partCase_ == 1) { + part_ = b; + } + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int FILE_FIELD_NUMBER = 2; + /** + * .a2a.v1.FilePart file = 2; + * @return Whether the file field is set. + */ + @java.lang.Override + public boolean hasFile() { + return partCase_ == 2; + } + /** + * .a2a.v1.FilePart file = 2; + * @return The file. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.FilePart getFile() { + if (partCase_ == 2) { + return (org.a2aproject.sdk.compat03.grpc.FilePart) part_; + } + return org.a2aproject.sdk.compat03.grpc.FilePart.getDefaultInstance(); + } + /** + * .a2a.v1.FilePart file = 2; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.FilePartOrBuilder getFileOrBuilder() { + if (partCase_ == 2) { + return (org.a2aproject.sdk.compat03.grpc.FilePart) part_; + } + return org.a2aproject.sdk.compat03.grpc.FilePart.getDefaultInstance(); + } + + public static final int DATA_FIELD_NUMBER = 3; + /** + * .a2a.v1.DataPart data = 3; + * @return Whether the data field is set. + */ + @java.lang.Override + public boolean hasData() { + return partCase_ == 3; + } + /** + * .a2a.v1.DataPart data = 3; + * @return The data. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.DataPart getData() { + if (partCase_ == 3) { + return (org.a2aproject.sdk.compat03.grpc.DataPart) part_; + } + return org.a2aproject.sdk.compat03.grpc.DataPart.getDefaultInstance(); + } + /** + * .a2a.v1.DataPart data = 3; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.DataPartOrBuilder getDataOrBuilder() { + if (partCase_ == 3) { + return (org.a2aproject.sdk.compat03.grpc.DataPart) part_; + } + return org.a2aproject.sdk.compat03.grpc.DataPart.getDefaultInstance(); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (partCase_ == 1) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, part_); + } + if (partCase_ == 2) { + output.writeMessage(2, (org.a2aproject.sdk.compat03.grpc.FilePart) part_); + } + if (partCase_ == 3) { + output.writeMessage(3, (org.a2aproject.sdk.compat03.grpc.DataPart) part_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (partCase_ == 1) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, part_); + } + if (partCase_ == 2) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, (org.a2aproject.sdk.compat03.grpc.FilePart) part_); + } + if (partCase_ == 3) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, (org.a2aproject.sdk.compat03.grpc.DataPart) part_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.Part)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.Part other = (org.a2aproject.sdk.compat03.grpc.Part) obj; + + if (!getPartCase().equals(other.getPartCase())) return false; + switch (partCase_) { + case 1: + if (!getText() + .equals(other.getText())) return false; + break; + case 2: + if (!getFile() + .equals(other.getFile())) return false; + break; + case 3: + if (!getData() + .equals(other.getData())) return false; + break; + case 0: + default: + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + switch (partCase_) { + case 1: + hash = (37 * hash) + TEXT_FIELD_NUMBER; + hash = (53 * hash) + getText().hashCode(); + break; + case 2: + hash = (37 * hash) + FILE_FIELD_NUMBER; + hash = (53 * hash) + getFile().hashCode(); + break; + case 3: + hash = (37 * hash) + DATA_FIELD_NUMBER; + hash = (53 * hash) + getData().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.Part parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.Part parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.Part parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.Part parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.Part parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.Part parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.Part parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.Part parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.Part parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.Part parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.Part parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.Part parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.Part prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * Part represents a container for a section of communication content.
+   * Parts can be purely textual, some sort of file (image, video, etc) or
+   * a structured data blob (i.e. JSON).
+   * 
+ * + * Protobuf type {@code a2a.v1.Part} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.Part) + org.a2aproject.sdk.compat03.grpc.PartOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_Part_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_Part_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.Part.class, org.a2aproject.sdk.compat03.grpc.Part.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.Part.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + if (fileBuilder_ != null) { + fileBuilder_.clear(); + } + if (dataBuilder_ != null) { + dataBuilder_.clear(); + } + partCase_ = 0; + part_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_Part_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Part getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.Part.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Part build() { + org.a2aproject.sdk.compat03.grpc.Part result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Part buildPartial() { + org.a2aproject.sdk.compat03.grpc.Part result = new org.a2aproject.sdk.compat03.grpc.Part(this); + if (bitField0_ != 0) { buildPartial0(result); } + buildPartialOneofs(result); + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.Part result) { + int from_bitField0_ = bitField0_; + } + + private void buildPartialOneofs(org.a2aproject.sdk.compat03.grpc.Part result) { + result.partCase_ = partCase_; + result.part_ = this.part_; + if (partCase_ == 2 && + fileBuilder_ != null) { + result.part_ = fileBuilder_.build(); + } + if (partCase_ == 3 && + dataBuilder_ != null) { + result.part_ = dataBuilder_.build(); + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.Part) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.Part)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.Part other) { + if (other == org.a2aproject.sdk.compat03.grpc.Part.getDefaultInstance()) return this; + switch (other.getPartCase()) { + case TEXT: { + partCase_ = 1; + part_ = other.part_; + onChanged(); + break; + } + case FILE: { + mergeFile(other.getFile()); + break; + } + case DATA: { + mergeData(other.getData()); + break; + } + case PART_NOT_SET: { + break; + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + partCase_ = 1; + part_ = s; + break; + } // case 10 + case 18: { + input.readMessage( + internalGetFileFieldBuilder().getBuilder(), + extensionRegistry); + partCase_ = 2; + break; + } // case 18 + case 26: { + input.readMessage( + internalGetDataFieldBuilder().getBuilder(), + extensionRegistry); + partCase_ = 3; + break; + } // case 26 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int partCase_ = 0; + private java.lang.Object part_; + public PartCase + getPartCase() { + return PartCase.forNumber( + partCase_); + } + + public Builder clearPart() { + partCase_ = 0; + part_ = null; + onChanged(); + return this; + } + + private int bitField0_; + + /** + * string text = 1; + * @return Whether the text field is set. + */ + @java.lang.Override + public boolean hasText() { + return partCase_ == 1; + } + /** + * string text = 1; + * @return The text. + */ + @java.lang.Override + public java.lang.String getText() { + java.lang.Object ref = ""; + if (partCase_ == 1) { + ref = part_; + } + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (partCase_ == 1) { + part_ = s; + } + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string text = 1; + * @return The bytes for text. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getTextBytes() { + java.lang.Object ref = ""; + if (partCase_ == 1) { + ref = part_; + } + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + if (partCase_ == 1) { + part_ = b; + } + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string text = 1; + * @param value The text to set. + * @return This builder for chaining. + */ + public Builder setText( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + partCase_ = 1; + part_ = value; + onChanged(); + return this; + } + /** + * string text = 1; + * @return This builder for chaining. + */ + public Builder clearText() { + if (partCase_ == 1) { + partCase_ = 0; + part_ = null; + onChanged(); + } + return this; + } + /** + * string text = 1; + * @param value The bytes for text to set. + * @return This builder for chaining. + */ + public Builder setTextBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + partCase_ = 1; + part_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.FilePart, org.a2aproject.sdk.compat03.grpc.FilePart.Builder, org.a2aproject.sdk.compat03.grpc.FilePartOrBuilder> fileBuilder_; + /** + * .a2a.v1.FilePart file = 2; + * @return Whether the file field is set. + */ + @java.lang.Override + public boolean hasFile() { + return partCase_ == 2; + } + /** + * .a2a.v1.FilePart file = 2; + * @return The file. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.FilePart getFile() { + if (fileBuilder_ == null) { + if (partCase_ == 2) { + return (org.a2aproject.sdk.compat03.grpc.FilePart) part_; + } + return org.a2aproject.sdk.compat03.grpc.FilePart.getDefaultInstance(); + } else { + if (partCase_ == 2) { + return fileBuilder_.getMessage(); + } + return org.a2aproject.sdk.compat03.grpc.FilePart.getDefaultInstance(); + } + } + /** + * .a2a.v1.FilePart file = 2; + */ + public Builder setFile(org.a2aproject.sdk.compat03.grpc.FilePart value) { + if (fileBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + part_ = value; + onChanged(); + } else { + fileBuilder_.setMessage(value); + } + partCase_ = 2; + return this; + } + /** + * .a2a.v1.FilePart file = 2; + */ + public Builder setFile( + org.a2aproject.sdk.compat03.grpc.FilePart.Builder builderForValue) { + if (fileBuilder_ == null) { + part_ = builderForValue.build(); + onChanged(); + } else { + fileBuilder_.setMessage(builderForValue.build()); + } + partCase_ = 2; + return this; + } + /** + * .a2a.v1.FilePart file = 2; + */ + public Builder mergeFile(org.a2aproject.sdk.compat03.grpc.FilePart value) { + if (fileBuilder_ == null) { + if (partCase_ == 2 && + part_ != org.a2aproject.sdk.compat03.grpc.FilePart.getDefaultInstance()) { + part_ = org.a2aproject.sdk.compat03.grpc.FilePart.newBuilder((org.a2aproject.sdk.compat03.grpc.FilePart) part_) + .mergeFrom(value).buildPartial(); + } else { + part_ = value; + } + onChanged(); + } else { + if (partCase_ == 2) { + fileBuilder_.mergeFrom(value); + } else { + fileBuilder_.setMessage(value); + } + } + partCase_ = 2; + return this; + } + /** + * .a2a.v1.FilePart file = 2; + */ + public Builder clearFile() { + if (fileBuilder_ == null) { + if (partCase_ == 2) { + partCase_ = 0; + part_ = null; + onChanged(); + } + } else { + if (partCase_ == 2) { + partCase_ = 0; + part_ = null; + } + fileBuilder_.clear(); + } + return this; + } + /** + * .a2a.v1.FilePart file = 2; + */ + public org.a2aproject.sdk.compat03.grpc.FilePart.Builder getFileBuilder() { + return internalGetFileFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.FilePart file = 2; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.FilePartOrBuilder getFileOrBuilder() { + if ((partCase_ == 2) && (fileBuilder_ != null)) { + return fileBuilder_.getMessageOrBuilder(); + } else { + if (partCase_ == 2) { + return (org.a2aproject.sdk.compat03.grpc.FilePart) part_; + } + return org.a2aproject.sdk.compat03.grpc.FilePart.getDefaultInstance(); + } + } + /** + * .a2a.v1.FilePart file = 2; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.FilePart, org.a2aproject.sdk.compat03.grpc.FilePart.Builder, org.a2aproject.sdk.compat03.grpc.FilePartOrBuilder> + internalGetFileFieldBuilder() { + if (fileBuilder_ == null) { + if (!(partCase_ == 2)) { + part_ = org.a2aproject.sdk.compat03.grpc.FilePart.getDefaultInstance(); + } + fileBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.FilePart, org.a2aproject.sdk.compat03.grpc.FilePart.Builder, org.a2aproject.sdk.compat03.grpc.FilePartOrBuilder>( + (org.a2aproject.sdk.compat03.grpc.FilePart) part_, + getParentForChildren(), + isClean()); + part_ = null; + } + partCase_ = 2; + onChanged(); + return fileBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.DataPart, org.a2aproject.sdk.compat03.grpc.DataPart.Builder, org.a2aproject.sdk.compat03.grpc.DataPartOrBuilder> dataBuilder_; + /** + * .a2a.v1.DataPart data = 3; + * @return Whether the data field is set. + */ + @java.lang.Override + public boolean hasData() { + return partCase_ == 3; + } + /** + * .a2a.v1.DataPart data = 3; + * @return The data. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.DataPart getData() { + if (dataBuilder_ == null) { + if (partCase_ == 3) { + return (org.a2aproject.sdk.compat03.grpc.DataPart) part_; + } + return org.a2aproject.sdk.compat03.grpc.DataPart.getDefaultInstance(); + } else { + if (partCase_ == 3) { + return dataBuilder_.getMessage(); + } + return org.a2aproject.sdk.compat03.grpc.DataPart.getDefaultInstance(); + } + } + /** + * .a2a.v1.DataPart data = 3; + */ + public Builder setData(org.a2aproject.sdk.compat03.grpc.DataPart value) { + if (dataBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + part_ = value; + onChanged(); + } else { + dataBuilder_.setMessage(value); + } + partCase_ = 3; + return this; + } + /** + * .a2a.v1.DataPart data = 3; + */ + public Builder setData( + org.a2aproject.sdk.compat03.grpc.DataPart.Builder builderForValue) { + if (dataBuilder_ == null) { + part_ = builderForValue.build(); + onChanged(); + } else { + dataBuilder_.setMessage(builderForValue.build()); + } + partCase_ = 3; + return this; + } + /** + * .a2a.v1.DataPart data = 3; + */ + public Builder mergeData(org.a2aproject.sdk.compat03.grpc.DataPart value) { + if (dataBuilder_ == null) { + if (partCase_ == 3 && + part_ != org.a2aproject.sdk.compat03.grpc.DataPart.getDefaultInstance()) { + part_ = org.a2aproject.sdk.compat03.grpc.DataPart.newBuilder((org.a2aproject.sdk.compat03.grpc.DataPart) part_) + .mergeFrom(value).buildPartial(); + } else { + part_ = value; + } + onChanged(); + } else { + if (partCase_ == 3) { + dataBuilder_.mergeFrom(value); + } else { + dataBuilder_.setMessage(value); + } + } + partCase_ = 3; + return this; + } + /** + * .a2a.v1.DataPart data = 3; + */ + public Builder clearData() { + if (dataBuilder_ == null) { + if (partCase_ == 3) { + partCase_ = 0; + part_ = null; + onChanged(); + } + } else { + if (partCase_ == 3) { + partCase_ = 0; + part_ = null; + } + dataBuilder_.clear(); + } + return this; + } + /** + * .a2a.v1.DataPart data = 3; + */ + public org.a2aproject.sdk.compat03.grpc.DataPart.Builder getDataBuilder() { + return internalGetDataFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.DataPart data = 3; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.DataPartOrBuilder getDataOrBuilder() { + if ((partCase_ == 3) && (dataBuilder_ != null)) { + return dataBuilder_.getMessageOrBuilder(); + } else { + if (partCase_ == 3) { + return (org.a2aproject.sdk.compat03.grpc.DataPart) part_; + } + return org.a2aproject.sdk.compat03.grpc.DataPart.getDefaultInstance(); + } + } + /** + * .a2a.v1.DataPart data = 3; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.DataPart, org.a2aproject.sdk.compat03.grpc.DataPart.Builder, org.a2aproject.sdk.compat03.grpc.DataPartOrBuilder> + internalGetDataFieldBuilder() { + if (dataBuilder_ == null) { + if (!(partCase_ == 3)) { + part_ = org.a2aproject.sdk.compat03.grpc.DataPart.getDefaultInstance(); + } + dataBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.DataPart, org.a2aproject.sdk.compat03.grpc.DataPart.Builder, org.a2aproject.sdk.compat03.grpc.DataPartOrBuilder>( + (org.a2aproject.sdk.compat03.grpc.DataPart) part_, + getParentForChildren(), + isClean()); + part_ = null; + } + partCase_ = 3; + onChanged(); + return dataBuilder_; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.Part) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.Part) + private static final org.a2aproject.sdk.compat03.grpc.Part DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.Part(); + } + + public static org.a2aproject.sdk.compat03.grpc.Part getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Part parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Part getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/PartOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/PartOrBuilder.java new file mode 100644 index 000000000..90b0075d5 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/PartOrBuilder.java @@ -0,0 +1,61 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface PartOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.Part) + com.google.protobuf.MessageOrBuilder { + + /** + * string text = 1; + * @return Whether the text field is set. + */ + boolean hasText(); + /** + * string text = 1; + * @return The text. + */ + java.lang.String getText(); + /** + * string text = 1; + * @return The bytes for text. + */ + com.google.protobuf.ByteString + getTextBytes(); + + /** + * .a2a.v1.FilePart file = 2; + * @return Whether the file field is set. + */ + boolean hasFile(); + /** + * .a2a.v1.FilePart file = 2; + * @return The file. + */ + org.a2aproject.sdk.compat03.grpc.FilePart getFile(); + /** + * .a2a.v1.FilePart file = 2; + */ + org.a2aproject.sdk.compat03.grpc.FilePartOrBuilder getFileOrBuilder(); + + /** + * .a2a.v1.DataPart data = 3; + * @return Whether the data field is set. + */ + boolean hasData(); + /** + * .a2a.v1.DataPart data = 3; + * @return The data. + */ + org.a2aproject.sdk.compat03.grpc.DataPart getData(); + /** + * .a2a.v1.DataPart data = 3; + */ + org.a2aproject.sdk.compat03.grpc.DataPartOrBuilder getDataOrBuilder(); + + org.a2aproject.sdk.compat03.grpc.Part.PartCase getPartCase(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/PasswordOAuthFlow.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/PasswordOAuthFlow.java new file mode 100644 index 000000000..f37e34aad --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/PasswordOAuthFlow.java @@ -0,0 +1,1042 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.PasswordOAuthFlow} + */ +@com.google.protobuf.Generated +public final class PasswordOAuthFlow extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.PasswordOAuthFlow) + PasswordOAuthFlowOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "PasswordOAuthFlow"); + } + // Use PasswordOAuthFlow.newBuilder() to construct. + private PasswordOAuthFlow(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private PasswordOAuthFlow() { + tokenUrl_ = ""; + refreshUrl_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_PasswordOAuthFlow_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { + switch (number) { + case 3: + return internalGetScopes(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_PasswordOAuthFlow_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.class, org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.Builder.class); + } + + public static final int TOKEN_URL_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object tokenUrl_ = ""; + /** + *
+   * The token URL to be used for this flow. This MUST be in the form of a URL.
+   * The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string token_url = 1; + * @return The tokenUrl. + */ + @java.lang.Override + public java.lang.String getTokenUrl() { + java.lang.Object ref = tokenUrl_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + tokenUrl_ = s; + return s; + } + } + /** + *
+   * The token URL to be used for this flow. This MUST be in the form of a URL.
+   * The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string token_url = 1; + * @return The bytes for tokenUrl. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getTokenUrlBytes() { + java.lang.Object ref = tokenUrl_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + tokenUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int REFRESH_URL_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object refreshUrl_ = ""; + /** + *
+   * The URL to be used for obtaining refresh tokens. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string refresh_url = 2; + * @return The refreshUrl. + */ + @java.lang.Override + public java.lang.String getRefreshUrl() { + java.lang.Object ref = refreshUrl_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + refreshUrl_ = s; + return s; + } + } + /** + *
+   * The URL to be used for obtaining refresh tokens. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string refresh_url = 2; + * @return The bytes for refreshUrl. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getRefreshUrlBytes() { + java.lang.Object ref = refreshUrl_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + refreshUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SCOPES_FIELD_NUMBER = 3; + private static final class ScopesDefaultEntryHolder { + static final com.google.protobuf.MapEntry< + java.lang.String, java.lang.String> defaultEntry = + com.google.protobuf.MapEntry + .newDefaultInstance( + A2A.internal_static_a2a_v1_PasswordOAuthFlow_ScopesEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + @SuppressWarnings("serial") + private com.google.protobuf.MapField< + java.lang.String, java.lang.String> scopes_; + private com.google.protobuf.MapField + internalGetScopes() { + if (scopes_ == null) { + return com.google.protobuf.MapField.emptyMapField( + ScopesDefaultEntryHolder.defaultEntry); + } + return scopes_; + } + public int getScopesCount() { + return internalGetScopes().getMap().size(); + } + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public boolean containsScopes( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + return internalGetScopes().getMap().containsKey(key); + } + /** + * Use {@link #getScopesMap()} instead. + */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getScopes() { + return getScopesMap(); + } + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public java.util.Map getScopesMap() { + return internalGetScopes().getMap(); + } + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public /* nullable */ +java.lang.String getScopesOrDefault( + java.lang.String key, + /* nullable */ +java.lang.String defaultValue) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetScopes().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public java.lang.String getScopesOrThrow( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetScopes().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(tokenUrl_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, tokenUrl_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(refreshUrl_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, refreshUrl_); + } + com.google.protobuf.GeneratedMessage + .serializeStringMapTo( + output, + internalGetScopes(), + ScopesDefaultEntryHolder.defaultEntry, + 3); + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(tokenUrl_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, tokenUrl_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(refreshUrl_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, refreshUrl_); + } + for (java.util.Map.Entry entry + : internalGetScopes().getMap().entrySet()) { + com.google.protobuf.MapEntry + scopes__ = ScopesDefaultEntryHolder.defaultEntry.newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, scopes__); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow other = (org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow) obj; + + if (!getTokenUrl() + .equals(other.getTokenUrl())) return false; + if (!getRefreshUrl() + .equals(other.getRefreshUrl())) return false; + if (!internalGetScopes().equals( + other.internalGetScopes())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + TOKEN_URL_FIELD_NUMBER; + hash = (53 * hash) + getTokenUrl().hashCode(); + hash = (37 * hash) + REFRESH_URL_FIELD_NUMBER; + hash = (53 * hash) + getRefreshUrl().hashCode(); + if (!internalGetScopes().getMap().isEmpty()) { + hash = (37 * hash) + SCOPES_FIELD_NUMBER; + hash = (53 * hash) + internalGetScopes().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.PasswordOAuthFlow} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.PasswordOAuthFlow) + org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlowOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_PasswordOAuthFlow_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { + switch (number) { + case 3: + return internalGetScopes(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMutableMapFieldReflection( + int number) { + switch (number) { + case 3: + return internalGetMutableScopes(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_PasswordOAuthFlow_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.class, org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + tokenUrl_ = ""; + refreshUrl_ = ""; + internalGetMutableScopes().clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_PasswordOAuthFlow_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow build() { + org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow buildPartial() { + org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow result = new org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.tokenUrl_ = tokenUrl_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.refreshUrl_ = refreshUrl_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.scopes_ = internalGetScopes(); + result.scopes_.makeImmutable(); + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow other) { + if (other == org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.getDefaultInstance()) return this; + if (!other.getTokenUrl().isEmpty()) { + tokenUrl_ = other.tokenUrl_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getRefreshUrl().isEmpty()) { + refreshUrl_ = other.refreshUrl_; + bitField0_ |= 0x00000002; + onChanged(); + } + internalGetMutableScopes().mergeFrom( + other.internalGetScopes()); + bitField0_ |= 0x00000004; + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + tokenUrl_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + refreshUrl_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: { + com.google.protobuf.MapEntry + scopes__ = input.readMessage( + ScopesDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); + internalGetMutableScopes().getMutableMap().put( + scopes__.getKey(), scopes__.getValue()); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object tokenUrl_ = ""; + /** + *
+     * The token URL to be used for this flow. This MUST be in the form of a URL.
+     * The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string token_url = 1; + * @return The tokenUrl. + */ + public java.lang.String getTokenUrl() { + java.lang.Object ref = tokenUrl_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + tokenUrl_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The token URL to be used for this flow. This MUST be in the form of a URL.
+     * The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string token_url = 1; + * @return The bytes for tokenUrl. + */ + public com.google.protobuf.ByteString + getTokenUrlBytes() { + java.lang.Object ref = tokenUrl_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + tokenUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The token URL to be used for this flow. This MUST be in the form of a URL.
+     * The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string token_url = 1; + * @param value The tokenUrl to set. + * @return This builder for chaining. + */ + public Builder setTokenUrl( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + tokenUrl_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * The token URL to be used for this flow. This MUST be in the form of a URL.
+     * The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string token_url = 1; + * @return This builder for chaining. + */ + public Builder clearTokenUrl() { + tokenUrl_ = getDefaultInstance().getTokenUrl(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * The token URL to be used for this flow. This MUST be in the form of a URL.
+     * The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string token_url = 1; + * @param value The bytes for tokenUrl to set. + * @return This builder for chaining. + */ + public Builder setTokenUrlBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + tokenUrl_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object refreshUrl_ = ""; + /** + *
+     * The URL to be used for obtaining refresh tokens. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string refresh_url = 2; + * @return The refreshUrl. + */ + public java.lang.String getRefreshUrl() { + java.lang.Object ref = refreshUrl_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + refreshUrl_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The URL to be used for obtaining refresh tokens. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string refresh_url = 2; + * @return The bytes for refreshUrl. + */ + public com.google.protobuf.ByteString + getRefreshUrlBytes() { + java.lang.Object ref = refreshUrl_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + refreshUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The URL to be used for obtaining refresh tokens. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string refresh_url = 2; + * @param value The refreshUrl to set. + * @return This builder for chaining. + */ + public Builder setRefreshUrl( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + refreshUrl_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * The URL to be used for obtaining refresh tokens. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string refresh_url = 2; + * @return This builder for chaining. + */ + public Builder clearRefreshUrl() { + refreshUrl_ = getDefaultInstance().getRefreshUrl(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * The URL to be used for obtaining refresh tokens. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string refresh_url = 2; + * @param value The bytes for refreshUrl to set. + * @return This builder for chaining. + */ + public Builder setRefreshUrlBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + refreshUrl_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private com.google.protobuf.MapField< + java.lang.String, java.lang.String> scopes_; + private com.google.protobuf.MapField + internalGetScopes() { + if (scopes_ == null) { + return com.google.protobuf.MapField.emptyMapField( + ScopesDefaultEntryHolder.defaultEntry); + } + return scopes_; + } + private com.google.protobuf.MapField + internalGetMutableScopes() { + if (scopes_ == null) { + scopes_ = com.google.protobuf.MapField.newMapField( + ScopesDefaultEntryHolder.defaultEntry); + } + if (!scopes_.isMutable()) { + scopes_ = scopes_.copy(); + } + bitField0_ |= 0x00000004; + onChanged(); + return scopes_; + } + public int getScopesCount() { + return internalGetScopes().getMap().size(); + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public boolean containsScopes( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + return internalGetScopes().getMap().containsKey(key); + } + /** + * Use {@link #getScopesMap()} instead. + */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getScopes() { + return getScopesMap(); + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public java.util.Map getScopesMap() { + return internalGetScopes().getMap(); + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public /* nullable */ +java.lang.String getScopesOrDefault( + java.lang.String key, + /* nullable */ +java.lang.String defaultValue) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetScopes().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public java.lang.String getScopesOrThrow( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetScopes().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + public Builder clearScopes() { + bitField0_ = (bitField0_ & ~0x00000004); + internalGetMutableScopes().getMutableMap() + .clear(); + return this; + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + public Builder removeScopes( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + internalGetMutableScopes().getMutableMap() + .remove(key); + return this; + } + /** + * Use alternate mutation accessors instead. + */ + @java.lang.Deprecated + public java.util.Map + getMutableScopes() { + bitField0_ |= 0x00000004; + return internalGetMutableScopes().getMutableMap(); + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + public Builder putScopes( + java.lang.String key, + java.lang.String value) { + if (key == null) { throw new NullPointerException("map key"); } + if (value == null) { throw new NullPointerException("map value"); } + internalGetMutableScopes().getMutableMap() + .put(key, value); + bitField0_ |= 0x00000004; + return this; + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + public Builder putAllScopes( + java.util.Map values) { + internalGetMutableScopes().getMutableMap() + .putAll(values); + bitField0_ |= 0x00000004; + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.PasswordOAuthFlow) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.PasswordOAuthFlow) + private static final org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow(); + } + + public static org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public PasswordOAuthFlow parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/PasswordOAuthFlowOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/PasswordOAuthFlowOrBuilder.java new file mode 100644 index 000000000..ec5a79ac1 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/PasswordOAuthFlowOrBuilder.java @@ -0,0 +1,115 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface PasswordOAuthFlowOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.PasswordOAuthFlow) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The token URL to be used for this flow. This MUST be in the form of a URL.
+   * The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string token_url = 1; + * @return The tokenUrl. + */ + java.lang.String getTokenUrl(); + /** + *
+   * The token URL to be used for this flow. This MUST be in the form of a URL.
+   * The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string token_url = 1; + * @return The bytes for tokenUrl. + */ + com.google.protobuf.ByteString + getTokenUrlBytes(); + + /** + *
+   * The URL to be used for obtaining refresh tokens. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string refresh_url = 2; + * @return The refreshUrl. + */ + java.lang.String getRefreshUrl(); + /** + *
+   * The URL to be used for obtaining refresh tokens. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string refresh_url = 2; + * @return The bytes for refreshUrl. + */ + com.google.protobuf.ByteString + getRefreshUrlBytes(); + + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + int getScopesCount(); + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + boolean containsScopes( + java.lang.String key); + /** + * Use {@link #getScopesMap()} instead. + */ + @java.lang.Deprecated + java.util.Map + getScopes(); + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + java.util.Map + getScopesMap(); + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + /* nullable */ +java.lang.String getScopesOrDefault( + java.lang.String key, + /* nullable */ +java.lang.String defaultValue); + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + java.lang.String getScopesOrThrow( + java.lang.String key); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/PushNotificationConfig.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/PushNotificationConfig.java new file mode 100644 index 000000000..c7c9d14c9 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/PushNotificationConfig.java @@ -0,0 +1,1107 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * Configuration for setting up push notifications for task updates.
+ * 
+ * + * Protobuf type {@code a2a.v1.PushNotificationConfig} + */ +@com.google.protobuf.Generated +public final class PushNotificationConfig extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.PushNotificationConfig) + PushNotificationConfigOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "PushNotificationConfig"); + } + // Use PushNotificationConfig.newBuilder() to construct. + private PushNotificationConfig(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private PushNotificationConfig() { + id_ = ""; + url_ = ""; + token_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_PushNotificationConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_PushNotificationConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.class, org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.Builder.class); + } + + private int bitField0_; + public static final int ID_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object id_ = ""; + /** + *
+   * A unique id for this push notification.
+   * 
+ * + * string id = 1; + * @return The id. + */ + @java.lang.Override + public java.lang.String getId() { + java.lang.Object ref = id_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + id_ = s; + return s; + } + } + /** + *
+   * A unique id for this push notification.
+   * 
+ * + * string id = 1; + * @return The bytes for id. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getIdBytes() { + java.lang.Object ref = id_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + id_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int URL_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object url_ = ""; + /** + *
+   * Url to send the notification too
+   * 
+ * + * string url = 2; + * @return The url. + */ + @java.lang.Override + public java.lang.String getUrl() { + java.lang.Object ref = url_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + url_ = s; + return s; + } + } + /** + *
+   * Url to send the notification too
+   * 
+ * + * string url = 2; + * @return The bytes for url. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getUrlBytes() { + java.lang.Object ref = url_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + url_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int TOKEN_FIELD_NUMBER = 3; + @SuppressWarnings("serial") + private volatile java.lang.Object token_ = ""; + /** + *
+   * Token unique for this task/session
+   * 
+ * + * string token = 3; + * @return The token. + */ + @java.lang.Override + public java.lang.String getToken() { + java.lang.Object ref = token_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + token_ = s; + return s; + } + } + /** + *
+   * Token unique for this task/session
+   * 
+ * + * string token = 3; + * @return The bytes for token. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getTokenBytes() { + java.lang.Object ref = token_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + token_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int AUTHENTICATION_FIELD_NUMBER = 4; + private org.a2aproject.sdk.compat03.grpc.AuthenticationInfo authentication_; + /** + *
+   * Information about the authentication to sent with the notification
+   * 
+ * + * .a2a.v1.AuthenticationInfo authentication = 4; + * @return Whether the authentication field is set. + */ + @java.lang.Override + public boolean hasAuthentication() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + *
+   * Information about the authentication to sent with the notification
+   * 
+ * + * .a2a.v1.AuthenticationInfo authentication = 4; + * @return The authentication. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AuthenticationInfo getAuthentication() { + return authentication_ == null ? org.a2aproject.sdk.compat03.grpc.AuthenticationInfo.getDefaultInstance() : authentication_; + } + /** + *
+   * Information about the authentication to sent with the notification
+   * 
+ * + * .a2a.v1.AuthenticationInfo authentication = 4; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AuthenticationInfoOrBuilder getAuthenticationOrBuilder() { + return authentication_ == null ? org.a2aproject.sdk.compat03.grpc.AuthenticationInfo.getDefaultInstance() : authentication_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(id_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, id_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(url_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, url_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(token_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 3, token_); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(4, getAuthentication()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(id_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, id_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(url_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, url_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(token_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(3, token_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, getAuthentication()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.PushNotificationConfig)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig other = (org.a2aproject.sdk.compat03.grpc.PushNotificationConfig) obj; + + if (!getId() + .equals(other.getId())) return false; + if (!getUrl() + .equals(other.getUrl())) return false; + if (!getToken() + .equals(other.getToken())) return false; + if (hasAuthentication() != other.hasAuthentication()) return false; + if (hasAuthentication()) { + if (!getAuthentication() + .equals(other.getAuthentication())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + ID_FIELD_NUMBER; + hash = (53 * hash) + getId().hashCode(); + hash = (37 * hash) + URL_FIELD_NUMBER; + hash = (53 * hash) + getUrl().hashCode(); + hash = (37 * hash) + TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getToken().hashCode(); + if (hasAuthentication()) { + hash = (37 * hash) + AUTHENTICATION_FIELD_NUMBER; + hash = (53 * hash) + getAuthentication().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.PushNotificationConfig parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.PushNotificationConfig parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.PushNotificationConfig parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.PushNotificationConfig parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.PushNotificationConfig parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.PushNotificationConfig parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.PushNotificationConfig parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.PushNotificationConfig parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.PushNotificationConfig parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.PushNotificationConfig parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.PushNotificationConfig parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.PushNotificationConfig parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.PushNotificationConfig prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * Configuration for setting up push notifications for task updates.
+   * 
+ * + * Protobuf type {@code a2a.v1.PushNotificationConfig} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.PushNotificationConfig) + org.a2aproject.sdk.compat03.grpc.PushNotificationConfigOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_PushNotificationConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_PushNotificationConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.class, org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage + .alwaysUseFieldBuilders) { + internalGetAuthenticationFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + id_ = ""; + url_ = ""; + token_ = ""; + authentication_ = null; + if (authenticationBuilder_ != null) { + authenticationBuilder_.dispose(); + authenticationBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_PushNotificationConfig_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.PushNotificationConfig getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.PushNotificationConfig build() { + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.PushNotificationConfig buildPartial() { + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig result = new org.a2aproject.sdk.compat03.grpc.PushNotificationConfig(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.PushNotificationConfig result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.id_ = id_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.url_ = url_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.token_ = token_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000008) != 0)) { + result.authentication_ = authenticationBuilder_ == null + ? authentication_ + : authenticationBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.PushNotificationConfig) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.PushNotificationConfig)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.PushNotificationConfig other) { + if (other == org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.getDefaultInstance()) return this; + if (!other.getId().isEmpty()) { + id_ = other.id_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getUrl().isEmpty()) { + url_ = other.url_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (!other.getToken().isEmpty()) { + token_ = other.token_; + bitField0_ |= 0x00000004; + onChanged(); + } + if (other.hasAuthentication()) { + mergeAuthentication(other.getAuthentication()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + id_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + url_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: { + token_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + case 34: { + input.readMessage( + internalGetAuthenticationFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000008; + break; + } // case 34 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object id_ = ""; + /** + *
+     * A unique id for this push notification.
+     * 
+ * + * string id = 1; + * @return The id. + */ + public java.lang.String getId() { + java.lang.Object ref = id_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + id_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * A unique id for this push notification.
+     * 
+ * + * string id = 1; + * @return The bytes for id. + */ + public com.google.protobuf.ByteString + getIdBytes() { + java.lang.Object ref = id_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + id_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * A unique id for this push notification.
+     * 
+ * + * string id = 1; + * @param value The id to set. + * @return This builder for chaining. + */ + public Builder setId( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + id_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * A unique id for this push notification.
+     * 
+ * + * string id = 1; + * @return This builder for chaining. + */ + public Builder clearId() { + id_ = getDefaultInstance().getId(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * A unique id for this push notification.
+     * 
+ * + * string id = 1; + * @param value The bytes for id to set. + * @return This builder for chaining. + */ + public Builder setIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + id_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object url_ = ""; + /** + *
+     * Url to send the notification too
+     * 
+ * + * string url = 2; + * @return The url. + */ + public java.lang.String getUrl() { + java.lang.Object ref = url_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + url_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Url to send the notification too
+     * 
+ * + * string url = 2; + * @return The bytes for url. + */ + public com.google.protobuf.ByteString + getUrlBytes() { + java.lang.Object ref = url_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + url_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Url to send the notification too
+     * 
+ * + * string url = 2; + * @param value The url to set. + * @return This builder for chaining. + */ + public Builder setUrl( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + url_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * Url to send the notification too
+     * 
+ * + * string url = 2; + * @return This builder for chaining. + */ + public Builder clearUrl() { + url_ = getDefaultInstance().getUrl(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * Url to send the notification too
+     * 
+ * + * string url = 2; + * @param value The bytes for url to set. + * @return This builder for chaining. + */ + public Builder setUrlBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + url_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private java.lang.Object token_ = ""; + /** + *
+     * Token unique for this task/session
+     * 
+ * + * string token = 3; + * @return The token. + */ + public java.lang.String getToken() { + java.lang.Object ref = token_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + token_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Token unique for this task/session
+     * 
+ * + * string token = 3; + * @return The bytes for token. + */ + public com.google.protobuf.ByteString + getTokenBytes() { + java.lang.Object ref = token_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + token_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Token unique for this task/session
+     * 
+ * + * string token = 3; + * @param value The token to set. + * @return This builder for chaining. + */ + public Builder setToken( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + token_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * Token unique for this task/session
+     * 
+ * + * string token = 3; + * @return This builder for chaining. + */ + public Builder clearToken() { + token_ = getDefaultInstance().getToken(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + *
+     * Token unique for this task/session
+     * 
+ * + * string token = 3; + * @param value The bytes for token to set. + * @return This builder for chaining. + */ + public Builder setTokenBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + token_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + private org.a2aproject.sdk.compat03.grpc.AuthenticationInfo authentication_; + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AuthenticationInfo, org.a2aproject.sdk.compat03.grpc.AuthenticationInfo.Builder, org.a2aproject.sdk.compat03.grpc.AuthenticationInfoOrBuilder> authenticationBuilder_; + /** + *
+     * Information about the authentication to sent with the notification
+     * 
+ * + * .a2a.v1.AuthenticationInfo authentication = 4; + * @return Whether the authentication field is set. + */ + public boolean hasAuthentication() { + return ((bitField0_ & 0x00000008) != 0); + } + /** + *
+     * Information about the authentication to sent with the notification
+     * 
+ * + * .a2a.v1.AuthenticationInfo authentication = 4; + * @return The authentication. + */ + public org.a2aproject.sdk.compat03.grpc.AuthenticationInfo getAuthentication() { + if (authenticationBuilder_ == null) { + return authentication_ == null ? org.a2aproject.sdk.compat03.grpc.AuthenticationInfo.getDefaultInstance() : authentication_; + } else { + return authenticationBuilder_.getMessage(); + } + } + /** + *
+     * Information about the authentication to sent with the notification
+     * 
+ * + * .a2a.v1.AuthenticationInfo authentication = 4; + */ + public Builder setAuthentication(org.a2aproject.sdk.compat03.grpc.AuthenticationInfo value) { + if (authenticationBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + authentication_ = value; + } else { + authenticationBuilder_.setMessage(value); + } + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + *
+     * Information about the authentication to sent with the notification
+     * 
+ * + * .a2a.v1.AuthenticationInfo authentication = 4; + */ + public Builder setAuthentication( + org.a2aproject.sdk.compat03.grpc.AuthenticationInfo.Builder builderForValue) { + if (authenticationBuilder_ == null) { + authentication_ = builderForValue.build(); + } else { + authenticationBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + *
+     * Information about the authentication to sent with the notification
+     * 
+ * + * .a2a.v1.AuthenticationInfo authentication = 4; + */ + public Builder mergeAuthentication(org.a2aproject.sdk.compat03.grpc.AuthenticationInfo value) { + if (authenticationBuilder_ == null) { + if (((bitField0_ & 0x00000008) != 0) && + authentication_ != null && + authentication_ != org.a2aproject.sdk.compat03.grpc.AuthenticationInfo.getDefaultInstance()) { + getAuthenticationBuilder().mergeFrom(value); + } else { + authentication_ = value; + } + } else { + authenticationBuilder_.mergeFrom(value); + } + if (authentication_ != null) { + bitField0_ |= 0x00000008; + onChanged(); + } + return this; + } + /** + *
+     * Information about the authentication to sent with the notification
+     * 
+ * + * .a2a.v1.AuthenticationInfo authentication = 4; + */ + public Builder clearAuthentication() { + bitField0_ = (bitField0_ & ~0x00000008); + authentication_ = null; + if (authenticationBuilder_ != null) { + authenticationBuilder_.dispose(); + authenticationBuilder_ = null; + } + onChanged(); + return this; + } + /** + *
+     * Information about the authentication to sent with the notification
+     * 
+ * + * .a2a.v1.AuthenticationInfo authentication = 4; + */ + public org.a2aproject.sdk.compat03.grpc.AuthenticationInfo.Builder getAuthenticationBuilder() { + bitField0_ |= 0x00000008; + onChanged(); + return internalGetAuthenticationFieldBuilder().getBuilder(); + } + /** + *
+     * Information about the authentication to sent with the notification
+     * 
+ * + * .a2a.v1.AuthenticationInfo authentication = 4; + */ + public org.a2aproject.sdk.compat03.grpc.AuthenticationInfoOrBuilder getAuthenticationOrBuilder() { + if (authenticationBuilder_ != null) { + return authenticationBuilder_.getMessageOrBuilder(); + } else { + return authentication_ == null ? + org.a2aproject.sdk.compat03.grpc.AuthenticationInfo.getDefaultInstance() : authentication_; + } + } + /** + *
+     * Information about the authentication to sent with the notification
+     * 
+ * + * .a2a.v1.AuthenticationInfo authentication = 4; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AuthenticationInfo, org.a2aproject.sdk.compat03.grpc.AuthenticationInfo.Builder, org.a2aproject.sdk.compat03.grpc.AuthenticationInfoOrBuilder> + internalGetAuthenticationFieldBuilder() { + if (authenticationBuilder_ == null) { + authenticationBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AuthenticationInfo, org.a2aproject.sdk.compat03.grpc.AuthenticationInfo.Builder, org.a2aproject.sdk.compat03.grpc.AuthenticationInfoOrBuilder>( + getAuthentication(), + getParentForChildren(), + isClean()); + authentication_ = null; + } + return authenticationBuilder_; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.PushNotificationConfig) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.PushNotificationConfig) + private static final org.a2aproject.sdk.compat03.grpc.PushNotificationConfig DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.PushNotificationConfig(); + } + + public static org.a2aproject.sdk.compat03.grpc.PushNotificationConfig getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public PushNotificationConfig parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.PushNotificationConfig getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/PushNotificationConfigOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/PushNotificationConfigOrBuilder.java new file mode 100644 index 000000000..a8990646f --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/PushNotificationConfigOrBuilder.java @@ -0,0 +1,99 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface PushNotificationConfigOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.PushNotificationConfig) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * A unique id for this push notification.
+   * 
+ * + * string id = 1; + * @return The id. + */ + java.lang.String getId(); + /** + *
+   * A unique id for this push notification.
+   * 
+ * + * string id = 1; + * @return The bytes for id. + */ + com.google.protobuf.ByteString + getIdBytes(); + + /** + *
+   * Url to send the notification too
+   * 
+ * + * string url = 2; + * @return The url. + */ + java.lang.String getUrl(); + /** + *
+   * Url to send the notification too
+   * 
+ * + * string url = 2; + * @return The bytes for url. + */ + com.google.protobuf.ByteString + getUrlBytes(); + + /** + *
+   * Token unique for this task/session
+   * 
+ * + * string token = 3; + * @return The token. + */ + java.lang.String getToken(); + /** + *
+   * Token unique for this task/session
+   * 
+ * + * string token = 3; + * @return The bytes for token. + */ + com.google.protobuf.ByteString + getTokenBytes(); + + /** + *
+   * Information about the authentication to sent with the notification
+   * 
+ * + * .a2a.v1.AuthenticationInfo authentication = 4; + * @return Whether the authentication field is set. + */ + boolean hasAuthentication(); + /** + *
+   * Information about the authentication to sent with the notification
+   * 
+ * + * .a2a.v1.AuthenticationInfo authentication = 4; + * @return The authentication. + */ + org.a2aproject.sdk.compat03.grpc.AuthenticationInfo getAuthentication(); + /** + *
+   * Information about the authentication to sent with the notification
+   * 
+ * + * .a2a.v1.AuthenticationInfo authentication = 4; + */ + org.a2aproject.sdk.compat03.grpc.AuthenticationInfoOrBuilder getAuthenticationOrBuilder(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/Role.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/Role.java new file mode 100644 index 000000000..52116e3a7 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/Role.java @@ -0,0 +1,150 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf enum {@code a2a.v1.Role} + */ +@com.google.protobuf.Generated +public enum Role + implements com.google.protobuf.ProtocolMessageEnum { + /** + * ROLE_UNSPECIFIED = 0; + */ + ROLE_UNSPECIFIED(0), + /** + *
+   * USER role refers to communication from the client to the server.
+   * 
+ * + * ROLE_USER = 1; + */ + ROLE_USER(1), + /** + *
+   * AGENT role refers to communication from the server to the client.
+   * 
+ * + * ROLE_AGENT = 2; + */ + ROLE_AGENT(2), + UNRECOGNIZED(-1), + ; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "Role"); + } + /** + * ROLE_UNSPECIFIED = 0; + */ + public static final int ROLE_UNSPECIFIED_VALUE = 0; + /** + *
+   * USER role refers to communication from the client to the server.
+   * 
+ * + * ROLE_USER = 1; + */ + public static final int ROLE_USER_VALUE = 1; + /** + *
+   * AGENT role refers to communication from the server to the client.
+   * 
+ * + * ROLE_AGENT = 2; + */ + public static final int ROLE_AGENT_VALUE = 2; + + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static Role valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static Role forNumber(int value) { + switch (value) { + case 0: return ROLE_UNSPECIFIED; + case 1: return ROLE_USER; + case 2: return ROLE_AGENT; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static final com.google.protobuf.Internal.EnumLiteMap< + Role> internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public Role findValueByNumber(int number) { + return Role.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return A2A.getDescriptor().getEnumTypes().get(1); + } + + private static final Role[] VALUES = values(); + + public static Role valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private Role(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:a2a.v1.Role) +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/Security.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/Security.java new file mode 100644 index 000000000..5eea07a7e --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/Security.java @@ -0,0 +1,672 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.Security} + */ +@com.google.protobuf.Generated +public final class Security extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.Security) + SecurityOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "Security"); + } + // Use Security.newBuilder() to construct. + private Security(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private Security() { + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_Security_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { + switch (number) { + case 1: + return internalGetSchemes(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_Security_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.Security.class, org.a2aproject.sdk.compat03.grpc.Security.Builder.class); + } + + public static final int SCHEMES_FIELD_NUMBER = 1; + private static final class SchemesDefaultEntryHolder { + static final com.google.protobuf.MapEntry< + java.lang.String, org.a2aproject.sdk.compat03.grpc.StringList> defaultEntry = + com.google.protobuf.MapEntry + .newDefaultInstance( + A2A.internal_static_a2a_v1_Security_SchemesEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.MESSAGE, + org.a2aproject.sdk.compat03.grpc.StringList.getDefaultInstance()); + } + @SuppressWarnings("serial") + private com.google.protobuf.MapField< + java.lang.String, org.a2aproject.sdk.compat03.grpc.StringList> schemes_; + private com.google.protobuf.MapField + internalGetSchemes() { + if (schemes_ == null) { + return com.google.protobuf.MapField.emptyMapField( + SchemesDefaultEntryHolder.defaultEntry); + } + return schemes_; + } + public int getSchemesCount() { + return internalGetSchemes().getMap().size(); + } + /** + * map<string, .a2a.v1.StringList> schemes = 1; + */ + @java.lang.Override + public boolean containsSchemes( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + return internalGetSchemes().getMap().containsKey(key); + } + /** + * Use {@link #getSchemesMap()} instead. + */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getSchemes() { + return getSchemesMap(); + } + /** + * map<string, .a2a.v1.StringList> schemes = 1; + */ + @java.lang.Override + public java.util.Map getSchemesMap() { + return internalGetSchemes().getMap(); + } + /** + * map<string, .a2a.v1.StringList> schemes = 1; + */ + @java.lang.Override + public /* nullable */ +org.a2aproject.sdk.compat03.grpc.StringList getSchemesOrDefault( + java.lang.String key, + /* nullable */ +org.a2aproject.sdk.compat03.grpc.StringList defaultValue) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetSchemes().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * map<string, .a2a.v1.StringList> schemes = 1; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.StringList getSchemesOrThrow( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetSchemes().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + com.google.protobuf.GeneratedMessage + .serializeStringMapTo( + output, + internalGetSchemes(), + SchemesDefaultEntryHolder.defaultEntry, + 1); + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (java.util.Map.Entry entry + : internalGetSchemes().getMap().entrySet()) { + com.google.protobuf.MapEntry + schemes__ = SchemesDefaultEntryHolder.defaultEntry.newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, schemes__); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.Security)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.Security other = (org.a2aproject.sdk.compat03.grpc.Security) obj; + + if (!internalGetSchemes().equals( + other.internalGetSchemes())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (!internalGetSchemes().getMap().isEmpty()) { + hash = (37 * hash) + SCHEMES_FIELD_NUMBER; + hash = (53 * hash) + internalGetSchemes().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.Security parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.Security parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.Security parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.Security parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.Security parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.Security parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.Security parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.Security parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.Security parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.Security parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.Security parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.Security parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.Security prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.Security} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.Security) + org.a2aproject.sdk.compat03.grpc.SecurityOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_Security_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { + switch (number) { + case 1: + return internalGetSchemes(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMutableMapFieldReflection( + int number) { + switch (number) { + case 1: + return internalGetMutableSchemes(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_Security_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.Security.class, org.a2aproject.sdk.compat03.grpc.Security.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.Security.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + internalGetMutableSchemes().clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_Security_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Security getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.Security.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Security build() { + org.a2aproject.sdk.compat03.grpc.Security result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Security buildPartial() { + org.a2aproject.sdk.compat03.grpc.Security result = new org.a2aproject.sdk.compat03.grpc.Security(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.Security result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.schemes_ = internalGetSchemes().build(SchemesDefaultEntryHolder.defaultEntry); + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.Security) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.Security)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.Security other) { + if (other == org.a2aproject.sdk.compat03.grpc.Security.getDefaultInstance()) return this; + internalGetMutableSchemes().mergeFrom( + other.internalGetSchemes()); + bitField0_ |= 0x00000001; + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + com.google.protobuf.MapEntry + schemes__ = input.readMessage( + SchemesDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); + internalGetMutableSchemes().ensureBuilderMap().put( + schemes__.getKey(), schemes__.getValue()); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private static final class SchemesConverter implements com.google.protobuf.MapFieldBuilder.Converter { + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.StringList build(org.a2aproject.sdk.compat03.grpc.StringListOrBuilder val) { + if (val instanceof org.a2aproject.sdk.compat03.grpc.StringList) { return (org.a2aproject.sdk.compat03.grpc.StringList) val; } + return ((org.a2aproject.sdk.compat03.grpc.StringList.Builder) val).build(); + } + + @java.lang.Override + public com.google.protobuf.MapEntry defaultEntry() { + return SchemesDefaultEntryHolder.defaultEntry; + } + }; + private static final SchemesConverter schemesConverter = new SchemesConverter(); + + private com.google.protobuf.MapFieldBuilder< + java.lang.String, org.a2aproject.sdk.compat03.grpc.StringListOrBuilder, org.a2aproject.sdk.compat03.grpc.StringList, org.a2aproject.sdk.compat03.grpc.StringList.Builder> schemes_; + private com.google.protobuf.MapFieldBuilder + internalGetSchemes() { + if (schemes_ == null) { + return new com.google.protobuf.MapFieldBuilder<>(schemesConverter); + } + return schemes_; + } + private com.google.protobuf.MapFieldBuilder + internalGetMutableSchemes() { + if (schemes_ == null) { + schemes_ = new com.google.protobuf.MapFieldBuilder<>(schemesConverter); + } + bitField0_ |= 0x00000001; + onChanged(); + return schemes_; + } + public int getSchemesCount() { + return internalGetSchemes().ensureBuilderMap().size(); + } + /** + * map<string, .a2a.v1.StringList> schemes = 1; + */ + @java.lang.Override + public boolean containsSchemes( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + return internalGetSchemes().ensureBuilderMap().containsKey(key); + } + /** + * Use {@link #getSchemesMap()} instead. + */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getSchemes() { + return getSchemesMap(); + } + /** + * map<string, .a2a.v1.StringList> schemes = 1; + */ + @java.lang.Override + public java.util.Map getSchemesMap() { + return internalGetSchemes().getImmutableMap(); + } + /** + * map<string, .a2a.v1.StringList> schemes = 1; + */ + @java.lang.Override + public /* nullable */ +org.a2aproject.sdk.compat03.grpc.StringList getSchemesOrDefault( + java.lang.String key, + /* nullable */ +org.a2aproject.sdk.compat03.grpc.StringList defaultValue) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = internalGetMutableSchemes().ensureBuilderMap(); + return map.containsKey(key) ? schemesConverter.build(map.get(key)) : defaultValue; + } + /** + * map<string, .a2a.v1.StringList> schemes = 1; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.StringList getSchemesOrThrow( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = internalGetMutableSchemes().ensureBuilderMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return schemesConverter.build(map.get(key)); + } + public Builder clearSchemes() { + bitField0_ = (bitField0_ & ~0x00000001); + internalGetMutableSchemes().clear(); + return this; + } + /** + * map<string, .a2a.v1.StringList> schemes = 1; + */ + public Builder removeSchemes( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + internalGetMutableSchemes().ensureBuilderMap() + .remove(key); + return this; + } + /** + * Use alternate mutation accessors instead. + */ + @java.lang.Deprecated + public java.util.Map + getMutableSchemes() { + bitField0_ |= 0x00000001; + return internalGetMutableSchemes().ensureMessageMap(); + } + /** + * map<string, .a2a.v1.StringList> schemes = 1; + */ + public Builder putSchemes( + java.lang.String key, + org.a2aproject.sdk.compat03.grpc.StringList value) { + if (key == null) { throw new NullPointerException("map key"); } + if (value == null) { throw new NullPointerException("map value"); } + internalGetMutableSchemes().ensureBuilderMap() + .put(key, value); + bitField0_ |= 0x00000001; + return this; + } + /** + * map<string, .a2a.v1.StringList> schemes = 1; + */ + public Builder putAllSchemes( + java.util.Map values) { + for (java.util.Map.Entry e : values.entrySet()) { + if (e.getKey() == null || e.getValue() == null) { + throw new NullPointerException(); + } + } + internalGetMutableSchemes().ensureBuilderMap() + .putAll(values); + bitField0_ |= 0x00000001; + return this; + } + /** + * map<string, .a2a.v1.StringList> schemes = 1; + */ + public org.a2aproject.sdk.compat03.grpc.StringList.Builder putSchemesBuilderIfAbsent( + java.lang.String key) { + java.util.Map builderMap = internalGetMutableSchemes().ensureBuilderMap(); + org.a2aproject.sdk.compat03.grpc.StringListOrBuilder entry = builderMap.get(key); + if (entry == null) { + entry = org.a2aproject.sdk.compat03.grpc.StringList.newBuilder(); + builderMap.put(key, entry); + } + if (entry instanceof org.a2aproject.sdk.compat03.grpc.StringList) { + entry = ((org.a2aproject.sdk.compat03.grpc.StringList) entry).toBuilder(); + builderMap.put(key, entry); + } + return (org.a2aproject.sdk.compat03.grpc.StringList.Builder) entry; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.Security) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.Security) + private static final org.a2aproject.sdk.compat03.grpc.Security DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.Security(); + } + + public static org.a2aproject.sdk.compat03.grpc.Security getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Security parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Security getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SecurityOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SecurityOrBuilder.java new file mode 100644 index 000000000..9c65475cb --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SecurityOrBuilder.java @@ -0,0 +1,46 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface SecurityOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.Security) + com.google.protobuf.MessageOrBuilder { + + /** + * map<string, .a2a.v1.StringList> schemes = 1; + */ + int getSchemesCount(); + /** + * map<string, .a2a.v1.StringList> schemes = 1; + */ + boolean containsSchemes( + java.lang.String key); + /** + * Use {@link #getSchemesMap()} instead. + */ + @java.lang.Deprecated + java.util.Map + getSchemes(); + /** + * map<string, .a2a.v1.StringList> schemes = 1; + */ + java.util.Map + getSchemesMap(); + /** + * map<string, .a2a.v1.StringList> schemes = 1; + */ + /* nullable */ +org.a2aproject.sdk.compat03.grpc.StringList getSchemesOrDefault( + java.lang.String key, + /* nullable */ +org.a2aproject.sdk.compat03.grpc.StringList defaultValue); + /** + * map<string, .a2a.v1.StringList> schemes = 1; + */ + org.a2aproject.sdk.compat03.grpc.StringList getSchemesOrThrow( + java.lang.String key); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SecurityScheme.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SecurityScheme.java new file mode 100644 index 000000000..b1a96b77f --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SecurityScheme.java @@ -0,0 +1,1481 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.SecurityScheme} + */ +@com.google.protobuf.Generated +public final class SecurityScheme extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.SecurityScheme) + SecuritySchemeOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "SecurityScheme"); + } + // Use SecurityScheme.newBuilder() to construct. + private SecurityScheme(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private SecurityScheme() { + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_SecurityScheme_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_SecurityScheme_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.SecurityScheme.class, org.a2aproject.sdk.compat03.grpc.SecurityScheme.Builder.class); + } + + private int schemeCase_ = 0; + @SuppressWarnings("serial") + private java.lang.Object scheme_; + public enum SchemeCase + implements com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + API_KEY_SECURITY_SCHEME(1), + HTTP_AUTH_SECURITY_SCHEME(2), + OAUTH2_SECURITY_SCHEME(3), + OPEN_ID_CONNECT_SECURITY_SCHEME(4), + MTLS_SECURITY_SCHEME(5), + SCHEME_NOT_SET(0); + private final int value; + private SchemeCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static SchemeCase valueOf(int value) { + return forNumber(value); + } + + public static SchemeCase forNumber(int value) { + switch (value) { + case 1: return API_KEY_SECURITY_SCHEME; + case 2: return HTTP_AUTH_SECURITY_SCHEME; + case 3: return OAUTH2_SECURITY_SCHEME; + case 4: return OPEN_ID_CONNECT_SECURITY_SCHEME; + case 5: return MTLS_SECURITY_SCHEME; + case 0: return SCHEME_NOT_SET; + default: return null; + } + } + public int getNumber() { + return this.value; + } + }; + + public SchemeCase + getSchemeCase() { + return SchemeCase.forNumber( + schemeCase_); + } + + public static final int API_KEY_SECURITY_SCHEME_FIELD_NUMBER = 1; + /** + * .a2a.v1.APIKeySecurityScheme api_key_security_scheme = 1; + * @return Whether the apiKeySecurityScheme field is set. + */ + @java.lang.Override + public boolean hasApiKeySecurityScheme() { + return schemeCase_ == 1; + } + /** + * .a2a.v1.APIKeySecurityScheme api_key_security_scheme = 1; + * @return The apiKeySecurityScheme. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme getApiKeySecurityScheme() { + if (schemeCase_ == 1) { + return (org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme) scheme_; + } + return org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.getDefaultInstance(); + } + /** + * .a2a.v1.APIKeySecurityScheme api_key_security_scheme = 1; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.APIKeySecuritySchemeOrBuilder getApiKeySecuritySchemeOrBuilder() { + if (schemeCase_ == 1) { + return (org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme) scheme_; + } + return org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.getDefaultInstance(); + } + + public static final int HTTP_AUTH_SECURITY_SCHEME_FIELD_NUMBER = 2; + /** + * .a2a.v1.HTTPAuthSecurityScheme http_auth_security_scheme = 2; + * @return Whether the httpAuthSecurityScheme field is set. + */ + @java.lang.Override + public boolean hasHttpAuthSecurityScheme() { + return schemeCase_ == 2; + } + /** + * .a2a.v1.HTTPAuthSecurityScheme http_auth_security_scheme = 2; + * @return The httpAuthSecurityScheme. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme getHttpAuthSecurityScheme() { + if (schemeCase_ == 2) { + return (org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme) scheme_; + } + return org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.getDefaultInstance(); + } + /** + * .a2a.v1.HTTPAuthSecurityScheme http_auth_security_scheme = 2; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.HTTPAuthSecuritySchemeOrBuilder getHttpAuthSecuritySchemeOrBuilder() { + if (schemeCase_ == 2) { + return (org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme) scheme_; + } + return org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.getDefaultInstance(); + } + + public static final int OAUTH2_SECURITY_SCHEME_FIELD_NUMBER = 3; + /** + * .a2a.v1.OAuth2SecurityScheme oauth2_security_scheme = 3; + * @return Whether the oauth2SecurityScheme field is set. + */ + @java.lang.Override + public boolean hasOauth2SecurityScheme() { + return schemeCase_ == 3; + } + /** + * .a2a.v1.OAuth2SecurityScheme oauth2_security_scheme = 3; + * @return The oauth2SecurityScheme. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme getOauth2SecurityScheme() { + if (schemeCase_ == 3) { + return (org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme) scheme_; + } + return org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.getDefaultInstance(); + } + /** + * .a2a.v1.OAuth2SecurityScheme oauth2_security_scheme = 3; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OAuth2SecuritySchemeOrBuilder getOauth2SecuritySchemeOrBuilder() { + if (schemeCase_ == 3) { + return (org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme) scheme_; + } + return org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.getDefaultInstance(); + } + + public static final int OPEN_ID_CONNECT_SECURITY_SCHEME_FIELD_NUMBER = 4; + /** + * .a2a.v1.OpenIdConnectSecurityScheme open_id_connect_security_scheme = 4; + * @return Whether the openIdConnectSecurityScheme field is set. + */ + @java.lang.Override + public boolean hasOpenIdConnectSecurityScheme() { + return schemeCase_ == 4; + } + /** + * .a2a.v1.OpenIdConnectSecurityScheme open_id_connect_security_scheme = 4; + * @return The openIdConnectSecurityScheme. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme getOpenIdConnectSecurityScheme() { + if (schemeCase_ == 4) { + return (org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme) scheme_; + } + return org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.getDefaultInstance(); + } + /** + * .a2a.v1.OpenIdConnectSecurityScheme open_id_connect_security_scheme = 4; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecuritySchemeOrBuilder getOpenIdConnectSecuritySchemeOrBuilder() { + if (schemeCase_ == 4) { + return (org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme) scheme_; + } + return org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.getDefaultInstance(); + } + + public static final int MTLS_SECURITY_SCHEME_FIELD_NUMBER = 5; + /** + * .a2a.v1.MutualTlsSecurityScheme mtls_security_scheme = 5; + * @return Whether the mtlsSecurityScheme field is set. + */ + @java.lang.Override + public boolean hasMtlsSecurityScheme() { + return schemeCase_ == 5; + } + /** + * .a2a.v1.MutualTlsSecurityScheme mtls_security_scheme = 5; + * @return The mtlsSecurityScheme. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme getMtlsSecurityScheme() { + if (schemeCase_ == 5) { + return (org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme) scheme_; + } + return org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.getDefaultInstance(); + } + /** + * .a2a.v1.MutualTlsSecurityScheme mtls_security_scheme = 5; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.MutualTlsSecuritySchemeOrBuilder getMtlsSecuritySchemeOrBuilder() { + if (schemeCase_ == 5) { + return (org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme) scheme_; + } + return org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.getDefaultInstance(); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (schemeCase_ == 1) { + output.writeMessage(1, (org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme) scheme_); + } + if (schemeCase_ == 2) { + output.writeMessage(2, (org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme) scheme_); + } + if (schemeCase_ == 3) { + output.writeMessage(3, (org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme) scheme_); + } + if (schemeCase_ == 4) { + output.writeMessage(4, (org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme) scheme_); + } + if (schemeCase_ == 5) { + output.writeMessage(5, (org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme) scheme_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (schemeCase_ == 1) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, (org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme) scheme_); + } + if (schemeCase_ == 2) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, (org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme) scheme_); + } + if (schemeCase_ == 3) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, (org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme) scheme_); + } + if (schemeCase_ == 4) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, (org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme) scheme_); + } + if (schemeCase_ == 5) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(5, (org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme) scheme_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.SecurityScheme)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.SecurityScheme other = (org.a2aproject.sdk.compat03.grpc.SecurityScheme) obj; + + if (!getSchemeCase().equals(other.getSchemeCase())) return false; + switch (schemeCase_) { + case 1: + if (!getApiKeySecurityScheme() + .equals(other.getApiKeySecurityScheme())) return false; + break; + case 2: + if (!getHttpAuthSecurityScheme() + .equals(other.getHttpAuthSecurityScheme())) return false; + break; + case 3: + if (!getOauth2SecurityScheme() + .equals(other.getOauth2SecurityScheme())) return false; + break; + case 4: + if (!getOpenIdConnectSecurityScheme() + .equals(other.getOpenIdConnectSecurityScheme())) return false; + break; + case 5: + if (!getMtlsSecurityScheme() + .equals(other.getMtlsSecurityScheme())) return false; + break; + case 0: + default: + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + switch (schemeCase_) { + case 1: + hash = (37 * hash) + API_KEY_SECURITY_SCHEME_FIELD_NUMBER; + hash = (53 * hash) + getApiKeySecurityScheme().hashCode(); + break; + case 2: + hash = (37 * hash) + HTTP_AUTH_SECURITY_SCHEME_FIELD_NUMBER; + hash = (53 * hash) + getHttpAuthSecurityScheme().hashCode(); + break; + case 3: + hash = (37 * hash) + OAUTH2_SECURITY_SCHEME_FIELD_NUMBER; + hash = (53 * hash) + getOauth2SecurityScheme().hashCode(); + break; + case 4: + hash = (37 * hash) + OPEN_ID_CONNECT_SECURITY_SCHEME_FIELD_NUMBER; + hash = (53 * hash) + getOpenIdConnectSecurityScheme().hashCode(); + break; + case 5: + hash = (37 * hash) + MTLS_SECURITY_SCHEME_FIELD_NUMBER; + hash = (53 * hash) + getMtlsSecurityScheme().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.SecurityScheme parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.SecurityScheme parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.SecurityScheme parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.SecurityScheme parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.SecurityScheme parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.SecurityScheme parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.SecurityScheme parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.SecurityScheme parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.SecurityScheme parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.SecurityScheme parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.SecurityScheme parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.SecurityScheme parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.SecurityScheme prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.SecurityScheme} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.SecurityScheme) + org.a2aproject.sdk.compat03.grpc.SecuritySchemeOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_SecurityScheme_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_SecurityScheme_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.SecurityScheme.class, org.a2aproject.sdk.compat03.grpc.SecurityScheme.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.SecurityScheme.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + if (apiKeySecuritySchemeBuilder_ != null) { + apiKeySecuritySchemeBuilder_.clear(); + } + if (httpAuthSecuritySchemeBuilder_ != null) { + httpAuthSecuritySchemeBuilder_.clear(); + } + if (oauth2SecuritySchemeBuilder_ != null) { + oauth2SecuritySchemeBuilder_.clear(); + } + if (openIdConnectSecuritySchemeBuilder_ != null) { + openIdConnectSecuritySchemeBuilder_.clear(); + } + if (mtlsSecuritySchemeBuilder_ != null) { + mtlsSecuritySchemeBuilder_.clear(); + } + schemeCase_ = 0; + scheme_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_SecurityScheme_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SecurityScheme getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.SecurityScheme.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SecurityScheme build() { + org.a2aproject.sdk.compat03.grpc.SecurityScheme result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SecurityScheme buildPartial() { + org.a2aproject.sdk.compat03.grpc.SecurityScheme result = new org.a2aproject.sdk.compat03.grpc.SecurityScheme(this); + if (bitField0_ != 0) { buildPartial0(result); } + buildPartialOneofs(result); + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.SecurityScheme result) { + int from_bitField0_ = bitField0_; + } + + private void buildPartialOneofs(org.a2aproject.sdk.compat03.grpc.SecurityScheme result) { + result.schemeCase_ = schemeCase_; + result.scheme_ = this.scheme_; + if (schemeCase_ == 1 && + apiKeySecuritySchemeBuilder_ != null) { + result.scheme_ = apiKeySecuritySchemeBuilder_.build(); + } + if (schemeCase_ == 2 && + httpAuthSecuritySchemeBuilder_ != null) { + result.scheme_ = httpAuthSecuritySchemeBuilder_.build(); + } + if (schemeCase_ == 3 && + oauth2SecuritySchemeBuilder_ != null) { + result.scheme_ = oauth2SecuritySchemeBuilder_.build(); + } + if (schemeCase_ == 4 && + openIdConnectSecuritySchemeBuilder_ != null) { + result.scheme_ = openIdConnectSecuritySchemeBuilder_.build(); + } + if (schemeCase_ == 5 && + mtlsSecuritySchemeBuilder_ != null) { + result.scheme_ = mtlsSecuritySchemeBuilder_.build(); + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.SecurityScheme) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.SecurityScheme)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.SecurityScheme other) { + if (other == org.a2aproject.sdk.compat03.grpc.SecurityScheme.getDefaultInstance()) return this; + switch (other.getSchemeCase()) { + case API_KEY_SECURITY_SCHEME: { + mergeApiKeySecurityScheme(other.getApiKeySecurityScheme()); + break; + } + case HTTP_AUTH_SECURITY_SCHEME: { + mergeHttpAuthSecurityScheme(other.getHttpAuthSecurityScheme()); + break; + } + case OAUTH2_SECURITY_SCHEME: { + mergeOauth2SecurityScheme(other.getOauth2SecurityScheme()); + break; + } + case OPEN_ID_CONNECT_SECURITY_SCHEME: { + mergeOpenIdConnectSecurityScheme(other.getOpenIdConnectSecurityScheme()); + break; + } + case MTLS_SECURITY_SCHEME: { + mergeMtlsSecurityScheme(other.getMtlsSecurityScheme()); + break; + } + case SCHEME_NOT_SET: { + break; + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + input.readMessage( + internalGetApiKeySecuritySchemeFieldBuilder().getBuilder(), + extensionRegistry); + schemeCase_ = 1; + break; + } // case 10 + case 18: { + input.readMessage( + internalGetHttpAuthSecuritySchemeFieldBuilder().getBuilder(), + extensionRegistry); + schemeCase_ = 2; + break; + } // case 18 + case 26: { + input.readMessage( + internalGetOauth2SecuritySchemeFieldBuilder().getBuilder(), + extensionRegistry); + schemeCase_ = 3; + break; + } // case 26 + case 34: { + input.readMessage( + internalGetOpenIdConnectSecuritySchemeFieldBuilder().getBuilder(), + extensionRegistry); + schemeCase_ = 4; + break; + } // case 34 + case 42: { + input.readMessage( + internalGetMtlsSecuritySchemeFieldBuilder().getBuilder(), + extensionRegistry); + schemeCase_ = 5; + break; + } // case 42 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int schemeCase_ = 0; + private java.lang.Object scheme_; + public SchemeCase + getSchemeCase() { + return SchemeCase.forNumber( + schemeCase_); + } + + public Builder clearScheme() { + schemeCase_ = 0; + scheme_ = null; + onChanged(); + return this; + } + + private int bitField0_; + + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme, org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.Builder, org.a2aproject.sdk.compat03.grpc.APIKeySecuritySchemeOrBuilder> apiKeySecuritySchemeBuilder_; + /** + * .a2a.v1.APIKeySecurityScheme api_key_security_scheme = 1; + * @return Whether the apiKeySecurityScheme field is set. + */ + @java.lang.Override + public boolean hasApiKeySecurityScheme() { + return schemeCase_ == 1; + } + /** + * .a2a.v1.APIKeySecurityScheme api_key_security_scheme = 1; + * @return The apiKeySecurityScheme. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme getApiKeySecurityScheme() { + if (apiKeySecuritySchemeBuilder_ == null) { + if (schemeCase_ == 1) { + return (org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme) scheme_; + } + return org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.getDefaultInstance(); + } else { + if (schemeCase_ == 1) { + return apiKeySecuritySchemeBuilder_.getMessage(); + } + return org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.getDefaultInstance(); + } + } + /** + * .a2a.v1.APIKeySecurityScheme api_key_security_scheme = 1; + */ + public Builder setApiKeySecurityScheme(org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme value) { + if (apiKeySecuritySchemeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + scheme_ = value; + onChanged(); + } else { + apiKeySecuritySchemeBuilder_.setMessage(value); + } + schemeCase_ = 1; + return this; + } + /** + * .a2a.v1.APIKeySecurityScheme api_key_security_scheme = 1; + */ + public Builder setApiKeySecurityScheme( + org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.Builder builderForValue) { + if (apiKeySecuritySchemeBuilder_ == null) { + scheme_ = builderForValue.build(); + onChanged(); + } else { + apiKeySecuritySchemeBuilder_.setMessage(builderForValue.build()); + } + schemeCase_ = 1; + return this; + } + /** + * .a2a.v1.APIKeySecurityScheme api_key_security_scheme = 1; + */ + public Builder mergeApiKeySecurityScheme(org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme value) { + if (apiKeySecuritySchemeBuilder_ == null) { + if (schemeCase_ == 1 && + scheme_ != org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.getDefaultInstance()) { + scheme_ = org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.newBuilder((org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme) scheme_) + .mergeFrom(value).buildPartial(); + } else { + scheme_ = value; + } + onChanged(); + } else { + if (schemeCase_ == 1) { + apiKeySecuritySchemeBuilder_.mergeFrom(value); + } else { + apiKeySecuritySchemeBuilder_.setMessage(value); + } + } + schemeCase_ = 1; + return this; + } + /** + * .a2a.v1.APIKeySecurityScheme api_key_security_scheme = 1; + */ + public Builder clearApiKeySecurityScheme() { + if (apiKeySecuritySchemeBuilder_ == null) { + if (schemeCase_ == 1) { + schemeCase_ = 0; + scheme_ = null; + onChanged(); + } + } else { + if (schemeCase_ == 1) { + schemeCase_ = 0; + scheme_ = null; + } + apiKeySecuritySchemeBuilder_.clear(); + } + return this; + } + /** + * .a2a.v1.APIKeySecurityScheme api_key_security_scheme = 1; + */ + public org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.Builder getApiKeySecuritySchemeBuilder() { + return internalGetApiKeySecuritySchemeFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.APIKeySecurityScheme api_key_security_scheme = 1; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.APIKeySecuritySchemeOrBuilder getApiKeySecuritySchemeOrBuilder() { + if ((schemeCase_ == 1) && (apiKeySecuritySchemeBuilder_ != null)) { + return apiKeySecuritySchemeBuilder_.getMessageOrBuilder(); + } else { + if (schemeCase_ == 1) { + return (org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme) scheme_; + } + return org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.getDefaultInstance(); + } + } + /** + * .a2a.v1.APIKeySecurityScheme api_key_security_scheme = 1; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme, org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.Builder, org.a2aproject.sdk.compat03.grpc.APIKeySecuritySchemeOrBuilder> + internalGetApiKeySecuritySchemeFieldBuilder() { + if (apiKeySecuritySchemeBuilder_ == null) { + if (!(schemeCase_ == 1)) { + scheme_ = org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.getDefaultInstance(); + } + apiKeySecuritySchemeBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme, org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.Builder, org.a2aproject.sdk.compat03.grpc.APIKeySecuritySchemeOrBuilder>( + (org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme) scheme_, + getParentForChildren(), + isClean()); + scheme_ = null; + } + schemeCase_ = 1; + onChanged(); + return apiKeySecuritySchemeBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme, org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.Builder, org.a2aproject.sdk.compat03.grpc.HTTPAuthSecuritySchemeOrBuilder> httpAuthSecuritySchemeBuilder_; + /** + * .a2a.v1.HTTPAuthSecurityScheme http_auth_security_scheme = 2; + * @return Whether the httpAuthSecurityScheme field is set. + */ + @java.lang.Override + public boolean hasHttpAuthSecurityScheme() { + return schemeCase_ == 2; + } + /** + * .a2a.v1.HTTPAuthSecurityScheme http_auth_security_scheme = 2; + * @return The httpAuthSecurityScheme. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme getHttpAuthSecurityScheme() { + if (httpAuthSecuritySchemeBuilder_ == null) { + if (schemeCase_ == 2) { + return (org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme) scheme_; + } + return org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.getDefaultInstance(); + } else { + if (schemeCase_ == 2) { + return httpAuthSecuritySchemeBuilder_.getMessage(); + } + return org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.getDefaultInstance(); + } + } + /** + * .a2a.v1.HTTPAuthSecurityScheme http_auth_security_scheme = 2; + */ + public Builder setHttpAuthSecurityScheme(org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme value) { + if (httpAuthSecuritySchemeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + scheme_ = value; + onChanged(); + } else { + httpAuthSecuritySchemeBuilder_.setMessage(value); + } + schemeCase_ = 2; + return this; + } + /** + * .a2a.v1.HTTPAuthSecurityScheme http_auth_security_scheme = 2; + */ + public Builder setHttpAuthSecurityScheme( + org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.Builder builderForValue) { + if (httpAuthSecuritySchemeBuilder_ == null) { + scheme_ = builderForValue.build(); + onChanged(); + } else { + httpAuthSecuritySchemeBuilder_.setMessage(builderForValue.build()); + } + schemeCase_ = 2; + return this; + } + /** + * .a2a.v1.HTTPAuthSecurityScheme http_auth_security_scheme = 2; + */ + public Builder mergeHttpAuthSecurityScheme(org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme value) { + if (httpAuthSecuritySchemeBuilder_ == null) { + if (schemeCase_ == 2 && + scheme_ != org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.getDefaultInstance()) { + scheme_ = org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.newBuilder((org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme) scheme_) + .mergeFrom(value).buildPartial(); + } else { + scheme_ = value; + } + onChanged(); + } else { + if (schemeCase_ == 2) { + httpAuthSecuritySchemeBuilder_.mergeFrom(value); + } else { + httpAuthSecuritySchemeBuilder_.setMessage(value); + } + } + schemeCase_ = 2; + return this; + } + /** + * .a2a.v1.HTTPAuthSecurityScheme http_auth_security_scheme = 2; + */ + public Builder clearHttpAuthSecurityScheme() { + if (httpAuthSecuritySchemeBuilder_ == null) { + if (schemeCase_ == 2) { + schemeCase_ = 0; + scheme_ = null; + onChanged(); + } + } else { + if (schemeCase_ == 2) { + schemeCase_ = 0; + scheme_ = null; + } + httpAuthSecuritySchemeBuilder_.clear(); + } + return this; + } + /** + * .a2a.v1.HTTPAuthSecurityScheme http_auth_security_scheme = 2; + */ + public org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.Builder getHttpAuthSecuritySchemeBuilder() { + return internalGetHttpAuthSecuritySchemeFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.HTTPAuthSecurityScheme http_auth_security_scheme = 2; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.HTTPAuthSecuritySchemeOrBuilder getHttpAuthSecuritySchemeOrBuilder() { + if ((schemeCase_ == 2) && (httpAuthSecuritySchemeBuilder_ != null)) { + return httpAuthSecuritySchemeBuilder_.getMessageOrBuilder(); + } else { + if (schemeCase_ == 2) { + return (org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme) scheme_; + } + return org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.getDefaultInstance(); + } + } + /** + * .a2a.v1.HTTPAuthSecurityScheme http_auth_security_scheme = 2; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme, org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.Builder, org.a2aproject.sdk.compat03.grpc.HTTPAuthSecuritySchemeOrBuilder> + internalGetHttpAuthSecuritySchemeFieldBuilder() { + if (httpAuthSecuritySchemeBuilder_ == null) { + if (!(schemeCase_ == 2)) { + scheme_ = org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.getDefaultInstance(); + } + httpAuthSecuritySchemeBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme, org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.Builder, org.a2aproject.sdk.compat03.grpc.HTTPAuthSecuritySchemeOrBuilder>( + (org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme) scheme_, + getParentForChildren(), + isClean()); + scheme_ = null; + } + schemeCase_ = 2; + onChanged(); + return httpAuthSecuritySchemeBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme, org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.Builder, org.a2aproject.sdk.compat03.grpc.OAuth2SecuritySchemeOrBuilder> oauth2SecuritySchemeBuilder_; + /** + * .a2a.v1.OAuth2SecurityScheme oauth2_security_scheme = 3; + * @return Whether the oauth2SecurityScheme field is set. + */ + @java.lang.Override + public boolean hasOauth2SecurityScheme() { + return schemeCase_ == 3; + } + /** + * .a2a.v1.OAuth2SecurityScheme oauth2_security_scheme = 3; + * @return The oauth2SecurityScheme. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme getOauth2SecurityScheme() { + if (oauth2SecuritySchemeBuilder_ == null) { + if (schemeCase_ == 3) { + return (org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme) scheme_; + } + return org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.getDefaultInstance(); + } else { + if (schemeCase_ == 3) { + return oauth2SecuritySchemeBuilder_.getMessage(); + } + return org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.getDefaultInstance(); + } + } + /** + * .a2a.v1.OAuth2SecurityScheme oauth2_security_scheme = 3; + */ + public Builder setOauth2SecurityScheme(org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme value) { + if (oauth2SecuritySchemeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + scheme_ = value; + onChanged(); + } else { + oauth2SecuritySchemeBuilder_.setMessage(value); + } + schemeCase_ = 3; + return this; + } + /** + * .a2a.v1.OAuth2SecurityScheme oauth2_security_scheme = 3; + */ + public Builder setOauth2SecurityScheme( + org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.Builder builderForValue) { + if (oauth2SecuritySchemeBuilder_ == null) { + scheme_ = builderForValue.build(); + onChanged(); + } else { + oauth2SecuritySchemeBuilder_.setMessage(builderForValue.build()); + } + schemeCase_ = 3; + return this; + } + /** + * .a2a.v1.OAuth2SecurityScheme oauth2_security_scheme = 3; + */ + public Builder mergeOauth2SecurityScheme(org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme value) { + if (oauth2SecuritySchemeBuilder_ == null) { + if (schemeCase_ == 3 && + scheme_ != org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.getDefaultInstance()) { + scheme_ = org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.newBuilder((org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme) scheme_) + .mergeFrom(value).buildPartial(); + } else { + scheme_ = value; + } + onChanged(); + } else { + if (schemeCase_ == 3) { + oauth2SecuritySchemeBuilder_.mergeFrom(value); + } else { + oauth2SecuritySchemeBuilder_.setMessage(value); + } + } + schemeCase_ = 3; + return this; + } + /** + * .a2a.v1.OAuth2SecurityScheme oauth2_security_scheme = 3; + */ + public Builder clearOauth2SecurityScheme() { + if (oauth2SecuritySchemeBuilder_ == null) { + if (schemeCase_ == 3) { + schemeCase_ = 0; + scheme_ = null; + onChanged(); + } + } else { + if (schemeCase_ == 3) { + schemeCase_ = 0; + scheme_ = null; + } + oauth2SecuritySchemeBuilder_.clear(); + } + return this; + } + /** + * .a2a.v1.OAuth2SecurityScheme oauth2_security_scheme = 3; + */ + public org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.Builder getOauth2SecuritySchemeBuilder() { + return internalGetOauth2SecuritySchemeFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.OAuth2SecurityScheme oauth2_security_scheme = 3; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OAuth2SecuritySchemeOrBuilder getOauth2SecuritySchemeOrBuilder() { + if ((schemeCase_ == 3) && (oauth2SecuritySchemeBuilder_ != null)) { + return oauth2SecuritySchemeBuilder_.getMessageOrBuilder(); + } else { + if (schemeCase_ == 3) { + return (org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme) scheme_; + } + return org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.getDefaultInstance(); + } + } + /** + * .a2a.v1.OAuth2SecurityScheme oauth2_security_scheme = 3; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme, org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.Builder, org.a2aproject.sdk.compat03.grpc.OAuth2SecuritySchemeOrBuilder> + internalGetOauth2SecuritySchemeFieldBuilder() { + if (oauth2SecuritySchemeBuilder_ == null) { + if (!(schemeCase_ == 3)) { + scheme_ = org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.getDefaultInstance(); + } + oauth2SecuritySchemeBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme, org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.Builder, org.a2aproject.sdk.compat03.grpc.OAuth2SecuritySchemeOrBuilder>( + (org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme) scheme_, + getParentForChildren(), + isClean()); + scheme_ = null; + } + schemeCase_ = 3; + onChanged(); + return oauth2SecuritySchemeBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme, org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.Builder, org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecuritySchemeOrBuilder> openIdConnectSecuritySchemeBuilder_; + /** + * .a2a.v1.OpenIdConnectSecurityScheme open_id_connect_security_scheme = 4; + * @return Whether the openIdConnectSecurityScheme field is set. + */ + @java.lang.Override + public boolean hasOpenIdConnectSecurityScheme() { + return schemeCase_ == 4; + } + /** + * .a2a.v1.OpenIdConnectSecurityScheme open_id_connect_security_scheme = 4; + * @return The openIdConnectSecurityScheme. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme getOpenIdConnectSecurityScheme() { + if (openIdConnectSecuritySchemeBuilder_ == null) { + if (schemeCase_ == 4) { + return (org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme) scheme_; + } + return org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.getDefaultInstance(); + } else { + if (schemeCase_ == 4) { + return openIdConnectSecuritySchemeBuilder_.getMessage(); + } + return org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.getDefaultInstance(); + } + } + /** + * .a2a.v1.OpenIdConnectSecurityScheme open_id_connect_security_scheme = 4; + */ + public Builder setOpenIdConnectSecurityScheme(org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme value) { + if (openIdConnectSecuritySchemeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + scheme_ = value; + onChanged(); + } else { + openIdConnectSecuritySchemeBuilder_.setMessage(value); + } + schemeCase_ = 4; + return this; + } + /** + * .a2a.v1.OpenIdConnectSecurityScheme open_id_connect_security_scheme = 4; + */ + public Builder setOpenIdConnectSecurityScheme( + org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.Builder builderForValue) { + if (openIdConnectSecuritySchemeBuilder_ == null) { + scheme_ = builderForValue.build(); + onChanged(); + } else { + openIdConnectSecuritySchemeBuilder_.setMessage(builderForValue.build()); + } + schemeCase_ = 4; + return this; + } + /** + * .a2a.v1.OpenIdConnectSecurityScheme open_id_connect_security_scheme = 4; + */ + public Builder mergeOpenIdConnectSecurityScheme(org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme value) { + if (openIdConnectSecuritySchemeBuilder_ == null) { + if (schemeCase_ == 4 && + scheme_ != org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.getDefaultInstance()) { + scheme_ = org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.newBuilder((org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme) scheme_) + .mergeFrom(value).buildPartial(); + } else { + scheme_ = value; + } + onChanged(); + } else { + if (schemeCase_ == 4) { + openIdConnectSecuritySchemeBuilder_.mergeFrom(value); + } else { + openIdConnectSecuritySchemeBuilder_.setMessage(value); + } + } + schemeCase_ = 4; + return this; + } + /** + * .a2a.v1.OpenIdConnectSecurityScheme open_id_connect_security_scheme = 4; + */ + public Builder clearOpenIdConnectSecurityScheme() { + if (openIdConnectSecuritySchemeBuilder_ == null) { + if (schemeCase_ == 4) { + schemeCase_ = 0; + scheme_ = null; + onChanged(); + } + } else { + if (schemeCase_ == 4) { + schemeCase_ = 0; + scheme_ = null; + } + openIdConnectSecuritySchemeBuilder_.clear(); + } + return this; + } + /** + * .a2a.v1.OpenIdConnectSecurityScheme open_id_connect_security_scheme = 4; + */ + public org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.Builder getOpenIdConnectSecuritySchemeBuilder() { + return internalGetOpenIdConnectSecuritySchemeFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.OpenIdConnectSecurityScheme open_id_connect_security_scheme = 4; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecuritySchemeOrBuilder getOpenIdConnectSecuritySchemeOrBuilder() { + if ((schemeCase_ == 4) && (openIdConnectSecuritySchemeBuilder_ != null)) { + return openIdConnectSecuritySchemeBuilder_.getMessageOrBuilder(); + } else { + if (schemeCase_ == 4) { + return (org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme) scheme_; + } + return org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.getDefaultInstance(); + } + } + /** + * .a2a.v1.OpenIdConnectSecurityScheme open_id_connect_security_scheme = 4; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme, org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.Builder, org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecuritySchemeOrBuilder> + internalGetOpenIdConnectSecuritySchemeFieldBuilder() { + if (openIdConnectSecuritySchemeBuilder_ == null) { + if (!(schemeCase_ == 4)) { + scheme_ = org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.getDefaultInstance(); + } + openIdConnectSecuritySchemeBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme, org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.Builder, org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecuritySchemeOrBuilder>( + (org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme) scheme_, + getParentForChildren(), + isClean()); + scheme_ = null; + } + schemeCase_ = 4; + onChanged(); + return openIdConnectSecuritySchemeBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme, org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.Builder, org.a2aproject.sdk.compat03.grpc.MutualTlsSecuritySchemeOrBuilder> mtlsSecuritySchemeBuilder_; + /** + * .a2a.v1.MutualTlsSecurityScheme mtls_security_scheme = 5; + * @return Whether the mtlsSecurityScheme field is set. + */ + @java.lang.Override + public boolean hasMtlsSecurityScheme() { + return schemeCase_ == 5; + } + /** + * .a2a.v1.MutualTlsSecurityScheme mtls_security_scheme = 5; + * @return The mtlsSecurityScheme. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme getMtlsSecurityScheme() { + if (mtlsSecuritySchemeBuilder_ == null) { + if (schemeCase_ == 5) { + return (org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme) scheme_; + } + return org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.getDefaultInstance(); + } else { + if (schemeCase_ == 5) { + return mtlsSecuritySchemeBuilder_.getMessage(); + } + return org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.getDefaultInstance(); + } + } + /** + * .a2a.v1.MutualTlsSecurityScheme mtls_security_scheme = 5; + */ + public Builder setMtlsSecurityScheme(org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme value) { + if (mtlsSecuritySchemeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + scheme_ = value; + onChanged(); + } else { + mtlsSecuritySchemeBuilder_.setMessage(value); + } + schemeCase_ = 5; + return this; + } + /** + * .a2a.v1.MutualTlsSecurityScheme mtls_security_scheme = 5; + */ + public Builder setMtlsSecurityScheme( + org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.Builder builderForValue) { + if (mtlsSecuritySchemeBuilder_ == null) { + scheme_ = builderForValue.build(); + onChanged(); + } else { + mtlsSecuritySchemeBuilder_.setMessage(builderForValue.build()); + } + schemeCase_ = 5; + return this; + } + /** + * .a2a.v1.MutualTlsSecurityScheme mtls_security_scheme = 5; + */ + public Builder mergeMtlsSecurityScheme(org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme value) { + if (mtlsSecuritySchemeBuilder_ == null) { + if (schemeCase_ == 5 && + scheme_ != org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.getDefaultInstance()) { + scheme_ = org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.newBuilder((org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme) scheme_) + .mergeFrom(value).buildPartial(); + } else { + scheme_ = value; + } + onChanged(); + } else { + if (schemeCase_ == 5) { + mtlsSecuritySchemeBuilder_.mergeFrom(value); + } else { + mtlsSecuritySchemeBuilder_.setMessage(value); + } + } + schemeCase_ = 5; + return this; + } + /** + * .a2a.v1.MutualTlsSecurityScheme mtls_security_scheme = 5; + */ + public Builder clearMtlsSecurityScheme() { + if (mtlsSecuritySchemeBuilder_ == null) { + if (schemeCase_ == 5) { + schemeCase_ = 0; + scheme_ = null; + onChanged(); + } + } else { + if (schemeCase_ == 5) { + schemeCase_ = 0; + scheme_ = null; + } + mtlsSecuritySchemeBuilder_.clear(); + } + return this; + } + /** + * .a2a.v1.MutualTlsSecurityScheme mtls_security_scheme = 5; + */ + public org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.Builder getMtlsSecuritySchemeBuilder() { + return internalGetMtlsSecuritySchemeFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.MutualTlsSecurityScheme mtls_security_scheme = 5; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.MutualTlsSecuritySchemeOrBuilder getMtlsSecuritySchemeOrBuilder() { + if ((schemeCase_ == 5) && (mtlsSecuritySchemeBuilder_ != null)) { + return mtlsSecuritySchemeBuilder_.getMessageOrBuilder(); + } else { + if (schemeCase_ == 5) { + return (org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme) scheme_; + } + return org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.getDefaultInstance(); + } + } + /** + * .a2a.v1.MutualTlsSecurityScheme mtls_security_scheme = 5; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme, org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.Builder, org.a2aproject.sdk.compat03.grpc.MutualTlsSecuritySchemeOrBuilder> + internalGetMtlsSecuritySchemeFieldBuilder() { + if (mtlsSecuritySchemeBuilder_ == null) { + if (!(schemeCase_ == 5)) { + scheme_ = org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.getDefaultInstance(); + } + mtlsSecuritySchemeBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme, org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.Builder, org.a2aproject.sdk.compat03.grpc.MutualTlsSecuritySchemeOrBuilder>( + (org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme) scheme_, + getParentForChildren(), + isClean()); + scheme_ = null; + } + schemeCase_ = 5; + onChanged(); + return mtlsSecuritySchemeBuilder_; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.SecurityScheme) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.SecurityScheme) + private static final org.a2aproject.sdk.compat03.grpc.SecurityScheme DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.SecurityScheme(); + } + + public static org.a2aproject.sdk.compat03.grpc.SecurityScheme getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SecurityScheme parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SecurityScheme getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SecuritySchemeOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SecuritySchemeOrBuilder.java new file mode 100644 index 000000000..d7b60e978 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SecuritySchemeOrBuilder.java @@ -0,0 +1,89 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface SecuritySchemeOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.SecurityScheme) + com.google.protobuf.MessageOrBuilder { + + /** + * .a2a.v1.APIKeySecurityScheme api_key_security_scheme = 1; + * @return Whether the apiKeySecurityScheme field is set. + */ + boolean hasApiKeySecurityScheme(); + /** + * .a2a.v1.APIKeySecurityScheme api_key_security_scheme = 1; + * @return The apiKeySecurityScheme. + */ + org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme getApiKeySecurityScheme(); + /** + * .a2a.v1.APIKeySecurityScheme api_key_security_scheme = 1; + */ + org.a2aproject.sdk.compat03.grpc.APIKeySecuritySchemeOrBuilder getApiKeySecuritySchemeOrBuilder(); + + /** + * .a2a.v1.HTTPAuthSecurityScheme http_auth_security_scheme = 2; + * @return Whether the httpAuthSecurityScheme field is set. + */ + boolean hasHttpAuthSecurityScheme(); + /** + * .a2a.v1.HTTPAuthSecurityScheme http_auth_security_scheme = 2; + * @return The httpAuthSecurityScheme. + */ + org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme getHttpAuthSecurityScheme(); + /** + * .a2a.v1.HTTPAuthSecurityScheme http_auth_security_scheme = 2; + */ + org.a2aproject.sdk.compat03.grpc.HTTPAuthSecuritySchemeOrBuilder getHttpAuthSecuritySchemeOrBuilder(); + + /** + * .a2a.v1.OAuth2SecurityScheme oauth2_security_scheme = 3; + * @return Whether the oauth2SecurityScheme field is set. + */ + boolean hasOauth2SecurityScheme(); + /** + * .a2a.v1.OAuth2SecurityScheme oauth2_security_scheme = 3; + * @return The oauth2SecurityScheme. + */ + org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme getOauth2SecurityScheme(); + /** + * .a2a.v1.OAuth2SecurityScheme oauth2_security_scheme = 3; + */ + org.a2aproject.sdk.compat03.grpc.OAuth2SecuritySchemeOrBuilder getOauth2SecuritySchemeOrBuilder(); + + /** + * .a2a.v1.OpenIdConnectSecurityScheme open_id_connect_security_scheme = 4; + * @return Whether the openIdConnectSecurityScheme field is set. + */ + boolean hasOpenIdConnectSecurityScheme(); + /** + * .a2a.v1.OpenIdConnectSecurityScheme open_id_connect_security_scheme = 4; + * @return The openIdConnectSecurityScheme. + */ + org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme getOpenIdConnectSecurityScheme(); + /** + * .a2a.v1.OpenIdConnectSecurityScheme open_id_connect_security_scheme = 4; + */ + org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecuritySchemeOrBuilder getOpenIdConnectSecuritySchemeOrBuilder(); + + /** + * .a2a.v1.MutualTlsSecurityScheme mtls_security_scheme = 5; + * @return Whether the mtlsSecurityScheme field is set. + */ + boolean hasMtlsSecurityScheme(); + /** + * .a2a.v1.MutualTlsSecurityScheme mtls_security_scheme = 5; + * @return The mtlsSecurityScheme. + */ + org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme getMtlsSecurityScheme(); + /** + * .a2a.v1.MutualTlsSecurityScheme mtls_security_scheme = 5; + */ + org.a2aproject.sdk.compat03.grpc.MutualTlsSecuritySchemeOrBuilder getMtlsSecuritySchemeOrBuilder(); + + org.a2aproject.sdk.compat03.grpc.SecurityScheme.SchemeCase getSchemeCase(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SendMessageConfiguration.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SendMessageConfiguration.java new file mode 100644 index 000000000..38b6c6aad --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SendMessageConfiguration.java @@ -0,0 +1,1037 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * Configuration of a send message request.
+ * 
+ * + * Protobuf type {@code a2a.v1.SendMessageConfiguration} + */ +@com.google.protobuf.Generated +public final class SendMessageConfiguration extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.SendMessageConfiguration) + SendMessageConfigurationOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "SendMessageConfiguration"); + } + // Use SendMessageConfiguration.newBuilder() to construct. + private SendMessageConfiguration(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private SendMessageConfiguration() { + acceptedOutputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_SendMessageConfiguration_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_SendMessageConfiguration_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration.class, org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration.Builder.class); + } + + private int bitField0_; + public static final int ACCEPTED_OUTPUT_MODES_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList acceptedOutputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + /** + *
+   * The output modes that the agent is expected to respond with.
+   * 
+ * + * repeated string accepted_output_modes = 1; + * @return A list containing the acceptedOutputModes. + */ + public com.google.protobuf.ProtocolStringList + getAcceptedOutputModesList() { + return acceptedOutputModes_; + } + /** + *
+   * The output modes that the agent is expected to respond with.
+   * 
+ * + * repeated string accepted_output_modes = 1; + * @return The count of acceptedOutputModes. + */ + public int getAcceptedOutputModesCount() { + return acceptedOutputModes_.size(); + } + /** + *
+   * The output modes that the agent is expected to respond with.
+   * 
+ * + * repeated string accepted_output_modes = 1; + * @param index The index of the element to return. + * @return The acceptedOutputModes at the given index. + */ + public java.lang.String getAcceptedOutputModes(int index) { + return acceptedOutputModes_.get(index); + } + /** + *
+   * The output modes that the agent is expected to respond with.
+   * 
+ * + * repeated string accepted_output_modes = 1; + * @param index The index of the value to return. + * @return The bytes of the acceptedOutputModes at the given index. + */ + public com.google.protobuf.ByteString + getAcceptedOutputModesBytes(int index) { + return acceptedOutputModes_.getByteString(index); + } + + public static final int PUSH_NOTIFICATION_FIELD_NUMBER = 2; + private org.a2aproject.sdk.compat03.grpc.PushNotificationConfig pushNotification_; + /** + *
+   * A configuration of a webhook that can be used to receive updates
+   * 
+ * + * .a2a.v1.PushNotificationConfig push_notification = 2; + * @return Whether the pushNotification field is set. + */ + @java.lang.Override + public boolean hasPushNotification() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + *
+   * A configuration of a webhook that can be used to receive updates
+   * 
+ * + * .a2a.v1.PushNotificationConfig push_notification = 2; + * @return The pushNotification. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.PushNotificationConfig getPushNotification() { + return pushNotification_ == null ? org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.getDefaultInstance() : pushNotification_; + } + /** + *
+   * A configuration of a webhook that can be used to receive updates
+   * 
+ * + * .a2a.v1.PushNotificationConfig push_notification = 2; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.PushNotificationConfigOrBuilder getPushNotificationOrBuilder() { + return pushNotification_ == null ? org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.getDefaultInstance() : pushNotification_; + } + + public static final int HISTORY_LENGTH_FIELD_NUMBER = 3; + private int historyLength_ = 0; + /** + *
+   * The maximum number of messages to include in the history. if 0, the
+   * history will be unlimited.
+   * 
+ * + * int32 history_length = 3; + * @return The historyLength. + */ + @java.lang.Override + public int getHistoryLength() { + return historyLength_; + } + + public static final int BLOCKING_FIELD_NUMBER = 4; + private boolean blocking_ = false; + /** + *
+   * If true, the message will be blocking until the task is completed. If
+   * false, the message will be non-blocking and the task will be returned
+   * immediately. It is the caller's responsibility to check for any task
+   * updates.
+   * 
+ * + * bool blocking = 4; + * @return The blocking. + */ + @java.lang.Override + public boolean getBlocking() { + return blocking_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + for (int i = 0; i < acceptedOutputModes_.size(); i++) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, acceptedOutputModes_.getRaw(i)); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(2, getPushNotification()); + } + if (historyLength_ != 0) { + output.writeInt32(3, historyLength_); + } + if (blocking_ != false) { + output.writeBool(4, blocking_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + for (int i = 0; i < acceptedOutputModes_.size(); i++) { + dataSize += computeStringSizeNoTag(acceptedOutputModes_.getRaw(i)); + } + size += dataSize; + size += 1 * getAcceptedOutputModesList().size(); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, getPushNotification()); + } + if (historyLength_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(3, historyLength_); + } + if (blocking_ != false) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(4, blocking_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration other = (org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration) obj; + + if (!getAcceptedOutputModesList() + .equals(other.getAcceptedOutputModesList())) return false; + if (hasPushNotification() != other.hasPushNotification()) return false; + if (hasPushNotification()) { + if (!getPushNotification() + .equals(other.getPushNotification())) return false; + } + if (getHistoryLength() + != other.getHistoryLength()) return false; + if (getBlocking() + != other.getBlocking()) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getAcceptedOutputModesCount() > 0) { + hash = (37 * hash) + ACCEPTED_OUTPUT_MODES_FIELD_NUMBER; + hash = (53 * hash) + getAcceptedOutputModesList().hashCode(); + } + if (hasPushNotification()) { + hash = (37 * hash) + PUSH_NOTIFICATION_FIELD_NUMBER; + hash = (53 * hash) + getPushNotification().hashCode(); + } + hash = (37 * hash) + HISTORY_LENGTH_FIELD_NUMBER; + hash = (53 * hash) + getHistoryLength(); + hash = (37 * hash) + BLOCKING_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( + getBlocking()); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * Configuration of a send message request.
+   * 
+ * + * Protobuf type {@code a2a.v1.SendMessageConfiguration} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.SendMessageConfiguration) + org.a2aproject.sdk.compat03.grpc.SendMessageConfigurationOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_SendMessageConfiguration_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_SendMessageConfiguration_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration.class, org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage + .alwaysUseFieldBuilders) { + internalGetPushNotificationFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + acceptedOutputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + pushNotification_ = null; + if (pushNotificationBuilder_ != null) { + pushNotificationBuilder_.dispose(); + pushNotificationBuilder_ = null; + } + historyLength_ = 0; + blocking_ = false; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_SendMessageConfiguration_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration build() { + org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration buildPartial() { + org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration result = new org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + acceptedOutputModes_.makeImmutable(); + result.acceptedOutputModes_ = acceptedOutputModes_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.pushNotification_ = pushNotificationBuilder_ == null + ? pushNotification_ + : pushNotificationBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.historyLength_ = historyLength_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.blocking_ = blocking_; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration other) { + if (other == org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration.getDefaultInstance()) return this; + if (!other.acceptedOutputModes_.isEmpty()) { + if (acceptedOutputModes_.isEmpty()) { + acceptedOutputModes_ = other.acceptedOutputModes_; + bitField0_ |= 0x00000001; + } else { + ensureAcceptedOutputModesIsMutable(); + acceptedOutputModes_.addAll(other.acceptedOutputModes_); + } + onChanged(); + } + if (other.hasPushNotification()) { + mergePushNotification(other.getPushNotification()); + } + if (other.getHistoryLength() != 0) { + setHistoryLength(other.getHistoryLength()); + } + if (other.getBlocking() != false) { + setBlocking(other.getBlocking()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + ensureAcceptedOutputModesIsMutable(); + acceptedOutputModes_.add(s); + break; + } // case 10 + case 18: { + input.readMessage( + internalGetPushNotificationFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 24: { + historyLength_ = input.readInt32(); + bitField0_ |= 0x00000004; + break; + } // case 24 + case 32: { + blocking_ = input.readBool(); + bitField0_ |= 0x00000008; + break; + } // case 32 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private com.google.protobuf.LazyStringArrayList acceptedOutputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + private void ensureAcceptedOutputModesIsMutable() { + if (!acceptedOutputModes_.isModifiable()) { + acceptedOutputModes_ = new com.google.protobuf.LazyStringArrayList(acceptedOutputModes_); + } + bitField0_ |= 0x00000001; + } + /** + *
+     * The output modes that the agent is expected to respond with.
+     * 
+ * + * repeated string accepted_output_modes = 1; + * @return A list containing the acceptedOutputModes. + */ + public com.google.protobuf.ProtocolStringList + getAcceptedOutputModesList() { + acceptedOutputModes_.makeImmutable(); + return acceptedOutputModes_; + } + /** + *
+     * The output modes that the agent is expected to respond with.
+     * 
+ * + * repeated string accepted_output_modes = 1; + * @return The count of acceptedOutputModes. + */ + public int getAcceptedOutputModesCount() { + return acceptedOutputModes_.size(); + } + /** + *
+     * The output modes that the agent is expected to respond with.
+     * 
+ * + * repeated string accepted_output_modes = 1; + * @param index The index of the element to return. + * @return The acceptedOutputModes at the given index. + */ + public java.lang.String getAcceptedOutputModes(int index) { + return acceptedOutputModes_.get(index); + } + /** + *
+     * The output modes that the agent is expected to respond with.
+     * 
+ * + * repeated string accepted_output_modes = 1; + * @param index The index of the value to return. + * @return The bytes of the acceptedOutputModes at the given index. + */ + public com.google.protobuf.ByteString + getAcceptedOutputModesBytes(int index) { + return acceptedOutputModes_.getByteString(index); + } + /** + *
+     * The output modes that the agent is expected to respond with.
+     * 
+ * + * repeated string accepted_output_modes = 1; + * @param index The index to set the value at. + * @param value The acceptedOutputModes to set. + * @return This builder for chaining. + */ + public Builder setAcceptedOutputModes( + int index, java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureAcceptedOutputModesIsMutable(); + acceptedOutputModes_.set(index, value); + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * The output modes that the agent is expected to respond with.
+     * 
+ * + * repeated string accepted_output_modes = 1; + * @param value The acceptedOutputModes to add. + * @return This builder for chaining. + */ + public Builder addAcceptedOutputModes( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureAcceptedOutputModesIsMutable(); + acceptedOutputModes_.add(value); + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * The output modes that the agent is expected to respond with.
+     * 
+ * + * repeated string accepted_output_modes = 1; + * @param values The acceptedOutputModes to add. + * @return This builder for chaining. + */ + public Builder addAllAcceptedOutputModes( + java.lang.Iterable values) { + ensureAcceptedOutputModesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, acceptedOutputModes_); + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * The output modes that the agent is expected to respond with.
+     * 
+ * + * repeated string accepted_output_modes = 1; + * @return This builder for chaining. + */ + public Builder clearAcceptedOutputModes() { + acceptedOutputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001);; + onChanged(); + return this; + } + /** + *
+     * The output modes that the agent is expected to respond with.
+     * 
+ * + * repeated string accepted_output_modes = 1; + * @param value The bytes of the acceptedOutputModes to add. + * @return This builder for chaining. + */ + public Builder addAcceptedOutputModesBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + ensureAcceptedOutputModesIsMutable(); + acceptedOutputModes_.add(value); + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private org.a2aproject.sdk.compat03.grpc.PushNotificationConfig pushNotification_; + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig, org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.Builder, org.a2aproject.sdk.compat03.grpc.PushNotificationConfigOrBuilder> pushNotificationBuilder_; + /** + *
+     * A configuration of a webhook that can be used to receive updates
+     * 
+ * + * .a2a.v1.PushNotificationConfig push_notification = 2; + * @return Whether the pushNotification field is set. + */ + public boolean hasPushNotification() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + *
+     * A configuration of a webhook that can be used to receive updates
+     * 
+ * + * .a2a.v1.PushNotificationConfig push_notification = 2; + * @return The pushNotification. + */ + public org.a2aproject.sdk.compat03.grpc.PushNotificationConfig getPushNotification() { + if (pushNotificationBuilder_ == null) { + return pushNotification_ == null ? org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.getDefaultInstance() : pushNotification_; + } else { + return pushNotificationBuilder_.getMessage(); + } + } + /** + *
+     * A configuration of a webhook that can be used to receive updates
+     * 
+ * + * .a2a.v1.PushNotificationConfig push_notification = 2; + */ + public Builder setPushNotification(org.a2aproject.sdk.compat03.grpc.PushNotificationConfig value) { + if (pushNotificationBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + pushNotification_ = value; + } else { + pushNotificationBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * A configuration of a webhook that can be used to receive updates
+     * 
+ * + * .a2a.v1.PushNotificationConfig push_notification = 2; + */ + public Builder setPushNotification( + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.Builder builderForValue) { + if (pushNotificationBuilder_ == null) { + pushNotification_ = builderForValue.build(); + } else { + pushNotificationBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * A configuration of a webhook that can be used to receive updates
+     * 
+ * + * .a2a.v1.PushNotificationConfig push_notification = 2; + */ + public Builder mergePushNotification(org.a2aproject.sdk.compat03.grpc.PushNotificationConfig value) { + if (pushNotificationBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) && + pushNotification_ != null && + pushNotification_ != org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.getDefaultInstance()) { + getPushNotificationBuilder().mergeFrom(value); + } else { + pushNotification_ = value; + } + } else { + pushNotificationBuilder_.mergeFrom(value); + } + if (pushNotification_ != null) { + bitField0_ |= 0x00000002; + onChanged(); + } + return this; + } + /** + *
+     * A configuration of a webhook that can be used to receive updates
+     * 
+ * + * .a2a.v1.PushNotificationConfig push_notification = 2; + */ + public Builder clearPushNotification() { + bitField0_ = (bitField0_ & ~0x00000002); + pushNotification_ = null; + if (pushNotificationBuilder_ != null) { + pushNotificationBuilder_.dispose(); + pushNotificationBuilder_ = null; + } + onChanged(); + return this; + } + /** + *
+     * A configuration of a webhook that can be used to receive updates
+     * 
+ * + * .a2a.v1.PushNotificationConfig push_notification = 2; + */ + public org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.Builder getPushNotificationBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return internalGetPushNotificationFieldBuilder().getBuilder(); + } + /** + *
+     * A configuration of a webhook that can be used to receive updates
+     * 
+ * + * .a2a.v1.PushNotificationConfig push_notification = 2; + */ + public org.a2aproject.sdk.compat03.grpc.PushNotificationConfigOrBuilder getPushNotificationOrBuilder() { + if (pushNotificationBuilder_ != null) { + return pushNotificationBuilder_.getMessageOrBuilder(); + } else { + return pushNotification_ == null ? + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.getDefaultInstance() : pushNotification_; + } + } + /** + *
+     * A configuration of a webhook that can be used to receive updates
+     * 
+ * + * .a2a.v1.PushNotificationConfig push_notification = 2; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig, org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.Builder, org.a2aproject.sdk.compat03.grpc.PushNotificationConfigOrBuilder> + internalGetPushNotificationFieldBuilder() { + if (pushNotificationBuilder_ == null) { + pushNotificationBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig, org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.Builder, org.a2aproject.sdk.compat03.grpc.PushNotificationConfigOrBuilder>( + getPushNotification(), + getParentForChildren(), + isClean()); + pushNotification_ = null; + } + return pushNotificationBuilder_; + } + + private int historyLength_ ; + /** + *
+     * The maximum number of messages to include in the history. if 0, the
+     * history will be unlimited.
+     * 
+ * + * int32 history_length = 3; + * @return The historyLength. + */ + @java.lang.Override + public int getHistoryLength() { + return historyLength_; + } + /** + *
+     * The maximum number of messages to include in the history. if 0, the
+     * history will be unlimited.
+     * 
+ * + * int32 history_length = 3; + * @param value The historyLength to set. + * @return This builder for chaining. + */ + public Builder setHistoryLength(int value) { + + historyLength_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * The maximum number of messages to include in the history. if 0, the
+     * history will be unlimited.
+     * 
+ * + * int32 history_length = 3; + * @return This builder for chaining. + */ + public Builder clearHistoryLength() { + bitField0_ = (bitField0_ & ~0x00000004); + historyLength_ = 0; + onChanged(); + return this; + } + + private boolean blocking_ ; + /** + *
+     * If true, the message will be blocking until the task is completed. If
+     * false, the message will be non-blocking and the task will be returned
+     * immediately. It is the caller's responsibility to check for any task
+     * updates.
+     * 
+ * + * bool blocking = 4; + * @return The blocking. + */ + @java.lang.Override + public boolean getBlocking() { + return blocking_; + } + /** + *
+     * If true, the message will be blocking until the task is completed. If
+     * false, the message will be non-blocking and the task will be returned
+     * immediately. It is the caller's responsibility to check for any task
+     * updates.
+     * 
+ * + * bool blocking = 4; + * @param value The blocking to set. + * @return This builder for chaining. + */ + public Builder setBlocking(boolean value) { + + blocking_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + *
+     * If true, the message will be blocking until the task is completed. If
+     * false, the message will be non-blocking and the task will be returned
+     * immediately. It is the caller's responsibility to check for any task
+     * updates.
+     * 
+ * + * bool blocking = 4; + * @return This builder for chaining. + */ + public Builder clearBlocking() { + bitField0_ = (bitField0_ & ~0x00000008); + blocking_ = false; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.SendMessageConfiguration) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.SendMessageConfiguration) + private static final org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration(); + } + + public static org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SendMessageConfiguration parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SendMessageConfigurationOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SendMessageConfigurationOrBuilder.java new file mode 100644 index 000000000..cdc78e9bf --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SendMessageConfigurationOrBuilder.java @@ -0,0 +1,104 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface SendMessageConfigurationOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.SendMessageConfiguration) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The output modes that the agent is expected to respond with.
+   * 
+ * + * repeated string accepted_output_modes = 1; + * @return A list containing the acceptedOutputModes. + */ + java.util.List + getAcceptedOutputModesList(); + /** + *
+   * The output modes that the agent is expected to respond with.
+   * 
+ * + * repeated string accepted_output_modes = 1; + * @return The count of acceptedOutputModes. + */ + int getAcceptedOutputModesCount(); + /** + *
+   * The output modes that the agent is expected to respond with.
+   * 
+ * + * repeated string accepted_output_modes = 1; + * @param index The index of the element to return. + * @return The acceptedOutputModes at the given index. + */ + java.lang.String getAcceptedOutputModes(int index); + /** + *
+   * The output modes that the agent is expected to respond with.
+   * 
+ * + * repeated string accepted_output_modes = 1; + * @param index The index of the value to return. + * @return The bytes of the acceptedOutputModes at the given index. + */ + com.google.protobuf.ByteString + getAcceptedOutputModesBytes(int index); + + /** + *
+   * A configuration of a webhook that can be used to receive updates
+   * 
+ * + * .a2a.v1.PushNotificationConfig push_notification = 2; + * @return Whether the pushNotification field is set. + */ + boolean hasPushNotification(); + /** + *
+   * A configuration of a webhook that can be used to receive updates
+   * 
+ * + * .a2a.v1.PushNotificationConfig push_notification = 2; + * @return The pushNotification. + */ + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig getPushNotification(); + /** + *
+   * A configuration of a webhook that can be used to receive updates
+   * 
+ * + * .a2a.v1.PushNotificationConfig push_notification = 2; + */ + org.a2aproject.sdk.compat03.grpc.PushNotificationConfigOrBuilder getPushNotificationOrBuilder(); + + /** + *
+   * The maximum number of messages to include in the history. if 0, the
+   * history will be unlimited.
+   * 
+ * + * int32 history_length = 3; + * @return The historyLength. + */ + int getHistoryLength(); + + /** + *
+   * If true, the message will be blocking until the task is completed. If
+   * false, the message will be non-blocking and the task will be returned
+   * immediately. It is the caller's responsibility to check for any task
+   * updates.
+   * 
+ * + * bool blocking = 4; + * @return The blocking. + */ + boolean getBlocking(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SendMessageRequest.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SendMessageRequest.java new file mode 100644 index 000000000..1bf76aae0 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SendMessageRequest.java @@ -0,0 +1,937 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * /////////// Request Messages ///////////
+ * 
+ * + * Protobuf type {@code a2a.v1.SendMessageRequest} + */ +@com.google.protobuf.Generated +public final class SendMessageRequest extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.SendMessageRequest) + SendMessageRequestOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "SendMessageRequest"); + } + // Use SendMessageRequest.newBuilder() to construct. + private SendMessageRequest(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private SendMessageRequest() { + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_SendMessageRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_SendMessageRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.SendMessageRequest.class, org.a2aproject.sdk.compat03.grpc.SendMessageRequest.Builder.class); + } + + private int bitField0_; + public static final int REQUEST_FIELD_NUMBER = 1; + private org.a2aproject.sdk.compat03.grpc.Message request_; + /** + * .a2a.v1.Message request = 1 [json_name = "message", (.google.api.field_behavior) = REQUIRED]; + * @return Whether the request field is set. + */ + @java.lang.Override + public boolean hasRequest() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * .a2a.v1.Message request = 1 [json_name = "message", (.google.api.field_behavior) = REQUIRED]; + * @return The request. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Message getRequest() { + return request_ == null ? org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance() : request_; + } + /** + * .a2a.v1.Message request = 1 [json_name = "message", (.google.api.field_behavior) = REQUIRED]; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.MessageOrBuilder getRequestOrBuilder() { + return request_ == null ? org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance() : request_; + } + + public static final int CONFIGURATION_FIELD_NUMBER = 2; + private org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration configuration_; + /** + * .a2a.v1.SendMessageConfiguration configuration = 2; + * @return Whether the configuration field is set. + */ + @java.lang.Override + public boolean hasConfiguration() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * .a2a.v1.SendMessageConfiguration configuration = 2; + * @return The configuration. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration getConfiguration() { + return configuration_ == null ? org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration.getDefaultInstance() : configuration_; + } + /** + * .a2a.v1.SendMessageConfiguration configuration = 2; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SendMessageConfigurationOrBuilder getConfigurationOrBuilder() { + return configuration_ == null ? org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration.getDefaultInstance() : configuration_; + } + + public static final int METADATA_FIELD_NUMBER = 3; + private com.google.protobuf.Struct metadata_; + /** + * .google.protobuf.Struct metadata = 3; + * @return Whether the metadata field is set. + */ + @java.lang.Override + public boolean hasMetadata() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * .google.protobuf.Struct metadata = 3; + * @return The metadata. + */ + @java.lang.Override + public com.google.protobuf.Struct getMetadata() { + return metadata_ == null ? com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } + /** + * .google.protobuf.Struct metadata = 3; + */ + @java.lang.Override + public com.google.protobuf.StructOrBuilder getMetadataOrBuilder() { + return metadata_ == null ? com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(1, getRequest()); + } + if (((bitField0_ & 0x00000002) != 0)) { + output.writeMessage(2, getConfiguration()); + } + if (((bitField0_ & 0x00000004) != 0)) { + output.writeMessage(3, getMetadata()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, getRequest()); + } + if (((bitField0_ & 0x00000002) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, getConfiguration()); + } + if (((bitField0_ & 0x00000004) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, getMetadata()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.SendMessageRequest)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.SendMessageRequest other = (org.a2aproject.sdk.compat03.grpc.SendMessageRequest) obj; + + if (hasRequest() != other.hasRequest()) return false; + if (hasRequest()) { + if (!getRequest() + .equals(other.getRequest())) return false; + } + if (hasConfiguration() != other.hasConfiguration()) return false; + if (hasConfiguration()) { + if (!getConfiguration() + .equals(other.getConfiguration())) return false; + } + if (hasMetadata() != other.hasMetadata()) return false; + if (hasMetadata()) { + if (!getMetadata() + .equals(other.getMetadata())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasRequest()) { + hash = (37 * hash) + REQUEST_FIELD_NUMBER; + hash = (53 * hash) + getRequest().hashCode(); + } + if (hasConfiguration()) { + hash = (37 * hash) + CONFIGURATION_FIELD_NUMBER; + hash = (53 * hash) + getConfiguration().hashCode(); + } + if (hasMetadata()) { + hash = (37 * hash) + METADATA_FIELD_NUMBER; + hash = (53 * hash) + getMetadata().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.SendMessageRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageRequest parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.SendMessageRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.SendMessageRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.SendMessageRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * /////////// Request Messages ///////////
+   * 
+ * + * Protobuf type {@code a2a.v1.SendMessageRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.SendMessageRequest) + org.a2aproject.sdk.compat03.grpc.SendMessageRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_SendMessageRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_SendMessageRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.SendMessageRequest.class, org.a2aproject.sdk.compat03.grpc.SendMessageRequest.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.SendMessageRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage + .alwaysUseFieldBuilders) { + internalGetRequestFieldBuilder(); + internalGetConfigurationFieldBuilder(); + internalGetMetadataFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + request_ = null; + if (requestBuilder_ != null) { + requestBuilder_.dispose(); + requestBuilder_ = null; + } + configuration_ = null; + if (configurationBuilder_ != null) { + configurationBuilder_.dispose(); + configurationBuilder_ = null; + } + metadata_ = null; + if (metadataBuilder_ != null) { + metadataBuilder_.dispose(); + metadataBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_SendMessageRequest_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SendMessageRequest getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.SendMessageRequest.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SendMessageRequest build() { + org.a2aproject.sdk.compat03.grpc.SendMessageRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SendMessageRequest buildPartial() { + org.a2aproject.sdk.compat03.grpc.SendMessageRequest result = new org.a2aproject.sdk.compat03.grpc.SendMessageRequest(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.SendMessageRequest result) { + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.request_ = requestBuilder_ == null + ? request_ + : requestBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.configuration_ = configurationBuilder_ == null + ? configuration_ + : configurationBuilder_.build(); + to_bitField0_ |= 0x00000002; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.metadata_ = metadataBuilder_ == null + ? metadata_ + : metadataBuilder_.build(); + to_bitField0_ |= 0x00000004; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.SendMessageRequest) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.SendMessageRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.SendMessageRequest other) { + if (other == org.a2aproject.sdk.compat03.grpc.SendMessageRequest.getDefaultInstance()) return this; + if (other.hasRequest()) { + mergeRequest(other.getRequest()); + } + if (other.hasConfiguration()) { + mergeConfiguration(other.getConfiguration()); + } + if (other.hasMetadata()) { + mergeMetadata(other.getMetadata()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + input.readMessage( + internalGetRequestFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + input.readMessage( + internalGetConfigurationFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: { + input.readMessage( + internalGetMetadataFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private org.a2aproject.sdk.compat03.grpc.Message request_; + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Message, org.a2aproject.sdk.compat03.grpc.Message.Builder, org.a2aproject.sdk.compat03.grpc.MessageOrBuilder> requestBuilder_; + /** + * .a2a.v1.Message request = 1 [json_name = "message", (.google.api.field_behavior) = REQUIRED]; + * @return Whether the request field is set. + */ + public boolean hasRequest() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * .a2a.v1.Message request = 1 [json_name = "message", (.google.api.field_behavior) = REQUIRED]; + * @return The request. + */ + public org.a2aproject.sdk.compat03.grpc.Message getRequest() { + if (requestBuilder_ == null) { + return request_ == null ? org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance() : request_; + } else { + return requestBuilder_.getMessage(); + } + } + /** + * .a2a.v1.Message request = 1 [json_name = "message", (.google.api.field_behavior) = REQUIRED]; + */ + public Builder setRequest(org.a2aproject.sdk.compat03.grpc.Message value) { + if (requestBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + request_ = value; + } else { + requestBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * .a2a.v1.Message request = 1 [json_name = "message", (.google.api.field_behavior) = REQUIRED]; + */ + public Builder setRequest( + org.a2aproject.sdk.compat03.grpc.Message.Builder builderForValue) { + if (requestBuilder_ == null) { + request_ = builderForValue.build(); + } else { + requestBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * .a2a.v1.Message request = 1 [json_name = "message", (.google.api.field_behavior) = REQUIRED]; + */ + public Builder mergeRequest(org.a2aproject.sdk.compat03.grpc.Message value) { + if (requestBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0) && + request_ != null && + request_ != org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance()) { + getRequestBuilder().mergeFrom(value); + } else { + request_ = value; + } + } else { + requestBuilder_.mergeFrom(value); + } + if (request_ != null) { + bitField0_ |= 0x00000001; + onChanged(); + } + return this; + } + /** + * .a2a.v1.Message request = 1 [json_name = "message", (.google.api.field_behavior) = REQUIRED]; + */ + public Builder clearRequest() { + bitField0_ = (bitField0_ & ~0x00000001); + request_ = null; + if (requestBuilder_ != null) { + requestBuilder_.dispose(); + requestBuilder_ = null; + } + onChanged(); + return this; + } + /** + * .a2a.v1.Message request = 1 [json_name = "message", (.google.api.field_behavior) = REQUIRED]; + */ + public org.a2aproject.sdk.compat03.grpc.Message.Builder getRequestBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return internalGetRequestFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.Message request = 1 [json_name = "message", (.google.api.field_behavior) = REQUIRED]; + */ + public org.a2aproject.sdk.compat03.grpc.MessageOrBuilder getRequestOrBuilder() { + if (requestBuilder_ != null) { + return requestBuilder_.getMessageOrBuilder(); + } else { + return request_ == null ? + org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance() : request_; + } + } + /** + * .a2a.v1.Message request = 1 [json_name = "message", (.google.api.field_behavior) = REQUIRED]; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Message, org.a2aproject.sdk.compat03.grpc.Message.Builder, org.a2aproject.sdk.compat03.grpc.MessageOrBuilder> + internalGetRequestFieldBuilder() { + if (requestBuilder_ == null) { + requestBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Message, org.a2aproject.sdk.compat03.grpc.Message.Builder, org.a2aproject.sdk.compat03.grpc.MessageOrBuilder>( + getRequest(), + getParentForChildren(), + isClean()); + request_ = null; + } + return requestBuilder_; + } + + private org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration configuration_; + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration, org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration.Builder, org.a2aproject.sdk.compat03.grpc.SendMessageConfigurationOrBuilder> configurationBuilder_; + /** + * .a2a.v1.SendMessageConfiguration configuration = 2; + * @return Whether the configuration field is set. + */ + public boolean hasConfiguration() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * .a2a.v1.SendMessageConfiguration configuration = 2; + * @return The configuration. + */ + public org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration getConfiguration() { + if (configurationBuilder_ == null) { + return configuration_ == null ? org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration.getDefaultInstance() : configuration_; + } else { + return configurationBuilder_.getMessage(); + } + } + /** + * .a2a.v1.SendMessageConfiguration configuration = 2; + */ + public Builder setConfiguration(org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration value) { + if (configurationBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + configuration_ = value; + } else { + configurationBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * .a2a.v1.SendMessageConfiguration configuration = 2; + */ + public Builder setConfiguration( + org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration.Builder builderForValue) { + if (configurationBuilder_ == null) { + configuration_ = builderForValue.build(); + } else { + configurationBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * .a2a.v1.SendMessageConfiguration configuration = 2; + */ + public Builder mergeConfiguration(org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration value) { + if (configurationBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) && + configuration_ != null && + configuration_ != org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration.getDefaultInstance()) { + getConfigurationBuilder().mergeFrom(value); + } else { + configuration_ = value; + } + } else { + configurationBuilder_.mergeFrom(value); + } + if (configuration_ != null) { + bitField0_ |= 0x00000002; + onChanged(); + } + return this; + } + /** + * .a2a.v1.SendMessageConfiguration configuration = 2; + */ + public Builder clearConfiguration() { + bitField0_ = (bitField0_ & ~0x00000002); + configuration_ = null; + if (configurationBuilder_ != null) { + configurationBuilder_.dispose(); + configurationBuilder_ = null; + } + onChanged(); + return this; + } + /** + * .a2a.v1.SendMessageConfiguration configuration = 2; + */ + public org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration.Builder getConfigurationBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return internalGetConfigurationFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.SendMessageConfiguration configuration = 2; + */ + public org.a2aproject.sdk.compat03.grpc.SendMessageConfigurationOrBuilder getConfigurationOrBuilder() { + if (configurationBuilder_ != null) { + return configurationBuilder_.getMessageOrBuilder(); + } else { + return configuration_ == null ? + org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration.getDefaultInstance() : configuration_; + } + } + /** + * .a2a.v1.SendMessageConfiguration configuration = 2; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration, org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration.Builder, org.a2aproject.sdk.compat03.grpc.SendMessageConfigurationOrBuilder> + internalGetConfigurationFieldBuilder() { + if (configurationBuilder_ == null) { + configurationBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration, org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration.Builder, org.a2aproject.sdk.compat03.grpc.SendMessageConfigurationOrBuilder>( + getConfiguration(), + getParentForChildren(), + isClean()); + configuration_ = null; + } + return configurationBuilder_; + } + + private com.google.protobuf.Struct metadata_; + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> metadataBuilder_; + /** + * .google.protobuf.Struct metadata = 3; + * @return Whether the metadata field is set. + */ + public boolean hasMetadata() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * .google.protobuf.Struct metadata = 3; + * @return The metadata. + */ + public com.google.protobuf.Struct getMetadata() { + if (metadataBuilder_ == null) { + return metadata_ == null ? com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } else { + return metadataBuilder_.getMessage(); + } + } + /** + * .google.protobuf.Struct metadata = 3; + */ + public Builder setMetadata(com.google.protobuf.Struct value) { + if (metadataBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + metadata_ = value; + } else { + metadataBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * .google.protobuf.Struct metadata = 3; + */ + public Builder setMetadata( + com.google.protobuf.Struct.Builder builderForValue) { + if (metadataBuilder_ == null) { + metadata_ = builderForValue.build(); + } else { + metadataBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * .google.protobuf.Struct metadata = 3; + */ + public Builder mergeMetadata(com.google.protobuf.Struct value) { + if (metadataBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0) && + metadata_ != null && + metadata_ != com.google.protobuf.Struct.getDefaultInstance()) { + getMetadataBuilder().mergeFrom(value); + } else { + metadata_ = value; + } + } else { + metadataBuilder_.mergeFrom(value); + } + if (metadata_ != null) { + bitField0_ |= 0x00000004; + onChanged(); + } + return this; + } + /** + * .google.protobuf.Struct metadata = 3; + */ + public Builder clearMetadata() { + bitField0_ = (bitField0_ & ~0x00000004); + metadata_ = null; + if (metadataBuilder_ != null) { + metadataBuilder_.dispose(); + metadataBuilder_ = null; + } + onChanged(); + return this; + } + /** + * .google.protobuf.Struct metadata = 3; + */ + public com.google.protobuf.Struct.Builder getMetadataBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return internalGetMetadataFieldBuilder().getBuilder(); + } + /** + * .google.protobuf.Struct metadata = 3; + */ + public com.google.protobuf.StructOrBuilder getMetadataOrBuilder() { + if (metadataBuilder_ != null) { + return metadataBuilder_.getMessageOrBuilder(); + } else { + return metadata_ == null ? + com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } + } + /** + * .google.protobuf.Struct metadata = 3; + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> + internalGetMetadataFieldBuilder() { + if (metadataBuilder_ == null) { + metadataBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder>( + getMetadata(), + getParentForChildren(), + isClean()); + metadata_ = null; + } + return metadataBuilder_; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.SendMessageRequest) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.SendMessageRequest) + private static final org.a2aproject.sdk.compat03.grpc.SendMessageRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.SendMessageRequest(); + } + + public static org.a2aproject.sdk.compat03.grpc.SendMessageRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SendMessageRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SendMessageRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SendMessageRequestOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SendMessageRequestOrBuilder.java new file mode 100644 index 000000000..6adc2a4b0 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SendMessageRequestOrBuilder.java @@ -0,0 +1,57 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface SendMessageRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.SendMessageRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * .a2a.v1.Message request = 1 [json_name = "message", (.google.api.field_behavior) = REQUIRED]; + * @return Whether the request field is set. + */ + boolean hasRequest(); + /** + * .a2a.v1.Message request = 1 [json_name = "message", (.google.api.field_behavior) = REQUIRED]; + * @return The request. + */ + org.a2aproject.sdk.compat03.grpc.Message getRequest(); + /** + * .a2a.v1.Message request = 1 [json_name = "message", (.google.api.field_behavior) = REQUIRED]; + */ + org.a2aproject.sdk.compat03.grpc.MessageOrBuilder getRequestOrBuilder(); + + /** + * .a2a.v1.SendMessageConfiguration configuration = 2; + * @return Whether the configuration field is set. + */ + boolean hasConfiguration(); + /** + * .a2a.v1.SendMessageConfiguration configuration = 2; + * @return The configuration. + */ + org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration getConfiguration(); + /** + * .a2a.v1.SendMessageConfiguration configuration = 2; + */ + org.a2aproject.sdk.compat03.grpc.SendMessageConfigurationOrBuilder getConfigurationOrBuilder(); + + /** + * .google.protobuf.Struct metadata = 3; + * @return Whether the metadata field is set. + */ + boolean hasMetadata(); + /** + * .google.protobuf.Struct metadata = 3; + * @return The metadata. + */ + com.google.protobuf.Struct getMetadata(); + /** + * .google.protobuf.Struct metadata = 3; + */ + com.google.protobuf.StructOrBuilder getMetadataOrBuilder(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SendMessageResponse.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SendMessageResponse.java new file mode 100644 index 000000000..054fb6a55 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SendMessageResponse.java @@ -0,0 +1,865 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * ////// Response Messages ///////////
+ * 
+ * + * Protobuf type {@code a2a.v1.SendMessageResponse} + */ +@com.google.protobuf.Generated +public final class SendMessageResponse extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.SendMessageResponse) + SendMessageResponseOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "SendMessageResponse"); + } + // Use SendMessageResponse.newBuilder() to construct. + private SendMessageResponse(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private SendMessageResponse() { + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_SendMessageResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_SendMessageResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.SendMessageResponse.class, org.a2aproject.sdk.compat03.grpc.SendMessageResponse.Builder.class); + } + + private int payloadCase_ = 0; + @SuppressWarnings("serial") + private java.lang.Object payload_; + public enum PayloadCase + implements com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + TASK(1), + MSG(2), + PAYLOAD_NOT_SET(0); + private final int value; + private PayloadCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static PayloadCase valueOf(int value) { + return forNumber(value); + } + + public static PayloadCase forNumber(int value) { + switch (value) { + case 1: return TASK; + case 2: return MSG; + case 0: return PAYLOAD_NOT_SET; + default: return null; + } + } + public int getNumber() { + return this.value; + } + }; + + public PayloadCase + getPayloadCase() { + return PayloadCase.forNumber( + payloadCase_); + } + + public static final int TASK_FIELD_NUMBER = 1; + /** + * .a2a.v1.Task task = 1; + * @return Whether the task field is set. + */ + @java.lang.Override + public boolean hasTask() { + return payloadCase_ == 1; + } + /** + * .a2a.v1.Task task = 1; + * @return The task. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Task getTask() { + if (payloadCase_ == 1) { + return (org.a2aproject.sdk.compat03.grpc.Task) payload_; + } + return org.a2aproject.sdk.compat03.grpc.Task.getDefaultInstance(); + } + /** + * .a2a.v1.Task task = 1; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskOrBuilder getTaskOrBuilder() { + if (payloadCase_ == 1) { + return (org.a2aproject.sdk.compat03.grpc.Task) payload_; + } + return org.a2aproject.sdk.compat03.grpc.Task.getDefaultInstance(); + } + + public static final int MSG_FIELD_NUMBER = 2; + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + * @return Whether the msg field is set. + */ + @java.lang.Override + public boolean hasMsg() { + return payloadCase_ == 2; + } + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + * @return The msg. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Message getMsg() { + if (payloadCase_ == 2) { + return (org.a2aproject.sdk.compat03.grpc.Message) payload_; + } + return org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance(); + } + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.MessageOrBuilder getMsgOrBuilder() { + if (payloadCase_ == 2) { + return (org.a2aproject.sdk.compat03.grpc.Message) payload_; + } + return org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance(); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (payloadCase_ == 1) { + output.writeMessage(1, (org.a2aproject.sdk.compat03.grpc.Task) payload_); + } + if (payloadCase_ == 2) { + output.writeMessage(2, (org.a2aproject.sdk.compat03.grpc.Message) payload_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (payloadCase_ == 1) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, (org.a2aproject.sdk.compat03.grpc.Task) payload_); + } + if (payloadCase_ == 2) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, (org.a2aproject.sdk.compat03.grpc.Message) payload_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.SendMessageResponse)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.SendMessageResponse other = (org.a2aproject.sdk.compat03.grpc.SendMessageResponse) obj; + + if (!getPayloadCase().equals(other.getPayloadCase())) return false; + switch (payloadCase_) { + case 1: + if (!getTask() + .equals(other.getTask())) return false; + break; + case 2: + if (!getMsg() + .equals(other.getMsg())) return false; + break; + case 0: + default: + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + switch (payloadCase_) { + case 1: + hash = (37 * hash) + TASK_FIELD_NUMBER; + hash = (53 * hash) + getTask().hashCode(); + break; + case 2: + hash = (37 * hash) + MSG_FIELD_NUMBER; + hash = (53 * hash) + getMsg().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.SendMessageResponse parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageResponse parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.SendMessageResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.SendMessageResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.SendMessageResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * ////// Response Messages ///////////
+   * 
+ * + * Protobuf type {@code a2a.v1.SendMessageResponse} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.SendMessageResponse) + org.a2aproject.sdk.compat03.grpc.SendMessageResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_SendMessageResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_SendMessageResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.SendMessageResponse.class, org.a2aproject.sdk.compat03.grpc.SendMessageResponse.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.SendMessageResponse.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + if (taskBuilder_ != null) { + taskBuilder_.clear(); + } + if (msgBuilder_ != null) { + msgBuilder_.clear(); + } + payloadCase_ = 0; + payload_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_SendMessageResponse_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SendMessageResponse getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.SendMessageResponse.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SendMessageResponse build() { + org.a2aproject.sdk.compat03.grpc.SendMessageResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SendMessageResponse buildPartial() { + org.a2aproject.sdk.compat03.grpc.SendMessageResponse result = new org.a2aproject.sdk.compat03.grpc.SendMessageResponse(this); + if (bitField0_ != 0) { buildPartial0(result); } + buildPartialOneofs(result); + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.SendMessageResponse result) { + int from_bitField0_ = bitField0_; + } + + private void buildPartialOneofs(org.a2aproject.sdk.compat03.grpc.SendMessageResponse result) { + result.payloadCase_ = payloadCase_; + result.payload_ = this.payload_; + if (payloadCase_ == 1 && + taskBuilder_ != null) { + result.payload_ = taskBuilder_.build(); + } + if (payloadCase_ == 2 && + msgBuilder_ != null) { + result.payload_ = msgBuilder_.build(); + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.SendMessageResponse) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.SendMessageResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.SendMessageResponse other) { + if (other == org.a2aproject.sdk.compat03.grpc.SendMessageResponse.getDefaultInstance()) return this; + switch (other.getPayloadCase()) { + case TASK: { + mergeTask(other.getTask()); + break; + } + case MSG: { + mergeMsg(other.getMsg()); + break; + } + case PAYLOAD_NOT_SET: { + break; + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + input.readMessage( + internalGetTaskFieldBuilder().getBuilder(), + extensionRegistry); + payloadCase_ = 1; + break; + } // case 10 + case 18: { + input.readMessage( + internalGetMsgFieldBuilder().getBuilder(), + extensionRegistry); + payloadCase_ = 2; + break; + } // case 18 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int payloadCase_ = 0; + private java.lang.Object payload_; + public PayloadCase + getPayloadCase() { + return PayloadCase.forNumber( + payloadCase_); + } + + public Builder clearPayload() { + payloadCase_ = 0; + payload_ = null; + onChanged(); + return this; + } + + private int bitField0_; + + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Task, org.a2aproject.sdk.compat03.grpc.Task.Builder, org.a2aproject.sdk.compat03.grpc.TaskOrBuilder> taskBuilder_; + /** + * .a2a.v1.Task task = 1; + * @return Whether the task field is set. + */ + @java.lang.Override + public boolean hasTask() { + return payloadCase_ == 1; + } + /** + * .a2a.v1.Task task = 1; + * @return The task. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Task getTask() { + if (taskBuilder_ == null) { + if (payloadCase_ == 1) { + return (org.a2aproject.sdk.compat03.grpc.Task) payload_; + } + return org.a2aproject.sdk.compat03.grpc.Task.getDefaultInstance(); + } else { + if (payloadCase_ == 1) { + return taskBuilder_.getMessage(); + } + return org.a2aproject.sdk.compat03.grpc.Task.getDefaultInstance(); + } + } + /** + * .a2a.v1.Task task = 1; + */ + public Builder setTask(org.a2aproject.sdk.compat03.grpc.Task value) { + if (taskBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + payload_ = value; + onChanged(); + } else { + taskBuilder_.setMessage(value); + } + payloadCase_ = 1; + return this; + } + /** + * .a2a.v1.Task task = 1; + */ + public Builder setTask( + org.a2aproject.sdk.compat03.grpc.Task.Builder builderForValue) { + if (taskBuilder_ == null) { + payload_ = builderForValue.build(); + onChanged(); + } else { + taskBuilder_.setMessage(builderForValue.build()); + } + payloadCase_ = 1; + return this; + } + /** + * .a2a.v1.Task task = 1; + */ + public Builder mergeTask(org.a2aproject.sdk.compat03.grpc.Task value) { + if (taskBuilder_ == null) { + if (payloadCase_ == 1 && + payload_ != org.a2aproject.sdk.compat03.grpc.Task.getDefaultInstance()) { + payload_ = org.a2aproject.sdk.compat03.grpc.Task.newBuilder((org.a2aproject.sdk.compat03.grpc.Task) payload_) + .mergeFrom(value).buildPartial(); + } else { + payload_ = value; + } + onChanged(); + } else { + if (payloadCase_ == 1) { + taskBuilder_.mergeFrom(value); + } else { + taskBuilder_.setMessage(value); + } + } + payloadCase_ = 1; + return this; + } + /** + * .a2a.v1.Task task = 1; + */ + public Builder clearTask() { + if (taskBuilder_ == null) { + if (payloadCase_ == 1) { + payloadCase_ = 0; + payload_ = null; + onChanged(); + } + } else { + if (payloadCase_ == 1) { + payloadCase_ = 0; + payload_ = null; + } + taskBuilder_.clear(); + } + return this; + } + /** + * .a2a.v1.Task task = 1; + */ + public org.a2aproject.sdk.compat03.grpc.Task.Builder getTaskBuilder() { + return internalGetTaskFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.Task task = 1; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskOrBuilder getTaskOrBuilder() { + if ((payloadCase_ == 1) && (taskBuilder_ != null)) { + return taskBuilder_.getMessageOrBuilder(); + } else { + if (payloadCase_ == 1) { + return (org.a2aproject.sdk.compat03.grpc.Task) payload_; + } + return org.a2aproject.sdk.compat03.grpc.Task.getDefaultInstance(); + } + } + /** + * .a2a.v1.Task task = 1; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Task, org.a2aproject.sdk.compat03.grpc.Task.Builder, org.a2aproject.sdk.compat03.grpc.TaskOrBuilder> + internalGetTaskFieldBuilder() { + if (taskBuilder_ == null) { + if (!(payloadCase_ == 1)) { + payload_ = org.a2aproject.sdk.compat03.grpc.Task.getDefaultInstance(); + } + taskBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Task, org.a2aproject.sdk.compat03.grpc.Task.Builder, org.a2aproject.sdk.compat03.grpc.TaskOrBuilder>( + (org.a2aproject.sdk.compat03.grpc.Task) payload_, + getParentForChildren(), + isClean()); + payload_ = null; + } + payloadCase_ = 1; + onChanged(); + return taskBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Message, org.a2aproject.sdk.compat03.grpc.Message.Builder, org.a2aproject.sdk.compat03.grpc.MessageOrBuilder> msgBuilder_; + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + * @return Whether the msg field is set. + */ + @java.lang.Override + public boolean hasMsg() { + return payloadCase_ == 2; + } + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + * @return The msg. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Message getMsg() { + if (msgBuilder_ == null) { + if (payloadCase_ == 2) { + return (org.a2aproject.sdk.compat03.grpc.Message) payload_; + } + return org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance(); + } else { + if (payloadCase_ == 2) { + return msgBuilder_.getMessage(); + } + return org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance(); + } + } + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + */ + public Builder setMsg(org.a2aproject.sdk.compat03.grpc.Message value) { + if (msgBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + payload_ = value; + onChanged(); + } else { + msgBuilder_.setMessage(value); + } + payloadCase_ = 2; + return this; + } + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + */ + public Builder setMsg( + org.a2aproject.sdk.compat03.grpc.Message.Builder builderForValue) { + if (msgBuilder_ == null) { + payload_ = builderForValue.build(); + onChanged(); + } else { + msgBuilder_.setMessage(builderForValue.build()); + } + payloadCase_ = 2; + return this; + } + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + */ + public Builder mergeMsg(org.a2aproject.sdk.compat03.grpc.Message value) { + if (msgBuilder_ == null) { + if (payloadCase_ == 2 && + payload_ != org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance()) { + payload_ = org.a2aproject.sdk.compat03.grpc.Message.newBuilder((org.a2aproject.sdk.compat03.grpc.Message) payload_) + .mergeFrom(value).buildPartial(); + } else { + payload_ = value; + } + onChanged(); + } else { + if (payloadCase_ == 2) { + msgBuilder_.mergeFrom(value); + } else { + msgBuilder_.setMessage(value); + } + } + payloadCase_ = 2; + return this; + } + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + */ + public Builder clearMsg() { + if (msgBuilder_ == null) { + if (payloadCase_ == 2) { + payloadCase_ = 0; + payload_ = null; + onChanged(); + } + } else { + if (payloadCase_ == 2) { + payloadCase_ = 0; + payload_ = null; + } + msgBuilder_.clear(); + } + return this; + } + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + */ + public org.a2aproject.sdk.compat03.grpc.Message.Builder getMsgBuilder() { + return internalGetMsgFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.MessageOrBuilder getMsgOrBuilder() { + if ((payloadCase_ == 2) && (msgBuilder_ != null)) { + return msgBuilder_.getMessageOrBuilder(); + } else { + if (payloadCase_ == 2) { + return (org.a2aproject.sdk.compat03.grpc.Message) payload_; + } + return org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance(); + } + } + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Message, org.a2aproject.sdk.compat03.grpc.Message.Builder, org.a2aproject.sdk.compat03.grpc.MessageOrBuilder> + internalGetMsgFieldBuilder() { + if (msgBuilder_ == null) { + if (!(payloadCase_ == 2)) { + payload_ = org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance(); + } + msgBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Message, org.a2aproject.sdk.compat03.grpc.Message.Builder, org.a2aproject.sdk.compat03.grpc.MessageOrBuilder>( + (org.a2aproject.sdk.compat03.grpc.Message) payload_, + getParentForChildren(), + isClean()); + payload_ = null; + } + payloadCase_ = 2; + onChanged(); + return msgBuilder_; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.SendMessageResponse) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.SendMessageResponse) + private static final org.a2aproject.sdk.compat03.grpc.SendMessageResponse DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.SendMessageResponse(); + } + + public static org.a2aproject.sdk.compat03.grpc.SendMessageResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SendMessageResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SendMessageResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SendMessageResponseOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SendMessageResponseOrBuilder.java new file mode 100644 index 000000000..3b71db61f --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SendMessageResponseOrBuilder.java @@ -0,0 +1,44 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface SendMessageResponseOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.SendMessageResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * .a2a.v1.Task task = 1; + * @return Whether the task field is set. + */ + boolean hasTask(); + /** + * .a2a.v1.Task task = 1; + * @return The task. + */ + org.a2aproject.sdk.compat03.grpc.Task getTask(); + /** + * .a2a.v1.Task task = 1; + */ + org.a2aproject.sdk.compat03.grpc.TaskOrBuilder getTaskOrBuilder(); + + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + * @return Whether the msg field is set. + */ + boolean hasMsg(); + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + * @return The msg. + */ + org.a2aproject.sdk.compat03.grpc.Message getMsg(); + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + */ + org.a2aproject.sdk.compat03.grpc.MessageOrBuilder getMsgOrBuilder(); + + org.a2aproject.sdk.compat03.grpc.SendMessageResponse.PayloadCase getPayloadCase(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/StreamResponse.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/StreamResponse.java new file mode 100644 index 000000000..4812ac200 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/StreamResponse.java @@ -0,0 +1,1297 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * The stream response for a message. The stream should be one of the following
+ * sequences:
+ * If the response is a message, the stream should contain one, and only one,
+ * message and then close
+ * If the response is a task lifecycle, the first response should be a Task
+ * object followed by zero or more TaskStatusUpdateEvents and
+ * TaskArtifactUpdateEvents. The stream should complete when the Task
+ * if in an interrupted or terminal state. A stream that ends before these
+ * conditions are met are
+ * 
+ * + * Protobuf type {@code a2a.v1.StreamResponse} + */ +@com.google.protobuf.Generated +public final class StreamResponse extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.StreamResponse) + StreamResponseOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "StreamResponse"); + } + // Use StreamResponse.newBuilder() to construct. + private StreamResponse(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private StreamResponse() { + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_StreamResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_StreamResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.StreamResponse.class, org.a2aproject.sdk.compat03.grpc.StreamResponse.Builder.class); + } + + private int payloadCase_ = 0; + @SuppressWarnings("serial") + private java.lang.Object payload_; + public enum PayloadCase + implements com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + TASK(1), + MSG(2), + STATUS_UPDATE(3), + ARTIFACT_UPDATE(4), + PAYLOAD_NOT_SET(0); + private final int value; + private PayloadCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static PayloadCase valueOf(int value) { + return forNumber(value); + } + + public static PayloadCase forNumber(int value) { + switch (value) { + case 1: return TASK; + case 2: return MSG; + case 3: return STATUS_UPDATE; + case 4: return ARTIFACT_UPDATE; + case 0: return PAYLOAD_NOT_SET; + default: return null; + } + } + public int getNumber() { + return this.value; + } + }; + + public PayloadCase + getPayloadCase() { + return PayloadCase.forNumber( + payloadCase_); + } + + public static final int TASK_FIELD_NUMBER = 1; + /** + * .a2a.v1.Task task = 1; + * @return Whether the task field is set. + */ + @java.lang.Override + public boolean hasTask() { + return payloadCase_ == 1; + } + /** + * .a2a.v1.Task task = 1; + * @return The task. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Task getTask() { + if (payloadCase_ == 1) { + return (org.a2aproject.sdk.compat03.grpc.Task) payload_; + } + return org.a2aproject.sdk.compat03.grpc.Task.getDefaultInstance(); + } + /** + * .a2a.v1.Task task = 1; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskOrBuilder getTaskOrBuilder() { + if (payloadCase_ == 1) { + return (org.a2aproject.sdk.compat03.grpc.Task) payload_; + } + return org.a2aproject.sdk.compat03.grpc.Task.getDefaultInstance(); + } + + public static final int MSG_FIELD_NUMBER = 2; + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + * @return Whether the msg field is set. + */ + @java.lang.Override + public boolean hasMsg() { + return payloadCase_ == 2; + } + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + * @return The msg. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Message getMsg() { + if (payloadCase_ == 2) { + return (org.a2aproject.sdk.compat03.grpc.Message) payload_; + } + return org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance(); + } + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.MessageOrBuilder getMsgOrBuilder() { + if (payloadCase_ == 2) { + return (org.a2aproject.sdk.compat03.grpc.Message) payload_; + } + return org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance(); + } + + public static final int STATUS_UPDATE_FIELD_NUMBER = 3; + /** + * .a2a.v1.TaskStatusUpdateEvent status_update = 3; + * @return Whether the statusUpdate field is set. + */ + @java.lang.Override + public boolean hasStatusUpdate() { + return payloadCase_ == 3; + } + /** + * .a2a.v1.TaskStatusUpdateEvent status_update = 3; + * @return The statusUpdate. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent getStatusUpdate() { + if (payloadCase_ == 3) { + return (org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent) payload_; + } + return org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.getDefaultInstance(); + } + /** + * .a2a.v1.TaskStatusUpdateEvent status_update = 3; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEventOrBuilder getStatusUpdateOrBuilder() { + if (payloadCase_ == 3) { + return (org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent) payload_; + } + return org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.getDefaultInstance(); + } + + public static final int ARTIFACT_UPDATE_FIELD_NUMBER = 4; + /** + * .a2a.v1.TaskArtifactUpdateEvent artifact_update = 4; + * @return Whether the artifactUpdate field is set. + */ + @java.lang.Override + public boolean hasArtifactUpdate() { + return payloadCase_ == 4; + } + /** + * .a2a.v1.TaskArtifactUpdateEvent artifact_update = 4; + * @return The artifactUpdate. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent getArtifactUpdate() { + if (payloadCase_ == 4) { + return (org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent) payload_; + } + return org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.getDefaultInstance(); + } + /** + * .a2a.v1.TaskArtifactUpdateEvent artifact_update = 4; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEventOrBuilder getArtifactUpdateOrBuilder() { + if (payloadCase_ == 4) { + return (org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent) payload_; + } + return org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.getDefaultInstance(); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (payloadCase_ == 1) { + output.writeMessage(1, (org.a2aproject.sdk.compat03.grpc.Task) payload_); + } + if (payloadCase_ == 2) { + output.writeMessage(2, (org.a2aproject.sdk.compat03.grpc.Message) payload_); + } + if (payloadCase_ == 3) { + output.writeMessage(3, (org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent) payload_); + } + if (payloadCase_ == 4) { + output.writeMessage(4, (org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent) payload_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (payloadCase_ == 1) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, (org.a2aproject.sdk.compat03.grpc.Task) payload_); + } + if (payloadCase_ == 2) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, (org.a2aproject.sdk.compat03.grpc.Message) payload_); + } + if (payloadCase_ == 3) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, (org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent) payload_); + } + if (payloadCase_ == 4) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, (org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent) payload_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.StreamResponse)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.StreamResponse other = (org.a2aproject.sdk.compat03.grpc.StreamResponse) obj; + + if (!getPayloadCase().equals(other.getPayloadCase())) return false; + switch (payloadCase_) { + case 1: + if (!getTask() + .equals(other.getTask())) return false; + break; + case 2: + if (!getMsg() + .equals(other.getMsg())) return false; + break; + case 3: + if (!getStatusUpdate() + .equals(other.getStatusUpdate())) return false; + break; + case 4: + if (!getArtifactUpdate() + .equals(other.getArtifactUpdate())) return false; + break; + case 0: + default: + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + switch (payloadCase_) { + case 1: + hash = (37 * hash) + TASK_FIELD_NUMBER; + hash = (53 * hash) + getTask().hashCode(); + break; + case 2: + hash = (37 * hash) + MSG_FIELD_NUMBER; + hash = (53 * hash) + getMsg().hashCode(); + break; + case 3: + hash = (37 * hash) + STATUS_UPDATE_FIELD_NUMBER; + hash = (53 * hash) + getStatusUpdate().hashCode(); + break; + case 4: + hash = (37 * hash) + ARTIFACT_UPDATE_FIELD_NUMBER; + hash = (53 * hash) + getArtifactUpdate().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.StreamResponse parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.StreamResponse parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.StreamResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.StreamResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.StreamResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.StreamResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.StreamResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.StreamResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.StreamResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.StreamResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.StreamResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.StreamResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.StreamResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * The stream response for a message. The stream should be one of the following
+   * sequences:
+   * If the response is a message, the stream should contain one, and only one,
+   * message and then close
+   * If the response is a task lifecycle, the first response should be a Task
+   * object followed by zero or more TaskStatusUpdateEvents and
+   * TaskArtifactUpdateEvents. The stream should complete when the Task
+   * if in an interrupted or terminal state. A stream that ends before these
+   * conditions are met are
+   * 
+ * + * Protobuf type {@code a2a.v1.StreamResponse} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.StreamResponse) + org.a2aproject.sdk.compat03.grpc.StreamResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_StreamResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_StreamResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.StreamResponse.class, org.a2aproject.sdk.compat03.grpc.StreamResponse.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.StreamResponse.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + if (taskBuilder_ != null) { + taskBuilder_.clear(); + } + if (msgBuilder_ != null) { + msgBuilder_.clear(); + } + if (statusUpdateBuilder_ != null) { + statusUpdateBuilder_.clear(); + } + if (artifactUpdateBuilder_ != null) { + artifactUpdateBuilder_.clear(); + } + payloadCase_ = 0; + payload_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_StreamResponse_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.StreamResponse getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.StreamResponse.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.StreamResponse build() { + org.a2aproject.sdk.compat03.grpc.StreamResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.StreamResponse buildPartial() { + org.a2aproject.sdk.compat03.grpc.StreamResponse result = new org.a2aproject.sdk.compat03.grpc.StreamResponse(this); + if (bitField0_ != 0) { buildPartial0(result); } + buildPartialOneofs(result); + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.StreamResponse result) { + int from_bitField0_ = bitField0_; + } + + private void buildPartialOneofs(org.a2aproject.sdk.compat03.grpc.StreamResponse result) { + result.payloadCase_ = payloadCase_; + result.payload_ = this.payload_; + if (payloadCase_ == 1 && + taskBuilder_ != null) { + result.payload_ = taskBuilder_.build(); + } + if (payloadCase_ == 2 && + msgBuilder_ != null) { + result.payload_ = msgBuilder_.build(); + } + if (payloadCase_ == 3 && + statusUpdateBuilder_ != null) { + result.payload_ = statusUpdateBuilder_.build(); + } + if (payloadCase_ == 4 && + artifactUpdateBuilder_ != null) { + result.payload_ = artifactUpdateBuilder_.build(); + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.StreamResponse) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.StreamResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.StreamResponse other) { + if (other == org.a2aproject.sdk.compat03.grpc.StreamResponse.getDefaultInstance()) return this; + switch (other.getPayloadCase()) { + case TASK: { + mergeTask(other.getTask()); + break; + } + case MSG: { + mergeMsg(other.getMsg()); + break; + } + case STATUS_UPDATE: { + mergeStatusUpdate(other.getStatusUpdate()); + break; + } + case ARTIFACT_UPDATE: { + mergeArtifactUpdate(other.getArtifactUpdate()); + break; + } + case PAYLOAD_NOT_SET: { + break; + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + input.readMessage( + internalGetTaskFieldBuilder().getBuilder(), + extensionRegistry); + payloadCase_ = 1; + break; + } // case 10 + case 18: { + input.readMessage( + internalGetMsgFieldBuilder().getBuilder(), + extensionRegistry); + payloadCase_ = 2; + break; + } // case 18 + case 26: { + input.readMessage( + internalGetStatusUpdateFieldBuilder().getBuilder(), + extensionRegistry); + payloadCase_ = 3; + break; + } // case 26 + case 34: { + input.readMessage( + internalGetArtifactUpdateFieldBuilder().getBuilder(), + extensionRegistry); + payloadCase_ = 4; + break; + } // case 34 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int payloadCase_ = 0; + private java.lang.Object payload_; + public PayloadCase + getPayloadCase() { + return PayloadCase.forNumber( + payloadCase_); + } + + public Builder clearPayload() { + payloadCase_ = 0; + payload_ = null; + onChanged(); + return this; + } + + private int bitField0_; + + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Task, org.a2aproject.sdk.compat03.grpc.Task.Builder, org.a2aproject.sdk.compat03.grpc.TaskOrBuilder> taskBuilder_; + /** + * .a2a.v1.Task task = 1; + * @return Whether the task field is set. + */ + @java.lang.Override + public boolean hasTask() { + return payloadCase_ == 1; + } + /** + * .a2a.v1.Task task = 1; + * @return The task. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Task getTask() { + if (taskBuilder_ == null) { + if (payloadCase_ == 1) { + return (org.a2aproject.sdk.compat03.grpc.Task) payload_; + } + return org.a2aproject.sdk.compat03.grpc.Task.getDefaultInstance(); + } else { + if (payloadCase_ == 1) { + return taskBuilder_.getMessage(); + } + return org.a2aproject.sdk.compat03.grpc.Task.getDefaultInstance(); + } + } + /** + * .a2a.v1.Task task = 1; + */ + public Builder setTask(org.a2aproject.sdk.compat03.grpc.Task value) { + if (taskBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + payload_ = value; + onChanged(); + } else { + taskBuilder_.setMessage(value); + } + payloadCase_ = 1; + return this; + } + /** + * .a2a.v1.Task task = 1; + */ + public Builder setTask( + org.a2aproject.sdk.compat03.grpc.Task.Builder builderForValue) { + if (taskBuilder_ == null) { + payload_ = builderForValue.build(); + onChanged(); + } else { + taskBuilder_.setMessage(builderForValue.build()); + } + payloadCase_ = 1; + return this; + } + /** + * .a2a.v1.Task task = 1; + */ + public Builder mergeTask(org.a2aproject.sdk.compat03.grpc.Task value) { + if (taskBuilder_ == null) { + if (payloadCase_ == 1 && + payload_ != org.a2aproject.sdk.compat03.grpc.Task.getDefaultInstance()) { + payload_ = org.a2aproject.sdk.compat03.grpc.Task.newBuilder((org.a2aproject.sdk.compat03.grpc.Task) payload_) + .mergeFrom(value).buildPartial(); + } else { + payload_ = value; + } + onChanged(); + } else { + if (payloadCase_ == 1) { + taskBuilder_.mergeFrom(value); + } else { + taskBuilder_.setMessage(value); + } + } + payloadCase_ = 1; + return this; + } + /** + * .a2a.v1.Task task = 1; + */ + public Builder clearTask() { + if (taskBuilder_ == null) { + if (payloadCase_ == 1) { + payloadCase_ = 0; + payload_ = null; + onChanged(); + } + } else { + if (payloadCase_ == 1) { + payloadCase_ = 0; + payload_ = null; + } + taskBuilder_.clear(); + } + return this; + } + /** + * .a2a.v1.Task task = 1; + */ + public org.a2aproject.sdk.compat03.grpc.Task.Builder getTaskBuilder() { + return internalGetTaskFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.Task task = 1; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskOrBuilder getTaskOrBuilder() { + if ((payloadCase_ == 1) && (taskBuilder_ != null)) { + return taskBuilder_.getMessageOrBuilder(); + } else { + if (payloadCase_ == 1) { + return (org.a2aproject.sdk.compat03.grpc.Task) payload_; + } + return org.a2aproject.sdk.compat03.grpc.Task.getDefaultInstance(); + } + } + /** + * .a2a.v1.Task task = 1; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Task, org.a2aproject.sdk.compat03.grpc.Task.Builder, org.a2aproject.sdk.compat03.grpc.TaskOrBuilder> + internalGetTaskFieldBuilder() { + if (taskBuilder_ == null) { + if (!(payloadCase_ == 1)) { + payload_ = org.a2aproject.sdk.compat03.grpc.Task.getDefaultInstance(); + } + taskBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Task, org.a2aproject.sdk.compat03.grpc.Task.Builder, org.a2aproject.sdk.compat03.grpc.TaskOrBuilder>( + (org.a2aproject.sdk.compat03.grpc.Task) payload_, + getParentForChildren(), + isClean()); + payload_ = null; + } + payloadCase_ = 1; + onChanged(); + return taskBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Message, org.a2aproject.sdk.compat03.grpc.Message.Builder, org.a2aproject.sdk.compat03.grpc.MessageOrBuilder> msgBuilder_; + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + * @return Whether the msg field is set. + */ + @java.lang.Override + public boolean hasMsg() { + return payloadCase_ == 2; + } + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + * @return The msg. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Message getMsg() { + if (msgBuilder_ == null) { + if (payloadCase_ == 2) { + return (org.a2aproject.sdk.compat03.grpc.Message) payload_; + } + return org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance(); + } else { + if (payloadCase_ == 2) { + return msgBuilder_.getMessage(); + } + return org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance(); + } + } + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + */ + public Builder setMsg(org.a2aproject.sdk.compat03.grpc.Message value) { + if (msgBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + payload_ = value; + onChanged(); + } else { + msgBuilder_.setMessage(value); + } + payloadCase_ = 2; + return this; + } + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + */ + public Builder setMsg( + org.a2aproject.sdk.compat03.grpc.Message.Builder builderForValue) { + if (msgBuilder_ == null) { + payload_ = builderForValue.build(); + onChanged(); + } else { + msgBuilder_.setMessage(builderForValue.build()); + } + payloadCase_ = 2; + return this; + } + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + */ + public Builder mergeMsg(org.a2aproject.sdk.compat03.grpc.Message value) { + if (msgBuilder_ == null) { + if (payloadCase_ == 2 && + payload_ != org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance()) { + payload_ = org.a2aproject.sdk.compat03.grpc.Message.newBuilder((org.a2aproject.sdk.compat03.grpc.Message) payload_) + .mergeFrom(value).buildPartial(); + } else { + payload_ = value; + } + onChanged(); + } else { + if (payloadCase_ == 2) { + msgBuilder_.mergeFrom(value); + } else { + msgBuilder_.setMessage(value); + } + } + payloadCase_ = 2; + return this; + } + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + */ + public Builder clearMsg() { + if (msgBuilder_ == null) { + if (payloadCase_ == 2) { + payloadCase_ = 0; + payload_ = null; + onChanged(); + } + } else { + if (payloadCase_ == 2) { + payloadCase_ = 0; + payload_ = null; + } + msgBuilder_.clear(); + } + return this; + } + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + */ + public org.a2aproject.sdk.compat03.grpc.Message.Builder getMsgBuilder() { + return internalGetMsgFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.MessageOrBuilder getMsgOrBuilder() { + if ((payloadCase_ == 2) && (msgBuilder_ != null)) { + return msgBuilder_.getMessageOrBuilder(); + } else { + if (payloadCase_ == 2) { + return (org.a2aproject.sdk.compat03.grpc.Message) payload_; + } + return org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance(); + } + } + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Message, org.a2aproject.sdk.compat03.grpc.Message.Builder, org.a2aproject.sdk.compat03.grpc.MessageOrBuilder> + internalGetMsgFieldBuilder() { + if (msgBuilder_ == null) { + if (!(payloadCase_ == 2)) { + payload_ = org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance(); + } + msgBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Message, org.a2aproject.sdk.compat03.grpc.Message.Builder, org.a2aproject.sdk.compat03.grpc.MessageOrBuilder>( + (org.a2aproject.sdk.compat03.grpc.Message) payload_, + getParentForChildren(), + isClean()); + payload_ = null; + } + payloadCase_ = 2; + onChanged(); + return msgBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent, org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.Builder, org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEventOrBuilder> statusUpdateBuilder_; + /** + * .a2a.v1.TaskStatusUpdateEvent status_update = 3; + * @return Whether the statusUpdate field is set. + */ + @java.lang.Override + public boolean hasStatusUpdate() { + return payloadCase_ == 3; + } + /** + * .a2a.v1.TaskStatusUpdateEvent status_update = 3; + * @return The statusUpdate. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent getStatusUpdate() { + if (statusUpdateBuilder_ == null) { + if (payloadCase_ == 3) { + return (org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent) payload_; + } + return org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.getDefaultInstance(); + } else { + if (payloadCase_ == 3) { + return statusUpdateBuilder_.getMessage(); + } + return org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.getDefaultInstance(); + } + } + /** + * .a2a.v1.TaskStatusUpdateEvent status_update = 3; + */ + public Builder setStatusUpdate(org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent value) { + if (statusUpdateBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + payload_ = value; + onChanged(); + } else { + statusUpdateBuilder_.setMessage(value); + } + payloadCase_ = 3; + return this; + } + /** + * .a2a.v1.TaskStatusUpdateEvent status_update = 3; + */ + public Builder setStatusUpdate( + org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.Builder builderForValue) { + if (statusUpdateBuilder_ == null) { + payload_ = builderForValue.build(); + onChanged(); + } else { + statusUpdateBuilder_.setMessage(builderForValue.build()); + } + payloadCase_ = 3; + return this; + } + /** + * .a2a.v1.TaskStatusUpdateEvent status_update = 3; + */ + public Builder mergeStatusUpdate(org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent value) { + if (statusUpdateBuilder_ == null) { + if (payloadCase_ == 3 && + payload_ != org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.getDefaultInstance()) { + payload_ = org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.newBuilder((org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent) payload_) + .mergeFrom(value).buildPartial(); + } else { + payload_ = value; + } + onChanged(); + } else { + if (payloadCase_ == 3) { + statusUpdateBuilder_.mergeFrom(value); + } else { + statusUpdateBuilder_.setMessage(value); + } + } + payloadCase_ = 3; + return this; + } + /** + * .a2a.v1.TaskStatusUpdateEvent status_update = 3; + */ + public Builder clearStatusUpdate() { + if (statusUpdateBuilder_ == null) { + if (payloadCase_ == 3) { + payloadCase_ = 0; + payload_ = null; + onChanged(); + } + } else { + if (payloadCase_ == 3) { + payloadCase_ = 0; + payload_ = null; + } + statusUpdateBuilder_.clear(); + } + return this; + } + /** + * .a2a.v1.TaskStatusUpdateEvent status_update = 3; + */ + public org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.Builder getStatusUpdateBuilder() { + return internalGetStatusUpdateFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.TaskStatusUpdateEvent status_update = 3; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEventOrBuilder getStatusUpdateOrBuilder() { + if ((payloadCase_ == 3) && (statusUpdateBuilder_ != null)) { + return statusUpdateBuilder_.getMessageOrBuilder(); + } else { + if (payloadCase_ == 3) { + return (org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent) payload_; + } + return org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.getDefaultInstance(); + } + } + /** + * .a2a.v1.TaskStatusUpdateEvent status_update = 3; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent, org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.Builder, org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEventOrBuilder> + internalGetStatusUpdateFieldBuilder() { + if (statusUpdateBuilder_ == null) { + if (!(payloadCase_ == 3)) { + payload_ = org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.getDefaultInstance(); + } + statusUpdateBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent, org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.Builder, org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEventOrBuilder>( + (org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent) payload_, + getParentForChildren(), + isClean()); + payload_ = null; + } + payloadCase_ = 3; + onChanged(); + return statusUpdateBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent, org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.Builder, org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEventOrBuilder> artifactUpdateBuilder_; + /** + * .a2a.v1.TaskArtifactUpdateEvent artifact_update = 4; + * @return Whether the artifactUpdate field is set. + */ + @java.lang.Override + public boolean hasArtifactUpdate() { + return payloadCase_ == 4; + } + /** + * .a2a.v1.TaskArtifactUpdateEvent artifact_update = 4; + * @return The artifactUpdate. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent getArtifactUpdate() { + if (artifactUpdateBuilder_ == null) { + if (payloadCase_ == 4) { + return (org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent) payload_; + } + return org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.getDefaultInstance(); + } else { + if (payloadCase_ == 4) { + return artifactUpdateBuilder_.getMessage(); + } + return org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.getDefaultInstance(); + } + } + /** + * .a2a.v1.TaskArtifactUpdateEvent artifact_update = 4; + */ + public Builder setArtifactUpdate(org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent value) { + if (artifactUpdateBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + payload_ = value; + onChanged(); + } else { + artifactUpdateBuilder_.setMessage(value); + } + payloadCase_ = 4; + return this; + } + /** + * .a2a.v1.TaskArtifactUpdateEvent artifact_update = 4; + */ + public Builder setArtifactUpdate( + org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.Builder builderForValue) { + if (artifactUpdateBuilder_ == null) { + payload_ = builderForValue.build(); + onChanged(); + } else { + artifactUpdateBuilder_.setMessage(builderForValue.build()); + } + payloadCase_ = 4; + return this; + } + /** + * .a2a.v1.TaskArtifactUpdateEvent artifact_update = 4; + */ + public Builder mergeArtifactUpdate(org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent value) { + if (artifactUpdateBuilder_ == null) { + if (payloadCase_ == 4 && + payload_ != org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.getDefaultInstance()) { + payload_ = org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.newBuilder((org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent) payload_) + .mergeFrom(value).buildPartial(); + } else { + payload_ = value; + } + onChanged(); + } else { + if (payloadCase_ == 4) { + artifactUpdateBuilder_.mergeFrom(value); + } else { + artifactUpdateBuilder_.setMessage(value); + } + } + payloadCase_ = 4; + return this; + } + /** + * .a2a.v1.TaskArtifactUpdateEvent artifact_update = 4; + */ + public Builder clearArtifactUpdate() { + if (artifactUpdateBuilder_ == null) { + if (payloadCase_ == 4) { + payloadCase_ = 0; + payload_ = null; + onChanged(); + } + } else { + if (payloadCase_ == 4) { + payloadCase_ = 0; + payload_ = null; + } + artifactUpdateBuilder_.clear(); + } + return this; + } + /** + * .a2a.v1.TaskArtifactUpdateEvent artifact_update = 4; + */ + public org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.Builder getArtifactUpdateBuilder() { + return internalGetArtifactUpdateFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.TaskArtifactUpdateEvent artifact_update = 4; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEventOrBuilder getArtifactUpdateOrBuilder() { + if ((payloadCase_ == 4) && (artifactUpdateBuilder_ != null)) { + return artifactUpdateBuilder_.getMessageOrBuilder(); + } else { + if (payloadCase_ == 4) { + return (org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent) payload_; + } + return org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.getDefaultInstance(); + } + } + /** + * .a2a.v1.TaskArtifactUpdateEvent artifact_update = 4; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent, org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.Builder, org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEventOrBuilder> + internalGetArtifactUpdateFieldBuilder() { + if (artifactUpdateBuilder_ == null) { + if (!(payloadCase_ == 4)) { + payload_ = org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.getDefaultInstance(); + } + artifactUpdateBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent, org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.Builder, org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEventOrBuilder>( + (org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent) payload_, + getParentForChildren(), + isClean()); + payload_ = null; + } + payloadCase_ = 4; + onChanged(); + return artifactUpdateBuilder_; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.StreamResponse) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.StreamResponse) + private static final org.a2aproject.sdk.compat03.grpc.StreamResponse DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.StreamResponse(); + } + + public static org.a2aproject.sdk.compat03.grpc.StreamResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public StreamResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.StreamResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/StreamResponseOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/StreamResponseOrBuilder.java new file mode 100644 index 000000000..a6b71e2f2 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/StreamResponseOrBuilder.java @@ -0,0 +1,74 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface StreamResponseOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.StreamResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * .a2a.v1.Task task = 1; + * @return Whether the task field is set. + */ + boolean hasTask(); + /** + * .a2a.v1.Task task = 1; + * @return The task. + */ + org.a2aproject.sdk.compat03.grpc.Task getTask(); + /** + * .a2a.v1.Task task = 1; + */ + org.a2aproject.sdk.compat03.grpc.TaskOrBuilder getTaskOrBuilder(); + + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + * @return Whether the msg field is set. + */ + boolean hasMsg(); + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + * @return The msg. + */ + org.a2aproject.sdk.compat03.grpc.Message getMsg(); + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + */ + org.a2aproject.sdk.compat03.grpc.MessageOrBuilder getMsgOrBuilder(); + + /** + * .a2a.v1.TaskStatusUpdateEvent status_update = 3; + * @return Whether the statusUpdate field is set. + */ + boolean hasStatusUpdate(); + /** + * .a2a.v1.TaskStatusUpdateEvent status_update = 3; + * @return The statusUpdate. + */ + org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent getStatusUpdate(); + /** + * .a2a.v1.TaskStatusUpdateEvent status_update = 3; + */ + org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEventOrBuilder getStatusUpdateOrBuilder(); + + /** + * .a2a.v1.TaskArtifactUpdateEvent artifact_update = 4; + * @return Whether the artifactUpdate field is set. + */ + boolean hasArtifactUpdate(); + /** + * .a2a.v1.TaskArtifactUpdateEvent artifact_update = 4; + * @return The artifactUpdate. + */ + org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent getArtifactUpdate(); + /** + * .a2a.v1.TaskArtifactUpdateEvent artifact_update = 4; + */ + org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEventOrBuilder getArtifactUpdateOrBuilder(); + + org.a2aproject.sdk.compat03.grpc.StreamResponse.PayloadCase getPayloadCase(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/StringList.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/StringList.java new file mode 100644 index 000000000..688a72984 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/StringList.java @@ -0,0 +1,563 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+ * 
+ * + * Protobuf type {@code a2a.v1.StringList} + */ +@com.google.protobuf.Generated +public final class StringList extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.StringList) + StringListOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "StringList"); + } + // Use StringList.newBuilder() to construct. + private StringList(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private StringList() { + list_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_StringList_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_StringList_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.StringList.class, org.a2aproject.sdk.compat03.grpc.StringList.Builder.class); + } + + public static final int LIST_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList list_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + /** + * repeated string list = 1; + * @return A list containing the list. + */ + public com.google.protobuf.ProtocolStringList + getListList() { + return list_; + } + /** + * repeated string list = 1; + * @return The count of list. + */ + public int getListCount() { + return list_.size(); + } + /** + * repeated string list = 1; + * @param index The index of the element to return. + * @return The list at the given index. + */ + public java.lang.String getList(int index) { + return list_.get(index); + } + /** + * repeated string list = 1; + * @param index The index of the value to return. + * @return The bytes of the list at the given index. + */ + public com.google.protobuf.ByteString + getListBytes(int index) { + return list_.getByteString(index); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + for (int i = 0; i < list_.size(); i++) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, list_.getRaw(i)); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + for (int i = 0; i < list_.size(); i++) { + dataSize += computeStringSizeNoTag(list_.getRaw(i)); + } + size += dataSize; + size += 1 * getListList().size(); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.StringList)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.StringList other = (org.a2aproject.sdk.compat03.grpc.StringList) obj; + + if (!getListList() + .equals(other.getListList())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getListCount() > 0) { + hash = (37 * hash) + LIST_FIELD_NUMBER; + hash = (53 * hash) + getListList().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.StringList parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.StringList parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.StringList parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.StringList parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.StringList parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.StringList parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.StringList parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.StringList parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.StringList parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.StringList parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.StringList parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.StringList parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.StringList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * 
+ * + * Protobuf type {@code a2a.v1.StringList} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.StringList) + org.a2aproject.sdk.compat03.grpc.StringListOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_StringList_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_StringList_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.StringList.class, org.a2aproject.sdk.compat03.grpc.StringList.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.StringList.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + list_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_StringList_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.StringList getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.StringList.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.StringList build() { + org.a2aproject.sdk.compat03.grpc.StringList result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.StringList buildPartial() { + org.a2aproject.sdk.compat03.grpc.StringList result = new org.a2aproject.sdk.compat03.grpc.StringList(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.StringList result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + list_.makeImmutable(); + result.list_ = list_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.StringList) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.StringList)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.StringList other) { + if (other == org.a2aproject.sdk.compat03.grpc.StringList.getDefaultInstance()) return this; + if (!other.list_.isEmpty()) { + if (list_.isEmpty()) { + list_ = other.list_; + bitField0_ |= 0x00000001; + } else { + ensureListIsMutable(); + list_.addAll(other.list_); + } + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + ensureListIsMutable(); + list_.add(s); + break; + } // case 10 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private com.google.protobuf.LazyStringArrayList list_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + private void ensureListIsMutable() { + if (!list_.isModifiable()) { + list_ = new com.google.protobuf.LazyStringArrayList(list_); + } + bitField0_ |= 0x00000001; + } + /** + * repeated string list = 1; + * @return A list containing the list. + */ + public com.google.protobuf.ProtocolStringList + getListList() { + list_.makeImmutable(); + return list_; + } + /** + * repeated string list = 1; + * @return The count of list. + */ + public int getListCount() { + return list_.size(); + } + /** + * repeated string list = 1; + * @param index The index of the element to return. + * @return The list at the given index. + */ + public java.lang.String getList(int index) { + return list_.get(index); + } + /** + * repeated string list = 1; + * @param index The index of the value to return. + * @return The bytes of the list at the given index. + */ + public com.google.protobuf.ByteString + getListBytes(int index) { + return list_.getByteString(index); + } + /** + * repeated string list = 1; + * @param index The index to set the value at. + * @param value The list to set. + * @return This builder for chaining. + */ + public Builder setList( + int index, java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureListIsMutable(); + list_.set(index, value); + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * repeated string list = 1; + * @param value The list to add. + * @return This builder for chaining. + */ + public Builder addList( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureListIsMutable(); + list_.add(value); + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * repeated string list = 1; + * @param values The list to add. + * @return This builder for chaining. + */ + public Builder addAllList( + java.lang.Iterable values) { + ensureListIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, list_); + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * repeated string list = 1; + * @return This builder for chaining. + */ + public Builder clearList() { + list_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001);; + onChanged(); + return this; + } + /** + * repeated string list = 1; + * @param value The bytes of the list to add. + * @return This builder for chaining. + */ + public Builder addListBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + ensureListIsMutable(); + list_.add(value); + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.StringList) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.StringList) + private static final org.a2aproject.sdk.compat03.grpc.StringList DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.StringList(); + } + + public static org.a2aproject.sdk.compat03.grpc.StringList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public StringList parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.StringList getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/StringListOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/StringListOrBuilder.java new file mode 100644 index 000000000..461eb119f --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/StringListOrBuilder.java @@ -0,0 +1,37 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface StringListOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.StringList) + com.google.protobuf.MessageOrBuilder { + + /** + * repeated string list = 1; + * @return A list containing the list. + */ + java.util.List + getListList(); + /** + * repeated string list = 1; + * @return The count of list. + */ + int getListCount(); + /** + * repeated string list = 1; + * @param index The index of the element to return. + * @return The list at the given index. + */ + java.lang.String getList(int index); + /** + * repeated string list = 1; + * @param index The index of the value to return. + * @return The bytes of the list at the given index. + */ + com.google.protobuf.ByteString + getListBytes(int index); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/Task.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/Task.java new file mode 100644 index 000000000..25dc67af7 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/Task.java @@ -0,0 +1,2114 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * Task is the core unit of action for A2A. It has a current status
+ * and when results are created for the task they are stored in the
+ * artifact. If there are multiple turns for a task, these are stored in
+ * history.
+ * 
+ * + * Protobuf type {@code a2a.v1.Task} + */ +@com.google.protobuf.Generated +public final class Task extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.Task) + TaskOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "Task"); + } + // Use Task.newBuilder() to construct. + private Task(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private Task() { + id_ = ""; + contextId_ = ""; + artifacts_ = java.util.Collections.emptyList(); + history_ = java.util.Collections.emptyList(); + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_Task_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_Task_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.Task.class, org.a2aproject.sdk.compat03.grpc.Task.Builder.class); + } + + private int bitField0_; + public static final int ID_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object id_ = ""; + /** + *
+   * Unique identifier for a task, created by the A2A server.
+   * 
+ * + * string id = 1; + * @return The id. + */ + @java.lang.Override + public java.lang.String getId() { + java.lang.Object ref = id_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + id_ = s; + return s; + } + } + /** + *
+   * Unique identifier for a task, created by the A2A server.
+   * 
+ * + * string id = 1; + * @return The bytes for id. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getIdBytes() { + java.lang.Object ref = id_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + id_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CONTEXT_ID_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object contextId_ = ""; + /** + *
+   * Unique identifier for the contextual collection of interactions (tasks
+   * and messages). Created by the A2A server.
+   * 
+ * + * string context_id = 2; + * @return The contextId. + */ + @java.lang.Override + public java.lang.String getContextId() { + java.lang.Object ref = contextId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + contextId_ = s; + return s; + } + } + /** + *
+   * Unique identifier for the contextual collection of interactions (tasks
+   * and messages). Created by the A2A server.
+   * 
+ * + * string context_id = 2; + * @return The bytes for contextId. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getContextIdBytes() { + java.lang.Object ref = contextId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + contextId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int STATUS_FIELD_NUMBER = 3; + private org.a2aproject.sdk.compat03.grpc.TaskStatus status_; + /** + *
+   * The current status of a Task, including state and a message.
+   * 
+ * + * .a2a.v1.TaskStatus status = 3; + * @return Whether the status field is set. + */ + @java.lang.Override + public boolean hasStatus() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + *
+   * The current status of a Task, including state and a message.
+   * 
+ * + * .a2a.v1.TaskStatus status = 3; + * @return The status. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskStatus getStatus() { + return status_ == null ? org.a2aproject.sdk.compat03.grpc.TaskStatus.getDefaultInstance() : status_; + } + /** + *
+   * The current status of a Task, including state and a message.
+   * 
+ * + * .a2a.v1.TaskStatus status = 3; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskStatusOrBuilder getStatusOrBuilder() { + return status_ == null ? org.a2aproject.sdk.compat03.grpc.TaskStatus.getDefaultInstance() : status_; + } + + public static final int ARTIFACTS_FIELD_NUMBER = 4; + @SuppressWarnings("serial") + private java.util.List artifacts_; + /** + *
+   * A set of output artifacts for a Task.
+   * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + @java.lang.Override + public java.util.List getArtifactsList() { + return artifacts_; + } + /** + *
+   * A set of output artifacts for a Task.
+   * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + @java.lang.Override + public java.util.List + getArtifactsOrBuilderList() { + return artifacts_; + } + /** + *
+   * A set of output artifacts for a Task.
+   * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + @java.lang.Override + public int getArtifactsCount() { + return artifacts_.size(); + } + /** + *
+   * A set of output artifacts for a Task.
+   * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Artifact getArtifacts(int index) { + return artifacts_.get(index); + } + /** + *
+   * A set of output artifacts for a Task.
+   * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ArtifactOrBuilder getArtifactsOrBuilder( + int index) { + return artifacts_.get(index); + } + + public static final int HISTORY_FIELD_NUMBER = 5; + @SuppressWarnings("serial") + private java.util.List history_; + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * The history of interactions from a task.
+   * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + @java.lang.Override + public java.util.List getHistoryList() { + return history_; + } + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * The history of interactions from a task.
+   * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + @java.lang.Override + public java.util.List + getHistoryOrBuilderList() { + return history_; + } + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * The history of interactions from a task.
+   * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + @java.lang.Override + public int getHistoryCount() { + return history_.size(); + } + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * The history of interactions from a task.
+   * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Message getHistory(int index) { + return history_.get(index); + } + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * The history of interactions from a task.
+   * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.MessageOrBuilder getHistoryOrBuilder( + int index) { + return history_.get(index); + } + + public static final int METADATA_FIELD_NUMBER = 6; + private com.google.protobuf.Struct metadata_; + /** + *
+   * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+   * A key/value object to store custom metadata about a task.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return Whether the metadata field is set. + */ + @java.lang.Override + public boolean hasMetadata() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + *
+   * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+   * A key/value object to store custom metadata about a task.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return The metadata. + */ + @java.lang.Override + public com.google.protobuf.Struct getMetadata() { + return metadata_ == null ? com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } + /** + *
+   * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+   * A key/value object to store custom metadata about a task.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + @java.lang.Override + public com.google.protobuf.StructOrBuilder getMetadataOrBuilder() { + return metadata_ == null ? com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(id_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, id_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(contextId_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, contextId_); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(3, getStatus()); + } + for (int i = 0; i < artifacts_.size(); i++) { + output.writeMessage(4, artifacts_.get(i)); + } + for (int i = 0; i < history_.size(); i++) { + output.writeMessage(5, history_.get(i)); + } + if (((bitField0_ & 0x00000002) != 0)) { + output.writeMessage(6, getMetadata()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(id_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, id_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(contextId_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, contextId_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, getStatus()); + } + for (int i = 0; i < artifacts_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, artifacts_.get(i)); + } + for (int i = 0; i < history_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(5, history_.get(i)); + } + if (((bitField0_ & 0x00000002) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(6, getMetadata()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.Task)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.Task other = (org.a2aproject.sdk.compat03.grpc.Task) obj; + + if (!getId() + .equals(other.getId())) return false; + if (!getContextId() + .equals(other.getContextId())) return false; + if (hasStatus() != other.hasStatus()) return false; + if (hasStatus()) { + if (!getStatus() + .equals(other.getStatus())) return false; + } + if (!getArtifactsList() + .equals(other.getArtifactsList())) return false; + if (!getHistoryList() + .equals(other.getHistoryList())) return false; + if (hasMetadata() != other.hasMetadata()) return false; + if (hasMetadata()) { + if (!getMetadata() + .equals(other.getMetadata())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + ID_FIELD_NUMBER; + hash = (53 * hash) + getId().hashCode(); + hash = (37 * hash) + CONTEXT_ID_FIELD_NUMBER; + hash = (53 * hash) + getContextId().hashCode(); + if (hasStatus()) { + hash = (37 * hash) + STATUS_FIELD_NUMBER; + hash = (53 * hash) + getStatus().hashCode(); + } + if (getArtifactsCount() > 0) { + hash = (37 * hash) + ARTIFACTS_FIELD_NUMBER; + hash = (53 * hash) + getArtifactsList().hashCode(); + } + if (getHistoryCount() > 0) { + hash = (37 * hash) + HISTORY_FIELD_NUMBER; + hash = (53 * hash) + getHistoryList().hashCode(); + } + if (hasMetadata()) { + hash = (37 * hash) + METADATA_FIELD_NUMBER; + hash = (53 * hash) + getMetadata().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.Task parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.Task parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.Task parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.Task parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.Task parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.Task parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.Task parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.Task parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.Task parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.Task parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.Task parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.Task parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.Task prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * Task is the core unit of action for A2A. It has a current status
+   * and when results are created for the task they are stored in the
+   * artifact. If there are multiple turns for a task, these are stored in
+   * history.
+   * 
+ * + * Protobuf type {@code a2a.v1.Task} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.Task) + org.a2aproject.sdk.compat03.grpc.TaskOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_Task_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_Task_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.Task.class, org.a2aproject.sdk.compat03.grpc.Task.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.Task.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage + .alwaysUseFieldBuilders) { + internalGetStatusFieldBuilder(); + internalGetArtifactsFieldBuilder(); + internalGetHistoryFieldBuilder(); + internalGetMetadataFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + id_ = ""; + contextId_ = ""; + status_ = null; + if (statusBuilder_ != null) { + statusBuilder_.dispose(); + statusBuilder_ = null; + } + if (artifactsBuilder_ == null) { + artifacts_ = java.util.Collections.emptyList(); + } else { + artifacts_ = null; + artifactsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000008); + if (historyBuilder_ == null) { + history_ = java.util.Collections.emptyList(); + } else { + history_ = null; + historyBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000010); + metadata_ = null; + if (metadataBuilder_ != null) { + metadataBuilder_.dispose(); + metadataBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_Task_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Task getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.Task.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Task build() { + org.a2aproject.sdk.compat03.grpc.Task result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Task buildPartial() { + org.a2aproject.sdk.compat03.grpc.Task result = new org.a2aproject.sdk.compat03.grpc.Task(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields(org.a2aproject.sdk.compat03.grpc.Task result) { + if (artifactsBuilder_ == null) { + if (((bitField0_ & 0x00000008) != 0)) { + artifacts_ = java.util.Collections.unmodifiableList(artifacts_); + bitField0_ = (bitField0_ & ~0x00000008); + } + result.artifacts_ = artifacts_; + } else { + result.artifacts_ = artifactsBuilder_.build(); + } + if (historyBuilder_ == null) { + if (((bitField0_ & 0x00000010) != 0)) { + history_ = java.util.Collections.unmodifiableList(history_); + bitField0_ = (bitField0_ & ~0x00000010); + } + result.history_ = history_; + } else { + result.history_ = historyBuilder_.build(); + } + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.Task result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.id_ = id_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.contextId_ = contextId_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000004) != 0)) { + result.status_ = statusBuilder_ == null + ? status_ + : statusBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000020) != 0)) { + result.metadata_ = metadataBuilder_ == null + ? metadata_ + : metadataBuilder_.build(); + to_bitField0_ |= 0x00000002; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.Task) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.Task)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.Task other) { + if (other == org.a2aproject.sdk.compat03.grpc.Task.getDefaultInstance()) return this; + if (!other.getId().isEmpty()) { + id_ = other.id_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getContextId().isEmpty()) { + contextId_ = other.contextId_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (other.hasStatus()) { + mergeStatus(other.getStatus()); + } + if (artifactsBuilder_ == null) { + if (!other.artifacts_.isEmpty()) { + if (artifacts_.isEmpty()) { + artifacts_ = other.artifacts_; + bitField0_ = (bitField0_ & ~0x00000008); + } else { + ensureArtifactsIsMutable(); + artifacts_.addAll(other.artifacts_); + } + onChanged(); + } + } else { + if (!other.artifacts_.isEmpty()) { + if (artifactsBuilder_.isEmpty()) { + artifactsBuilder_.dispose(); + artifactsBuilder_ = null; + artifacts_ = other.artifacts_; + bitField0_ = (bitField0_ & ~0x00000008); + artifactsBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + internalGetArtifactsFieldBuilder() : null; + } else { + artifactsBuilder_.addAllMessages(other.artifacts_); + } + } + } + if (historyBuilder_ == null) { + if (!other.history_.isEmpty()) { + if (history_.isEmpty()) { + history_ = other.history_; + bitField0_ = (bitField0_ & ~0x00000010); + } else { + ensureHistoryIsMutable(); + history_.addAll(other.history_); + } + onChanged(); + } + } else { + if (!other.history_.isEmpty()) { + if (historyBuilder_.isEmpty()) { + historyBuilder_.dispose(); + historyBuilder_ = null; + history_ = other.history_; + bitField0_ = (bitField0_ & ~0x00000010); + historyBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + internalGetHistoryFieldBuilder() : null; + } else { + historyBuilder_.addAllMessages(other.history_); + } + } + } + if (other.hasMetadata()) { + mergeMetadata(other.getMetadata()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + id_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + contextId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: { + input.readMessage( + internalGetStatusFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000004; + break; + } // case 26 + case 34: { + org.a2aproject.sdk.compat03.grpc.Artifact m = + input.readMessage( + org.a2aproject.sdk.compat03.grpc.Artifact.parser(), + extensionRegistry); + if (artifactsBuilder_ == null) { + ensureArtifactsIsMutable(); + artifacts_.add(m); + } else { + artifactsBuilder_.addMessage(m); + } + break; + } // case 34 + case 42: { + org.a2aproject.sdk.compat03.grpc.Message m = + input.readMessage( + org.a2aproject.sdk.compat03.grpc.Message.parser(), + extensionRegistry); + if (historyBuilder_ == null) { + ensureHistoryIsMutable(); + history_.add(m); + } else { + historyBuilder_.addMessage(m); + } + break; + } // case 42 + case 50: { + input.readMessage( + internalGetMetadataFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000020; + break; + } // case 50 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object id_ = ""; + /** + *
+     * Unique identifier for a task, created by the A2A server.
+     * 
+ * + * string id = 1; + * @return The id. + */ + public java.lang.String getId() { + java.lang.Object ref = id_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + id_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Unique identifier for a task, created by the A2A server.
+     * 
+ * + * string id = 1; + * @return The bytes for id. + */ + public com.google.protobuf.ByteString + getIdBytes() { + java.lang.Object ref = id_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + id_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Unique identifier for a task, created by the A2A server.
+     * 
+ * + * string id = 1; + * @param value The id to set. + * @return This builder for chaining. + */ + public Builder setId( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + id_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * Unique identifier for a task, created by the A2A server.
+     * 
+ * + * string id = 1; + * @return This builder for chaining. + */ + public Builder clearId() { + id_ = getDefaultInstance().getId(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * Unique identifier for a task, created by the A2A server.
+     * 
+ * + * string id = 1; + * @param value The bytes for id to set. + * @return This builder for chaining. + */ + public Builder setIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + id_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object contextId_ = ""; + /** + *
+     * Unique identifier for the contextual collection of interactions (tasks
+     * and messages). Created by the A2A server.
+     * 
+ * + * string context_id = 2; + * @return The contextId. + */ + public java.lang.String getContextId() { + java.lang.Object ref = contextId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + contextId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Unique identifier for the contextual collection of interactions (tasks
+     * and messages). Created by the A2A server.
+     * 
+ * + * string context_id = 2; + * @return The bytes for contextId. + */ + public com.google.protobuf.ByteString + getContextIdBytes() { + java.lang.Object ref = contextId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + contextId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Unique identifier for the contextual collection of interactions (tasks
+     * and messages). Created by the A2A server.
+     * 
+ * + * string context_id = 2; + * @param value The contextId to set. + * @return This builder for chaining. + */ + public Builder setContextId( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + contextId_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * Unique identifier for the contextual collection of interactions (tasks
+     * and messages). Created by the A2A server.
+     * 
+ * + * string context_id = 2; + * @return This builder for chaining. + */ + public Builder clearContextId() { + contextId_ = getDefaultInstance().getContextId(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * Unique identifier for the contextual collection of interactions (tasks
+     * and messages). Created by the A2A server.
+     * 
+ * + * string context_id = 2; + * @param value The bytes for contextId to set. + * @return This builder for chaining. + */ + public Builder setContextIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + contextId_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private org.a2aproject.sdk.compat03.grpc.TaskStatus status_; + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.TaskStatus, org.a2aproject.sdk.compat03.grpc.TaskStatus.Builder, org.a2aproject.sdk.compat03.grpc.TaskStatusOrBuilder> statusBuilder_; + /** + *
+     * The current status of a Task, including state and a message.
+     * 
+ * + * .a2a.v1.TaskStatus status = 3; + * @return Whether the status field is set. + */ + public boolean hasStatus() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + *
+     * The current status of a Task, including state and a message.
+     * 
+ * + * .a2a.v1.TaskStatus status = 3; + * @return The status. + */ + public org.a2aproject.sdk.compat03.grpc.TaskStatus getStatus() { + if (statusBuilder_ == null) { + return status_ == null ? org.a2aproject.sdk.compat03.grpc.TaskStatus.getDefaultInstance() : status_; + } else { + return statusBuilder_.getMessage(); + } + } + /** + *
+     * The current status of a Task, including state and a message.
+     * 
+ * + * .a2a.v1.TaskStatus status = 3; + */ + public Builder setStatus(org.a2aproject.sdk.compat03.grpc.TaskStatus value) { + if (statusBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + status_ = value; + } else { + statusBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * The current status of a Task, including state and a message.
+     * 
+ * + * .a2a.v1.TaskStatus status = 3; + */ + public Builder setStatus( + org.a2aproject.sdk.compat03.grpc.TaskStatus.Builder builderForValue) { + if (statusBuilder_ == null) { + status_ = builderForValue.build(); + } else { + statusBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * The current status of a Task, including state and a message.
+     * 
+ * + * .a2a.v1.TaskStatus status = 3; + */ + public Builder mergeStatus(org.a2aproject.sdk.compat03.grpc.TaskStatus value) { + if (statusBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0) && + status_ != null && + status_ != org.a2aproject.sdk.compat03.grpc.TaskStatus.getDefaultInstance()) { + getStatusBuilder().mergeFrom(value); + } else { + status_ = value; + } + } else { + statusBuilder_.mergeFrom(value); + } + if (status_ != null) { + bitField0_ |= 0x00000004; + onChanged(); + } + return this; + } + /** + *
+     * The current status of a Task, including state and a message.
+     * 
+ * + * .a2a.v1.TaskStatus status = 3; + */ + public Builder clearStatus() { + bitField0_ = (bitField0_ & ~0x00000004); + status_ = null; + if (statusBuilder_ != null) { + statusBuilder_.dispose(); + statusBuilder_ = null; + } + onChanged(); + return this; + } + /** + *
+     * The current status of a Task, including state and a message.
+     * 
+ * + * .a2a.v1.TaskStatus status = 3; + */ + public org.a2aproject.sdk.compat03.grpc.TaskStatus.Builder getStatusBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return internalGetStatusFieldBuilder().getBuilder(); + } + /** + *
+     * The current status of a Task, including state and a message.
+     * 
+ * + * .a2a.v1.TaskStatus status = 3; + */ + public org.a2aproject.sdk.compat03.grpc.TaskStatusOrBuilder getStatusOrBuilder() { + if (statusBuilder_ != null) { + return statusBuilder_.getMessageOrBuilder(); + } else { + return status_ == null ? + org.a2aproject.sdk.compat03.grpc.TaskStatus.getDefaultInstance() : status_; + } + } + /** + *
+     * The current status of a Task, including state and a message.
+     * 
+ * + * .a2a.v1.TaskStatus status = 3; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.TaskStatus, org.a2aproject.sdk.compat03.grpc.TaskStatus.Builder, org.a2aproject.sdk.compat03.grpc.TaskStatusOrBuilder> + internalGetStatusFieldBuilder() { + if (statusBuilder_ == null) { + statusBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.TaskStatus, org.a2aproject.sdk.compat03.grpc.TaskStatus.Builder, org.a2aproject.sdk.compat03.grpc.TaskStatusOrBuilder>( + getStatus(), + getParentForChildren(), + isClean()); + status_ = null; + } + return statusBuilder_; + } + + private java.util.List artifacts_ = + java.util.Collections.emptyList(); + private void ensureArtifactsIsMutable() { + if (!((bitField0_ & 0x00000008) != 0)) { + artifacts_ = new java.util.ArrayList(artifacts_); + bitField0_ |= 0x00000008; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Artifact, org.a2aproject.sdk.compat03.grpc.Artifact.Builder, org.a2aproject.sdk.compat03.grpc.ArtifactOrBuilder> artifactsBuilder_; + + /** + *
+     * A set of output artifacts for a Task.
+     * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + public java.util.List getArtifactsList() { + if (artifactsBuilder_ == null) { + return java.util.Collections.unmodifiableList(artifacts_); + } else { + return artifactsBuilder_.getMessageList(); + } + } + /** + *
+     * A set of output artifacts for a Task.
+     * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + public int getArtifactsCount() { + if (artifactsBuilder_ == null) { + return artifacts_.size(); + } else { + return artifactsBuilder_.getCount(); + } + } + /** + *
+     * A set of output artifacts for a Task.
+     * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + public org.a2aproject.sdk.compat03.grpc.Artifact getArtifacts(int index) { + if (artifactsBuilder_ == null) { + return artifacts_.get(index); + } else { + return artifactsBuilder_.getMessage(index); + } + } + /** + *
+     * A set of output artifacts for a Task.
+     * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + public Builder setArtifacts( + int index, org.a2aproject.sdk.compat03.grpc.Artifact value) { + if (artifactsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureArtifactsIsMutable(); + artifacts_.set(index, value); + onChanged(); + } else { + artifactsBuilder_.setMessage(index, value); + } + return this; + } + /** + *
+     * A set of output artifacts for a Task.
+     * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + public Builder setArtifacts( + int index, org.a2aproject.sdk.compat03.grpc.Artifact.Builder builderForValue) { + if (artifactsBuilder_ == null) { + ensureArtifactsIsMutable(); + artifacts_.set(index, builderForValue.build()); + onChanged(); + } else { + artifactsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * A set of output artifacts for a Task.
+     * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + public Builder addArtifacts(org.a2aproject.sdk.compat03.grpc.Artifact value) { + if (artifactsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureArtifactsIsMutable(); + artifacts_.add(value); + onChanged(); + } else { + artifactsBuilder_.addMessage(value); + } + return this; + } + /** + *
+     * A set of output artifacts for a Task.
+     * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + public Builder addArtifacts( + int index, org.a2aproject.sdk.compat03.grpc.Artifact value) { + if (artifactsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureArtifactsIsMutable(); + artifacts_.add(index, value); + onChanged(); + } else { + artifactsBuilder_.addMessage(index, value); + } + return this; + } + /** + *
+     * A set of output artifacts for a Task.
+     * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + public Builder addArtifacts( + org.a2aproject.sdk.compat03.grpc.Artifact.Builder builderForValue) { + if (artifactsBuilder_ == null) { + ensureArtifactsIsMutable(); + artifacts_.add(builderForValue.build()); + onChanged(); + } else { + artifactsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + *
+     * A set of output artifacts for a Task.
+     * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + public Builder addArtifacts( + int index, org.a2aproject.sdk.compat03.grpc.Artifact.Builder builderForValue) { + if (artifactsBuilder_ == null) { + ensureArtifactsIsMutable(); + artifacts_.add(index, builderForValue.build()); + onChanged(); + } else { + artifactsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * A set of output artifacts for a Task.
+     * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + public Builder addAllArtifacts( + java.lang.Iterable values) { + if (artifactsBuilder_ == null) { + ensureArtifactsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, artifacts_); + onChanged(); + } else { + artifactsBuilder_.addAllMessages(values); + } + return this; + } + /** + *
+     * A set of output artifacts for a Task.
+     * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + public Builder clearArtifacts() { + if (artifactsBuilder_ == null) { + artifacts_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000008); + onChanged(); + } else { + artifactsBuilder_.clear(); + } + return this; + } + /** + *
+     * A set of output artifacts for a Task.
+     * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + public Builder removeArtifacts(int index) { + if (artifactsBuilder_ == null) { + ensureArtifactsIsMutable(); + artifacts_.remove(index); + onChanged(); + } else { + artifactsBuilder_.remove(index); + } + return this; + } + /** + *
+     * A set of output artifacts for a Task.
+     * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + public org.a2aproject.sdk.compat03.grpc.Artifact.Builder getArtifactsBuilder( + int index) { + return internalGetArtifactsFieldBuilder().getBuilder(index); + } + /** + *
+     * A set of output artifacts for a Task.
+     * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + public org.a2aproject.sdk.compat03.grpc.ArtifactOrBuilder getArtifactsOrBuilder( + int index) { + if (artifactsBuilder_ == null) { + return artifacts_.get(index); } else { + return artifactsBuilder_.getMessageOrBuilder(index); + } + } + /** + *
+     * A set of output artifacts for a Task.
+     * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + public java.util.List + getArtifactsOrBuilderList() { + if (artifactsBuilder_ != null) { + return artifactsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(artifacts_); + } + } + /** + *
+     * A set of output artifacts for a Task.
+     * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + public org.a2aproject.sdk.compat03.grpc.Artifact.Builder addArtifactsBuilder() { + return internalGetArtifactsFieldBuilder().addBuilder( + org.a2aproject.sdk.compat03.grpc.Artifact.getDefaultInstance()); + } + /** + *
+     * A set of output artifacts for a Task.
+     * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + public org.a2aproject.sdk.compat03.grpc.Artifact.Builder addArtifactsBuilder( + int index) { + return internalGetArtifactsFieldBuilder().addBuilder( + index, org.a2aproject.sdk.compat03.grpc.Artifact.getDefaultInstance()); + } + /** + *
+     * A set of output artifacts for a Task.
+     * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + public java.util.List + getArtifactsBuilderList() { + return internalGetArtifactsFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Artifact, org.a2aproject.sdk.compat03.grpc.Artifact.Builder, org.a2aproject.sdk.compat03.grpc.ArtifactOrBuilder> + internalGetArtifactsFieldBuilder() { + if (artifactsBuilder_ == null) { + artifactsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Artifact, org.a2aproject.sdk.compat03.grpc.Artifact.Builder, org.a2aproject.sdk.compat03.grpc.ArtifactOrBuilder>( + artifacts_, + ((bitField0_ & 0x00000008) != 0), + getParentForChildren(), + isClean()); + artifacts_ = null; + } + return artifactsBuilder_; + } + + private java.util.List history_ = + java.util.Collections.emptyList(); + private void ensureHistoryIsMutable() { + if (!((bitField0_ & 0x00000010) != 0)) { + history_ = new java.util.ArrayList(history_); + bitField0_ |= 0x00000010; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Message, org.a2aproject.sdk.compat03.grpc.Message.Builder, org.a2aproject.sdk.compat03.grpc.MessageOrBuilder> historyBuilder_; + + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * The history of interactions from a task.
+     * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + public java.util.List getHistoryList() { + if (historyBuilder_ == null) { + return java.util.Collections.unmodifiableList(history_); + } else { + return historyBuilder_.getMessageList(); + } + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * The history of interactions from a task.
+     * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + public int getHistoryCount() { + if (historyBuilder_ == null) { + return history_.size(); + } else { + return historyBuilder_.getCount(); + } + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * The history of interactions from a task.
+     * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + public org.a2aproject.sdk.compat03.grpc.Message getHistory(int index) { + if (historyBuilder_ == null) { + return history_.get(index); + } else { + return historyBuilder_.getMessage(index); + } + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * The history of interactions from a task.
+     * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + public Builder setHistory( + int index, org.a2aproject.sdk.compat03.grpc.Message value) { + if (historyBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureHistoryIsMutable(); + history_.set(index, value); + onChanged(); + } else { + historyBuilder_.setMessage(index, value); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * The history of interactions from a task.
+     * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + public Builder setHistory( + int index, org.a2aproject.sdk.compat03.grpc.Message.Builder builderForValue) { + if (historyBuilder_ == null) { + ensureHistoryIsMutable(); + history_.set(index, builderForValue.build()); + onChanged(); + } else { + historyBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * The history of interactions from a task.
+     * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + public Builder addHistory(org.a2aproject.sdk.compat03.grpc.Message value) { + if (historyBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureHistoryIsMutable(); + history_.add(value); + onChanged(); + } else { + historyBuilder_.addMessage(value); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * The history of interactions from a task.
+     * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + public Builder addHistory( + int index, org.a2aproject.sdk.compat03.grpc.Message value) { + if (historyBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureHistoryIsMutable(); + history_.add(index, value); + onChanged(); + } else { + historyBuilder_.addMessage(index, value); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * The history of interactions from a task.
+     * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + public Builder addHistory( + org.a2aproject.sdk.compat03.grpc.Message.Builder builderForValue) { + if (historyBuilder_ == null) { + ensureHistoryIsMutable(); + history_.add(builderForValue.build()); + onChanged(); + } else { + historyBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * The history of interactions from a task.
+     * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + public Builder addHistory( + int index, org.a2aproject.sdk.compat03.grpc.Message.Builder builderForValue) { + if (historyBuilder_ == null) { + ensureHistoryIsMutable(); + history_.add(index, builderForValue.build()); + onChanged(); + } else { + historyBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * The history of interactions from a task.
+     * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + public Builder addAllHistory( + java.lang.Iterable values) { + if (historyBuilder_ == null) { + ensureHistoryIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, history_); + onChanged(); + } else { + historyBuilder_.addAllMessages(values); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * The history of interactions from a task.
+     * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + public Builder clearHistory() { + if (historyBuilder_ == null) { + history_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000010); + onChanged(); + } else { + historyBuilder_.clear(); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * The history of interactions from a task.
+     * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + public Builder removeHistory(int index) { + if (historyBuilder_ == null) { + ensureHistoryIsMutable(); + history_.remove(index); + onChanged(); + } else { + historyBuilder_.remove(index); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * The history of interactions from a task.
+     * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + public org.a2aproject.sdk.compat03.grpc.Message.Builder getHistoryBuilder( + int index) { + return internalGetHistoryFieldBuilder().getBuilder(index); + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * The history of interactions from a task.
+     * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + public org.a2aproject.sdk.compat03.grpc.MessageOrBuilder getHistoryOrBuilder( + int index) { + if (historyBuilder_ == null) { + return history_.get(index); } else { + return historyBuilder_.getMessageOrBuilder(index); + } + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * The history of interactions from a task.
+     * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + public java.util.List + getHistoryOrBuilderList() { + if (historyBuilder_ != null) { + return historyBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(history_); + } + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * The history of interactions from a task.
+     * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + public org.a2aproject.sdk.compat03.grpc.Message.Builder addHistoryBuilder() { + return internalGetHistoryFieldBuilder().addBuilder( + org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance()); + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * The history of interactions from a task.
+     * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + public org.a2aproject.sdk.compat03.grpc.Message.Builder addHistoryBuilder( + int index) { + return internalGetHistoryFieldBuilder().addBuilder( + index, org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance()); + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * The history of interactions from a task.
+     * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + public java.util.List + getHistoryBuilderList() { + return internalGetHistoryFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Message, org.a2aproject.sdk.compat03.grpc.Message.Builder, org.a2aproject.sdk.compat03.grpc.MessageOrBuilder> + internalGetHistoryFieldBuilder() { + if (historyBuilder_ == null) { + historyBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Message, org.a2aproject.sdk.compat03.grpc.Message.Builder, org.a2aproject.sdk.compat03.grpc.MessageOrBuilder>( + history_, + ((bitField0_ & 0x00000010) != 0), + getParentForChildren(), + isClean()); + history_ = null; + } + return historyBuilder_; + } + + private com.google.protobuf.Struct metadata_; + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> metadataBuilder_; + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * A key/value object to store custom metadata about a task.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return Whether the metadata field is set. + */ + public boolean hasMetadata() { + return ((bitField0_ & 0x00000020) != 0); + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * A key/value object to store custom metadata about a task.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return The metadata. + */ + public com.google.protobuf.Struct getMetadata() { + if (metadataBuilder_ == null) { + return metadata_ == null ? com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } else { + return metadataBuilder_.getMessage(); + } + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * A key/value object to store custom metadata about a task.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public Builder setMetadata(com.google.protobuf.Struct value) { + if (metadataBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + metadata_ = value; + } else { + metadataBuilder_.setMessage(value); + } + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * A key/value object to store custom metadata about a task.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public Builder setMetadata( + com.google.protobuf.Struct.Builder builderForValue) { + if (metadataBuilder_ == null) { + metadata_ = builderForValue.build(); + } else { + metadataBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * A key/value object to store custom metadata about a task.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public Builder mergeMetadata(com.google.protobuf.Struct value) { + if (metadataBuilder_ == null) { + if (((bitField0_ & 0x00000020) != 0) && + metadata_ != null && + metadata_ != com.google.protobuf.Struct.getDefaultInstance()) { + getMetadataBuilder().mergeFrom(value); + } else { + metadata_ = value; + } + } else { + metadataBuilder_.mergeFrom(value); + } + if (metadata_ != null) { + bitField0_ |= 0x00000020; + onChanged(); + } + return this; + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * A key/value object to store custom metadata about a task.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public Builder clearMetadata() { + bitField0_ = (bitField0_ & ~0x00000020); + metadata_ = null; + if (metadataBuilder_ != null) { + metadataBuilder_.dispose(); + metadataBuilder_ = null; + } + onChanged(); + return this; + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * A key/value object to store custom metadata about a task.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public com.google.protobuf.Struct.Builder getMetadataBuilder() { + bitField0_ |= 0x00000020; + onChanged(); + return internalGetMetadataFieldBuilder().getBuilder(); + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * A key/value object to store custom metadata about a task.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public com.google.protobuf.StructOrBuilder getMetadataOrBuilder() { + if (metadataBuilder_ != null) { + return metadataBuilder_.getMessageOrBuilder(); + } else { + return metadata_ == null ? + com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * A key/value object to store custom metadata about a task.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> + internalGetMetadataFieldBuilder() { + if (metadataBuilder_ == null) { + metadataBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder>( + getMetadata(), + getParentForChildren(), + isClean()); + metadata_ = null; + } + return metadataBuilder_; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.Task) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.Task) + private static final org.a2aproject.sdk.compat03.grpc.Task DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.Task(); + } + + public static org.a2aproject.sdk.compat03.grpc.Task getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Task parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Task getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskArtifactUpdateEvent.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskArtifactUpdateEvent.java new file mode 100644 index 000000000..a145eca7b --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskArtifactUpdateEvent.java @@ -0,0 +1,1344 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * TaskArtifactUpdateEvent represents a task delta where an artifact has
+ * been generated.
+ * 
+ * + * Protobuf type {@code a2a.v1.TaskArtifactUpdateEvent} + */ +@com.google.protobuf.Generated +public final class TaskArtifactUpdateEvent extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.TaskArtifactUpdateEvent) + TaskArtifactUpdateEventOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "TaskArtifactUpdateEvent"); + } + // Use TaskArtifactUpdateEvent.newBuilder() to construct. + private TaskArtifactUpdateEvent(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private TaskArtifactUpdateEvent() { + taskId_ = ""; + contextId_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_TaskArtifactUpdateEvent_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_TaskArtifactUpdateEvent_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.class, org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.Builder.class); + } + + private int bitField0_; + public static final int TASK_ID_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object taskId_ = ""; + /** + *
+   * The id of the task for this artifact
+   * 
+ * + * string task_id = 1; + * @return The taskId. + */ + @java.lang.Override + public java.lang.String getTaskId() { + java.lang.Object ref = taskId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + taskId_ = s; + return s; + } + } + /** + *
+   * The id of the task for this artifact
+   * 
+ * + * string task_id = 1; + * @return The bytes for taskId. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getTaskIdBytes() { + java.lang.Object ref = taskId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + taskId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CONTEXT_ID_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object contextId_ = ""; + /** + *
+   * The id of the context that this task belongs too
+   * 
+ * + * string context_id = 2; + * @return The contextId. + */ + @java.lang.Override + public java.lang.String getContextId() { + java.lang.Object ref = contextId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + contextId_ = s; + return s; + } + } + /** + *
+   * The id of the context that this task belongs too
+   * 
+ * + * string context_id = 2; + * @return The bytes for contextId. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getContextIdBytes() { + java.lang.Object ref = contextId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + contextId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int ARTIFACT_FIELD_NUMBER = 3; + private org.a2aproject.sdk.compat03.grpc.Artifact artifact_; + /** + *
+   * The artifact itself
+   * 
+ * + * .a2a.v1.Artifact artifact = 3; + * @return Whether the artifact field is set. + */ + @java.lang.Override + public boolean hasArtifact() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + *
+   * The artifact itself
+   * 
+ * + * .a2a.v1.Artifact artifact = 3; + * @return The artifact. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Artifact getArtifact() { + return artifact_ == null ? org.a2aproject.sdk.compat03.grpc.Artifact.getDefaultInstance() : artifact_; + } + /** + *
+   * The artifact itself
+   * 
+ * + * .a2a.v1.Artifact artifact = 3; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ArtifactOrBuilder getArtifactOrBuilder() { + return artifact_ == null ? org.a2aproject.sdk.compat03.grpc.Artifact.getDefaultInstance() : artifact_; + } + + public static final int APPEND_FIELD_NUMBER = 4; + private boolean append_ = false; + /** + *
+   * Whether this should be appended to a prior one produced
+   * 
+ * + * bool append = 4; + * @return The append. + */ + @java.lang.Override + public boolean getAppend() { + return append_; + } + + public static final int LAST_CHUNK_FIELD_NUMBER = 5; + private boolean lastChunk_ = false; + /** + *
+   * Whether this represents the last part of an artifact
+   * 
+ * + * bool last_chunk = 5; + * @return The lastChunk. + */ + @java.lang.Override + public boolean getLastChunk() { + return lastChunk_; + } + + public static final int METADATA_FIELD_NUMBER = 6; + private com.google.protobuf.Struct metadata_; + /** + *
+   * Optional metadata associated with the artifact update.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return Whether the metadata field is set. + */ + @java.lang.Override + public boolean hasMetadata() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + *
+   * Optional metadata associated with the artifact update.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return The metadata. + */ + @java.lang.Override + public com.google.protobuf.Struct getMetadata() { + return metadata_ == null ? com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } + /** + *
+   * Optional metadata associated with the artifact update.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + @java.lang.Override + public com.google.protobuf.StructOrBuilder getMetadataOrBuilder() { + return metadata_ == null ? com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(taskId_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, taskId_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(contextId_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, contextId_); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(3, getArtifact()); + } + if (append_ != false) { + output.writeBool(4, append_); + } + if (lastChunk_ != false) { + output.writeBool(5, lastChunk_); + } + if (((bitField0_ & 0x00000002) != 0)) { + output.writeMessage(6, getMetadata()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(taskId_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, taskId_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(contextId_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, contextId_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, getArtifact()); + } + if (append_ != false) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(4, append_); + } + if (lastChunk_ != false) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(5, lastChunk_); + } + if (((bitField0_ & 0x00000002) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(6, getMetadata()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent other = (org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent) obj; + + if (!getTaskId() + .equals(other.getTaskId())) return false; + if (!getContextId() + .equals(other.getContextId())) return false; + if (hasArtifact() != other.hasArtifact()) return false; + if (hasArtifact()) { + if (!getArtifact() + .equals(other.getArtifact())) return false; + } + if (getAppend() + != other.getAppend()) return false; + if (getLastChunk() + != other.getLastChunk()) return false; + if (hasMetadata() != other.hasMetadata()) return false; + if (hasMetadata()) { + if (!getMetadata() + .equals(other.getMetadata())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + TASK_ID_FIELD_NUMBER; + hash = (53 * hash) + getTaskId().hashCode(); + hash = (37 * hash) + CONTEXT_ID_FIELD_NUMBER; + hash = (53 * hash) + getContextId().hashCode(); + if (hasArtifact()) { + hash = (37 * hash) + ARTIFACT_FIELD_NUMBER; + hash = (53 * hash) + getArtifact().hashCode(); + } + hash = (37 * hash) + APPEND_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( + getAppend()); + hash = (37 * hash) + LAST_CHUNK_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( + getLastChunk()); + if (hasMetadata()) { + hash = (37 * hash) + METADATA_FIELD_NUMBER; + hash = (53 * hash) + getMetadata().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * TaskArtifactUpdateEvent represents a task delta where an artifact has
+   * been generated.
+   * 
+ * + * Protobuf type {@code a2a.v1.TaskArtifactUpdateEvent} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.TaskArtifactUpdateEvent) + org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEventOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_TaskArtifactUpdateEvent_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_TaskArtifactUpdateEvent_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.class, org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage + .alwaysUseFieldBuilders) { + internalGetArtifactFieldBuilder(); + internalGetMetadataFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + taskId_ = ""; + contextId_ = ""; + artifact_ = null; + if (artifactBuilder_ != null) { + artifactBuilder_.dispose(); + artifactBuilder_ = null; + } + append_ = false; + lastChunk_ = false; + metadata_ = null; + if (metadataBuilder_ != null) { + metadataBuilder_.dispose(); + metadataBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_TaskArtifactUpdateEvent_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent build() { + org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent buildPartial() { + org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent result = new org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.taskId_ = taskId_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.contextId_ = contextId_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000004) != 0)) { + result.artifact_ = artifactBuilder_ == null + ? artifact_ + : artifactBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.append_ = append_; + } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.lastChunk_ = lastChunk_; + } + if (((from_bitField0_ & 0x00000020) != 0)) { + result.metadata_ = metadataBuilder_ == null + ? metadata_ + : metadataBuilder_.build(); + to_bitField0_ |= 0x00000002; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent other) { + if (other == org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.getDefaultInstance()) return this; + if (!other.getTaskId().isEmpty()) { + taskId_ = other.taskId_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getContextId().isEmpty()) { + contextId_ = other.contextId_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (other.hasArtifact()) { + mergeArtifact(other.getArtifact()); + } + if (other.getAppend() != false) { + setAppend(other.getAppend()); + } + if (other.getLastChunk() != false) { + setLastChunk(other.getLastChunk()); + } + if (other.hasMetadata()) { + mergeMetadata(other.getMetadata()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + taskId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + contextId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: { + input.readMessage( + internalGetArtifactFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000004; + break; + } // case 26 + case 32: { + append_ = input.readBool(); + bitField0_ |= 0x00000008; + break; + } // case 32 + case 40: { + lastChunk_ = input.readBool(); + bitField0_ |= 0x00000010; + break; + } // case 40 + case 50: { + input.readMessage( + internalGetMetadataFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000020; + break; + } // case 50 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object taskId_ = ""; + /** + *
+     * The id of the task for this artifact
+     * 
+ * + * string task_id = 1; + * @return The taskId. + */ + public java.lang.String getTaskId() { + java.lang.Object ref = taskId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + taskId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The id of the task for this artifact
+     * 
+ * + * string task_id = 1; + * @return The bytes for taskId. + */ + public com.google.protobuf.ByteString + getTaskIdBytes() { + java.lang.Object ref = taskId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + taskId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The id of the task for this artifact
+     * 
+ * + * string task_id = 1; + * @param value The taskId to set. + * @return This builder for chaining. + */ + public Builder setTaskId( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + taskId_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * The id of the task for this artifact
+     * 
+ * + * string task_id = 1; + * @return This builder for chaining. + */ + public Builder clearTaskId() { + taskId_ = getDefaultInstance().getTaskId(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * The id of the task for this artifact
+     * 
+ * + * string task_id = 1; + * @param value The bytes for taskId to set. + * @return This builder for chaining. + */ + public Builder setTaskIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + taskId_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object contextId_ = ""; + /** + *
+     * The id of the context that this task belongs too
+     * 
+ * + * string context_id = 2; + * @return The contextId. + */ + public java.lang.String getContextId() { + java.lang.Object ref = contextId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + contextId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The id of the context that this task belongs too
+     * 
+ * + * string context_id = 2; + * @return The bytes for contextId. + */ + public com.google.protobuf.ByteString + getContextIdBytes() { + java.lang.Object ref = contextId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + contextId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The id of the context that this task belongs too
+     * 
+ * + * string context_id = 2; + * @param value The contextId to set. + * @return This builder for chaining. + */ + public Builder setContextId( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + contextId_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * The id of the context that this task belongs too
+     * 
+ * + * string context_id = 2; + * @return This builder for chaining. + */ + public Builder clearContextId() { + contextId_ = getDefaultInstance().getContextId(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * The id of the context that this task belongs too
+     * 
+ * + * string context_id = 2; + * @param value The bytes for contextId to set. + * @return This builder for chaining. + */ + public Builder setContextIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + contextId_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private org.a2aproject.sdk.compat03.grpc.Artifact artifact_; + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Artifact, org.a2aproject.sdk.compat03.grpc.Artifact.Builder, org.a2aproject.sdk.compat03.grpc.ArtifactOrBuilder> artifactBuilder_; + /** + *
+     * The artifact itself
+     * 
+ * + * .a2a.v1.Artifact artifact = 3; + * @return Whether the artifact field is set. + */ + public boolean hasArtifact() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + *
+     * The artifact itself
+     * 
+ * + * .a2a.v1.Artifact artifact = 3; + * @return The artifact. + */ + public org.a2aproject.sdk.compat03.grpc.Artifact getArtifact() { + if (artifactBuilder_ == null) { + return artifact_ == null ? org.a2aproject.sdk.compat03.grpc.Artifact.getDefaultInstance() : artifact_; + } else { + return artifactBuilder_.getMessage(); + } + } + /** + *
+     * The artifact itself
+     * 
+ * + * .a2a.v1.Artifact artifact = 3; + */ + public Builder setArtifact(org.a2aproject.sdk.compat03.grpc.Artifact value) { + if (artifactBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + artifact_ = value; + } else { + artifactBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * The artifact itself
+     * 
+ * + * .a2a.v1.Artifact artifact = 3; + */ + public Builder setArtifact( + org.a2aproject.sdk.compat03.grpc.Artifact.Builder builderForValue) { + if (artifactBuilder_ == null) { + artifact_ = builderForValue.build(); + } else { + artifactBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * The artifact itself
+     * 
+ * + * .a2a.v1.Artifact artifact = 3; + */ + public Builder mergeArtifact(org.a2aproject.sdk.compat03.grpc.Artifact value) { + if (artifactBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0) && + artifact_ != null && + artifact_ != org.a2aproject.sdk.compat03.grpc.Artifact.getDefaultInstance()) { + getArtifactBuilder().mergeFrom(value); + } else { + artifact_ = value; + } + } else { + artifactBuilder_.mergeFrom(value); + } + if (artifact_ != null) { + bitField0_ |= 0x00000004; + onChanged(); + } + return this; + } + /** + *
+     * The artifact itself
+     * 
+ * + * .a2a.v1.Artifact artifact = 3; + */ + public Builder clearArtifact() { + bitField0_ = (bitField0_ & ~0x00000004); + artifact_ = null; + if (artifactBuilder_ != null) { + artifactBuilder_.dispose(); + artifactBuilder_ = null; + } + onChanged(); + return this; + } + /** + *
+     * The artifact itself
+     * 
+ * + * .a2a.v1.Artifact artifact = 3; + */ + public org.a2aproject.sdk.compat03.grpc.Artifact.Builder getArtifactBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return internalGetArtifactFieldBuilder().getBuilder(); + } + /** + *
+     * The artifact itself
+     * 
+ * + * .a2a.v1.Artifact artifact = 3; + */ + public org.a2aproject.sdk.compat03.grpc.ArtifactOrBuilder getArtifactOrBuilder() { + if (artifactBuilder_ != null) { + return artifactBuilder_.getMessageOrBuilder(); + } else { + return artifact_ == null ? + org.a2aproject.sdk.compat03.grpc.Artifact.getDefaultInstance() : artifact_; + } + } + /** + *
+     * The artifact itself
+     * 
+ * + * .a2a.v1.Artifact artifact = 3; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Artifact, org.a2aproject.sdk.compat03.grpc.Artifact.Builder, org.a2aproject.sdk.compat03.grpc.ArtifactOrBuilder> + internalGetArtifactFieldBuilder() { + if (artifactBuilder_ == null) { + artifactBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Artifact, org.a2aproject.sdk.compat03.grpc.Artifact.Builder, org.a2aproject.sdk.compat03.grpc.ArtifactOrBuilder>( + getArtifact(), + getParentForChildren(), + isClean()); + artifact_ = null; + } + return artifactBuilder_; + } + + private boolean append_ ; + /** + *
+     * Whether this should be appended to a prior one produced
+     * 
+ * + * bool append = 4; + * @return The append. + */ + @java.lang.Override + public boolean getAppend() { + return append_; + } + /** + *
+     * Whether this should be appended to a prior one produced
+     * 
+ * + * bool append = 4; + * @param value The append to set. + * @return This builder for chaining. + */ + public Builder setAppend(boolean value) { + + append_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + *
+     * Whether this should be appended to a prior one produced
+     * 
+ * + * bool append = 4; + * @return This builder for chaining. + */ + public Builder clearAppend() { + bitField0_ = (bitField0_ & ~0x00000008); + append_ = false; + onChanged(); + return this; + } + + private boolean lastChunk_ ; + /** + *
+     * Whether this represents the last part of an artifact
+     * 
+ * + * bool last_chunk = 5; + * @return The lastChunk. + */ + @java.lang.Override + public boolean getLastChunk() { + return lastChunk_; + } + /** + *
+     * Whether this represents the last part of an artifact
+     * 
+ * + * bool last_chunk = 5; + * @param value The lastChunk to set. + * @return This builder for chaining. + */ + public Builder setLastChunk(boolean value) { + + lastChunk_ = value; + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + *
+     * Whether this represents the last part of an artifact
+     * 
+ * + * bool last_chunk = 5; + * @return This builder for chaining. + */ + public Builder clearLastChunk() { + bitField0_ = (bitField0_ & ~0x00000010); + lastChunk_ = false; + onChanged(); + return this; + } + + private com.google.protobuf.Struct metadata_; + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> metadataBuilder_; + /** + *
+     * Optional metadata associated with the artifact update.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return Whether the metadata field is set. + */ + public boolean hasMetadata() { + return ((bitField0_ & 0x00000020) != 0); + } + /** + *
+     * Optional metadata associated with the artifact update.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return The metadata. + */ + public com.google.protobuf.Struct getMetadata() { + if (metadataBuilder_ == null) { + return metadata_ == null ? com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } else { + return metadataBuilder_.getMessage(); + } + } + /** + *
+     * Optional metadata associated with the artifact update.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public Builder setMetadata(com.google.protobuf.Struct value) { + if (metadataBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + metadata_ = value; + } else { + metadataBuilder_.setMessage(value); + } + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + *
+     * Optional metadata associated with the artifact update.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public Builder setMetadata( + com.google.protobuf.Struct.Builder builderForValue) { + if (metadataBuilder_ == null) { + metadata_ = builderForValue.build(); + } else { + metadataBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + *
+     * Optional metadata associated with the artifact update.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public Builder mergeMetadata(com.google.protobuf.Struct value) { + if (metadataBuilder_ == null) { + if (((bitField0_ & 0x00000020) != 0) && + metadata_ != null && + metadata_ != com.google.protobuf.Struct.getDefaultInstance()) { + getMetadataBuilder().mergeFrom(value); + } else { + metadata_ = value; + } + } else { + metadataBuilder_.mergeFrom(value); + } + if (metadata_ != null) { + bitField0_ |= 0x00000020; + onChanged(); + } + return this; + } + /** + *
+     * Optional metadata associated with the artifact update.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public Builder clearMetadata() { + bitField0_ = (bitField0_ & ~0x00000020); + metadata_ = null; + if (metadataBuilder_ != null) { + metadataBuilder_.dispose(); + metadataBuilder_ = null; + } + onChanged(); + return this; + } + /** + *
+     * Optional metadata associated with the artifact update.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public com.google.protobuf.Struct.Builder getMetadataBuilder() { + bitField0_ |= 0x00000020; + onChanged(); + return internalGetMetadataFieldBuilder().getBuilder(); + } + /** + *
+     * Optional metadata associated with the artifact update.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public com.google.protobuf.StructOrBuilder getMetadataOrBuilder() { + if (metadataBuilder_ != null) { + return metadataBuilder_.getMessageOrBuilder(); + } else { + return metadata_ == null ? + com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } + } + /** + *
+     * Optional metadata associated with the artifact update.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> + internalGetMetadataFieldBuilder() { + if (metadataBuilder_ == null) { + metadataBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder>( + getMetadata(), + getParentForChildren(), + isClean()); + metadata_ = null; + } + return metadataBuilder_; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.TaskArtifactUpdateEvent) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.TaskArtifactUpdateEvent) + private static final org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent(); + } + + public static org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public TaskArtifactUpdateEvent parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskArtifactUpdateEventOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskArtifactUpdateEventOrBuilder.java new file mode 100644 index 000000000..9abdfe8dd --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskArtifactUpdateEventOrBuilder.java @@ -0,0 +1,126 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface TaskArtifactUpdateEventOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.TaskArtifactUpdateEvent) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The id of the task for this artifact
+   * 
+ * + * string task_id = 1; + * @return The taskId. + */ + java.lang.String getTaskId(); + /** + *
+   * The id of the task for this artifact
+   * 
+ * + * string task_id = 1; + * @return The bytes for taskId. + */ + com.google.protobuf.ByteString + getTaskIdBytes(); + + /** + *
+   * The id of the context that this task belongs too
+   * 
+ * + * string context_id = 2; + * @return The contextId. + */ + java.lang.String getContextId(); + /** + *
+   * The id of the context that this task belongs too
+   * 
+ * + * string context_id = 2; + * @return The bytes for contextId. + */ + com.google.protobuf.ByteString + getContextIdBytes(); + + /** + *
+   * The artifact itself
+   * 
+ * + * .a2a.v1.Artifact artifact = 3; + * @return Whether the artifact field is set. + */ + boolean hasArtifact(); + /** + *
+   * The artifact itself
+   * 
+ * + * .a2a.v1.Artifact artifact = 3; + * @return The artifact. + */ + org.a2aproject.sdk.compat03.grpc.Artifact getArtifact(); + /** + *
+   * The artifact itself
+   * 
+ * + * .a2a.v1.Artifact artifact = 3; + */ + org.a2aproject.sdk.compat03.grpc.ArtifactOrBuilder getArtifactOrBuilder(); + + /** + *
+   * Whether this should be appended to a prior one produced
+   * 
+ * + * bool append = 4; + * @return The append. + */ + boolean getAppend(); + + /** + *
+   * Whether this represents the last part of an artifact
+   * 
+ * + * bool last_chunk = 5; + * @return The lastChunk. + */ + boolean getLastChunk(); + + /** + *
+   * Optional metadata associated with the artifact update.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return Whether the metadata field is set. + */ + boolean hasMetadata(); + /** + *
+   * Optional metadata associated with the artifact update.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return The metadata. + */ + com.google.protobuf.Struct getMetadata(); + /** + *
+   * Optional metadata associated with the artifact update.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + com.google.protobuf.StructOrBuilder getMetadataOrBuilder(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskOrBuilder.java new file mode 100644 index 000000000..ee239d12c --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskOrBuilder.java @@ -0,0 +1,204 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface TaskOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.Task) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Unique identifier for a task, created by the A2A server.
+   * 
+ * + * string id = 1; + * @return The id. + */ + java.lang.String getId(); + /** + *
+   * Unique identifier for a task, created by the A2A server.
+   * 
+ * + * string id = 1; + * @return The bytes for id. + */ + com.google.protobuf.ByteString + getIdBytes(); + + /** + *
+   * Unique identifier for the contextual collection of interactions (tasks
+   * and messages). Created by the A2A server.
+   * 
+ * + * string context_id = 2; + * @return The contextId. + */ + java.lang.String getContextId(); + /** + *
+   * Unique identifier for the contextual collection of interactions (tasks
+   * and messages). Created by the A2A server.
+   * 
+ * + * string context_id = 2; + * @return The bytes for contextId. + */ + com.google.protobuf.ByteString + getContextIdBytes(); + + /** + *
+   * The current status of a Task, including state and a message.
+   * 
+ * + * .a2a.v1.TaskStatus status = 3; + * @return Whether the status field is set. + */ + boolean hasStatus(); + /** + *
+   * The current status of a Task, including state and a message.
+   * 
+ * + * .a2a.v1.TaskStatus status = 3; + * @return The status. + */ + org.a2aproject.sdk.compat03.grpc.TaskStatus getStatus(); + /** + *
+   * The current status of a Task, including state and a message.
+   * 
+ * + * .a2a.v1.TaskStatus status = 3; + */ + org.a2aproject.sdk.compat03.grpc.TaskStatusOrBuilder getStatusOrBuilder(); + + /** + *
+   * A set of output artifacts for a Task.
+   * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + java.util.List + getArtifactsList(); + /** + *
+   * A set of output artifacts for a Task.
+   * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + org.a2aproject.sdk.compat03.grpc.Artifact getArtifacts(int index); + /** + *
+   * A set of output artifacts for a Task.
+   * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + int getArtifactsCount(); + /** + *
+   * A set of output artifacts for a Task.
+   * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + java.util.List + getArtifactsOrBuilderList(); + /** + *
+   * A set of output artifacts for a Task.
+   * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + org.a2aproject.sdk.compat03.grpc.ArtifactOrBuilder getArtifactsOrBuilder( + int index); + + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * The history of interactions from a task.
+   * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + java.util.List + getHistoryList(); + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * The history of interactions from a task.
+   * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + org.a2aproject.sdk.compat03.grpc.Message getHistory(int index); + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * The history of interactions from a task.
+   * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + int getHistoryCount(); + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * The history of interactions from a task.
+   * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + java.util.List + getHistoryOrBuilderList(); + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * The history of interactions from a task.
+   * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + org.a2aproject.sdk.compat03.grpc.MessageOrBuilder getHistoryOrBuilder( + int index); + + /** + *
+   * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+   * A key/value object to store custom metadata about a task.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return Whether the metadata field is set. + */ + boolean hasMetadata(); + /** + *
+   * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+   * A key/value object to store custom metadata about a task.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return The metadata. + */ + com.google.protobuf.Struct getMetadata(); + /** + *
+   * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+   * A key/value object to store custom metadata about a task.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + com.google.protobuf.StructOrBuilder getMetadataOrBuilder(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskPushNotificationConfig.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskPushNotificationConfig.java new file mode 100644 index 000000000..85691f7ca --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskPushNotificationConfig.java @@ -0,0 +1,723 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.TaskPushNotificationConfig} + */ +@com.google.protobuf.Generated +public final class TaskPushNotificationConfig extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.TaskPushNotificationConfig) + TaskPushNotificationConfigOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "TaskPushNotificationConfig"); + } + // Use TaskPushNotificationConfig.newBuilder() to construct. + private TaskPushNotificationConfig(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private TaskPushNotificationConfig() { + name_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_TaskPushNotificationConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_TaskPushNotificationConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.class, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.Builder.class); + } + + private int bitField0_; + public static final int NAME_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + *
+   * name=tasks/{id}/pushNotificationConfigs/{id}
+   * 
+ * + * string name = 1; + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + *
+   * name=tasks/{id}/pushNotificationConfigs/{id}
+   * 
+ * + * string name = 1; + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PUSH_NOTIFICATION_CONFIG_FIELD_NUMBER = 2; + private org.a2aproject.sdk.compat03.grpc.PushNotificationConfig pushNotificationConfig_; + /** + * .a2a.v1.PushNotificationConfig push_notification_config = 2; + * @return Whether the pushNotificationConfig field is set. + */ + @java.lang.Override + public boolean hasPushNotificationConfig() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * .a2a.v1.PushNotificationConfig push_notification_config = 2; + * @return The pushNotificationConfig. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.PushNotificationConfig getPushNotificationConfig() { + return pushNotificationConfig_ == null ? org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.getDefaultInstance() : pushNotificationConfig_; + } + /** + * .a2a.v1.PushNotificationConfig push_notification_config = 2; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.PushNotificationConfigOrBuilder getPushNotificationConfigOrBuilder() { + return pushNotificationConfig_ == null ? org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.getDefaultInstance() : pushNotificationConfig_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, name_); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(2, getPushNotificationConfig()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, name_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, getPushNotificationConfig()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig other = (org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig) obj; + + if (!getName() + .equals(other.getName())) return false; + if (hasPushNotificationConfig() != other.hasPushNotificationConfig()) return false; + if (hasPushNotificationConfig()) { + if (!getPushNotificationConfig() + .equals(other.getPushNotificationConfig())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + if (hasPushNotificationConfig()) { + hash = (37 * hash) + PUSH_NOTIFICATION_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getPushNotificationConfig().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.TaskPushNotificationConfig} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.TaskPushNotificationConfig) + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfigOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_TaskPushNotificationConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_TaskPushNotificationConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.class, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage + .alwaysUseFieldBuilders) { + internalGetPushNotificationConfigFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + name_ = ""; + pushNotificationConfig_ = null; + if (pushNotificationConfigBuilder_ != null) { + pushNotificationConfigBuilder_.dispose(); + pushNotificationConfigBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_TaskPushNotificationConfig_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig build() { + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig buildPartial() { + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig result = new org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.pushNotificationConfig_ = pushNotificationConfigBuilder_ == null + ? pushNotificationConfig_ + : pushNotificationConfigBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig other) { + if (other == org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (other.hasPushNotificationConfig()) { + mergePushNotificationConfig(other.getPushNotificationConfig()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + input.readMessage( + internalGetPushNotificationConfigFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + *
+     * name=tasks/{id}/pushNotificationConfigs/{id}
+     * 
+ * + * string name = 1; + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * name=tasks/{id}/pushNotificationConfigs/{id}
+     * 
+ * + * string name = 1; + * @return The bytes for name. + */ + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * name=tasks/{id}/pushNotificationConfigs/{id}
+     * 
+ * + * string name = 1; + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * name=tasks/{id}/pushNotificationConfigs/{id}
+     * 
+ * + * string name = 1; + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * name=tasks/{id}/pushNotificationConfigs/{id}
+     * 
+ * + * string name = 1; + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private org.a2aproject.sdk.compat03.grpc.PushNotificationConfig pushNotificationConfig_; + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig, org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.Builder, org.a2aproject.sdk.compat03.grpc.PushNotificationConfigOrBuilder> pushNotificationConfigBuilder_; + /** + * .a2a.v1.PushNotificationConfig push_notification_config = 2; + * @return Whether the pushNotificationConfig field is set. + */ + public boolean hasPushNotificationConfig() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * .a2a.v1.PushNotificationConfig push_notification_config = 2; + * @return The pushNotificationConfig. + */ + public org.a2aproject.sdk.compat03.grpc.PushNotificationConfig getPushNotificationConfig() { + if (pushNotificationConfigBuilder_ == null) { + return pushNotificationConfig_ == null ? org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.getDefaultInstance() : pushNotificationConfig_; + } else { + return pushNotificationConfigBuilder_.getMessage(); + } + } + /** + * .a2a.v1.PushNotificationConfig push_notification_config = 2; + */ + public Builder setPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.PushNotificationConfig value) { + if (pushNotificationConfigBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + pushNotificationConfig_ = value; + } else { + pushNotificationConfigBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * .a2a.v1.PushNotificationConfig push_notification_config = 2; + */ + public Builder setPushNotificationConfig( + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.Builder builderForValue) { + if (pushNotificationConfigBuilder_ == null) { + pushNotificationConfig_ = builderForValue.build(); + } else { + pushNotificationConfigBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * .a2a.v1.PushNotificationConfig push_notification_config = 2; + */ + public Builder mergePushNotificationConfig(org.a2aproject.sdk.compat03.grpc.PushNotificationConfig value) { + if (pushNotificationConfigBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) && + pushNotificationConfig_ != null && + pushNotificationConfig_ != org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.getDefaultInstance()) { + getPushNotificationConfigBuilder().mergeFrom(value); + } else { + pushNotificationConfig_ = value; + } + } else { + pushNotificationConfigBuilder_.mergeFrom(value); + } + if (pushNotificationConfig_ != null) { + bitField0_ |= 0x00000002; + onChanged(); + } + return this; + } + /** + * .a2a.v1.PushNotificationConfig push_notification_config = 2; + */ + public Builder clearPushNotificationConfig() { + bitField0_ = (bitField0_ & ~0x00000002); + pushNotificationConfig_ = null; + if (pushNotificationConfigBuilder_ != null) { + pushNotificationConfigBuilder_.dispose(); + pushNotificationConfigBuilder_ = null; + } + onChanged(); + return this; + } + /** + * .a2a.v1.PushNotificationConfig push_notification_config = 2; + */ + public org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.Builder getPushNotificationConfigBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return internalGetPushNotificationConfigFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.PushNotificationConfig push_notification_config = 2; + */ + public org.a2aproject.sdk.compat03.grpc.PushNotificationConfigOrBuilder getPushNotificationConfigOrBuilder() { + if (pushNotificationConfigBuilder_ != null) { + return pushNotificationConfigBuilder_.getMessageOrBuilder(); + } else { + return pushNotificationConfig_ == null ? + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.getDefaultInstance() : pushNotificationConfig_; + } + } + /** + * .a2a.v1.PushNotificationConfig push_notification_config = 2; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig, org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.Builder, org.a2aproject.sdk.compat03.grpc.PushNotificationConfigOrBuilder> + internalGetPushNotificationConfigFieldBuilder() { + if (pushNotificationConfigBuilder_ == null) { + pushNotificationConfigBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig, org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.Builder, org.a2aproject.sdk.compat03.grpc.PushNotificationConfigOrBuilder>( + getPushNotificationConfig(), + getParentForChildren(), + isClean()); + pushNotificationConfig_ = null; + } + return pushNotificationConfigBuilder_; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.TaskPushNotificationConfig) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.TaskPushNotificationConfig) + private static final org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig(); + } + + public static org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public TaskPushNotificationConfig parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskPushNotificationConfigOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskPushNotificationConfigOrBuilder.java new file mode 100644 index 000000000..3320be16c --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskPushNotificationConfigOrBuilder.java @@ -0,0 +1,47 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface TaskPushNotificationConfigOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.TaskPushNotificationConfig) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * name=tasks/{id}/pushNotificationConfigs/{id}
+   * 
+ * + * string name = 1; + * @return The name. + */ + java.lang.String getName(); + /** + *
+   * name=tasks/{id}/pushNotificationConfigs/{id}
+   * 
+ * + * string name = 1; + * @return The bytes for name. + */ + com.google.protobuf.ByteString + getNameBytes(); + + /** + * .a2a.v1.PushNotificationConfig push_notification_config = 2; + * @return Whether the pushNotificationConfig field is set. + */ + boolean hasPushNotificationConfig(); + /** + * .a2a.v1.PushNotificationConfig push_notification_config = 2; + * @return The pushNotificationConfig. + */ + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig getPushNotificationConfig(); + /** + * .a2a.v1.PushNotificationConfig push_notification_config = 2; + */ + org.a2aproject.sdk.compat03.grpc.PushNotificationConfigOrBuilder getPushNotificationConfigOrBuilder(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskState.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskState.java new file mode 100644 index 000000000..57e21b3d7 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskState.java @@ -0,0 +1,268 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * The set of states a Task can be in.
+ * 
+ * + * Protobuf enum {@code a2a.v1.TaskState} + */ +@com.google.protobuf.Generated +public enum TaskState + implements com.google.protobuf.ProtocolMessageEnum { + /** + * TASK_STATE_UNSPECIFIED = 0; + */ + TASK_STATE_UNSPECIFIED(0), + /** + *
+   * Represents the status that acknowledges a task is created
+   * 
+ * + * TASK_STATE_SUBMITTED = 1; + */ + TASK_STATE_SUBMITTED(1), + /** + *
+   * Represents the status that a task is actively being processed
+   * 
+ * + * TASK_STATE_WORKING = 2; + */ + TASK_STATE_WORKING(2), + /** + *
+   * Represents the status a task is finished. This is a terminal state
+   * 
+ * + * TASK_STATE_COMPLETED = 3; + */ + TASK_STATE_COMPLETED(3), + /** + *
+   * Represents the status a task is done but failed. This is a terminal state
+   * 
+ * + * TASK_STATE_FAILED = 4; + */ + TASK_STATE_FAILED(4), + /** + *
+   * Represents the status a task was cancelled before it finished.
+   * This is a terminal state.
+   * 
+ * + * TASK_STATE_CANCELLED = 5; + */ + TASK_STATE_CANCELLED(5), + /** + *
+   * Represents the status that the task requires information to complete.
+   * This is an interrupted state.
+   * 
+ * + * TASK_STATE_INPUT_REQUIRED = 6; + */ + TASK_STATE_INPUT_REQUIRED(6), + /** + *
+   * Represents the status that the agent has decided to not perform the task.
+   * This may be done during initial task creation or later once an agent
+   * has determined it can't or won't proceed. This is a terminal state.
+   * 
+ * + * TASK_STATE_REJECTED = 7; + */ + TASK_STATE_REJECTED(7), + /** + *
+   * Represents the state that some authentication is needed from the upstream
+   * client. Authentication is expected to come out-of-band thus this is not
+   * an interrupted or terminal state.
+   * 
+ * + * TASK_STATE_AUTH_REQUIRED = 8; + */ + TASK_STATE_AUTH_REQUIRED(8), + UNRECOGNIZED(-1), + ; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "TaskState"); + } + /** + * TASK_STATE_UNSPECIFIED = 0; + */ + public static final int TASK_STATE_UNSPECIFIED_VALUE = 0; + /** + *
+   * Represents the status that acknowledges a task is created
+   * 
+ * + * TASK_STATE_SUBMITTED = 1; + */ + public static final int TASK_STATE_SUBMITTED_VALUE = 1; + /** + *
+   * Represents the status that a task is actively being processed
+   * 
+ * + * TASK_STATE_WORKING = 2; + */ + public static final int TASK_STATE_WORKING_VALUE = 2; + /** + *
+   * Represents the status a task is finished. This is a terminal state
+   * 
+ * + * TASK_STATE_COMPLETED = 3; + */ + public static final int TASK_STATE_COMPLETED_VALUE = 3; + /** + *
+   * Represents the status a task is done but failed. This is a terminal state
+   * 
+ * + * TASK_STATE_FAILED = 4; + */ + public static final int TASK_STATE_FAILED_VALUE = 4; + /** + *
+   * Represents the status a task was cancelled before it finished.
+   * This is a terminal state.
+   * 
+ * + * TASK_STATE_CANCELLED = 5; + */ + public static final int TASK_STATE_CANCELLED_VALUE = 5; + /** + *
+   * Represents the status that the task requires information to complete.
+   * This is an interrupted state.
+   * 
+ * + * TASK_STATE_INPUT_REQUIRED = 6; + */ + public static final int TASK_STATE_INPUT_REQUIRED_VALUE = 6; + /** + *
+   * Represents the status that the agent has decided to not perform the task.
+   * This may be done during initial task creation or later once an agent
+   * has determined it can't or won't proceed. This is a terminal state.
+   * 
+ * + * TASK_STATE_REJECTED = 7; + */ + public static final int TASK_STATE_REJECTED_VALUE = 7; + /** + *
+   * Represents the state that some authentication is needed from the upstream
+   * client. Authentication is expected to come out-of-band thus this is not
+   * an interrupted or terminal state.
+   * 
+ * + * TASK_STATE_AUTH_REQUIRED = 8; + */ + public static final int TASK_STATE_AUTH_REQUIRED_VALUE = 8; + + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static TaskState valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static TaskState forNumber(int value) { + switch (value) { + case 0: return TASK_STATE_UNSPECIFIED; + case 1: return TASK_STATE_SUBMITTED; + case 2: return TASK_STATE_WORKING; + case 3: return TASK_STATE_COMPLETED; + case 4: return TASK_STATE_FAILED; + case 5: return TASK_STATE_CANCELLED; + case 6: return TASK_STATE_INPUT_REQUIRED; + case 7: return TASK_STATE_REJECTED; + case 8: return TASK_STATE_AUTH_REQUIRED; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static final com.google.protobuf.Internal.EnumLiteMap< + TaskState> internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public TaskState findValueByNumber(int number) { + return TaskState.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return A2A.getDescriptor().getEnumTypes().get(0); + } + + private static final TaskState[] VALUES = values(); + + public static TaskState valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private TaskState(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:a2a.v1.TaskState) +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskStatus.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskStatus.java new file mode 100644 index 000000000..0d63d5502 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskStatus.java @@ -0,0 +1,980 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * A container for the status of a task
+ * 
+ * + * Protobuf type {@code a2a.v1.TaskStatus} + */ +@com.google.protobuf.Generated +public final class TaskStatus extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.TaskStatus) + TaskStatusOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "TaskStatus"); + } + // Use TaskStatus.newBuilder() to construct. + private TaskStatus(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private TaskStatus() { + state_ = 0; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_TaskStatus_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_TaskStatus_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.TaskStatus.class, org.a2aproject.sdk.compat03.grpc.TaskStatus.Builder.class); + } + + private int bitField0_; + public static final int STATE_FIELD_NUMBER = 1; + private int state_ = 0; + /** + *
+   * The current state of this task
+   * 
+ * + * .a2a.v1.TaskState state = 1; + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override public int getStateValue() { + return state_; + } + /** + *
+   * The current state of this task
+   * 
+ * + * .a2a.v1.TaskState state = 1; + * @return The state. + */ + @java.lang.Override public org.a2aproject.sdk.compat03.grpc.TaskState getState() { + org.a2aproject.sdk.compat03.grpc.TaskState result = org.a2aproject.sdk.compat03.grpc.TaskState.forNumber(state_); + return result == null ? org.a2aproject.sdk.compat03.grpc.TaskState.UNRECOGNIZED : result; + } + + public static final int UPDATE_FIELD_NUMBER = 2; + private org.a2aproject.sdk.compat03.grpc.Message update_; + /** + *
+   * A message associated with the status.
+   * 
+ * + * .a2a.v1.Message update = 2 [json_name = "message"]; + * @return Whether the update field is set. + */ + @java.lang.Override + public boolean hasUpdate() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + *
+   * A message associated with the status.
+   * 
+ * + * .a2a.v1.Message update = 2 [json_name = "message"]; + * @return The update. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Message getUpdate() { + return update_ == null ? org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance() : update_; + } + /** + *
+   * A message associated with the status.
+   * 
+ * + * .a2a.v1.Message update = 2 [json_name = "message"]; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.MessageOrBuilder getUpdateOrBuilder() { + return update_ == null ? org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance() : update_; + } + + public static final int TIMESTAMP_FIELD_NUMBER = 3; + private com.google.protobuf.Timestamp timestamp_; + /** + *
+   * Timestamp when the status was recorded.
+   * Example: "2023-10-27T10:00:00Z"
+   * 
+ * + * .google.protobuf.Timestamp timestamp = 3; + * @return Whether the timestamp field is set. + */ + @java.lang.Override + public boolean hasTimestamp() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + *
+   * Timestamp when the status was recorded.
+   * Example: "2023-10-27T10:00:00Z"
+   * 
+ * + * .google.protobuf.Timestamp timestamp = 3; + * @return The timestamp. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getTimestamp() { + return timestamp_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : timestamp_; + } + /** + *
+   * Timestamp when the status was recorded.
+   * Example: "2023-10-27T10:00:00Z"
+   * 
+ * + * .google.protobuf.Timestamp timestamp = 3; + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getTimestampOrBuilder() { + return timestamp_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : timestamp_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (state_ != org.a2aproject.sdk.compat03.grpc.TaskState.TASK_STATE_UNSPECIFIED.getNumber()) { + output.writeEnum(1, state_); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(2, getUpdate()); + } + if (((bitField0_ & 0x00000002) != 0)) { + output.writeMessage(3, getTimestamp()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (state_ != org.a2aproject.sdk.compat03.grpc.TaskState.TASK_STATE_UNSPECIFIED.getNumber()) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(1, state_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, getUpdate()); + } + if (((bitField0_ & 0x00000002) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, getTimestamp()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.TaskStatus)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.TaskStatus other = (org.a2aproject.sdk.compat03.grpc.TaskStatus) obj; + + if (state_ != other.state_) return false; + if (hasUpdate() != other.hasUpdate()) return false; + if (hasUpdate()) { + if (!getUpdate() + .equals(other.getUpdate())) return false; + } + if (hasTimestamp() != other.hasTimestamp()) return false; + if (hasTimestamp()) { + if (!getTimestamp() + .equals(other.getTimestamp())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + STATE_FIELD_NUMBER; + hash = (53 * hash) + state_; + if (hasUpdate()) { + hash = (37 * hash) + UPDATE_FIELD_NUMBER; + hash = (53 * hash) + getUpdate().hashCode(); + } + if (hasTimestamp()) { + hash = (37 * hash) + TIMESTAMP_FIELD_NUMBER; + hash = (53 * hash) + getTimestamp().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.TaskStatus parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.TaskStatus parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.TaskStatus parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.TaskStatus parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.TaskStatus parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.TaskStatus parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.TaskStatus parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.TaskStatus parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.TaskStatus parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.TaskStatus parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.TaskStatus parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.TaskStatus parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.TaskStatus prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * A container for the status of a task
+   * 
+ * + * Protobuf type {@code a2a.v1.TaskStatus} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.TaskStatus) + org.a2aproject.sdk.compat03.grpc.TaskStatusOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_TaskStatus_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_TaskStatus_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.TaskStatus.class, org.a2aproject.sdk.compat03.grpc.TaskStatus.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.TaskStatus.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage + .alwaysUseFieldBuilders) { + internalGetUpdateFieldBuilder(); + internalGetTimestampFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + state_ = 0; + update_ = null; + if (updateBuilder_ != null) { + updateBuilder_.dispose(); + updateBuilder_ = null; + } + timestamp_ = null; + if (timestampBuilder_ != null) { + timestampBuilder_.dispose(); + timestampBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_TaskStatus_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskStatus getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.TaskStatus.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskStatus build() { + org.a2aproject.sdk.compat03.grpc.TaskStatus result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskStatus buildPartial() { + org.a2aproject.sdk.compat03.grpc.TaskStatus result = new org.a2aproject.sdk.compat03.grpc.TaskStatus(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.TaskStatus result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.state_ = state_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.update_ = updateBuilder_ == null + ? update_ + : updateBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.timestamp_ = timestampBuilder_ == null + ? timestamp_ + : timestampBuilder_.build(); + to_bitField0_ |= 0x00000002; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.TaskStatus) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.TaskStatus)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.TaskStatus other) { + if (other == org.a2aproject.sdk.compat03.grpc.TaskStatus.getDefaultInstance()) return this; + if (other.state_ != 0) { + setStateValue(other.getStateValue()); + } + if (other.hasUpdate()) { + mergeUpdate(other.getUpdate()); + } + if (other.hasTimestamp()) { + mergeTimestamp(other.getTimestamp()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + state_ = input.readEnum(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 18: { + input.readMessage( + internalGetUpdateFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: { + input.readMessage( + internalGetTimestampFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private int state_ = 0; + /** + *
+     * The current state of this task
+     * 
+ * + * .a2a.v1.TaskState state = 1; + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override public int getStateValue() { + return state_; + } + /** + *
+     * The current state of this task
+     * 
+ * + * .a2a.v1.TaskState state = 1; + * @param value The enum numeric value on the wire for state to set. + * @return This builder for chaining. + */ + public Builder setStateValue(int value) { + state_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * The current state of this task
+     * 
+ * + * .a2a.v1.TaskState state = 1; + * @return The state. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskState getState() { + org.a2aproject.sdk.compat03.grpc.TaskState result = org.a2aproject.sdk.compat03.grpc.TaskState.forNumber(state_); + return result == null ? org.a2aproject.sdk.compat03.grpc.TaskState.UNRECOGNIZED : result; + } + /** + *
+     * The current state of this task
+     * 
+ * + * .a2a.v1.TaskState state = 1; + * @param value The state to set. + * @return This builder for chaining. + */ + public Builder setState(org.a2aproject.sdk.compat03.grpc.TaskState value) { + if (value == null) { throw new NullPointerException(); } + bitField0_ |= 0x00000001; + state_ = value.getNumber(); + onChanged(); + return this; + } + /** + *
+     * The current state of this task
+     * 
+ * + * .a2a.v1.TaskState state = 1; + * @return This builder for chaining. + */ + public Builder clearState() { + bitField0_ = (bitField0_ & ~0x00000001); + state_ = 0; + onChanged(); + return this; + } + + private org.a2aproject.sdk.compat03.grpc.Message update_; + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Message, org.a2aproject.sdk.compat03.grpc.Message.Builder, org.a2aproject.sdk.compat03.grpc.MessageOrBuilder> updateBuilder_; + /** + *
+     * A message associated with the status.
+     * 
+ * + * .a2a.v1.Message update = 2 [json_name = "message"]; + * @return Whether the update field is set. + */ + public boolean hasUpdate() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + *
+     * A message associated with the status.
+     * 
+ * + * .a2a.v1.Message update = 2 [json_name = "message"]; + * @return The update. + */ + public org.a2aproject.sdk.compat03.grpc.Message getUpdate() { + if (updateBuilder_ == null) { + return update_ == null ? org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance() : update_; + } else { + return updateBuilder_.getMessage(); + } + } + /** + *
+     * A message associated with the status.
+     * 
+ * + * .a2a.v1.Message update = 2 [json_name = "message"]; + */ + public Builder setUpdate(org.a2aproject.sdk.compat03.grpc.Message value) { + if (updateBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + update_ = value; + } else { + updateBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * A message associated with the status.
+     * 
+ * + * .a2a.v1.Message update = 2 [json_name = "message"]; + */ + public Builder setUpdate( + org.a2aproject.sdk.compat03.grpc.Message.Builder builderForValue) { + if (updateBuilder_ == null) { + update_ = builderForValue.build(); + } else { + updateBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * A message associated with the status.
+     * 
+ * + * .a2a.v1.Message update = 2 [json_name = "message"]; + */ + public Builder mergeUpdate(org.a2aproject.sdk.compat03.grpc.Message value) { + if (updateBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) && + update_ != null && + update_ != org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance()) { + getUpdateBuilder().mergeFrom(value); + } else { + update_ = value; + } + } else { + updateBuilder_.mergeFrom(value); + } + if (update_ != null) { + bitField0_ |= 0x00000002; + onChanged(); + } + return this; + } + /** + *
+     * A message associated with the status.
+     * 
+ * + * .a2a.v1.Message update = 2 [json_name = "message"]; + */ + public Builder clearUpdate() { + bitField0_ = (bitField0_ & ~0x00000002); + update_ = null; + if (updateBuilder_ != null) { + updateBuilder_.dispose(); + updateBuilder_ = null; + } + onChanged(); + return this; + } + /** + *
+     * A message associated with the status.
+     * 
+ * + * .a2a.v1.Message update = 2 [json_name = "message"]; + */ + public org.a2aproject.sdk.compat03.grpc.Message.Builder getUpdateBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return internalGetUpdateFieldBuilder().getBuilder(); + } + /** + *
+     * A message associated with the status.
+     * 
+ * + * .a2a.v1.Message update = 2 [json_name = "message"]; + */ + public org.a2aproject.sdk.compat03.grpc.MessageOrBuilder getUpdateOrBuilder() { + if (updateBuilder_ != null) { + return updateBuilder_.getMessageOrBuilder(); + } else { + return update_ == null ? + org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance() : update_; + } + } + /** + *
+     * A message associated with the status.
+     * 
+ * + * .a2a.v1.Message update = 2 [json_name = "message"]; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Message, org.a2aproject.sdk.compat03.grpc.Message.Builder, org.a2aproject.sdk.compat03.grpc.MessageOrBuilder> + internalGetUpdateFieldBuilder() { + if (updateBuilder_ == null) { + updateBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Message, org.a2aproject.sdk.compat03.grpc.Message.Builder, org.a2aproject.sdk.compat03.grpc.MessageOrBuilder>( + getUpdate(), + getParentForChildren(), + isClean()); + update_ = null; + } + return updateBuilder_; + } + + private com.google.protobuf.Timestamp timestamp_; + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> timestampBuilder_; + /** + *
+     * Timestamp when the status was recorded.
+     * Example: "2023-10-27T10:00:00Z"
+     * 
+ * + * .google.protobuf.Timestamp timestamp = 3; + * @return Whether the timestamp field is set. + */ + public boolean hasTimestamp() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + *
+     * Timestamp when the status was recorded.
+     * Example: "2023-10-27T10:00:00Z"
+     * 
+ * + * .google.protobuf.Timestamp timestamp = 3; + * @return The timestamp. + */ + public com.google.protobuf.Timestamp getTimestamp() { + if (timestampBuilder_ == null) { + return timestamp_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : timestamp_; + } else { + return timestampBuilder_.getMessage(); + } + } + /** + *
+     * Timestamp when the status was recorded.
+     * Example: "2023-10-27T10:00:00Z"
+     * 
+ * + * .google.protobuf.Timestamp timestamp = 3; + */ + public Builder setTimestamp(com.google.protobuf.Timestamp value) { + if (timestampBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + timestamp_ = value; + } else { + timestampBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * Timestamp when the status was recorded.
+     * Example: "2023-10-27T10:00:00Z"
+     * 
+ * + * .google.protobuf.Timestamp timestamp = 3; + */ + public Builder setTimestamp( + com.google.protobuf.Timestamp.Builder builderForValue) { + if (timestampBuilder_ == null) { + timestamp_ = builderForValue.build(); + } else { + timestampBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * Timestamp when the status was recorded.
+     * Example: "2023-10-27T10:00:00Z"
+     * 
+ * + * .google.protobuf.Timestamp timestamp = 3; + */ + public Builder mergeTimestamp(com.google.protobuf.Timestamp value) { + if (timestampBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0) && + timestamp_ != null && + timestamp_ != com.google.protobuf.Timestamp.getDefaultInstance()) { + getTimestampBuilder().mergeFrom(value); + } else { + timestamp_ = value; + } + } else { + timestampBuilder_.mergeFrom(value); + } + if (timestamp_ != null) { + bitField0_ |= 0x00000004; + onChanged(); + } + return this; + } + /** + *
+     * Timestamp when the status was recorded.
+     * Example: "2023-10-27T10:00:00Z"
+     * 
+ * + * .google.protobuf.Timestamp timestamp = 3; + */ + public Builder clearTimestamp() { + bitField0_ = (bitField0_ & ~0x00000004); + timestamp_ = null; + if (timestampBuilder_ != null) { + timestampBuilder_.dispose(); + timestampBuilder_ = null; + } + onChanged(); + return this; + } + /** + *
+     * Timestamp when the status was recorded.
+     * Example: "2023-10-27T10:00:00Z"
+     * 
+ * + * .google.protobuf.Timestamp timestamp = 3; + */ + public com.google.protobuf.Timestamp.Builder getTimestampBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return internalGetTimestampFieldBuilder().getBuilder(); + } + /** + *
+     * Timestamp when the status was recorded.
+     * Example: "2023-10-27T10:00:00Z"
+     * 
+ * + * .google.protobuf.Timestamp timestamp = 3; + */ + public com.google.protobuf.TimestampOrBuilder getTimestampOrBuilder() { + if (timestampBuilder_ != null) { + return timestampBuilder_.getMessageOrBuilder(); + } else { + return timestamp_ == null ? + com.google.protobuf.Timestamp.getDefaultInstance() : timestamp_; + } + } + /** + *
+     * Timestamp when the status was recorded.
+     * Example: "2023-10-27T10:00:00Z"
+     * 
+ * + * .google.protobuf.Timestamp timestamp = 3; + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> + internalGetTimestampFieldBuilder() { + if (timestampBuilder_ == null) { + timestampBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder>( + getTimestamp(), + getParentForChildren(), + isClean()); + timestamp_ = null; + } + return timestampBuilder_; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.TaskStatus) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.TaskStatus) + private static final org.a2aproject.sdk.compat03.grpc.TaskStatus DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.TaskStatus(); + } + + public static org.a2aproject.sdk.compat03.grpc.TaskStatus getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public TaskStatus parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskStatus getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskStatusOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskStatusOrBuilder.java new file mode 100644 index 000000000..025ed99bc --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskStatusOrBuilder.java @@ -0,0 +1,88 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface TaskStatusOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.TaskStatus) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The current state of this task
+   * 
+ * + * .a2a.v1.TaskState state = 1; + * @return The enum numeric value on the wire for state. + */ + int getStateValue(); + /** + *
+   * The current state of this task
+   * 
+ * + * .a2a.v1.TaskState state = 1; + * @return The state. + */ + org.a2aproject.sdk.compat03.grpc.TaskState getState(); + + /** + *
+   * A message associated with the status.
+   * 
+ * + * .a2a.v1.Message update = 2 [json_name = "message"]; + * @return Whether the update field is set. + */ + boolean hasUpdate(); + /** + *
+   * A message associated with the status.
+   * 
+ * + * .a2a.v1.Message update = 2 [json_name = "message"]; + * @return The update. + */ + org.a2aproject.sdk.compat03.grpc.Message getUpdate(); + /** + *
+   * A message associated with the status.
+   * 
+ * + * .a2a.v1.Message update = 2 [json_name = "message"]; + */ + org.a2aproject.sdk.compat03.grpc.MessageOrBuilder getUpdateOrBuilder(); + + /** + *
+   * Timestamp when the status was recorded.
+   * Example: "2023-10-27T10:00:00Z"
+   * 
+ * + * .google.protobuf.Timestamp timestamp = 3; + * @return Whether the timestamp field is set. + */ + boolean hasTimestamp(); + /** + *
+   * Timestamp when the status was recorded.
+   * Example: "2023-10-27T10:00:00Z"
+   * 
+ * + * .google.protobuf.Timestamp timestamp = 3; + * @return The timestamp. + */ + com.google.protobuf.Timestamp getTimestamp(); + /** + *
+   * Timestamp when the status was recorded.
+   * Example: "2023-10-27T10:00:00Z"
+   * 
+ * + * .google.protobuf.Timestamp timestamp = 3; + */ + com.google.protobuf.TimestampOrBuilder getTimestampOrBuilder(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskStatusUpdateEvent.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskStatusUpdateEvent.java new file mode 100644 index 000000000..5d146bfa5 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskStatusUpdateEvent.java @@ -0,0 +1,1261 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * TaskStatusUpdateEvent is a delta even on a task indicating that a task
+ * has changed.
+ * 
+ * + * Protobuf type {@code a2a.v1.TaskStatusUpdateEvent} + */ +@com.google.protobuf.Generated +public final class TaskStatusUpdateEvent extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.TaskStatusUpdateEvent) + TaskStatusUpdateEventOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "TaskStatusUpdateEvent"); + } + // Use TaskStatusUpdateEvent.newBuilder() to construct. + private TaskStatusUpdateEvent(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private TaskStatusUpdateEvent() { + taskId_ = ""; + contextId_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_TaskStatusUpdateEvent_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_TaskStatusUpdateEvent_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.class, org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.Builder.class); + } + + private int bitField0_; + public static final int TASK_ID_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object taskId_ = ""; + /** + *
+   * The id of the task that is changed
+   * 
+ * + * string task_id = 1; + * @return The taskId. + */ + @java.lang.Override + public java.lang.String getTaskId() { + java.lang.Object ref = taskId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + taskId_ = s; + return s; + } + } + /** + *
+   * The id of the task that is changed
+   * 
+ * + * string task_id = 1; + * @return The bytes for taskId. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getTaskIdBytes() { + java.lang.Object ref = taskId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + taskId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CONTEXT_ID_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object contextId_ = ""; + /** + *
+   * The id of the context that the task belongs to
+   * 
+ * + * string context_id = 2; + * @return The contextId. + */ + @java.lang.Override + public java.lang.String getContextId() { + java.lang.Object ref = contextId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + contextId_ = s; + return s; + } + } + /** + *
+   * The id of the context that the task belongs to
+   * 
+ * + * string context_id = 2; + * @return The bytes for contextId. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getContextIdBytes() { + java.lang.Object ref = contextId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + contextId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int STATUS_FIELD_NUMBER = 3; + private org.a2aproject.sdk.compat03.grpc.TaskStatus status_; + /** + *
+   * The new status of the task.
+   * 
+ * + * .a2a.v1.TaskStatus status = 3; + * @return Whether the status field is set. + */ + @java.lang.Override + public boolean hasStatus() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + *
+   * The new status of the task.
+   * 
+ * + * .a2a.v1.TaskStatus status = 3; + * @return The status. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskStatus getStatus() { + return status_ == null ? org.a2aproject.sdk.compat03.grpc.TaskStatus.getDefaultInstance() : status_; + } + /** + *
+   * The new status of the task.
+   * 
+ * + * .a2a.v1.TaskStatus status = 3; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskStatusOrBuilder getStatusOrBuilder() { + return status_ == null ? org.a2aproject.sdk.compat03.grpc.TaskStatus.getDefaultInstance() : status_; + } + + public static final int FINAL_FIELD_NUMBER = 4; + private boolean final_ = false; + /** + *
+   * Whether this is the last status update expected for this task.
+   * 
+ * + * bool final = 4; + * @return The final. + */ + @java.lang.Override + public boolean getFinal() { + return final_; + } + + public static final int METADATA_FIELD_NUMBER = 5; + private com.google.protobuf.Struct metadata_; + /** + *
+   * Optional metadata to associate with the task update.
+   * 
+ * + * .google.protobuf.Struct metadata = 5; + * @return Whether the metadata field is set. + */ + @java.lang.Override + public boolean hasMetadata() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + *
+   * Optional metadata to associate with the task update.
+   * 
+ * + * .google.protobuf.Struct metadata = 5; + * @return The metadata. + */ + @java.lang.Override + public com.google.protobuf.Struct getMetadata() { + return metadata_ == null ? com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } + /** + *
+   * Optional metadata to associate with the task update.
+   * 
+ * + * .google.protobuf.Struct metadata = 5; + */ + @java.lang.Override + public com.google.protobuf.StructOrBuilder getMetadataOrBuilder() { + return metadata_ == null ? com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(taskId_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, taskId_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(contextId_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, contextId_); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(3, getStatus()); + } + if (final_ != false) { + output.writeBool(4, final_); + } + if (((bitField0_ & 0x00000002) != 0)) { + output.writeMessage(5, getMetadata()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(taskId_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, taskId_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(contextId_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, contextId_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, getStatus()); + } + if (final_ != false) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(4, final_); + } + if (((bitField0_ & 0x00000002) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(5, getMetadata()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent other = (org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent) obj; + + if (!getTaskId() + .equals(other.getTaskId())) return false; + if (!getContextId() + .equals(other.getContextId())) return false; + if (hasStatus() != other.hasStatus()) return false; + if (hasStatus()) { + if (!getStatus() + .equals(other.getStatus())) return false; + } + if (getFinal() + != other.getFinal()) return false; + if (hasMetadata() != other.hasMetadata()) return false; + if (hasMetadata()) { + if (!getMetadata() + .equals(other.getMetadata())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + TASK_ID_FIELD_NUMBER; + hash = (53 * hash) + getTaskId().hashCode(); + hash = (37 * hash) + CONTEXT_ID_FIELD_NUMBER; + hash = (53 * hash) + getContextId().hashCode(); + if (hasStatus()) { + hash = (37 * hash) + STATUS_FIELD_NUMBER; + hash = (53 * hash) + getStatus().hashCode(); + } + hash = (37 * hash) + FINAL_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( + getFinal()); + if (hasMetadata()) { + hash = (37 * hash) + METADATA_FIELD_NUMBER; + hash = (53 * hash) + getMetadata().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * TaskStatusUpdateEvent is a delta even on a task indicating that a task
+   * has changed.
+   * 
+ * + * Protobuf type {@code a2a.v1.TaskStatusUpdateEvent} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.TaskStatusUpdateEvent) + org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEventOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_TaskStatusUpdateEvent_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_TaskStatusUpdateEvent_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.class, org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage + .alwaysUseFieldBuilders) { + internalGetStatusFieldBuilder(); + internalGetMetadataFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + taskId_ = ""; + contextId_ = ""; + status_ = null; + if (statusBuilder_ != null) { + statusBuilder_.dispose(); + statusBuilder_ = null; + } + final_ = false; + metadata_ = null; + if (metadataBuilder_ != null) { + metadataBuilder_.dispose(); + metadataBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_TaskStatusUpdateEvent_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent build() { + org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent buildPartial() { + org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent result = new org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.taskId_ = taskId_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.contextId_ = contextId_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000004) != 0)) { + result.status_ = statusBuilder_ == null + ? status_ + : statusBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.final_ = final_; + } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.metadata_ = metadataBuilder_ == null + ? metadata_ + : metadataBuilder_.build(); + to_bitField0_ |= 0x00000002; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent other) { + if (other == org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.getDefaultInstance()) return this; + if (!other.getTaskId().isEmpty()) { + taskId_ = other.taskId_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getContextId().isEmpty()) { + contextId_ = other.contextId_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (other.hasStatus()) { + mergeStatus(other.getStatus()); + } + if (other.getFinal() != false) { + setFinal(other.getFinal()); + } + if (other.hasMetadata()) { + mergeMetadata(other.getMetadata()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + taskId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + contextId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: { + input.readMessage( + internalGetStatusFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000004; + break; + } // case 26 + case 32: { + final_ = input.readBool(); + bitField0_ |= 0x00000008; + break; + } // case 32 + case 42: { + input.readMessage( + internalGetMetadataFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000010; + break; + } // case 42 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object taskId_ = ""; + /** + *
+     * The id of the task that is changed
+     * 
+ * + * string task_id = 1; + * @return The taskId. + */ + public java.lang.String getTaskId() { + java.lang.Object ref = taskId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + taskId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The id of the task that is changed
+     * 
+ * + * string task_id = 1; + * @return The bytes for taskId. + */ + public com.google.protobuf.ByteString + getTaskIdBytes() { + java.lang.Object ref = taskId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + taskId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The id of the task that is changed
+     * 
+ * + * string task_id = 1; + * @param value The taskId to set. + * @return This builder for chaining. + */ + public Builder setTaskId( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + taskId_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * The id of the task that is changed
+     * 
+ * + * string task_id = 1; + * @return This builder for chaining. + */ + public Builder clearTaskId() { + taskId_ = getDefaultInstance().getTaskId(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * The id of the task that is changed
+     * 
+ * + * string task_id = 1; + * @param value The bytes for taskId to set. + * @return This builder for chaining. + */ + public Builder setTaskIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + taskId_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object contextId_ = ""; + /** + *
+     * The id of the context that the task belongs to
+     * 
+ * + * string context_id = 2; + * @return The contextId. + */ + public java.lang.String getContextId() { + java.lang.Object ref = contextId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + contextId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The id of the context that the task belongs to
+     * 
+ * + * string context_id = 2; + * @return The bytes for contextId. + */ + public com.google.protobuf.ByteString + getContextIdBytes() { + java.lang.Object ref = contextId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + contextId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The id of the context that the task belongs to
+     * 
+ * + * string context_id = 2; + * @param value The contextId to set. + * @return This builder for chaining. + */ + public Builder setContextId( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + contextId_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * The id of the context that the task belongs to
+     * 
+ * + * string context_id = 2; + * @return This builder for chaining. + */ + public Builder clearContextId() { + contextId_ = getDefaultInstance().getContextId(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * The id of the context that the task belongs to
+     * 
+ * + * string context_id = 2; + * @param value The bytes for contextId to set. + * @return This builder for chaining. + */ + public Builder setContextIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + contextId_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private org.a2aproject.sdk.compat03.grpc.TaskStatus status_; + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.TaskStatus, org.a2aproject.sdk.compat03.grpc.TaskStatus.Builder, org.a2aproject.sdk.compat03.grpc.TaskStatusOrBuilder> statusBuilder_; + /** + *
+     * The new status of the task.
+     * 
+ * + * .a2a.v1.TaskStatus status = 3; + * @return Whether the status field is set. + */ + public boolean hasStatus() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + *
+     * The new status of the task.
+     * 
+ * + * .a2a.v1.TaskStatus status = 3; + * @return The status. + */ + public org.a2aproject.sdk.compat03.grpc.TaskStatus getStatus() { + if (statusBuilder_ == null) { + return status_ == null ? org.a2aproject.sdk.compat03.grpc.TaskStatus.getDefaultInstance() : status_; + } else { + return statusBuilder_.getMessage(); + } + } + /** + *
+     * The new status of the task.
+     * 
+ * + * .a2a.v1.TaskStatus status = 3; + */ + public Builder setStatus(org.a2aproject.sdk.compat03.grpc.TaskStatus value) { + if (statusBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + status_ = value; + } else { + statusBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * The new status of the task.
+     * 
+ * + * .a2a.v1.TaskStatus status = 3; + */ + public Builder setStatus( + org.a2aproject.sdk.compat03.grpc.TaskStatus.Builder builderForValue) { + if (statusBuilder_ == null) { + status_ = builderForValue.build(); + } else { + statusBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * The new status of the task.
+     * 
+ * + * .a2a.v1.TaskStatus status = 3; + */ + public Builder mergeStatus(org.a2aproject.sdk.compat03.grpc.TaskStatus value) { + if (statusBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0) && + status_ != null && + status_ != org.a2aproject.sdk.compat03.grpc.TaskStatus.getDefaultInstance()) { + getStatusBuilder().mergeFrom(value); + } else { + status_ = value; + } + } else { + statusBuilder_.mergeFrom(value); + } + if (status_ != null) { + bitField0_ |= 0x00000004; + onChanged(); + } + return this; + } + /** + *
+     * The new status of the task.
+     * 
+ * + * .a2a.v1.TaskStatus status = 3; + */ + public Builder clearStatus() { + bitField0_ = (bitField0_ & ~0x00000004); + status_ = null; + if (statusBuilder_ != null) { + statusBuilder_.dispose(); + statusBuilder_ = null; + } + onChanged(); + return this; + } + /** + *
+     * The new status of the task.
+     * 
+ * + * .a2a.v1.TaskStatus status = 3; + */ + public org.a2aproject.sdk.compat03.grpc.TaskStatus.Builder getStatusBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return internalGetStatusFieldBuilder().getBuilder(); + } + /** + *
+     * The new status of the task.
+     * 
+ * + * .a2a.v1.TaskStatus status = 3; + */ + public org.a2aproject.sdk.compat03.grpc.TaskStatusOrBuilder getStatusOrBuilder() { + if (statusBuilder_ != null) { + return statusBuilder_.getMessageOrBuilder(); + } else { + return status_ == null ? + org.a2aproject.sdk.compat03.grpc.TaskStatus.getDefaultInstance() : status_; + } + } + /** + *
+     * The new status of the task.
+     * 
+ * + * .a2a.v1.TaskStatus status = 3; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.TaskStatus, org.a2aproject.sdk.compat03.grpc.TaskStatus.Builder, org.a2aproject.sdk.compat03.grpc.TaskStatusOrBuilder> + internalGetStatusFieldBuilder() { + if (statusBuilder_ == null) { + statusBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.TaskStatus, org.a2aproject.sdk.compat03.grpc.TaskStatus.Builder, org.a2aproject.sdk.compat03.grpc.TaskStatusOrBuilder>( + getStatus(), + getParentForChildren(), + isClean()); + status_ = null; + } + return statusBuilder_; + } + + private boolean final_ ; + /** + *
+     * Whether this is the last status update expected for this task.
+     * 
+ * + * bool final = 4; + * @return The final. + */ + @java.lang.Override + public boolean getFinal() { + return final_; + } + /** + *
+     * Whether this is the last status update expected for this task.
+     * 
+ * + * bool final = 4; + * @param value The final to set. + * @return This builder for chaining. + */ + public Builder setFinal(boolean value) { + + final_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + *
+     * Whether this is the last status update expected for this task.
+     * 
+ * + * bool final = 4; + * @return This builder for chaining. + */ + public Builder clearFinal() { + bitField0_ = (bitField0_ & ~0x00000008); + final_ = false; + onChanged(); + return this; + } + + private com.google.protobuf.Struct metadata_; + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> metadataBuilder_; + /** + *
+     * Optional metadata to associate with the task update.
+     * 
+ * + * .google.protobuf.Struct metadata = 5; + * @return Whether the metadata field is set. + */ + public boolean hasMetadata() { + return ((bitField0_ & 0x00000010) != 0); + } + /** + *
+     * Optional metadata to associate with the task update.
+     * 
+ * + * .google.protobuf.Struct metadata = 5; + * @return The metadata. + */ + public com.google.protobuf.Struct getMetadata() { + if (metadataBuilder_ == null) { + return metadata_ == null ? com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } else { + return metadataBuilder_.getMessage(); + } + } + /** + *
+     * Optional metadata to associate with the task update.
+     * 
+ * + * .google.protobuf.Struct metadata = 5; + */ + public Builder setMetadata(com.google.protobuf.Struct value) { + if (metadataBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + metadata_ = value; + } else { + metadataBuilder_.setMessage(value); + } + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + *
+     * Optional metadata to associate with the task update.
+     * 
+ * + * .google.protobuf.Struct metadata = 5; + */ + public Builder setMetadata( + com.google.protobuf.Struct.Builder builderForValue) { + if (metadataBuilder_ == null) { + metadata_ = builderForValue.build(); + } else { + metadataBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + *
+     * Optional metadata to associate with the task update.
+     * 
+ * + * .google.protobuf.Struct metadata = 5; + */ + public Builder mergeMetadata(com.google.protobuf.Struct value) { + if (metadataBuilder_ == null) { + if (((bitField0_ & 0x00000010) != 0) && + metadata_ != null && + metadata_ != com.google.protobuf.Struct.getDefaultInstance()) { + getMetadataBuilder().mergeFrom(value); + } else { + metadata_ = value; + } + } else { + metadataBuilder_.mergeFrom(value); + } + if (metadata_ != null) { + bitField0_ |= 0x00000010; + onChanged(); + } + return this; + } + /** + *
+     * Optional metadata to associate with the task update.
+     * 
+ * + * .google.protobuf.Struct metadata = 5; + */ + public Builder clearMetadata() { + bitField0_ = (bitField0_ & ~0x00000010); + metadata_ = null; + if (metadataBuilder_ != null) { + metadataBuilder_.dispose(); + metadataBuilder_ = null; + } + onChanged(); + return this; + } + /** + *
+     * Optional metadata to associate with the task update.
+     * 
+ * + * .google.protobuf.Struct metadata = 5; + */ + public com.google.protobuf.Struct.Builder getMetadataBuilder() { + bitField0_ |= 0x00000010; + onChanged(); + return internalGetMetadataFieldBuilder().getBuilder(); + } + /** + *
+     * Optional metadata to associate with the task update.
+     * 
+ * + * .google.protobuf.Struct metadata = 5; + */ + public com.google.protobuf.StructOrBuilder getMetadataOrBuilder() { + if (metadataBuilder_ != null) { + return metadataBuilder_.getMessageOrBuilder(); + } else { + return metadata_ == null ? + com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } + } + /** + *
+     * Optional metadata to associate with the task update.
+     * 
+ * + * .google.protobuf.Struct metadata = 5; + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> + internalGetMetadataFieldBuilder() { + if (metadataBuilder_ == null) { + metadataBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder>( + getMetadata(), + getParentForChildren(), + isClean()); + metadata_ = null; + } + return metadataBuilder_; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.TaskStatusUpdateEvent) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.TaskStatusUpdateEvent) + private static final org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent(); + } + + public static org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public TaskStatusUpdateEvent parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskStatusUpdateEventOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskStatusUpdateEventOrBuilder.java new file mode 100644 index 000000000..02a951004 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskStatusUpdateEventOrBuilder.java @@ -0,0 +1,116 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface TaskStatusUpdateEventOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.TaskStatusUpdateEvent) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The id of the task that is changed
+   * 
+ * + * string task_id = 1; + * @return The taskId. + */ + java.lang.String getTaskId(); + /** + *
+   * The id of the task that is changed
+   * 
+ * + * string task_id = 1; + * @return The bytes for taskId. + */ + com.google.protobuf.ByteString + getTaskIdBytes(); + + /** + *
+   * The id of the context that the task belongs to
+   * 
+ * + * string context_id = 2; + * @return The contextId. + */ + java.lang.String getContextId(); + /** + *
+   * The id of the context that the task belongs to
+   * 
+ * + * string context_id = 2; + * @return The bytes for contextId. + */ + com.google.protobuf.ByteString + getContextIdBytes(); + + /** + *
+   * The new status of the task.
+   * 
+ * + * .a2a.v1.TaskStatus status = 3; + * @return Whether the status field is set. + */ + boolean hasStatus(); + /** + *
+   * The new status of the task.
+   * 
+ * + * .a2a.v1.TaskStatus status = 3; + * @return The status. + */ + org.a2aproject.sdk.compat03.grpc.TaskStatus getStatus(); + /** + *
+   * The new status of the task.
+   * 
+ * + * .a2a.v1.TaskStatus status = 3; + */ + org.a2aproject.sdk.compat03.grpc.TaskStatusOrBuilder getStatusOrBuilder(); + + /** + *
+   * Whether this is the last status update expected for this task.
+   * 
+ * + * bool final = 4; + * @return The final. + */ + boolean getFinal(); + + /** + *
+   * Optional metadata to associate with the task update.
+   * 
+ * + * .google.protobuf.Struct metadata = 5; + * @return Whether the metadata field is set. + */ + boolean hasMetadata(); + /** + *
+   * Optional metadata to associate with the task update.
+   * 
+ * + * .google.protobuf.Struct metadata = 5; + * @return The metadata. + */ + com.google.protobuf.Struct getMetadata(); + /** + *
+   * Optional metadata to associate with the task update.
+   * 
+ * + * .google.protobuf.Struct metadata = 5; + */ + com.google.protobuf.StructOrBuilder getMetadataOrBuilder(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskSubscriptionRequest.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskSubscriptionRequest.java new file mode 100644 index 000000000..239543702 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskSubscriptionRequest.java @@ -0,0 +1,530 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.TaskSubscriptionRequest} + */ +@com.google.protobuf.Generated +public final class TaskSubscriptionRequest extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.TaskSubscriptionRequest) + TaskSubscriptionRequestOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "TaskSubscriptionRequest"); + } + // Use TaskSubscriptionRequest.newBuilder() to construct. + private TaskSubscriptionRequest(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private TaskSubscriptionRequest() { + name_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_TaskSubscriptionRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_TaskSubscriptionRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest.class, org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + *
+   * name=tasks/{id}
+   * 
+ * + * string name = 1; + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + *
+   * name=tasks/{id}
+   * 
+ * + * string name = 1; + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, name_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, name_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest other = (org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest) obj; + + if (!getName() + .equals(other.getName())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.TaskSubscriptionRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.TaskSubscriptionRequest) + org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return A2A.internal_static_a2a_v1_TaskSubscriptionRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return A2A.internal_static_a2a_v1_TaskSubscriptionRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest.class, org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + name_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return A2A.internal_static_a2a_v1_TaskSubscriptionRequest_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest build() { + org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest buildPartial() { + org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest result = new org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest other) { + if (other == org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000001; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + *
+     * name=tasks/{id}
+     * 
+ * + * string name = 1; + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * name=tasks/{id}
+     * 
+ * + * string name = 1; + * @return The bytes for name. + */ + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * name=tasks/{id}
+     * 
+ * + * string name = 1; + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * name=tasks/{id}
+     * 
+ * + * string name = 1; + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * name=tasks/{id}
+     * 
+ * + * string name = 1; + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.TaskSubscriptionRequest) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.TaskSubscriptionRequest) + private static final org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest(); + } + + public static org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public TaskSubscriptionRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskSubscriptionRequestOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskSubscriptionRequestOrBuilder.java new file mode 100644 index 000000000..a5edfc6f0 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskSubscriptionRequestOrBuilder.java @@ -0,0 +1,32 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface TaskSubscriptionRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.TaskSubscriptionRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * name=tasks/{id}
+   * 
+ * + * string name = 1; + * @return The name. + */ + java.lang.String getName(); + /** + *
+   * name=tasks/{id}
+   * 
+ * + * string name = 1; + * @return The bytes for name. + */ + com.google.protobuf.ByteString + getNameBytes(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/utils/ProtoUtils_v0_3.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/utils/ProtoUtils_v0_3.java new file mode 100644 index 000000000..a69a376c8 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/utils/ProtoUtils_v0_3.java @@ -0,0 +1,1025 @@ +package org.a2aproject.sdk.compat03.grpc.utils; + + +import java.nio.charset.StandardCharsets; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import com.google.protobuf.ByteString; +import com.google.protobuf.Struct; +import com.google.protobuf.Value; +import org.a2aproject.sdk.compat03.grpc.StreamResponse; +import org.a2aproject.sdk.compat03.spec.APIKeySecurityScheme_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentCapabilities_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentCard_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentCardSignature_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentExtension_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentInterface_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentProvider_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentSkill_v0_3; +import org.a2aproject.sdk.compat03.spec.Artifact_v0_3; +import org.a2aproject.sdk.compat03.spec.AuthorizationCodeOAuthFlow_v0_3; +import org.a2aproject.sdk.compat03.spec.ClientCredentialsOAuthFlow_v0_3; +import org.a2aproject.sdk.compat03.spec.DataPart_v0_3; +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigParams_v0_3; +import org.a2aproject.sdk.compat03.spec.EventKind_v0_3; +import org.a2aproject.sdk.compat03.spec.FileContent_v0_3; +import org.a2aproject.sdk.compat03.spec.FilePart_v0_3; +import org.a2aproject.sdk.compat03.spec.FileWithBytes_v0_3; +import org.a2aproject.sdk.compat03.spec.FileWithUri_v0_3; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigParams_v0_3; +import org.a2aproject.sdk.compat03.spec.HTTPAuthSecurityScheme_v0_3; +import org.a2aproject.sdk.compat03.spec.ImplicitOAuthFlow_v0_3; +import org.a2aproject.sdk.compat03.spec.InvalidParamsError_v0_3; +import org.a2aproject.sdk.compat03.spec.InvalidRequestError_v0_3; +import org.a2aproject.sdk.compat03.spec.ListTaskPushNotificationConfigParams_v0_3; +import org.a2aproject.sdk.compat03.spec.Message_v0_3; +import org.a2aproject.sdk.compat03.spec.MessageSendConfiguration_v0_3; +import org.a2aproject.sdk.compat03.spec.MessageSendParams_v0_3; +import org.a2aproject.sdk.compat03.spec.MutualTLSSecurityScheme_v0_3; +import org.a2aproject.sdk.compat03.spec.OAuth2SecurityScheme_v0_3; +import org.a2aproject.sdk.compat03.spec.OAuthFlows_v0_3; +import org.a2aproject.sdk.compat03.spec.OpenIdConnectSecurityScheme_v0_3; +import org.a2aproject.sdk.compat03.spec.Part_v0_3; +import org.a2aproject.sdk.compat03.spec.PasswordOAuthFlow_v0_3; +import org.a2aproject.sdk.compat03.spec.PushNotificationAuthenticationInfo_v0_3; +import org.a2aproject.sdk.compat03.spec.PushNotificationConfig_v0_3; +import org.a2aproject.sdk.compat03.spec.SecurityScheme_v0_3; +import org.a2aproject.sdk.compat03.spec.StreamingEventKind_v0_3; +import org.a2aproject.sdk.compat03.spec.Task_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskArtifactUpdateEvent_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskIdParams_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskQueryParams_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskState_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskStatus_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskStatusUpdateEvent_v0_3; +import org.a2aproject.sdk.compat03.spec.TextPart_v0_3; +import org.jspecify.annotations.Nullable; + +/** + * Utility class to convert between GRPC and Spec objects. + */ +public class ProtoUtils_v0_3 { + + public static class ToProto { + + public static org.a2aproject.sdk.compat03.grpc.AgentCard agentCard(AgentCard_v0_3 agentCard) { + org.a2aproject.sdk.compat03.grpc.AgentCard.Builder builder = org.a2aproject.sdk.compat03.grpc.AgentCard.newBuilder(); + if (agentCard.protocolVersion() != null) { + builder.setProtocolVersion(agentCard.protocolVersion()); + } + if (agentCard.name() != null) { + builder.setName(agentCard.name()); + } + if (agentCard.description() != null) { + builder.setDescription(agentCard.description()); + } + if (agentCard.url() != null) { + builder.setUrl(agentCard.url()); + } + if (agentCard.preferredTransport() != null) { + builder.setPreferredTransport(agentCard.preferredTransport()); + } + if (agentCard.additionalInterfaces() != null) { + builder.addAllAdditionalInterfaces(agentCard.additionalInterfaces().stream().map(item -> agentInterface(item)).collect(Collectors.toList())); + } + if (agentCard.provider() != null) { + builder.setProvider(agentProvider(agentCard.provider())); + } + if (agentCard.version() != null) { + builder.setVersion(agentCard.version()); + } + if (agentCard.documentationUrl() != null) { + builder.setDocumentationUrl(agentCard.documentationUrl()); + } + if (agentCard.capabilities() != null) { + builder.setCapabilities(agentCapabilities(agentCard.capabilities())); + } + if (agentCard.securitySchemes() != null) { + builder.putAllSecuritySchemes( + agentCard.securitySchemes().entrySet().stream() + .collect(Collectors.toMap(Map.Entry::getKey, e -> securityScheme(e.getValue()))) + ); + } + if (agentCard.security() != null) { + builder.addAllSecurity(agentCard.security().stream().map(s -> { + org.a2aproject.sdk.compat03.grpc.Security.Builder securityBuilder = org.a2aproject.sdk.compat03.grpc.Security.newBuilder(); + s.forEach((key, value) -> { + org.a2aproject.sdk.compat03.grpc.StringList.Builder stringListBuilder = org.a2aproject.sdk.compat03.grpc.StringList.newBuilder(); + stringListBuilder.addAllList(value); + securityBuilder.putSchemes(key, stringListBuilder.build()); + }); + return securityBuilder.build(); + }).collect(Collectors.toList())); + } + if (agentCard.defaultInputModes() != null) { + builder.addAllDefaultInputModes(agentCard.defaultInputModes()); + } + if (agentCard.defaultOutputModes() != null) { + builder.addAllDefaultOutputModes(agentCard.defaultOutputModes()); + } + if (agentCard.skills() != null) { + builder.addAllSkills(agentCard.skills().stream().map(ToProto::agentSkill).collect(Collectors.toList())); + } + builder.setSupportsAuthenticatedExtendedCard(agentCard.supportsAuthenticatedExtendedCard()); + if (agentCard.signatures() != null) { + builder.addAllSignatures(agentCard.signatures().stream().map(ToProto::agentCardSignature).collect(Collectors.toList())); + } + return builder.build(); + } + + public static org.a2aproject.sdk.compat03.grpc.Task task(Task_v0_3 task) { + org.a2aproject.sdk.compat03.grpc.Task.Builder builder = org.a2aproject.sdk.compat03.grpc.Task.newBuilder(); + builder.setId(task.getId()); + builder.setContextId(task.getContextId()); + builder.setStatus(taskStatus(task.getStatus())); + if (task.getArtifacts() != null) { + builder.addAllArtifacts(task.getArtifacts().stream().map(ToProto::artifact).collect(Collectors.toList())); + } + if (task.getHistory() != null) { + builder.addAllHistory(task.getHistory().stream().map(ToProto::message).collect(Collectors.toList())); + } + builder.setMetadata(struct(task.getMetadata())); + return builder.build(); + } + + public static org.a2aproject.sdk.compat03.grpc.Message message(Message_v0_3 message) { + org.a2aproject.sdk.compat03.grpc.Message.Builder builder = org.a2aproject.sdk.compat03.grpc.Message.newBuilder(); + builder.setMessageId(message.getMessageId()); + if (message.getContextId() != null) { + builder.setContextId(message.getContextId()); + } + if (message.getTaskId() != null) { + builder.setTaskId(message.getTaskId()); + } + builder.setRole(role(message.getRole())); + if (message.getParts() != null) { + builder.addAllContent(message.getParts().stream().map(ToProto::part).collect(Collectors.toList())); + } + builder.setMetadata(struct(message.getMetadata())); + return builder.build(); + } + + public static org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig taskPushNotificationConfig(TaskPushNotificationConfig_v0_3 config) { + String id = config.pushNotificationConfig().id(); + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.Builder builder = org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.newBuilder(); + builder.setName("tasks/" + config.taskId() + "/pushNotificationConfigs" + (id == null ? "" : ('/' + id))); + builder.setPushNotificationConfig(pushNotificationConfig(config.pushNotificationConfig())); + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.PushNotificationConfig pushNotificationConfig(PushNotificationConfig_v0_3 config) { + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.Builder builder = org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.newBuilder(); + if (config.url() != null) { + builder.setUrl(config.url()); + } + if (config.token() != null) { + builder.setToken(config.token()); + } + if (config.authentication() != null) { + builder.setAuthentication(authenticationInfo(config.authentication())); + } + if (config.id() != null) { + builder.setId(config.id()); + } + return builder.build(); + } + + public static org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent taskArtifactUpdateEvent(TaskArtifactUpdateEvent_v0_3 event) { + org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.Builder builder = org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.newBuilder(); + builder.setTaskId(event.getTaskId()); + builder.setContextId(event.getContextId()); + builder.setArtifact(artifact(event.getArtifact())); + if (event.isAppend() != null) { + builder.setAppend(event.isAppend()); + } + if (event.isLastChunk() != null) { + builder.setLastChunk(event.isLastChunk()); + } + if (event.getMetadata() != null) { + builder.setMetadata(struct(event.getMetadata())); + } + return builder.build(); + } + + public static org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent taskStatusUpdateEvent(TaskStatusUpdateEvent_v0_3 event) { + org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.Builder builder = org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.newBuilder(); + builder.setTaskId(event.getTaskId()); + builder.setContextId(event.getContextId()); + builder.setStatus(taskStatus(event.getStatus())); + builder.setFinal(event.isFinal()); + if (event.getMetadata() != null) { + builder.setMetadata(struct(event.getMetadata())); + } + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.Artifact artifact(Artifact_v0_3 artifact) { + org.a2aproject.sdk.compat03.grpc.Artifact.Builder builder = org.a2aproject.sdk.compat03.grpc.Artifact.newBuilder(); + if (artifact.artifactId() != null) { + builder.setArtifactId(artifact.artifactId()); + } + if (artifact.name() != null) { + builder.setName(artifact.name()); + } + if (artifact.description() != null) { + builder.setDescription(artifact.description()); + } + if (artifact.parts() != null) { + builder.addAllParts(artifact.parts().stream().map(ToProto::part).collect(Collectors.toList())); + } + if (artifact.metadata() != null) { + builder.setMetadata(struct(artifact.metadata())); + } + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.Part part(Part_v0_3 part) { + org.a2aproject.sdk.compat03.grpc.Part.Builder builder = org.a2aproject.sdk.compat03.grpc.Part.newBuilder(); + if (part instanceof TextPart_v0_3) { + builder.setText(((TextPart_v0_3) part).getText()); + } else if (part instanceof FilePart_v0_3) { + builder.setFile(filePart((FilePart_v0_3) part)); + } else if (part instanceof DataPart_v0_3) { + builder.setData(dataPart((DataPart_v0_3) part)); + } + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.FilePart filePart(FilePart_v0_3 filePart) { + org.a2aproject.sdk.compat03.grpc.FilePart.Builder builder = org.a2aproject.sdk.compat03.grpc.FilePart.newBuilder(); + FileContent_v0_3 fileContent = filePart.getFile(); + if (fileContent instanceof FileWithBytes_v0_3) { + builder.setFileWithBytes(ByteString.copyFrom(((FileWithBytes_v0_3) fileContent).bytes(), StandardCharsets.UTF_8)); + } else if (fileContent instanceof FileWithUri_v0_3) { + builder.setFileWithUri(((FileWithUri_v0_3) fileContent).uri()); + } + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.DataPart dataPart(DataPart_v0_3 dataPart) { + org.a2aproject.sdk.compat03.grpc.DataPart.Builder builder = org.a2aproject.sdk.compat03.grpc.DataPart.newBuilder(); + if (dataPart.getData() != null) { + builder.setData(struct(dataPart.getData())); + } + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.Role role(Message_v0_3.Role role) { + if (role == null) { + return org.a2aproject.sdk.compat03.grpc.Role.ROLE_UNSPECIFIED; + } + return switch (role) { + case USER -> + org.a2aproject.sdk.compat03.grpc.Role.ROLE_USER; + case AGENT -> + org.a2aproject.sdk.compat03.grpc.Role.ROLE_AGENT; + }; + } + + private static org.a2aproject.sdk.compat03.grpc.TaskStatus taskStatus(TaskStatus_v0_3 taskStatus) { + org.a2aproject.sdk.compat03.grpc.TaskStatus.Builder builder = org.a2aproject.sdk.compat03.grpc.TaskStatus.newBuilder(); + if (taskStatus.state() != null) { + builder.setState(taskState(taskStatus.state())); + } + if (taskStatus.message() != null) { + builder.setUpdate(message(taskStatus.message())); + } + if (taskStatus.timestamp() != null) { + Instant instant = taskStatus.timestamp().toInstant(); + builder.setTimestamp(com.google.protobuf.Timestamp.newBuilder().setSeconds(instant.getEpochSecond()).setNanos(instant.getNano()).build()); + } + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.TaskState taskState(TaskState_v0_3 taskState) { + if (taskState == null) { + return org.a2aproject.sdk.compat03.grpc.TaskState.TASK_STATE_UNSPECIFIED; + } + return switch (taskState) { + case SUBMITTED -> + org.a2aproject.sdk.compat03.grpc.TaskState.TASK_STATE_SUBMITTED; + case WORKING -> + org.a2aproject.sdk.compat03.grpc.TaskState.TASK_STATE_WORKING; + case INPUT_REQUIRED -> + org.a2aproject.sdk.compat03.grpc.TaskState.TASK_STATE_INPUT_REQUIRED; + case AUTH_REQUIRED -> + org.a2aproject.sdk.compat03.grpc.TaskState.TASK_STATE_AUTH_REQUIRED; + case COMPLETED -> + org.a2aproject.sdk.compat03.grpc.TaskState.TASK_STATE_COMPLETED; + case CANCELED -> + org.a2aproject.sdk.compat03.grpc.TaskState.TASK_STATE_CANCELLED; + case FAILED -> + org.a2aproject.sdk.compat03.grpc.TaskState.TASK_STATE_FAILED; + case REJECTED -> + org.a2aproject.sdk.compat03.grpc.TaskState.TASK_STATE_REJECTED; + default -> + org.a2aproject.sdk.compat03.grpc.TaskState.TASK_STATE_UNSPECIFIED; + }; + } + + private static org.a2aproject.sdk.compat03.grpc.AuthenticationInfo authenticationInfo(PushNotificationAuthenticationInfo_v0_3 pushNotificationAuthenticationInfo) { + org.a2aproject.sdk.compat03.grpc.AuthenticationInfo.Builder builder = org.a2aproject.sdk.compat03.grpc.AuthenticationInfo.newBuilder(); + if (pushNotificationAuthenticationInfo.schemes() != null) { + builder.addAllSchemes(pushNotificationAuthenticationInfo.schemes()); + } + if (pushNotificationAuthenticationInfo.credentials() != null) { + builder.setCredentials(pushNotificationAuthenticationInfo.credentials()); + } + return builder.build(); + } + + public static org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration messageSendConfiguration(MessageSendConfiguration_v0_3 messageSendConfiguration) { + org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration.Builder builder = org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration.newBuilder(); + if (messageSendConfiguration.acceptedOutputModes() != null) { + builder.addAllAcceptedOutputModes(messageSendConfiguration.acceptedOutputModes()); + } + if (messageSendConfiguration.historyLength() != null) { + builder.setHistoryLength(messageSendConfiguration.historyLength()); + } + if (messageSendConfiguration.pushNotificationConfig() != null) { + builder.setPushNotification(pushNotificationConfig(messageSendConfiguration.pushNotificationConfig())); + } + builder.setBlocking(messageSendConfiguration.blocking()); + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.AgentProvider agentProvider(AgentProvider_v0_3 agentProvider) { + org.a2aproject.sdk.compat03.grpc.AgentProvider.Builder builder = org.a2aproject.sdk.compat03.grpc.AgentProvider.newBuilder(); + builder.setOrganization(agentProvider.organization()); + builder.setUrl(agentProvider.url()); + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.AgentCapabilities agentCapabilities(AgentCapabilities_v0_3 agentCapabilities) { + org.a2aproject.sdk.compat03.grpc.AgentCapabilities.Builder builder = org.a2aproject.sdk.compat03.grpc.AgentCapabilities.newBuilder(); + builder.setStreaming(agentCapabilities.streaming()); + builder.setPushNotifications(agentCapabilities.pushNotifications()); + if (agentCapabilities.extensions() != null) { + builder.addAllExtensions(agentCapabilities.extensions().stream().map(ToProto::agentExtension).collect(Collectors.toList())); + } + return builder.build(); + } + + public static org.a2aproject.sdk.compat03.grpc.SendMessageRequest sendMessageRequest(MessageSendParams_v0_3 request) { + org.a2aproject.sdk.compat03.grpc.SendMessageRequest.Builder builder = org.a2aproject.sdk.compat03.grpc.SendMessageRequest.newBuilder(); + builder.setRequest(message(request.message())); + if (request.configuration() != null) { + builder.setConfiguration(messageSendConfiguration(request.configuration())); + } + if (request.metadata() != null && ! request.metadata().isEmpty()) { + builder.setMetadata(struct(request.metadata())); + } + return builder.build(); + } + private static org.a2aproject.sdk.compat03.grpc.AgentExtension agentExtension(AgentExtension_v0_3 agentExtension) { + org.a2aproject.sdk.compat03.grpc.AgentExtension.Builder builder = org.a2aproject.sdk.compat03.grpc.AgentExtension.newBuilder(); + if (agentExtension.description() != null) { + builder.setDescription(agentExtension.description()); + } + if (agentExtension.params() != null) { + builder.setParams(struct(agentExtension.params())); + } + builder.setRequired(agentExtension.required()); + if (agentExtension.uri() != null) { + builder.setUri(agentExtension.uri()); + } + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.AgentSkill agentSkill(AgentSkill_v0_3 agentSkill) { + org.a2aproject.sdk.compat03.grpc.AgentSkill.Builder builder = org.a2aproject.sdk.compat03.grpc.AgentSkill.newBuilder(); + if (agentSkill.id() != null) { + builder.setId(agentSkill.id()); + } + if (agentSkill.name() != null) { + builder.setName(agentSkill.name()); + } + if (agentSkill.description() != null) { + builder.setDescription(agentSkill.description()); + } + if (agentSkill.tags() != null) { + builder.addAllTags(agentSkill.tags()); + } + if (agentSkill.examples() != null) { + builder.addAllExamples(agentSkill.examples()); + } + if (agentSkill.inputModes() != null) { + builder.addAllInputModes(agentSkill.inputModes()); + } + if (agentSkill.outputModes() != null) { + builder.addAllOutputModes(agentSkill.outputModes()); + } + if (agentSkill.security() != null) { + builder.addAllSecurity(agentSkill.security().stream().map(s -> { + org.a2aproject.sdk.compat03.grpc.Security.Builder securityBuilder = org.a2aproject.sdk.compat03.grpc.Security.newBuilder(); + s.forEach((key, value) -> { + org.a2aproject.sdk.compat03.grpc.StringList.Builder stringListBuilder = org.a2aproject.sdk.compat03.grpc.StringList.newBuilder(); + stringListBuilder.addAllList(value); + securityBuilder.putSchemes(key, stringListBuilder.build()); + }); + return securityBuilder.build(); + }).collect(Collectors.toList())); + } + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.AgentCardSignature agentCardSignature(AgentCardSignature_v0_3 agentCardSignature) { + org.a2aproject.sdk.compat03.grpc.AgentCardSignature.Builder builder = org.a2aproject.sdk.compat03.grpc.AgentCardSignature.newBuilder(); + builder.setProtected(agentCardSignature.protectedHeader()); + builder.setSignature(agentCardSignature.signature()); + if (agentCardSignature.header() != null) { + builder.setHeader(struct(agentCardSignature.header())); + } + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.SecurityScheme securityScheme(SecurityScheme_v0_3 securityScheme) { + org.a2aproject.sdk.compat03.grpc.SecurityScheme.Builder builder = org.a2aproject.sdk.compat03.grpc.SecurityScheme.newBuilder(); + if (securityScheme instanceof APIKeySecurityScheme_v0_3) { + builder.setApiKeySecurityScheme(apiKeySecurityScheme((APIKeySecurityScheme_v0_3) securityScheme)); + } else if (securityScheme instanceof HTTPAuthSecurityScheme_v0_3) { + builder.setHttpAuthSecurityScheme(httpAuthSecurityScheme((HTTPAuthSecurityScheme_v0_3) securityScheme)); + } else if (securityScheme instanceof OAuth2SecurityScheme_v0_3) { + builder.setOauth2SecurityScheme(oauthSecurityScheme((OAuth2SecurityScheme_v0_3) securityScheme)); + } else if (securityScheme instanceof OpenIdConnectSecurityScheme_v0_3) { + builder.setOpenIdConnectSecurityScheme(openIdConnectSecurityScheme((OpenIdConnectSecurityScheme_v0_3) securityScheme)); + } else if (securityScheme instanceof MutualTLSSecurityScheme_v0_3) { + builder.setMtlsSecurityScheme(mutualTlsSecurityScheme((MutualTLSSecurityScheme_v0_3) securityScheme)); + } + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme apiKeySecurityScheme(APIKeySecurityScheme_v0_3 apiKeySecurityScheme) { + org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.Builder builder = org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.newBuilder(); + if (apiKeySecurityScheme.getDescription() != null) { + builder.setDescription(apiKeySecurityScheme.getDescription()); + } + if (apiKeySecurityScheme.getIn() != null) { + builder.setLocation(apiKeySecurityScheme.getIn()); + } + if (apiKeySecurityScheme.getName() != null) { + builder.setName(apiKeySecurityScheme.getName()); + } + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme httpAuthSecurityScheme(HTTPAuthSecurityScheme_v0_3 httpAuthSecurityScheme) { + org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.Builder builder = org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.newBuilder(); + if (httpAuthSecurityScheme.getBearerFormat() != null) { + builder.setBearerFormat(httpAuthSecurityScheme.getBearerFormat()); + } + if (httpAuthSecurityScheme.getDescription() != null) { + builder.setDescription(httpAuthSecurityScheme.getDescription()); + } + if (httpAuthSecurityScheme.getScheme() != null) { + builder.setScheme(httpAuthSecurityScheme.getScheme()); + } + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme oauthSecurityScheme(OAuth2SecurityScheme_v0_3 oauth2SecurityScheme) { + org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.Builder builder = org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.newBuilder(); + if (oauth2SecurityScheme.getDescription() != null) { + builder.setDescription(oauth2SecurityScheme.getDescription()); + } + if (oauth2SecurityScheme.getFlows() != null) { + builder.setFlows(oauthFlows(oauth2SecurityScheme.getFlows())); + } + if (oauth2SecurityScheme.getOauth2MetadataUrl() != null) { + builder.setOauth2MetadataUrl(oauth2SecurityScheme.getOauth2MetadataUrl()); + } + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.OAuthFlows oauthFlows(OAuthFlows_v0_3 oAuthFlows) { + org.a2aproject.sdk.compat03.grpc.OAuthFlows.Builder builder = org.a2aproject.sdk.compat03.grpc.OAuthFlows.newBuilder(); + if (oAuthFlows.authorizationCode() != null) { + builder.setAuthorizationCode(authorizationCodeOAuthFlow(oAuthFlows.authorizationCode())); + } + if (oAuthFlows.clientCredentials() != null) { + builder.setClientCredentials(clientCredentialsOAuthFlow(oAuthFlows.clientCredentials())); + } + if (oAuthFlows.implicit() != null) { + builder.setImplicit(implicitOAuthFlow(oAuthFlows.implicit())); + } + if (oAuthFlows.password() != null) { + builder.setPassword(passwordOAuthFlow(oAuthFlows.password())); + } + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow authorizationCodeOAuthFlow(AuthorizationCodeOAuthFlow_v0_3 authorizationCodeOAuthFlow) { + org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.Builder builder = org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.newBuilder(); + if (authorizationCodeOAuthFlow.authorizationUrl() != null) { + builder.setAuthorizationUrl(authorizationCodeOAuthFlow.authorizationUrl()); + } + if (authorizationCodeOAuthFlow.refreshUrl() != null) { + builder.setRefreshUrl(authorizationCodeOAuthFlow.refreshUrl()); + } + if (authorizationCodeOAuthFlow.scopes() != null) { + builder.putAllScopes(authorizationCodeOAuthFlow.scopes()); + } + if (authorizationCodeOAuthFlow.tokenUrl() != null) { + builder.setTokenUrl(authorizationCodeOAuthFlow.tokenUrl()); + } + return builder.build(); + } + + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse listTaskPushNotificationConfigResponse(List configs) { + List confs = new ArrayList<>(configs.size()); + for(TaskPushNotificationConfig_v0_3 config: configs) { + confs.add(taskPushNotificationConfig(config)); + } + return org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse.newBuilder().addAllConfigs(confs).build(); + } + + private static org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow clientCredentialsOAuthFlow(ClientCredentialsOAuthFlow_v0_3 clientCredentialsOAuthFlow) { + org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.Builder builder = org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.newBuilder(); + if (clientCredentialsOAuthFlow.refreshUrl() != null) { + builder.setRefreshUrl(clientCredentialsOAuthFlow.refreshUrl()); + } + if (clientCredentialsOAuthFlow.scopes() != null) { + builder.putAllScopes(clientCredentialsOAuthFlow.scopes()); + } + if (clientCredentialsOAuthFlow.tokenUrl() != null) { + builder.setTokenUrl(clientCredentialsOAuthFlow.tokenUrl()); + } + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow implicitOAuthFlow(ImplicitOAuthFlow_v0_3 implicitOAuthFlow) { + org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.Builder builder = org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.newBuilder(); + if (implicitOAuthFlow.authorizationUrl() != null) { + builder.setAuthorizationUrl(implicitOAuthFlow.authorizationUrl()); + } + if (implicitOAuthFlow.refreshUrl() != null) { + builder.setRefreshUrl(implicitOAuthFlow.refreshUrl()); + } + if (implicitOAuthFlow.scopes() != null) { + builder.putAllScopes(implicitOAuthFlow.scopes()); + } + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow passwordOAuthFlow(PasswordOAuthFlow_v0_3 passwordOAuthFlow) { + org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.Builder builder = org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.newBuilder(); + if (passwordOAuthFlow.refreshUrl() != null) { + builder.setRefreshUrl(passwordOAuthFlow.refreshUrl()); + } + if (passwordOAuthFlow.scopes() != null) { + builder.putAllScopes(passwordOAuthFlow.scopes()); + } + if (passwordOAuthFlow.tokenUrl() != null) { + builder.setTokenUrl(passwordOAuthFlow.tokenUrl()); + } + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme openIdConnectSecurityScheme(OpenIdConnectSecurityScheme_v0_3 openIdConnectSecurityScheme) { + org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.Builder builder = org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.newBuilder(); + if (openIdConnectSecurityScheme.getDescription() != null) { + builder.setDescription(openIdConnectSecurityScheme.getDescription()); + } + if (openIdConnectSecurityScheme.getOpenIdConnectUrl() != null) { + builder.setOpenIdConnectUrl(openIdConnectSecurityScheme.getOpenIdConnectUrl()); + } + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme mutualTlsSecurityScheme(MutualTLSSecurityScheme_v0_3 mutualTlsSecurityScheme) { + org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.Builder builder = org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.newBuilder(); + if (mutualTlsSecurityScheme.getDescription() != null) { + builder.setDescription(mutualTlsSecurityScheme.getDescription()); + } + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.AgentInterface agentInterface(AgentInterface_v0_3 agentInterface) { + org.a2aproject.sdk.compat03.grpc.AgentInterface.Builder builder = org.a2aproject.sdk.compat03.grpc.AgentInterface.newBuilder(); + if (agentInterface.transport() != null) { + builder.setTransport(agentInterface.transport()); + } + if (agentInterface.url() != null) { + builder.setUrl(agentInterface.url()); + } + return builder.build(); + } + + public static Struct struct(Map map) { + Struct.Builder structBuilder = Struct.newBuilder(); + if (map != null) { + map.forEach((k, v) -> structBuilder.putFields(k, value(v))); + } + return structBuilder.build(); + } + + private static Value value(Object value) { + Value.Builder valueBuilder = Value.newBuilder(); + if (value instanceof String) { + valueBuilder.setStringValue((String) value); + } else if (value instanceof Number) { + valueBuilder.setNumberValue(((Number) value).doubleValue()); + } else if (value instanceof Boolean) { + valueBuilder.setBoolValue((Boolean) value); + } else if (value instanceof Map) { + valueBuilder.setStructValue(struct((Map) value)); + } else if (value instanceof List) { + valueBuilder.setListValue(listValue((List) value)); + } + return valueBuilder.build(); + } + + private static com.google.protobuf.ListValue listValue(List list) { + com.google.protobuf.ListValue.Builder listValueBuilder = com.google.protobuf.ListValue.newBuilder(); + if (list != null) { + list.forEach(o -> listValueBuilder.addValues(value(o))); + } + return listValueBuilder.build(); + } + + public static StreamResponse streamResponse(StreamingEventKind_v0_3 streamingEventKind) { + if (streamingEventKind instanceof TaskStatusUpdateEvent_v0_3) { + return StreamResponse.newBuilder() + .setStatusUpdate(taskStatusUpdateEvent((TaskStatusUpdateEvent_v0_3) streamingEventKind)) + .build(); + } else if (streamingEventKind instanceof TaskArtifactUpdateEvent_v0_3) { + return StreamResponse.newBuilder() + .setArtifactUpdate(taskArtifactUpdateEvent((TaskArtifactUpdateEvent_v0_3) streamingEventKind)) + .build(); + } else if (streamingEventKind instanceof Message_v0_3) { + return StreamResponse.newBuilder() + .setMsg(message((Message_v0_3) streamingEventKind)) + .build(); + } else if (streamingEventKind instanceof Task_v0_3) { + return StreamResponse.newBuilder() + .setTask(task((Task_v0_3) streamingEventKind)) + .build(); + } else { + throw new IllegalArgumentException("Unsupported event type: " + streamingEventKind); + } + } + + public static org.a2aproject.sdk.compat03.grpc.SendMessageResponse taskOrMessage(EventKind_v0_3 eventKind) { + if (eventKind instanceof Task_v0_3) { + return org.a2aproject.sdk.compat03.grpc.SendMessageResponse.newBuilder() + .setTask(task((Task_v0_3) eventKind)) + .build(); + } else if (eventKind instanceof Message_v0_3) { + return org.a2aproject.sdk.compat03.grpc.SendMessageResponse.newBuilder() + .setMsg(message((Message_v0_3) eventKind)) + .build(); + } else { + throw new IllegalArgumentException("Unsupported event type: " + eventKind); + } + } + + public static org.a2aproject.sdk.compat03.grpc.StreamResponse taskOrMessageStream(StreamingEventKind_v0_3 eventKind) { + if (eventKind instanceof Task_v0_3 task) { + return org.a2aproject.sdk.compat03.grpc.StreamResponse.newBuilder() + .setTask(task(task)) + .build(); + } else if (eventKind instanceof Message_v0_3 msg) { + return org.a2aproject.sdk.compat03.grpc.StreamResponse.newBuilder() + .setMsg(message(msg)) + .build(); + } else if (eventKind instanceof TaskArtifactUpdateEvent_v0_3 update) { + return org.a2aproject.sdk.compat03.grpc.StreamResponse.newBuilder() + .setArtifactUpdate(taskArtifactUpdateEvent(update)) + .build(); + } else if (eventKind instanceof TaskStatusUpdateEvent_v0_3 update) { + return org.a2aproject.sdk.compat03.grpc.StreamResponse.newBuilder() + .setStatusUpdate(taskStatusUpdateEvent(update)) + .build(); + } else { + throw new IllegalArgumentException("Unsupported event type: " + eventKind); + } + } + + } + + public static class FromProto { + + public static TaskQueryParams_v0_3 taskQueryParams(org.a2aproject.sdk.compat03.grpc.GetTaskRequestOrBuilder request) { + String name = request.getName(); + String id = name.substring(name.lastIndexOf('/') + 1); + return new TaskQueryParams_v0_3(id, request.getHistoryLength()); + } + + public static TaskIdParams_v0_3 taskIdParams(org.a2aproject.sdk.compat03.grpc.CancelTaskRequestOrBuilder request) { + String name = request.getName(); + String id = name.substring(name.lastIndexOf('/') + 1); + return new TaskIdParams_v0_3(id); + } + + public static MessageSendParams_v0_3 messageSendParams(org.a2aproject.sdk.compat03.grpc.SendMessageRequestOrBuilder request) { + MessageSendParams_v0_3.Builder builder = new MessageSendParams_v0_3.Builder(); + builder.message(message(request.getRequest())); + if (request.hasConfiguration()) { + builder.configuration(messageSendConfiguration(request.getConfiguration())); + } + if (request.hasMetadata()) { + builder.metadata(struct(request.getMetadata())); + } + return builder.build(); + } + + public static TaskPushNotificationConfig_v0_3 taskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequestOrBuilder request) { + return taskPushNotificationConfig(request.getConfig(), true); + } + + public static TaskPushNotificationConfig_v0_3 taskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfigOrBuilder config) { + return taskPushNotificationConfig(config, false); + } + + private static TaskPushNotificationConfig_v0_3 taskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfigOrBuilder config, boolean create) { + String name = config.getName(); // "tasks/{id}/pushNotificationConfigs/{push_id}" + String[] parts = name.split("/"); + String taskId = parts[1]; + String configId = ""; + if (create) { + if (parts.length < 3) { + throw new IllegalArgumentException("Invalid name format for TaskPushNotificationConfig: " + name); + } + if (parts.length == 4) { + configId = parts[3]; + } else { + configId = taskId; + } + } else { + if (parts.length < 4) { + throw new IllegalArgumentException("Invalid name format for TaskPushNotificationConfig: " + name); + } + configId = parts[3]; + } + PushNotificationConfig_v0_3 pnc = pushNotification(config.getPushNotificationConfig(), configId); + return new TaskPushNotificationConfig_v0_3(taskId, pnc); + } + + public static GetTaskPushNotificationConfigParams_v0_3 getTaskPushNotificationConfigParams(org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequestOrBuilder request) { + String name = request.getName(); // "tasks/{id}/pushNotificationConfigs/{push_id}" + String[] parts = name.split("/"); + String taskId = parts[1]; + String configId; + if (parts.length == 2) { + configId = taskId; + } else if (parts.length < 4) { + throw new IllegalArgumentException("Invalid name format for GetTaskPushNotificationConfigRequest: " + name); + } else { + configId = parts[3]; + } + return new GetTaskPushNotificationConfigParams_v0_3(taskId, configId); + } + + public static TaskIdParams_v0_3 taskIdParams(org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequestOrBuilder request) { + String name = request.getName(); + String id = name.substring(name.lastIndexOf('/') + 1); + return new TaskIdParams_v0_3(id); + } + + public static List listTaskPushNotificationConfigParams(org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponseOrBuilder response) { + List configs = response.getConfigsList(); + List result = new ArrayList<>(configs.size()); + for(org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig config : configs) { + result.add(taskPushNotificationConfig(config, false)); + } + return result; + } + + public static ListTaskPushNotificationConfigParams_v0_3 listTaskPushNotificationConfigParams(org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequestOrBuilder request) { + String parent = request.getParent(); + String id = parent.substring(parent.lastIndexOf('/') + 1); + return new ListTaskPushNotificationConfigParams_v0_3(id); + } + + public static DeleteTaskPushNotificationConfigParams_v0_3 deleteTaskPushNotificationConfigParams(org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequestOrBuilder request) { + String name = request.getName(); // "tasks/{id}/pushNotificationConfigs/{push_id}" + String[] parts = name.split("/"); + if (parts.length < 4) { + throw new IllegalArgumentException("Invalid name format for DeleteTaskPushNotificationConfigRequest: " + name); + } + String taskId = parts[1]; + String configId = parts[3]; + return new DeleteTaskPushNotificationConfigParams_v0_3(taskId, configId); + } + + private static AgentExtension_v0_3 agentExtension(org.a2aproject.sdk.compat03.grpc.AgentExtensionOrBuilder agentExtension) { + return new AgentExtension_v0_3( + agentExtension.getDescription(), + struct(agentExtension.getParams()), + agentExtension.getRequired(), + agentExtension.getUri() + ); + } + + private static MessageSendConfiguration_v0_3 messageSendConfiguration(org.a2aproject.sdk.compat03.grpc.SendMessageConfigurationOrBuilder sendMessageConfiguration) { + return new MessageSendConfiguration_v0_3( + sendMessageConfiguration.getAcceptedOutputModesList().isEmpty() ? null : + new ArrayList<>(sendMessageConfiguration.getAcceptedOutputModesList()), + sendMessageConfiguration.getHistoryLength(), + pushNotification(sendMessageConfiguration.getPushNotification()), + sendMessageConfiguration.getBlocking() + ); + } + + private static @Nullable PushNotificationConfig_v0_3 pushNotification(org.a2aproject.sdk.compat03.grpc.PushNotificationConfigOrBuilder pushNotification, String configId) { + if(pushNotification == null || pushNotification.getDefaultInstanceForType().equals(pushNotification)) { + return null; + } + return new PushNotificationConfig_v0_3( + pushNotification.getUrl(), + pushNotification.getToken().isEmpty() ? null : pushNotification.getToken(), + pushNotification.hasAuthentication() ? authenticationInfo(pushNotification.getAuthentication()) : null, + pushNotification.getId().isEmpty() ? configId : pushNotification.getId() + ); + } + + private static @Nullable PushNotificationConfig_v0_3 pushNotification(org.a2aproject.sdk.compat03.grpc.PushNotificationConfigOrBuilder pushNotification) { + return pushNotification(pushNotification, pushNotification.getId()); + } + + private static PushNotificationAuthenticationInfo_v0_3 authenticationInfo(org.a2aproject.sdk.compat03.grpc.AuthenticationInfoOrBuilder authenticationInfo) { + return new PushNotificationAuthenticationInfo_v0_3( + new ArrayList<>(authenticationInfo.getSchemesList()), + authenticationInfo.getCredentials() + ); + } + + public static Task_v0_3 task(org.a2aproject.sdk.compat03.grpc.TaskOrBuilder task) { + return new Task_v0_3( + task.getId(), + task.getContextId(), + taskStatus(task.getStatus()), + task.getArtifactsList().stream().map(item -> artifact(item)).collect(Collectors.toList()), + task.getHistoryList().stream().map(item -> message(item)).collect(Collectors.toList()), + struct(task.getMetadata()) + ); + } + + public static Message_v0_3 message(org.a2aproject.sdk.compat03.grpc.MessageOrBuilder message) { + if (message.getMessageId().isEmpty()) { + throw new InvalidParamsError_v0_3(); + } + + return new Message_v0_3( + role(message.getRole()), + message.getContentList().stream().map(item -> part(item)).collect(Collectors.toList()), + message.getMessageId().isEmpty() ? null : message.getMessageId(), + message.getContextId().isEmpty() ? null : message.getContextId(), + message.getTaskId().isEmpty() ? null : message.getTaskId(), + null, // referenceTaskIds is not in grpc message + struct(message.getMetadata()), + message.getExtensionsList().isEmpty() ? null : message.getExtensionsList() + ); + } + + public static TaskStatusUpdateEvent_v0_3 taskStatusUpdateEvent(org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEventOrBuilder taskStatusUpdateEvent) { + return new TaskStatusUpdateEvent_v0_3.Builder() + .taskId(taskStatusUpdateEvent.getTaskId()) + .status(taskStatus(taskStatusUpdateEvent.getStatus())) + .contextId(taskStatusUpdateEvent.getContextId()) + .isFinal(taskStatusUpdateEvent.getFinal()) + .metadata(struct(taskStatusUpdateEvent.getMetadata())) + .build(); + } + + public static TaskArtifactUpdateEvent_v0_3 taskArtifactUpdateEvent(org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEventOrBuilder taskArtifactUpdateEvent) { + return new TaskArtifactUpdateEvent_v0_3.Builder() + .taskId(taskArtifactUpdateEvent.getTaskId()) + .append(taskArtifactUpdateEvent.getAppend()) + .lastChunk(taskArtifactUpdateEvent.getLastChunk()) + .artifact(artifact(taskArtifactUpdateEvent.getArtifact())) + .contextId(taskArtifactUpdateEvent.getContextId()) + .metadata(struct(taskArtifactUpdateEvent.getMetadata())) + .build(); + } + + private static Artifact_v0_3 artifact(org.a2aproject.sdk.compat03.grpc.ArtifactOrBuilder artifact) { + return new Artifact_v0_3( + artifact.getArtifactId(), + artifact.getName(), + artifact.getDescription(), + artifact.getPartsList().stream().map(item -> part(item)).collect(Collectors.toList()), + struct(artifact.getMetadata()), + artifact.getExtensionsList().isEmpty() ? null : artifact.getExtensionsList() + ); + } + + private static Part_v0_3 part(org.a2aproject.sdk.compat03.grpc.PartOrBuilder part) { + if (part.hasText()) { + return textPart(part.getText()); + } else if (part.hasFile()) { + return filePart(part.getFile()); + } else if (part.hasData()) { + return dataPart(part.getData()); + } + throw new InvalidRequestError_v0_3(); + } + + private static TextPart_v0_3 textPart(String text) { + return new TextPart_v0_3(text); + } + + private static FilePart_v0_3 filePart(org.a2aproject.sdk.compat03.grpc.FilePartOrBuilder filePart) { + if (filePart.hasFileWithBytes()) { + return new FilePart_v0_3(new FileWithBytes_v0_3(filePart.getMimeType(), null, filePart.getFileWithBytes().toStringUtf8())); + } else if (filePart.hasFileWithUri()) { + return new FilePart_v0_3(new FileWithUri_v0_3(filePart.getMimeType(), null, filePart.getFileWithUri())); + } + throw new InvalidRequestError_v0_3(); + } + + private static DataPart_v0_3 dataPart(org.a2aproject.sdk.compat03.grpc.DataPartOrBuilder dataPart) { + return new DataPart_v0_3(struct(dataPart.getData())); + } + + private static @Nullable TaskStatus_v0_3 taskStatus(org.a2aproject.sdk.compat03.grpc.TaskStatusOrBuilder taskStatus) { + TaskState_v0_3 state = taskState(taskStatus.getState()); + if (state == null) { + return null; + } + return new TaskStatus_v0_3( + taskState(taskStatus.getState()), + taskStatus.hasUpdate() ? message(taskStatus.getUpdateOrBuilder()) : null, + OffsetDateTime.ofInstant(Instant.ofEpochSecond(taskStatus.getTimestamp().getSeconds(), taskStatus.getTimestamp().getNanos()), ZoneOffset.UTC) + ); + } + + private static Message_v0_3.@Nullable Role role(org.a2aproject.sdk.compat03.grpc.Role role) { + if (role == null) { + return null; + } + return switch (role) { + case ROLE_USER -> + Message_v0_3.Role.USER; + case ROLE_AGENT -> + Message_v0_3.Role.AGENT; + default -> + throw new InvalidRequestError_v0_3(); + }; + } + + private static @Nullable TaskState_v0_3 taskState(org.a2aproject.sdk.compat03.grpc.TaskState taskState) { + if (taskState == null) { + return null; + } + return switch (taskState) { + case TASK_STATE_SUBMITTED -> + TaskState_v0_3.SUBMITTED; + case TASK_STATE_WORKING -> + TaskState_v0_3.WORKING; + case TASK_STATE_INPUT_REQUIRED -> + TaskState_v0_3.INPUT_REQUIRED; + case TASK_STATE_AUTH_REQUIRED -> + TaskState_v0_3.AUTH_REQUIRED; + case TASK_STATE_COMPLETED -> + TaskState_v0_3.COMPLETED; + case TASK_STATE_CANCELLED -> + TaskState_v0_3.CANCELED; + case TASK_STATE_FAILED -> + TaskState_v0_3.FAILED; + case TASK_STATE_REJECTED -> + TaskState_v0_3.REJECTED; + case TASK_STATE_UNSPECIFIED -> + null; + case UNRECOGNIZED -> + null; + }; + } + + private static @Nullable Map struct(Struct struct) { + if (struct == null || struct.getFieldsCount() == 0) { + return null; + } + return struct.getFieldsMap().entrySet().stream() + .collect(Collectors.toMap(Map.Entry::getKey, e -> value(e.getValue()))); + } + + private static @Nullable Object value(Value value) { + switch (value.getKindCase()) { + case STRUCT_VALUE: + return struct(value.getStructValue()); + case LIST_VALUE: + return value.getListValue().getValuesList().stream() + .map(FromProto::value) + .collect(Collectors.toList()); + case BOOL_VALUE: + return value.getBoolValue(); + case NUMBER_VALUE: + return value.getNumberValue(); + case STRING_VALUE: + return value.getStringValue(); + case NULL_VALUE: + default: + throw new InvalidRequestError_v0_3(); + } + } + } + +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/utils/package-info.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/utils/package-info.java new file mode 100644 index 000000000..bd0d8d936 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/utils/package-info.java @@ -0,0 +1,5 @@ +@NullMarked +package org.a2aproject.sdk.compat03.grpc.utils; + +import org.jspecify.annotations.NullMarked; + diff --git a/compat-0.3/spec-grpc/src/main/proto/a2a.proto b/compat-0.3/spec-grpc/src/main/proto/a2a.proto new file mode 100644 index 000000000..89b21a258 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/proto/a2a.proto @@ -0,0 +1,717 @@ +// Older protoc compilers don't understand edition yet. +syntax = "proto3"; +package a2a.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; + +// Copied from https://github.com/a2aproject/A2A/blob/v0.3.0/specification/grpc/a2a.proto +// The only change is the 'java_package' update + +option csharp_namespace = "A2a.V1"; +option go_package = "google.golang.org/a2a/v1"; +option java_multiple_files = true; +option java_outer_classname = "A2A"; +// Update package from the spec version +option java_package = "org.a2aproject.sdk.compat03.grpc"; + +// A2AService defines the gRPC version of the A2A protocol. This has a slightly +// different shape than the JSONRPC version to better conform to AIP-127, +// where appropriate. The nouns are AgentCard, Message, Task and +// TaskPushNotificationConfig. +// - Messages are not a standard resource so there is no get/delete/update/list +// interface, only a send and stream custom methods. +// - Tasks have a get interface and custom cancel and subscribe methods. +// - TaskPushNotificationConfig are a resource whose parent is a task. +// They have get, list and create methods. +// - AgentCard is a static resource with only a get method. +// fields are not present as they don't comply with AIP rules, and the +// optional history_length on the get task method is not present as it also +// violates AIP-127 and AIP-131. +service A2AService { + // Send a message to the agent. This is a blocking call that will return the + // task once it is completed, or a LRO if requested. + rpc SendMessage(SendMessageRequest) returns (SendMessageResponse) { + option (google.api.http) = { + post: "/v1/message:send" + body: "*" + }; + } + // SendStreamingMessage is a streaming call that will return a stream of + // task update events until the Task is in an interrupted or terminal state. + rpc SendStreamingMessage(SendMessageRequest) returns (stream StreamResponse) { + option (google.api.http) = { + post: "/v1/message:stream" + body: "*" + }; + } + + // Get the current state of a task from the agent. + rpc GetTask(GetTaskRequest) returns (Task) { + option (google.api.http) = { + get: "/v1/{name=tasks/*}" + }; + option (google.api.method_signature) = "name"; + } + // Cancel a task from the agent. If supported one should expect no + // more task updates for the task. + rpc CancelTask(CancelTaskRequest) returns (Task) { + option (google.api.http) = { + post: "/v1/{name=tasks/*}:cancel" + body: "*" + }; + } + // TaskSubscription is a streaming call that will return a stream of task + // update events. This attaches the stream to an existing in process task. + // If the task is complete the stream will return the completed task (like + // GetTask) and close the stream. + rpc TaskSubscription(TaskSubscriptionRequest) + returns (stream StreamResponse) { + option (google.api.http) = { + get: "/v1/{name=tasks/*}:subscribe" + }; + } + + // Set a push notification config for a task. + rpc CreateTaskPushNotificationConfig(CreateTaskPushNotificationConfigRequest) + returns (TaskPushNotificationConfig) { + option (google.api.http) = { + post: "/v1/{parent=task/*/pushNotificationConfigs}" + body: "config" + }; + option (google.api.method_signature) = "parent,config"; + } + // Get a push notification config for a task. + rpc GetTaskPushNotificationConfig(GetTaskPushNotificationConfigRequest) + returns (TaskPushNotificationConfig) { + option (google.api.http) = { + get: "/v1/{name=tasks/*/pushNotificationConfigs/*}" + }; + option (google.api.method_signature) = "name"; + } + // Get a list of push notifications configured for a task. + rpc ListTaskPushNotificationConfig(ListTaskPushNotificationConfigRequest) + returns (ListTaskPushNotificationConfigResponse) { + option (google.api.http) = { + get: "/v1/{parent=tasks/*}/pushNotificationConfigs" + }; + option (google.api.method_signature) = "parent"; + } + // GetAgentCard returns the agent card for the agent. + rpc GetAgentCard(GetAgentCardRequest) returns (AgentCard) { + option (google.api.http) = { + get: "/v1/card" + }; + } + // Delete a push notification config for a task. + rpc DeleteTaskPushNotificationConfig(DeleteTaskPushNotificationConfigRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=tasks/*/pushNotificationConfigs/*}" + }; + option (google.api.method_signature) = "name"; + } +} + +///////// Data Model //////////// + +// Configuration of a send message request. +message SendMessageConfiguration { + // The output modes that the agent is expected to respond with. + repeated string accepted_output_modes = 1; + // A configuration of a webhook that can be used to receive updates + PushNotificationConfig push_notification = 2; + // The maximum number of messages to include in the history. if 0, the + // history will be unlimited. + int32 history_length = 3; + // If true, the message will be blocking until the task is completed. If + // false, the message will be non-blocking and the task will be returned + // immediately. It is the caller's responsibility to check for any task + // updates. + bool blocking = 4; +} + +// Task is the core unit of action for A2A. It has a current status +// and when results are created for the task they are stored in the +// artifact. If there are multiple turns for a task, these are stored in +// history. +message Task { + // Unique identifier for a task, created by the A2A server. + string id = 1; + // Unique identifier for the contextual collection of interactions (tasks + // and messages). Created by the A2A server. + string context_id = 2; + // The current status of a Task, including state and a message. + TaskStatus status = 3; + // A set of output artifacts for a Task. + repeated Artifact artifacts = 4; + // protolint:disable REPEATED_FIELD_NAMES_PLURALIZED + // The history of interactions from a task. + repeated Message history = 5; + // protolint:enable REPEATED_FIELD_NAMES_PLURALIZED + // A key/value object to store custom metadata about a task. + google.protobuf.Struct metadata = 6; +} + +// The set of states a Task can be in. +enum TaskState { + TASK_STATE_UNSPECIFIED = 0; + // Represents the status that acknowledges a task is created + TASK_STATE_SUBMITTED = 1; + // Represents the status that a task is actively being processed + TASK_STATE_WORKING = 2; + // Represents the status a task is finished. This is a terminal state + TASK_STATE_COMPLETED = 3; + // Represents the status a task is done but failed. This is a terminal state + TASK_STATE_FAILED = 4; + // Represents the status a task was cancelled before it finished. + // This is a terminal state. + TASK_STATE_CANCELLED = 5; + // Represents the status that the task requires information to complete. + // This is an interrupted state. + TASK_STATE_INPUT_REQUIRED = 6; + // Represents the status that the agent has decided to not perform the task. + // This may be done during initial task creation or later once an agent + // has determined it can't or won't proceed. This is a terminal state. + TASK_STATE_REJECTED = 7; + // Represents the state that some authentication is needed from the upstream + // client. Authentication is expected to come out-of-band thus this is not + // an interrupted or terminal state. + TASK_STATE_AUTH_REQUIRED = 8; +} + +// A container for the status of a task +message TaskStatus { + // The current state of this task + TaskState state = 1; + // A message associated with the status. + Message update = 2 [json_name = "message"]; + // Timestamp when the status was recorded. + // Example: "2023-10-27T10:00:00Z" + google.protobuf.Timestamp timestamp = 3; +} + +// Part represents a container for a section of communication content. +// Parts can be purely textual, some sort of file (image, video, etc) or +// a structured data blob (i.e. JSON). +message Part { + oneof part { + string text = 1; + FilePart file = 2; + DataPart data = 3; + } +} + +// FilePart represents the different ways files can be provided. If files are +// small, directly feeding the bytes is supported via file_with_bytes. If the +// file is large, the agent should read the content as appropriate directly +// from the file_with_uri source. +message FilePart { + oneof file { + string file_with_uri = 1; + bytes file_with_bytes = 2; + } + string mime_type = 3; +} + +// DataPart represents a structured blob. This is most commonly a JSON payload. +message DataPart { + google.protobuf.Struct data = 1; +} + +enum Role { + ROLE_UNSPECIFIED = 0; + // USER role refers to communication from the client to the server. + ROLE_USER = 1; + // AGENT role refers to communication from the server to the client. + ROLE_AGENT = 2; +} + +// Message is one unit of communication between client and server. It is +// associated with a context and optionally a task. Since the server is +// responsible for the context definition, it must always provide a context_id +// in its messages. The client can optionally provide the context_id if it +// knows the context to associate the message to. Similarly for task_id, +// except the server decides if a task is created and whether to include the +// task_id. +message Message { + // The message id of the message. This is required and created by the + // message creator. + string message_id = 1; + // The context id of the message. This is optional and if set, the message + // will be associated with the given context. + string context_id = 2; + // The task id of the message. This is optional and if set, the message + // will be associated with the given task. + string task_id = 3; + // A role for the message. + Role role = 4; + // protolint:disable REPEATED_FIELD_NAMES_PLURALIZED + // Content is the container of the message content. + repeated Part content = 5; + // protolint:enable REPEATED_FIELD_NAMES_PLURALIZED + // Any optional metadata to provide along with the message. + google.protobuf.Struct metadata = 6; + // The URIs of extensions that are present or contributed to this Message. + repeated string extensions = 7; +} + +// Artifacts are the container for task completed results. These are similar +// to Messages but are intended to be the product of a task, as opposed to +// point-to-point communication. +message Artifact { + // Unique id for the artifact. It must be at least unique within a task. + string artifact_id = 1; + // A human readable name for the artifact. + string name = 3; + // A human readable description of the artifact, optional. + string description = 4; + // The content of the artifact. + repeated Part parts = 5; + // Optional metadata included with the artifact. + google.protobuf.Struct metadata = 6; + // The URIs of extensions that are present or contributed to this Artifact. + repeated string extensions = 7; +} + +// TaskStatusUpdateEvent is a delta even on a task indicating that a task +// has changed. +message TaskStatusUpdateEvent { + // The id of the task that is changed + string task_id = 1; + // The id of the context that the task belongs to + string context_id = 2; + // The new status of the task. + TaskStatus status = 3; + // Whether this is the last status update expected for this task. + bool final = 4; + // Optional metadata to associate with the task update. + google.protobuf.Struct metadata = 5; +} + +// TaskArtifactUpdateEvent represents a task delta where an artifact has +// been generated. +message TaskArtifactUpdateEvent { + // The id of the task for this artifact + string task_id = 1; + // The id of the context that this task belongs too + string context_id = 2; + // The artifact itself + Artifact artifact = 3; + // Whether this should be appended to a prior one produced + bool append = 4; + // Whether this represents the last part of an artifact + bool last_chunk = 5; + // Optional metadata associated with the artifact update. + google.protobuf.Struct metadata = 6; +} + +// Configuration for setting up push notifications for task updates. +message PushNotificationConfig { + // A unique id for this push notification. + string id = 1; + // Url to send the notification too + string url = 2; + // Token unique for this task/session + string token = 3; + // Information about the authentication to sent with the notification + AuthenticationInfo authentication = 4; +} + +// Defines authentication details, used for push notifications. +message AuthenticationInfo { + // Supported authentication schemes - e.g. Basic, Bearer, etc + repeated string schemes = 1; + // Optional credentials + string credentials = 2; +} + +// Defines additional transport information for the agent. +message AgentInterface { + // The url this interface is found at. + string url = 1; + // The transport supported this url. This is an open form string, to be + // easily extended for many transport protocols. The core ones officially + // supported are JSONRPC, GRPC and HTTP+JSON. + string transport = 2; +} + +// AgentCard conveys key information: +// - Overall details (version, name, description, uses) +// - Skills; a set of actions/solutions the agent can perform +// - Default modalities/content types supported by the agent. +// - Authentication requirements +// Next ID: 18 +message AgentCard { + // The version of the A2A protocol this agent supports. + string protocol_version = 16; + // A human readable name for the agent. + // Example: "Recipe Agent" + string name = 1; + // A description of the agent's domain of action/solution space. + // Example: "Agent that helps users with recipes and cooking." + string description = 2; + // A URL to the address the agent is hosted at. This represents the + // preferred endpoint as declared by the agent. + string url = 3; + // The transport of the preferred endpoint. If empty, defaults to JSONRPC. + string preferred_transport = 14; + // Announcement of additional supported transports. Client can use any of + // the supported transports. + repeated AgentInterface additional_interfaces = 15; + // The service provider of the agent. + AgentProvider provider = 4; + // The version of the agent. + // Example: "1.0.0" + string version = 5; + // A url to provide additional documentation about the agent. + string documentation_url = 6; + // A2A Capability set supported by the agent. + AgentCapabilities capabilities = 7; + // The security scheme details used for authenticating with this agent. + map security_schemes = 8; + // protolint:disable REPEATED_FIELD_NAMES_PLURALIZED + // Security requirements for contacting the agent. + // This list can be seen as an OR of ANDs. Each object in the list describes + // one possible set of security requirements that must be present on a + // request. This allows specifying, for example, "callers must either use + // OAuth OR an API Key AND mTLS." + // Example: + // security { + // schemes { key: "oauth" value { list: ["read"] } } + // } + // security { + // schemes { key: "api-key" } + // schemes { key: "mtls" } + // } + repeated Security security = 9; + // protolint:enable REPEATED_FIELD_NAMES_PLURALIZED + // The set of interaction modes that the agent supports across all skills. + // This can be overridden per skill. Defined as mime types. + repeated string default_input_modes = 10; + // The mime types supported as outputs from this agent. + repeated string default_output_modes = 11; + // Skills represent a unit of ability an agent can perform. This may + // somewhat abstract but represents a more focused set of actions that the + // agent is highly likely to succeed at. + repeated AgentSkill skills = 12; + // Whether the agent supports providing an extended agent card when + // the user is authenticated, i.e. is the card from .well-known + // different than the card from GetAgentCard. + bool supports_authenticated_extended_card = 13; + // JSON Web Signatures computed for this AgentCard. + repeated AgentCardSignature signatures = 17; +} + +// Represents information about the service provider of an agent. +message AgentProvider { + // The providers reference url + // Example: "https://ai.google.dev" + string url = 1; + // The providers organization name + // Example: "Google" + string organization = 2; +} + +// Defines the A2A feature set supported by the agent +message AgentCapabilities { + // If the agent will support streaming responses + bool streaming = 1; + // If the agent can send push notifications to the clients webhook + bool push_notifications = 2; + // Extensions supported by this agent. + repeated AgentExtension extensions = 3; +} + +// A declaration of an extension supported by an Agent. +message AgentExtension { + // The URI of the extension. + // Example: "https://developers.google.com/identity/protocols/oauth2" + string uri = 1; + // A description of how this agent uses this extension. + // Example: "Google OAuth 2.0 authentication" + string description = 2; + // Whether the client must follow specific requirements of the extension. + // Example: false + bool required = 3; + // Optional configuration for the extension. + google.protobuf.Struct params = 4; +} + +// AgentSkill represents a unit of action/solution that the agent can perform. +// One can think of this as a type of highly reliable solution that an agent +// can be tasked to provide. Agents have the autonomy to choose how and when +// to use specific skills, but clients should have confidence that if the +// skill is defined that unit of action can be reliably performed. +message AgentSkill { + // Unique id of the skill within this agent. + string id = 1; + // A human readable name for the skill. + string name = 2; + // A human (or llm) readable description of the skill + // details and behaviors. + string description = 3; + // A set of tags for the skill to enhance categorization/utilization. + // Example: ["cooking", "customer support", "billing"] + repeated string tags = 4; + // A set of example queries that this skill is designed to address. + // These examples should help the caller to understand how to craft requests + // to the agent to achieve specific goals. + // Example: ["I need a recipe for bread"] + repeated string examples = 5; + // Possible input modalities supported. + repeated string input_modes = 6; + // Possible output modalities produced + repeated string output_modes = 7; + // protolint:disable REPEATED_FIELD_NAMES_PLURALIZED + // Security schemes necessary for the agent to leverage this skill. + // As in the overall AgentCard.security, this list represents a logical OR of + // security requirement objects. Each object is a set of security schemes + // that must be used together (a logical AND). + repeated Security security = 8; +} + +// AgentCardSignature represents a JWS signature of an AgentCard. +// This follows the JSON format of an RFC 7515 JSON Web Signature (JWS). +message AgentCardSignature { + // The protected JWS header for the signature. This is always a + // base64url-encoded JSON object. Required. + string protected = 1 [(google.api.field_behavior) = REQUIRED]; + // The computed signature, base64url-encoded. Required. + string signature = 2 [(google.api.field_behavior) = REQUIRED]; + // The unprotected JWS header values. + google.protobuf.Struct header = 3; +} + +message TaskPushNotificationConfig { + // name=tasks/{id}/pushNotificationConfigs/{id} + string name = 1; + PushNotificationConfig push_notification_config = 2; +} + +// protolint:disable REPEATED_FIELD_NAMES_PLURALIZED +message StringList { + repeated string list = 1; +} +// protolint:enable REPEATED_FIELD_NAMES_PLURALIZED + +message Security { + map schemes = 1; +} + +message SecurityScheme { + oneof scheme { + APIKeySecurityScheme api_key_security_scheme = 1; + HTTPAuthSecurityScheme http_auth_security_scheme = 2; + OAuth2SecurityScheme oauth2_security_scheme = 3; + OpenIdConnectSecurityScheme open_id_connect_security_scheme = 4; + MutualTlsSecurityScheme mtls_security_scheme = 5; + } +} + +message APIKeySecurityScheme { + // Description of this security scheme. + string description = 1; + // Location of the API key, valid values are "query", "header", or "cookie" + string location = 2; + // Name of the header, query or cookie parameter to be used. + string name = 3; +} + +message HTTPAuthSecurityScheme { + // Description of this security scheme. + string description = 1; + // The name of the HTTP Authentication scheme to be used in the + // Authorization header as defined in RFC7235. The values used SHOULD be + // registered in the IANA Authentication Scheme registry. + // The value is case-insensitive, as defined in RFC7235. + string scheme = 2; + // A hint to the client to identify how the bearer token is formatted. + // Bearer tokens are usually generated by an authorization server, so + // this information is primarily for documentation purposes. + string bearer_format = 3; +} + +message OAuth2SecurityScheme { + // Description of this security scheme. + string description = 1; + // An object containing configuration information for the flow types supported + OAuthFlows flows = 2; + // URL to the oauth2 authorization server metadata + // [RFC8414](https://datatracker.ietf.org/doc/html/rfc8414). TLS is required. + string oauth2_metadata_url = 3; +} + +message OpenIdConnectSecurityScheme { + // Description of this security scheme. + string description = 1; + // Well-known URL to discover the [[OpenID-Connect-Discovery]] provider + // metadata. + string open_id_connect_url = 2; +} + +message MutualTlsSecurityScheme { + // Description of this security scheme. + string description = 1; +} + +message OAuthFlows { + oneof flow { + AuthorizationCodeOAuthFlow authorization_code = 1; + ClientCredentialsOAuthFlow client_credentials = 2; + ImplicitOAuthFlow implicit = 3; + PasswordOAuthFlow password = 4; + } +} + +message AuthorizationCodeOAuthFlow { + // The authorization URL to be used for this flow. This MUST be in the + // form of a URL. The OAuth2 standard requires the use of TLS + string authorization_url = 1; + // The token URL to be used for this flow. This MUST be in the form of a URL. + // The OAuth2 standard requires the use of TLS. + string token_url = 2; + // The URL to be used for obtaining refresh tokens. This MUST be in the + // form of a URL. The OAuth2 standard requires the use of TLS. + string refresh_url = 3; + // The available scopes for the OAuth2 security scheme. A map between the + // scope name and a short description for it. The map MAY be empty. + map scopes = 4; +} + +message ClientCredentialsOAuthFlow { + // The token URL to be used for this flow. This MUST be in the form of a URL. + // The OAuth2 standard requires the use of TLS. + string token_url = 1; + // The URL to be used for obtaining refresh tokens. This MUST be in the + // form of a URL. The OAuth2 standard requires the use of TLS. + string refresh_url = 2; + // The available scopes for the OAuth2 security scheme. A map between the + // scope name and a short description for it. The map MAY be empty. + map scopes = 3; +} + +message ImplicitOAuthFlow { + // The authorization URL to be used for this flow. This MUST be in the + // form of a URL. The OAuth2 standard requires the use of TLS + string authorization_url = 1; + // The URL to be used for obtaining refresh tokens. This MUST be in the + // form of a URL. The OAuth2 standard requires the use of TLS. + string refresh_url = 2; + // The available scopes for the OAuth2 security scheme. A map between the + // scope name and a short description for it. The map MAY be empty. + map scopes = 3; +} + +message PasswordOAuthFlow { + // The token URL to be used for this flow. This MUST be in the form of a URL. + // The OAuth2 standard requires the use of TLS. + string token_url = 1; + // The URL to be used for obtaining refresh tokens. This MUST be in the + // form of a URL. The OAuth2 standard requires the use of TLS. + string refresh_url = 2; + // The available scopes for the OAuth2 security scheme. A map between the + // scope name and a short description for it. The map MAY be empty. + map scopes = 3; +} + +///////////// Request Messages /////////// +message SendMessageRequest { + Message request = 1 + [(google.api.field_behavior) = REQUIRED, json_name = "message"]; + SendMessageConfiguration configuration = 2; + google.protobuf.Struct metadata = 3; +} + +message GetTaskRequest { + // name=tasks/{id} + string name = 1 [(google.api.field_behavior) = REQUIRED]; + int32 history_length = 2; +} + +message CancelTaskRequest { + // name=tasks/{id} + string name = 1; +} + +message GetTaskPushNotificationConfigRequest { + // name=tasks/{id}/pushNotificationConfigs/{push_id} + string name = 1; +} + +message DeleteTaskPushNotificationConfigRequest { + // name=tasks/{id}/pushNotificationConfigs/{push_id} + string name = 1; +} + +message CreateTaskPushNotificationConfigRequest { + // The task resource for this config. + // Format: tasks/{id} + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + string config_id = 2 [(google.api.field_behavior) = REQUIRED]; + TaskPushNotificationConfig config = 3 + [(google.api.field_behavior) = REQUIRED]; +} + +message TaskSubscriptionRequest { + // name=tasks/{id} + string name = 1; +} + +message ListTaskPushNotificationConfigRequest { + // parent=tasks/{id} + string parent = 1; + // For AIP-158 these fields are present. Usually not used/needed. + // The maximum number of configurations to return. + // If unspecified, all configs will be returned. + int32 page_size = 2; + + // A page token received from a previous + // ListTaskPushNotificationConfigRequest call. + // Provide this to retrieve the subsequent page. + // When paginating, all other parameters provided to + // `ListTaskPushNotificationConfigRequest` must match the call that provided + // the page token. + string page_token = 3; +} + +message GetAgentCardRequest { + // Empty. Added to fix linter violation. +} + +//////// Response Messages /////////// +message SendMessageResponse { + oneof payload { + Task task = 1; + Message msg = 2 [json_name = "message"]; + } +} + +// The stream response for a message. The stream should be one of the following +// sequences: +// If the response is a message, the stream should contain one, and only one, +// message and then close +// If the response is a task lifecycle, the first response should be a Task +// object followed by zero or more TaskStatusUpdateEvents and +// TaskArtifactUpdateEvents. The stream should complete when the Task +// if in an interrupted or terminal state. A stream that ends before these +// conditions are met are +message StreamResponse { + oneof payload { + Task task = 1; + Message msg = 2 [json_name = "message"]; + TaskStatusUpdateEvent status_update = 3; + TaskArtifactUpdateEvent artifact_update = 4; + } +} + +message ListTaskPushNotificationConfigResponse { + repeated TaskPushNotificationConfig configs = 1; + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} diff --git a/compat-0.3/spec-grpc/src/main/resources/META-INF/beans.xml b/compat-0.3/spec-grpc/src/main/resources/META-INF/beans.xml new file mode 100644 index 000000000..e69de29bb diff --git a/compat-0.3/spec-grpc/src/test/java/org/a2aproject/sdk/compat03/grpc/utils/ToProto_v0_3_Test.java b/compat-0.3/spec-grpc/src/test/java/org/a2aproject/sdk/compat03/grpc/utils/ToProto_v0_3_Test.java new file mode 100644 index 000000000..f4b7d9204 --- /dev/null +++ b/compat-0.3/spec-grpc/src/test/java/org/a2aproject/sdk/compat03/grpc/utils/ToProto_v0_3_Test.java @@ -0,0 +1,292 @@ +package org.a2aproject.sdk.compat03.grpc.utils; + +import static org.a2aproject.sdk.compat03.grpc.Role.ROLE_AGENT; +import static org.a2aproject.sdk.compat03.grpc.Role.ROLE_USER; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration; +import org.a2aproject.sdk.compat03.spec.AgentCapabilities_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentCard_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentSkill_v0_3; +import org.a2aproject.sdk.compat03.spec.Artifact_v0_3; +import org.a2aproject.sdk.compat03.spec.HTTPAuthSecurityScheme_v0_3; +import org.a2aproject.sdk.compat03.spec.Message_v0_3; +import org.a2aproject.sdk.compat03.spec.MessageSendConfiguration_v0_3; +import org.a2aproject.sdk.compat03.spec.PushNotificationAuthenticationInfo_v0_3; +import org.a2aproject.sdk.compat03.spec.PushNotificationConfig_v0_3; +import org.a2aproject.sdk.compat03.spec.Task_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskArtifactUpdateEvent_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskState_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskStatus_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskStatusUpdateEvent_v0_3; +import org.a2aproject.sdk.compat03.spec.TextPart_v0_3; +import org.junit.jupiter.api.Test; + +public class ToProto_v0_3_Test { + + private static final Message_v0_3 SIMPLE_MESSAGE = new Message_v0_3.Builder() + .role(Message_v0_3.Role.USER) + .parts(Collections.singletonList(new TextPart_v0_3("tell me a joke"))) + .contextId("context-1234") + .messageId("message-1234") + .build(); + + @Test + public void convertAgentCard() { + AgentCard_v0_3 agentCard = new AgentCard_v0_3.Builder() + .name("Hello World Agent") + .description("Just a hello world agent") + .url("http://localhost:9999") + .version("1.0.0") + .documentationUrl("http://example.com/docs") + .capabilities(new AgentCapabilities_v0_3.Builder() + .streaming(true) + .pushNotifications(true) + .stateTransitionHistory(true) + .build()) + .defaultInputModes(Collections.singletonList("text")) + .defaultOutputModes(Collections.singletonList("text")) + .skills(Collections.singletonList(new AgentSkill_v0_3.Builder() + .id("hello_world") + .name("Returns hello world") + .description("just returns hello world") + .tags(Collections.singletonList("hello world")) + .examples(List.of("hi", "hello world")) + .build())) + .protocolVersion("0.2.5") + .build(); + org.a2aproject.sdk.compat03.grpc.AgentCard result = ProtoUtils_v0_3.ToProto.agentCard(agentCard); + assertEquals("Hello World Agent", result.getName()); + assertEquals("Just a hello world agent", result.getDescription()); + assertEquals("http://localhost:9999", result.getUrl()); + assertEquals("1.0.0", result.getVersion()); + assertEquals("http://example.com/docs", result.getDocumentationUrl()); + assertEquals(1, result.getDefaultInputModesCount()); + assertEquals("text", result.getDefaultInputModes(0)); + assertEquals(1, result.getDefaultOutputModesCount()); + assertEquals("text", result.getDefaultOutputModes(0)); + assertEquals("0.2.5", result.getProtocolVersion()); + agentCard = new AgentCard_v0_3.Builder() + .name("Hello World Agent") + .description("Just a hello world agent") + .url("http://localhost:9999") + .version("1.0.0") + .documentationUrl("http://example.com/docs") + .capabilities(new AgentCapabilities_v0_3.Builder() + .streaming(true) + .pushNotifications(true) + .stateTransitionHistory(true) + .build()) + .defaultInputModes(Collections.singletonList("text")) + .defaultOutputModes(Collections.singletonList("text")) + .skills(Collections.singletonList(new AgentSkill_v0_3.Builder() + .id("hello_world") + .name("Returns hello world") + .description("just returns hello world") + .tags(Collections.singletonList("hello world")) + .examples(List.of("hi", "hello world")) + .build())) + .preferredTransport("HTTP+JSON") +// .iconUrl("http://example.com/icon.svg") + .securitySchemes(Map.of("basic", new HTTPAuthSecurityScheme_v0_3.Builder().scheme("basic").description("Basic Auth").build())) + .security(List.of(Map.of("oauth", List.of("read")))) + .protocolVersion("0.2.5") + .build(); + result = ProtoUtils_v0_3.ToProto.agentCard(agentCard); + assertEquals("Hello World Agent", result.getName()); + assertEquals("Just a hello world agent", result.getDescription()); + assertEquals("http://localhost:9999", result.getUrl()); + assertEquals("1.0.0", result.getVersion()); + assertEquals("http://example.com/docs", result.getDocumentationUrl()); + assertEquals(1, result.getDefaultInputModesCount()); + assertEquals("text", result.getDefaultInputModes(0)); + assertEquals(1, result.getDefaultOutputModesCount()); + assertEquals("text", result.getDefaultOutputModes(0)); + assertEquals("0.2.5", result.getProtocolVersion()); + assertEquals("HTTP+JSON", result.getPreferredTransport()); + assertEquals(1, result.getSecurityCount()); + assertEquals(1, result.getSecurity(0).getSchemesMap().size()); + assertEquals(true, result.getSecurity(0).getSchemesMap().containsKey("oauth")); + assertEquals(1, result.getSecurity(0).getSchemesMap().get("oauth").getListCount()); + assertEquals("read", result.getSecurity(0).getSchemesMap().get("oauth").getList(0)); + assertEquals(1, result.getSecuritySchemesMap().size()); + assertEquals(true, result.getSecuritySchemesMap().containsKey("basic")); + assertEquals(result.getSecuritySchemesMap().get("basic").getApiKeySecurityScheme().getDefaultInstanceForType(), result.getSecuritySchemesMap().get("basic").getApiKeySecurityScheme()); + assertEquals(result.getSecuritySchemesMap().get("basic").getOauth2SecurityScheme().getDefaultInstanceForType(), result.getSecuritySchemesMap().get("basic").getOauth2SecurityScheme()); + assertEquals("basic", result.getSecuritySchemesMap().get("basic").getHttpAuthSecurityScheme().getScheme()); + assertEquals("Basic Auth", result.getSecuritySchemesMap().get("basic").getHttpAuthSecurityScheme().getDescription()); + } + + @Test + public void convertTask() { + Task_v0_3 task = new Task_v0_3.Builder().id("cancel-task-123") + .contextId("session-xyz") + .status(new TaskStatus_v0_3(TaskState_v0_3.SUBMITTED)) + .build(); + org.a2aproject.sdk.compat03.grpc.Task result = ProtoUtils_v0_3.ToProto.task(task); + assertEquals("session-xyz", result.getContextId()); + assertEquals("cancel-task-123", result.getId()); + assertEquals(org.a2aproject.sdk.compat03.grpc.TaskState.TASK_STATE_SUBMITTED, result.getStatus().getState()); + assertEquals(0, result.getArtifactsCount()); + assertEquals(0, result.getHistoryCount()); + task = new Task_v0_3.Builder().id("cancel-task-123") + .contextId("session-xyz") + .status(new TaskStatus_v0_3(TaskState_v0_3.SUBMITTED)) + .artifacts(List.of(new Artifact_v0_3.Builder() + .artifactId("11") + .name("artefact") + .parts(new TextPart_v0_3("text")) + .build())) + .history(List.of(SIMPLE_MESSAGE)) + .metadata(Collections.emptyMap()) + .build(); + result = ProtoUtils_v0_3.ToProto.task(task); + assertEquals("session-xyz", result.getContextId()); + assertEquals("cancel-task-123", result.getId()); + assertEquals(org.a2aproject.sdk.compat03.grpc.TaskState.TASK_STATE_SUBMITTED, result.getStatus().getState()); + assertEquals(1, result.getArtifactsCount()); + assertEquals("11", result.getArtifacts(0).getArtifactId()); + assertEquals("artefact", result.getArtifacts(0).getName()); + assertEquals(1, result.getArtifacts(0).getPartsCount()); + assertEquals(true, result.getArtifacts(0).getParts(0).hasText()); + assertEquals(false, result.getArtifacts(0).getParts(0).hasFile()); + assertEquals(false, result.getArtifacts(0).getParts(0).hasData()); + assertEquals("text", result.getArtifacts(0).getParts(0).getText()); + assertEquals(1, result.getHistoryCount()); + assertEquals("context-1234", result.getHistory(0).getContextId()); + assertEquals("message-1234", result.getHistory(0).getMessageId()); + assertEquals(ROLE_USER, result.getHistory(0).getRole()); + assertEquals(1, result.getHistory(0).getContentCount()); + assertEquals("tell me a joke", result.getHistory(0).getContent(0).getText()); + assertEquals(org.a2aproject.sdk.compat03.grpc.FilePart.getDefaultInstance(), result.getHistory(0).getContent(0).getFile()); + assertEquals(org.a2aproject.sdk.compat03.grpc.DataPart.getDefaultInstance(), result.getHistory(0).getContent(0).getData()); + } + + @Test + public void convertMessage() { + org.a2aproject.sdk.compat03.grpc.Message result = ProtoUtils_v0_3.ToProto.message(SIMPLE_MESSAGE); + assertEquals("context-1234", result.getContextId()); + assertEquals("message-1234", result.getMessageId()); + assertEquals(ROLE_USER, result.getRole()); + assertEquals(1, result.getContentCount()); + assertEquals("tell me a joke", result.getContent(0).getText()); + assertEquals(org.a2aproject.sdk.compat03.grpc.FilePart.getDefaultInstance(), result.getContent(0).getFile()); + assertEquals(org.a2aproject.sdk.compat03.grpc.DataPart.getDefaultInstance(), result.getContent(0).getData()); + Message_v0_3 message = new Message_v0_3.Builder() + .role(Message_v0_3.Role.AGENT) + .parts(Collections.singletonList(new TextPart_v0_3("tell me a joke"))) + .messageId("message-1234") + .build(); + result = ProtoUtils_v0_3.ToProto.message(message); + assertEquals("", result.getContextId()); + assertEquals("message-1234", result.getMessageId()); + assertEquals(ROLE_AGENT, result.getRole()); + assertEquals(1, result.getContentCount()); + assertEquals("tell me a joke", result.getContent(0).getText()); + assertEquals(org.a2aproject.sdk.compat03.grpc.FilePart.getDefaultInstance(), result.getContent(0).getFile()); + assertEquals(org.a2aproject.sdk.compat03.grpc.DataPart.getDefaultInstance(), result.getContent(0).getData()); + } + + @Test + public void convertTaskPushNotificationConfig() { + TaskPushNotificationConfig_v0_3 taskPushConfig = new TaskPushNotificationConfig_v0_3("push-task-123", + new PushNotificationConfig_v0_3.Builder() + .url("http://example.com") + .id("xyz") + .build()); + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig result = ProtoUtils_v0_3.ToProto.taskPushNotificationConfig(taskPushConfig); + assertEquals("tasks/push-task-123/pushNotificationConfigs/xyz", result.getName()); + assertNotNull(result.getPushNotificationConfig()); + assertEquals("http://example.com", result.getPushNotificationConfig().getUrl()); + assertEquals("xyz", result.getPushNotificationConfig().getId()); + assertEquals(false, result.getPushNotificationConfig().hasAuthentication()); + taskPushConfig + = new TaskPushNotificationConfig_v0_3("push-task-123", + new PushNotificationConfig_v0_3.Builder() + .token("AAAAAA") + .authenticationInfo(new PushNotificationAuthenticationInfo_v0_3(Collections.singletonList("jwt"), "credentials")) + .url("http://example.com") + .id("xyz") + .build()); + result = ProtoUtils_v0_3.ToProto.taskPushNotificationConfig(taskPushConfig); + assertEquals("tasks/push-task-123/pushNotificationConfigs/xyz", result.getName()); + assertNotNull(result.getPushNotificationConfig()); + assertEquals("http://example.com", result.getPushNotificationConfig().getUrl()); + assertEquals("xyz", result.getPushNotificationConfig().getId()); + assertEquals("AAAAAA", result.getPushNotificationConfig().getToken()); + assertEquals(true, result.getPushNotificationConfig().hasAuthentication()); + assertEquals("credentials", result.getPushNotificationConfig().getAuthentication().getCredentials()); + assertEquals(1, result.getPushNotificationConfig().getAuthentication().getSchemesCount()); + assertEquals("jwt", result.getPushNotificationConfig().getAuthentication().getSchemes(0)); + } + + @Test + public void convertTaskArtifactUpdateEvent() { + TaskArtifactUpdateEvent_v0_3 task = new TaskArtifactUpdateEvent_v0_3.Builder() + .taskId("task-123") + .contextId("session-123") + .artifact(new Artifact_v0_3.Builder() + .artifactId("11") + .parts(new TextPart_v0_3("text")) + .build()).build(); + org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent result = ProtoUtils_v0_3.ToProto.taskArtifactUpdateEvent(task); + assertEquals("task-123", result.getTaskId()); + assertEquals("session-123", result.getContextId()); + assertNotNull(result.getArtifact()); + assertEquals("11", result.getArtifact().getArtifactId()); + assertEquals(1, result.getArtifact().getPartsCount()); + assertEquals("text", result.getArtifact().getParts(0).getText()); + } + + @Test + public void convertTaskStatusUpdateEvent() { + TaskStatusUpdateEvent_v0_3 tsue = new TaskStatusUpdateEvent_v0_3.Builder() + .taskId("1234") + .contextId("xyz") + .status(new TaskStatus_v0_3(TaskState_v0_3.COMPLETED)) + .isFinal(true) + .build(); + org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent result = ProtoUtils_v0_3.ToProto.taskStatusUpdateEvent(tsue); + assertEquals("1234", result.getTaskId()); + assertEquals("xyz", result.getContextId()); + assertEquals(true, result.getFinal()); + assertEquals(org.a2aproject.sdk.compat03.grpc.TaskState.TASK_STATE_COMPLETED, result.getStatus().getState()); + } + + @Test + public void convertSendMessageConfiguration() { + MessageSendConfiguration_v0_3 configuration = new MessageSendConfiguration_v0_3.Builder() + .acceptedOutputModes(List.of("text")) + .blocking(false) + .build(); + SendMessageConfiguration result = ProtoUtils_v0_3.ToProto.messageSendConfiguration(configuration); + assertEquals(false, result.getBlocking()); + assertEquals(1, result.getAcceptedOutputModesCount()); + assertEquals("text", result.getAcceptedOutputModesBytes(0).toStringUtf8()); + } + + @Test + public void convertTaskTimestampStatus() { + OffsetDateTime expectedTimestamp = OffsetDateTime.parse("2024-10-05T12:34:56Z"); + TaskStatus_v0_3 testStatus = new TaskStatus_v0_3(TaskState_v0_3.COMPLETED, null, expectedTimestamp); + Task_v0_3 task = new Task_v0_3.Builder() + .id("task-123") + .contextId("context-456") + .status(testStatus) + .build(); + + org.a2aproject.sdk.compat03.grpc.Task grpcTask = ProtoUtils_v0_3.ToProto.task(task); + task = ProtoUtils_v0_3.FromProto.task(grpcTask); + TaskStatus_v0_3 status = task.getStatus(); + assertEquals(TaskState_v0_3.COMPLETED, status.state()); + assertNotNull(status.timestamp()); + assertEquals(expectedTimestamp, status.timestamp()); + } +} diff --git a/compat-0.3/spec/pom.xml b/compat-0.3/spec/pom.xml new file mode 100644 index 000000000..045ebaa50 --- /dev/null +++ b/compat-0.3/spec/pom.xml @@ -0,0 +1,42 @@ + + + 4.0.0 + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-parent + 1.0.0.Beta2-SNAPSHOT + .. + + a2a-java-sdk-compat-0.3-spec + + jar + + Java SDK A2A Compat 0.3 Spec + Java SDK for the Agent2Agent Protocol (A2A) - Spec + + + + ${project.groupId} + a2a-java-sdk-common + + + com.google.code.gson + gson + + + + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-params + test + + + + \ No newline at end of file diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/common/A2AHeaders_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/common/A2AHeaders_v0_3.java new file mode 100644 index 000000000..9c73d55b7 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/common/A2AHeaders_v0_3.java @@ -0,0 +1,18 @@ +package org.a2aproject.sdk.compat03.common; + +/** + * A2A Protocol v0.3 specific headers. + * These headers differ from the current protocol version. + */ +public final class A2AHeaders_v0_3 { + + /** + * HTTP header name for A2A extensions in protocol v0.3. + * Note: In current versions this is "A2A-Extensions" without the "X-" prefix. + */ + public static final String X_A2A_EXTENSIONS = "X-A2A-Extensions"; + + private A2AHeaders_v0_3() { + // Utility class + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/json/JsonMappingException_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/json/JsonMappingException_v0_3.java new file mode 100644 index 000000000..c03399149 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/json/JsonMappingException_v0_3.java @@ -0,0 +1,102 @@ +package org.a2aproject.sdk.compat03.json; + +import org.jspecify.annotations.Nullable; + +/** + * Exception for JSON mapping errors when converting between JSON and Java objects. + *

+ * This exception serves as a replacement for Jackson's JsonMappingException, allowing + * the A2A Java SDK to remain independent of any specific JSON library implementation. + * It represents errors that occur during the mapping phase of deserialization or + * serialization, such as type mismatches, invalid values, or constraint violations. + *

+ * This exception extends {@link JsonProcessingException_v0_3} and is used for more specific + * mapping-related errors compared to general parsing errors. + *

+ * Usage example: + *

{@code
+ * try {
+ *     Task task = JsonUtil.fromJson(json, Task.class);
+ *     if (task.getId() == null) {
+ *         throw new JsonMappingException(null, "Task ID cannot be null");
+ *     }
+ * } catch (JsonProcessingException e) {
+ *     throw new JsonMappingException(null, "Invalid task format: " + e.getMessage(), e);
+ * }
+ * }
+ * + * @see JsonProcessingException_v0_3 for the base exception class + */ +public class JsonMappingException_v0_3 extends JsonProcessingException_v0_3 { + + /** + * Optional reference object that caused the mapping error (e.g., JsonParser or field path). + */ + private final @Nullable Object reference; + + /** + * Constructs a new JsonMappingException with the specified reference and message. + *

+ * The reference parameter can be used to provide context about where the mapping + * error occurred (e.g., a field name, path, or parser reference). It can be null + * if no specific reference is available. + * + * @param reference optional reference object providing context for the error (may be null) + * @param message the detail message explaining the mapping error + */ + public JsonMappingException_v0_3(@Nullable Object reference, String message) { + super(message); + this.reference = reference; + } + + /** + * Constructs a new JsonMappingException with the specified reference, message, and cause. + *

+ * The reference parameter can be used to provide context about where the mapping + * error occurred (e.g., a field name, path, or parser reference). It can be null + * if no specific reference is available. + * + * @param reference optional reference object providing context for the error (may be null) + * @param message the detail message explaining the mapping error + * @param cause the underlying cause of the mapping error (may be null) + */ + public JsonMappingException_v0_3(@Nullable Object reference, String message, @Nullable Throwable cause) { + super(message, cause); + this.reference = reference; + } + + /** + * Constructs a new JsonMappingException with the specified message and cause. + *

+ * This constructor is provided for compatibility when no reference object is needed. + * + * @param message the detail message explaining the mapping error + * @param cause the underlying cause of the mapping error (may be null) + */ + public JsonMappingException_v0_3(String message, @Nullable Throwable cause) { + this(null, message, cause); + } + + /** + * Constructs a new JsonMappingException with the specified message. + *

+ * This constructor is provided for compatibility when no reference object is needed. + * + * @param message the detail message explaining the mapping error + */ + public JsonMappingException_v0_3(String message) { + this(null, message); + } + + /** + * Returns the reference object that provides context for the mapping error. + *

+ * This may be null if no specific reference was available when the exception + * was created. + * + * @return the reference object, or null if not available + */ + public @Nullable Object getReference() { + return reference; + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/json/JsonProcessingException_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/json/JsonProcessingException_v0_3.java new file mode 100644 index 000000000..3d33f103c --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/json/JsonProcessingException_v0_3.java @@ -0,0 +1,55 @@ +package org.a2aproject.sdk.compat03.json; + +import org.jspecify.annotations.Nullable; + +/** + * General exception for JSON processing errors during serialization or deserialization. + *

+ * This exception serves as a replacement for Jackson's JsonProcessingException, allowing + * the A2A Java SDK to remain independent of any specific JSON library implementation. + * It can be used with any JSON processing library (Gson, Jackson, etc.). + *

+ * This is the base class for more specific JSON processing exceptions like + * {@link JsonMappingException_v0_3}. + *

+ * Usage example: + *

{@code
+ * try {
+ *     String json = gson.toJson(object);
+ * } catch (Exception e) {
+ *     throw new JsonProcessingException("Failed to serialize object", e);
+ * }
+ * }
+ * + * @see JsonMappingException_v0_3 for mapping-specific errors + */ +public class JsonProcessingException_v0_3 extends Exception { + + /** + * Constructs a new JsonProcessingException with the specified message. + * + * @param message the detail message explaining the cause of the exception + */ + public JsonProcessingException_v0_3(String message) { + super(message); + } + + /** + * Constructs a new JsonProcessingException with the specified message and cause. + * + * @param message the detail message explaining the cause of the exception + * @param cause the underlying cause of the exception (may be null) + */ + public JsonProcessingException_v0_3(String message, @Nullable Throwable cause) { + super(message, cause); + } + + /** + * Constructs a new JsonProcessingException with the specified cause. + * + * @param cause the underlying cause of the exception + */ + public JsonProcessingException_v0_3(Throwable cause) { + super(cause); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/json/JsonUtil_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/json/JsonUtil_v0_3.java new file mode 100644 index 000000000..b28ee7f64 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/json/JsonUtil_v0_3.java @@ -0,0 +1,1048 @@ +package org.a2aproject.sdk.compat03.json; + +import static org.a2aproject.sdk.compat03.spec.A2AErrorCodes_v0_3.CONTENT_TYPE_NOT_SUPPORTED_ERROR_CODE; +import static org.a2aproject.sdk.compat03.spec.A2AErrorCodes_v0_3.INTERNAL_ERROR_CODE; +import static org.a2aproject.sdk.compat03.spec.A2AErrorCodes_v0_3.INVALID_AGENT_RESPONSE_ERROR_CODE; +import static org.a2aproject.sdk.compat03.spec.A2AErrorCodes_v0_3.INVALID_PARAMS_ERROR_CODE; +import static org.a2aproject.sdk.compat03.spec.A2AErrorCodes_v0_3.INVALID_REQUEST_ERROR_CODE; +import static org.a2aproject.sdk.compat03.spec.A2AErrorCodes_v0_3.JSON_PARSE_ERROR_CODE; +import static org.a2aproject.sdk.compat03.spec.A2AErrorCodes_v0_3.METHOD_NOT_FOUND_ERROR_CODE; +import static org.a2aproject.sdk.compat03.spec.A2AErrorCodes_v0_3.PUSH_NOTIFICATION_NOT_SUPPORTED_ERROR_CODE; +import static org.a2aproject.sdk.compat03.spec.A2AErrorCodes_v0_3.TASK_NOT_CANCELABLE_ERROR_CODE; +import static org.a2aproject.sdk.compat03.spec.A2AErrorCodes_v0_3.TASK_NOT_FOUND_ERROR_CODE; +import static org.a2aproject.sdk.compat03.spec.A2AErrorCodes_v0_3.UNSUPPORTED_OPERATION_ERROR_CODE; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonSyntaxException; +import com.google.gson.ToNumberPolicy; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import org.a2aproject.sdk.compat03.spec.APIKeySecurityScheme_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentCapabilities_v0_3; +import org.a2aproject.sdk.compat03.spec.EventKind_v0_3; +import org.a2aproject.sdk.compat03.spec.JSONRPCResponse_v0_3; +import org.a2aproject.sdk.compat03.spec.ContentTypeNotSupportedError_v0_3; +import org.a2aproject.sdk.compat03.spec.DataPart_v0_3; +import org.a2aproject.sdk.compat03.spec.FileContent_v0_3; +import org.a2aproject.sdk.compat03.spec.FilePart_v0_3; +import org.a2aproject.sdk.compat03.spec.FileWithBytes_v0_3; +import org.a2aproject.sdk.compat03.spec.FileWithUri_v0_3; +import org.a2aproject.sdk.compat03.spec.HTTPAuthSecurityScheme_v0_3; +import org.a2aproject.sdk.compat03.spec.InternalError_v0_3; +import org.a2aproject.sdk.compat03.spec.InvalidAgentResponseError_v0_3; +import org.a2aproject.sdk.compat03.spec.InvalidParamsError_v0_3; +import org.a2aproject.sdk.compat03.spec.InvalidRequestError_v0_3; +import org.a2aproject.sdk.compat03.spec.JSONParseError_v0_3; +import org.a2aproject.sdk.compat03.spec.JSONRPCError_v0_3; +import org.a2aproject.sdk.compat03.spec.Message_v0_3; +import org.a2aproject.sdk.compat03.spec.MethodNotFoundError_v0_3; +import org.a2aproject.sdk.compat03.spec.MutualTLSSecurityScheme_v0_3; +import org.a2aproject.sdk.compat03.spec.OAuth2SecurityScheme_v0_3; +import org.a2aproject.sdk.compat03.spec.OpenIdConnectSecurityScheme_v0_3; +import org.a2aproject.sdk.compat03.spec.Part_v0_3; +import org.a2aproject.sdk.compat03.spec.PushNotificationNotSupportedError_v0_3; +import org.a2aproject.sdk.compat03.spec.SecurityScheme_v0_3; +import org.a2aproject.sdk.compat03.spec.StreamingEventKind_v0_3; +import org.a2aproject.sdk.compat03.spec.Task_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskArtifactUpdateEvent_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskNotCancelableError_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskNotFoundError_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskState_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskStatusUpdateEvent_v0_3; +import org.a2aproject.sdk.compat03.spec.TextPart_v0_3; +import org.a2aproject.sdk.compat03.spec.UnsupportedOperationError_v0_3; +import java.io.StringReader; +import java.lang.reflect.Type; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeParseException; +import java.util.List; +import org.jspecify.annotations.Nullable; + +import static org.a2aproject.sdk.compat03.json.JsonUtil_v0_3.JSONRPCErrorTypeAdapter.THROWABLE_MARKER_FIELD; + +public class JsonUtil_v0_3 { + + private static GsonBuilder createBaseGsonBuilder() { + return new GsonBuilder() + .setObjectToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) + .registerTypeAdapter(OffsetDateTime.class, new OffsetDateTimeTypeAdapter()) + // Register JSONRPCError hierarchy adapter for all error subclasses + .registerTypeHierarchyAdapter(JSONRPCError_v0_3.class, new JSONRPCErrorTypeAdapter()) + // Register Throwable adapter for EXACT Throwable.class only (not subclasses) + // This prevents it from being used for JSONRPCError which extends Throwable + .registerTypeAdapter(Throwable.class, new ThrowableTypeAdapter()) + .registerTypeAdapter(TaskState_v0_3.class, new TaskStateTypeAdapter()) + .registerTypeAdapter(Message_v0_3.Role.class, new RoleTypeAdapter()) + .registerTypeAdapter(Part_v0_3.Kind.class, new PartKindTypeAdapter()) + .registerTypeHierarchyAdapter(FileContent_v0_3.class, new FileContentTypeAdapter()) + .registerTypeHierarchyAdapter(SecurityScheme_v0_3.class, new SecuritySchemeTypeAdapter()) + .registerTypeAdapter(void.class, new VoidTypeAdapter()) + .registerTypeAdapter(Void.class, new VoidTypeAdapter()) + .registerTypeAdapterFactory(new JSONRPCResponseTypeAdapterFactory()) + .registerTypeAdapter(AgentCapabilities_v0_3.class, new AgentCapabilitiesTypeAdapter()); + } + + /** + * Pre-configured {@link Gson} instance for JSON operations. + *

+ * This mapper is configured with strict parsing mode and all necessary custom TypeAdapters + * for A2A Protocol types including polymorphic types, enums, and date/time types. + *

+ * Used throughout the SDK for consistent JSON serialization and deserialization. + */ + public static final Gson OBJECT_MAPPER = createBaseGsonBuilder() + .registerTypeHierarchyAdapter(Part_v0_3.class, new PartTypeAdapter()) + .registerTypeHierarchyAdapter(StreamingEventKind_v0_3.class, new StreamingEventKindTypeAdapter()) + .registerTypeAdapter(EventKind_v0_3.class, new EventKindTypeAdapter()) + .create(); + + public static T fromJson(String json, Class classOfT) throws JsonProcessingException_v0_3 { + try { + return OBJECT_MAPPER.fromJson(json, classOfT); + } catch (JsonSyntaxException e) { + throw new JsonProcessingException_v0_3("Failed to parse JSON", e); + } + } + + public static T fromJson(String json, Type type) throws JsonProcessingException_v0_3 { + try { + return OBJECT_MAPPER.fromJson(json, type); + } catch (JsonSyntaxException e) { + throw new JsonProcessingException_v0_3("Failed to parse JSON", e); + } + } + + /** + * Serializes an object to a JSON string using Gson. + *

+ * This method uses the pre-configured {@link #OBJECT_MAPPER} to produce + * JSON representation of the provided object. + * + * @param data the object to serialize + * @return JSON string representation of the object + */ + public static String toJson(Object data) throws JsonProcessingException_v0_3 { + try { + return OBJECT_MAPPER.toJson(data); + } catch (JsonSyntaxException e) { + throw new JsonProcessingException_v0_3("Failed to generate JSON", e); + } + } + + /** + * Gson TypeAdapter for serializing and deserializing {@link OffsetDateTime} to/from ISO-8601 format. + *

+ * This adapter ensures that OffsetDateTime instances are serialized to ISO-8601 formatted strings + * (e.g., "2023-10-01T12:00:00.234-05:00") and deserialized from the same format. + * This is necessary because Gson cannot access private fields of java.time classes via reflection + * in Java 17+ due to module system restrictions. + *

+ * The adapter uses {@link DateTimeFormatter#ISO_OFFSET_DATE_TIME} for both serialization and + * deserialization, which ensures proper handling of timezone offsets. + * + * @see OffsetDateTime + * @see DateTimeFormatter#ISO_OFFSET_DATE_TIME + */ + static class OffsetDateTimeTypeAdapter extends TypeAdapter { + + @Override + public void write(JsonWriter out, OffsetDateTime value) throws java.io.IOException { + if (value == null) { + out.nullValue(); + } else { + out.value(value.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME)); + } + } + + @Override + public @Nullable + OffsetDateTime read(JsonReader in) throws java.io.IOException { + if (in.peek() == com.google.gson.stream.JsonToken.NULL) { + in.nextNull(); + return null; + } + String dateTimeString = in.nextString(); + try { + return OffsetDateTime.parse(dateTimeString, DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } catch (DateTimeParseException e) { + throw new JsonSyntaxException("Failed to parse OffsetDateTime: " + dateTimeString, e); + } + } + } + + /** + * Gson TypeAdapter for serializing and deserializing {@link Throwable} and its subclasses. + *

+ * This adapter avoids reflection into {@link Throwable}'s private fields, which is not allowed + * in Java 17+ due to module system restrictions. Instead, it serializes Throwables as simple + * objects containing only the type (fully qualified class name) and message. + *

+ * Serialization: Converts a Throwable to a JSON object with: + *

    + *
  • "type": The fully qualified class name (e.g., "java.lang.IllegalArgumentException")
  • + *
  • "message": The exception message
  • + *
+ *

+ * Deserialization: Reads the JSON and reconstructs the Throwable using reflection to find + * a constructor that accepts a String message parameter. If no such constructor exists or if + * instantiation fails, returns a generic {@link RuntimeException} with the message. + * + * @see Throwable + */ + static class ThrowableTypeAdapter extends TypeAdapter { + + @Override + public void write(JsonWriter out, Throwable value) throws java.io.IOException { + if (value == null) { + out.nullValue(); + return; + } + out.beginObject(); + out.name("type").value(value.getClass().getName()); + out.name("message").value(value.getMessage()); + out.name(THROWABLE_MARKER_FIELD).value(true); + out.endObject(); + } + + @Override + public @Nullable + Throwable read(JsonReader in) throws java.io.IOException { + if (in.peek() == com.google.gson.stream.JsonToken.NULL) { + in.nextNull(); + return null; + } + + String type = null; + String message = null; + + in.beginObject(); + while (in.hasNext()) { + String fieldName = in.nextName(); + switch (fieldName) { + case "type" -> + type = in.nextString(); + case "message" -> + message = in.nextString(); + default -> + in.skipValue(); + } + } + in.endObject(); + + // Try to reconstruct the Throwable + if (type != null) { + try { + Class throwableClass = Class.forName(type); + if (Throwable.class.isAssignableFrom(throwableClass)) { + // Try to find a constructor that takes a String message + try { + var constructor = throwableClass.getConstructor(String.class); + return (Throwable) constructor.newInstance(message); + } catch (NoSuchMethodException e) { + // No String constructor, return a generic RuntimeException + return new RuntimeException(message); + } + } + } catch (Exception e) { + // If we can't reconstruct the exact type, return a generic RuntimeException + return new RuntimeException(message); + } + } + return new RuntimeException(message); + } + } + + /** + * Gson TypeAdapter for serializing and deserializing {@link JSONRPCError_v0_3} and its subclasses. + *

+ * This adapter handles polymorphic deserialization based on the error code, creating the + * appropriate subclass instance. + *

+ * The adapter maps error codes to their corresponding error classes: + *

    + *
  • -32700: {@link JSONParseError_v0_3}
  • + *
  • -32600: {@link InvalidRequestError_v0_3}
  • + *
  • -32601: {@link MethodNotFoundError_v0_3}
  • + *
  • -32602: {@link InvalidParamsError_v0_3}
  • + *
  • -32603: {@link InternalError}
  • + *
  • -32001: {@link TaskNotFoundError_v0_3}
  • + *
  • -32002: {@link TaskNotCancelableError_v0_3}
  • + *
  • -32003: {@link PushNotificationNotSupportedError_v0_3}
  • + *
  • -32004: {@link UnsupportedOperationError_v0_3}
  • + *
  • -32005: {@link ContentTypeNotSupportedError_v0_3}
  • + *
  • -32006: {@link InvalidAgentResponseError_v0_3}
  • + *
  • Other codes: {@link JSONRPCError_v0_3}
  • + *
+ * + * @see JSONRPCError_v0_3 + */ + static class JSONRPCErrorTypeAdapter extends TypeAdapter { + + private static final ThrowableTypeAdapter THROWABLE_ADAPTER = new ThrowableTypeAdapter(); + static final String THROWABLE_MARKER_FIELD = "__throwable"; + private static final String CODE_FIELD = "code"; + private static final String DATA_FIELD = "data"; + private static final String MESSAGE_FIELD = "message"; + private static final String TYPE_FIELD = "type"; + + @Override + public void write(JsonWriter out, JSONRPCError_v0_3 value) throws java.io.IOException { + if (value == null) { + out.nullValue(); + return; + } + out.beginObject(); + out.name(CODE_FIELD).value(value.getCode()); + out.name(MESSAGE_FIELD).value(value.getMessage()); + if (value.getData() != null) { + out.name(DATA_FIELD); + // If data is a Throwable, use ThrowableTypeAdapter to avoid reflection issues + if (value.getData() instanceof Throwable throwable) { + THROWABLE_ADAPTER.write(out, throwable); + } else { + // Use Gson to serialize the data field for non-Throwable types + OBJECT_MAPPER.toJson(value.getData(), Object.class, out); + } + } + out.endObject(); + } + + @Override + public @Nullable + JSONRPCError_v0_3 read(JsonReader in) throws java.io.IOException { + if (in.peek() == com.google.gson.stream.JsonToken.NULL) { + in.nextNull(); + return null; + } + + Integer code = null; + String message = null; + Object data = null; + + in.beginObject(); + while (in.hasNext()) { + String fieldName = in.nextName(); + switch (fieldName) { + case CODE_FIELD -> + code = in.nextInt(); + case MESSAGE_FIELD -> + message = in.nextString(); + case DATA_FIELD -> { + // Read data as a generic object (could be string, number, object, etc.) + data = readDataValue(in); + } + default -> + in.skipValue(); + } + } + in.endObject(); + + // Create the appropriate subclass based on the error code + return createErrorInstance(code, message, data); + } + + /** + * Reads the data field value, which can be of any JSON type. + */ + private @Nullable + Object readDataValue(JsonReader in) throws java.io.IOException { + return switch (in.peek()) { + case STRING -> + in.nextString(); + case NUMBER -> + in.nextDouble(); + case BOOLEAN -> + in.nextBoolean(); + case NULL -> { + in.nextNull(); + yield null; + } + case BEGIN_OBJECT -> { + // Parse as JsonElement to check if it's a Throwable + com.google.gson.JsonElement element = com.google.gson.JsonParser.parseReader(in); + if (element.isJsonObject()) { + com.google.gson.JsonObject obj = element.getAsJsonObject(); + // Check if it has the structure of a serialized Throwable (type + message) + if (obj.has(TYPE_FIELD) && obj.has(MESSAGE_FIELD) && obj.has(THROWABLE_MARKER_FIELD)) { + // Deserialize as Throwable using ThrowableTypeAdapter + yield THROWABLE_ADAPTER.read(new JsonReader(new StringReader(element.toString()))); + } + } + // Otherwise, deserialize as generic object + yield OBJECT_MAPPER.fromJson(element, Object.class); + } + case BEGIN_ARRAY -> + // For arrays, read as raw JSON using Gson + OBJECT_MAPPER.fromJson(in, Object.class); + default -> { + in.skipValue(); + yield null; + } + }; + } + + /** + * Creates the appropriate JSONRPCError subclass based on the error code. + */ + private JSONRPCError_v0_3 createErrorInstance(@Nullable Integer code, @Nullable String message, @Nullable Object data) { + if (code == null) { + throw new JsonSyntaxException("JSONRPCError must have a code field"); + } + + return switch (code) { + case JSON_PARSE_ERROR_CODE -> + new JSONParseError_v0_3(code, message, data); + case INVALID_REQUEST_ERROR_CODE -> + new InvalidRequestError_v0_3(code, message, data); + case METHOD_NOT_FOUND_ERROR_CODE -> + new MethodNotFoundError_v0_3(code, message, data); + case INVALID_PARAMS_ERROR_CODE -> + new InvalidParamsError_v0_3(code, message, data); + case INTERNAL_ERROR_CODE -> + new InternalError_v0_3(code, message, data); + case TASK_NOT_FOUND_ERROR_CODE -> + new TaskNotFoundError_v0_3(code, message, data); + case TASK_NOT_CANCELABLE_ERROR_CODE -> + new TaskNotCancelableError_v0_3(code, message, data); + case PUSH_NOTIFICATION_NOT_SUPPORTED_ERROR_CODE -> + new PushNotificationNotSupportedError_v0_3(code, message, data); + case UNSUPPORTED_OPERATION_ERROR_CODE -> + new UnsupportedOperationError_v0_3(code, message, data); + case CONTENT_TYPE_NOT_SUPPORTED_ERROR_CODE -> + new ContentTypeNotSupportedError_v0_3(code, message, data); + case INVALID_AGENT_RESPONSE_ERROR_CODE -> + new InvalidAgentResponseError_v0_3(code, message, data); + default -> + new JSONRPCError_v0_3(code, message, data); + }; + } + } + + /** + * Gson TypeAdapter for serializing and deserializing {@link TaskState_v0_3} enum. + *

+ * This adapter ensures that TaskState enum values are serialized using their + * wire format string representation (e.g., "completed", "working") rather than + * the Java enum constant name (e.g., "COMPLETED", "WORKING"). + *

+ * For serialization, it uses {@link TaskState_v0_3#asString()} to get the wire format. + * For deserialization, it uses {@link TaskState_v0_3#fromString(String)} to parse the + * wire format back to the enum constant. + * + * @see TaskState_v0_3 + * @see TaskState_v0_3#asString() + * @see TaskState_v0_3#fromString(String) + */ + static class TaskStateTypeAdapter extends TypeAdapter { + + @Override + public void write(JsonWriter out, TaskState_v0_3 value) throws java.io.IOException { + if (value == null) { + out.nullValue(); + } else { + out.value(value.asString()); + } + } + + @Override + public @Nullable + TaskState_v0_3 read(JsonReader in) throws java.io.IOException { + if (in.peek() == com.google.gson.stream.JsonToken.NULL) { + in.nextNull(); + return null; + } + String stateString = in.nextString(); + try { + return TaskState_v0_3.fromString(stateString); + } catch (IllegalArgumentException e) { + throw new JsonSyntaxException("Invalid TaskState: " + stateString, e); + } + } + } + + /** + * Gson TypeAdapter for serializing and deserializing {@link Message_v0_3.Role} enum. + *

+ * This adapter ensures that Message.Role enum values are serialized using their + * wire format string representation (e.g., "user", "agent") rather than the Java + * enum constant name (e.g., "USER", "AGENT"). + *

+ * For serialization, it uses {@link Message_v0_3.Role#asString()} to get the wire format. + * For deserialization, it parses the string to the enum constant. + * + * @see Message_v0_3.Role + * @see Message_v0_3.Role#asString() + */ + static class RoleTypeAdapter extends TypeAdapter { + + @Override + public void write(JsonWriter out, Message_v0_3.Role value) throws java.io.IOException { + if (value == null) { + out.nullValue(); + } else { + out.value(value.asString()); + } + } + + @Override + public Message_v0_3.@Nullable Role read(JsonReader in) throws java.io.IOException { + if (in.peek() == com.google.gson.stream.JsonToken.NULL) { + in.nextNull(); + return null; + } + String roleString = in.nextString(); + try { + return switch (roleString) { + case "user" -> + Message_v0_3.Role.USER; + case "agent" -> + Message_v0_3.Role.AGENT; + default -> + throw new IllegalArgumentException("Invalid Role: " + roleString); + }; + } catch (IllegalArgumentException e) { + throw new JsonSyntaxException("Invalid Message.Role: " + roleString, e); + } + } + } + + /** + * Gson TypeAdapter for serializing and deserializing {@link Part_v0_3.Kind} enum. + *

+ * This adapter ensures that Part.Kind enum values are serialized using their + * wire format string representation (e.g., "text", "file", "data") rather than + * the Java enum constant name (e.g., "TEXT", "FILE", "DATA"). + *

+ * For serialization, it uses {@link Part_v0_3.Kind#asString()} to get the wire format. + * For deserialization, it parses the string to the enum constant. + * + * @see Part_v0_3.Kind + * @see Part_v0_3.Kind#asString() + */ + static class PartKindTypeAdapter extends TypeAdapter { + + @Override + public void write(JsonWriter out, Part_v0_3.Kind value) throws java.io.IOException { + if (value == null) { + out.nullValue(); + } else { + out.value(value.asString()); + } + } + + @Override + public Part_v0_3.@Nullable Kind read(JsonReader in) throws java.io.IOException { + if (in.peek() == com.google.gson.stream.JsonToken.NULL) { + in.nextNull(); + return null; + } + String kindString = in.nextString(); + try { + return switch (kindString) { + case "text" -> + Part_v0_3.Kind.TEXT; + case "file" -> + Part_v0_3.Kind.FILE; + case "data" -> + Part_v0_3.Kind.DATA; + default -> + throw new IllegalArgumentException("Invalid Part.Kind: " + kindString); + }; + } catch (IllegalArgumentException e) { + throw new JsonSyntaxException("Invalid Part.Kind: " + kindString, e); + } + } + } + + /** + * Gson TypeAdapter for serializing and deserializing {@link Part_v0_3} and its subclasses. + *

+ * This adapter handles polymorphic deserialization based on the "kind" field, creating the + * appropriate subclass instance (TextPart, FilePart, or DataPart). + *

+ * The adapter uses a two-pass approach: first reads the JSON as a tree to inspect the "kind" + * field, then deserializes to the appropriate concrete type. + * + * @see Part_v0_3 + * @see TextPart_v0_3 + * @see FilePart_v0_3 + * @see DataPart_v0_3 + */ + static class PartTypeAdapter extends TypeAdapter> { + + // Create separate Gson instance without the Part adapter to avoid recursion + private final Gson delegateGson = createBaseGsonBuilder().create(); + + @Override + public void write(JsonWriter out, Part_v0_3 value) throws java.io.IOException { + if (value == null) { + out.nullValue(); + return; + } + // Delegate to Gson's default serialization for the concrete type + if (value instanceof TextPart_v0_3 textPart) { + delegateGson.toJson(textPart, TextPart_v0_3.class, out); + } else if (value instanceof FilePart_v0_3 filePart) { + delegateGson.toJson(filePart, FilePart_v0_3.class, out); + } else if (value instanceof DataPart_v0_3 dataPart) { + delegateGson.toJson(dataPart, DataPart_v0_3.class, out); + } else { + throw new JsonSyntaxException("Unknown Part subclass: " + value.getClass().getName()); + } + } + + @Override + public @Nullable + Part_v0_3 read(JsonReader in) throws java.io.IOException { + if (in.peek() == com.google.gson.stream.JsonToken.NULL) { + in.nextNull(); + return null; + } + + // Read the JSON as a tree so we can inspect the "kind" field + com.google.gson.JsonElement jsonElement = com.google.gson.JsonParser.parseReader(in); + if (!jsonElement.isJsonObject()) { + throw new JsonSyntaxException("Part must be a JSON object"); + } + + com.google.gson.JsonObject jsonObject = jsonElement.getAsJsonObject(); + com.google.gson.JsonElement kindElement = jsonObject.get("kind"); + if (kindElement == null || !kindElement.isJsonPrimitive()) { + throw new JsonSyntaxException("Part must have a 'kind' field"); + } + + String kind = kindElement.getAsString(); + // Use the delegate Gson to deserialize to the concrete type + return switch (kind) { + case "text" -> + delegateGson.fromJson(jsonElement, TextPart_v0_3.class); + case "file" -> + delegateGson.fromJson(jsonElement, FilePart_v0_3.class); + case "data" -> + delegateGson.fromJson(jsonElement, DataPart_v0_3.class); + default -> + throw new JsonSyntaxException("Unknown Part kind: " + kind); + }; + } + } + + /** + * Gson TypeAdapter for serializing and deserializing {@link EventKind_v0_3} and its implementations. + *

+ * Discriminates based on the {@code "kind"} field: + *

    + *
  • {@code "task"} → {@link Task_v0_3}
  • + *
  • {@code "message"} → {@link Message_v0_3}
  • + *
+ */ + static class EventKindTypeAdapter extends TypeAdapter { + + private final Gson delegateGson = createBaseGsonBuilder() + .registerTypeHierarchyAdapter(Part_v0_3.class, new PartTypeAdapter()) + .create(); + + @Override + public void write(JsonWriter out, EventKind_v0_3 value) throws java.io.IOException { + if (value == null) { + out.nullValue(); + return; + } + if (value instanceof Task_v0_3 task) { + delegateGson.toJson(task, Task_v0_3.class, out); + } else if (value instanceof Message_v0_3 message) { + delegateGson.toJson(message, Message_v0_3.class, out); + } else { + throw new JsonSyntaxException("Unknown EventKind implementation: " + value.getClass().getName()); + } + } + + @Override + public @Nullable EventKind_v0_3 read(JsonReader in) throws java.io.IOException { + if (in.peek() == com.google.gson.stream.JsonToken.NULL) { + in.nextNull(); + return null; + } + + com.google.gson.JsonElement jsonElement = com.google.gson.JsonParser.parseReader(in); + if (!jsonElement.isJsonObject()) { + throw new JsonSyntaxException("EventKind must be a JSON object"); + } + + com.google.gson.JsonObject jsonObject = jsonElement.getAsJsonObject(); + com.google.gson.JsonElement kindElement = jsonObject.get("kind"); + if (kindElement == null || !kindElement.isJsonPrimitive()) { + throw new JsonSyntaxException("EventKind must have a 'kind' field"); + } + + String kind = kindElement.getAsString(); + return switch (kind) { + case Task_v0_3.TASK -> delegateGson.fromJson(jsonElement, Task_v0_3.class); + case Message_v0_3.MESSAGE -> delegateGson.fromJson(jsonElement, Message_v0_3.class); + default -> throw new JsonSyntaxException("Unknown EventKind kind: " + kind); + }; + } + } + + /** + * Gson TypeAdapter for serializing and deserializing {@link StreamingEventKind_v0_3} and its implementations. + *

+ * This adapter handles polymorphic deserialization based on the "kind" field, creating the + * appropriate implementation instance (Task, Message, TaskStatusUpdateEvent, or TaskArtifactUpdateEvent). + *

+ * The adapter uses a two-pass approach: first reads the JSON as a tree to inspect the "kind" + * field, then deserializes to the appropriate concrete type. + * + * @see StreamingEventKind_v0_3 + * @see Task_v0_3 + * @see Message_v0_3 + * @see TaskStatusUpdateEvent_v0_3 + * @see TaskArtifactUpdateEvent_v0_3 + */ + static class StreamingEventKindTypeAdapter extends TypeAdapter { + + // Create separate Gson instance without the StreamingEventKind adapter to avoid recursion + private final Gson delegateGson = createBaseGsonBuilder() + .registerTypeHierarchyAdapter(Part_v0_3.class, new PartTypeAdapter()) + .create(); + + @Override + public void write(JsonWriter out, StreamingEventKind_v0_3 value) throws java.io.IOException { + if (value == null) { + out.nullValue(); + return; + } + // Delegate to Gson's default serialization for the concrete type + if (value instanceof Task_v0_3 task) { + delegateGson.toJson(task, Task_v0_3.class, out); + } else if (value instanceof Message_v0_3 message) { + delegateGson.toJson(message, Message_v0_3.class, out); + } else if (value instanceof TaskStatusUpdateEvent_v0_3 event) { + delegateGson.toJson(event, TaskStatusUpdateEvent_v0_3.class, out); + } else if (value instanceof TaskArtifactUpdateEvent_v0_3 event) { + delegateGson.toJson(event, TaskArtifactUpdateEvent_v0_3.class, out); + } else { + throw new JsonSyntaxException("Unknown StreamingEventKind implementation: " + value.getClass().getName()); + } + } + + @Override + public @Nullable + StreamingEventKind_v0_3 read(JsonReader in) throws java.io.IOException { + if (in.peek() == com.google.gson.stream.JsonToken.NULL) { + in.nextNull(); + return null; + } + + // Read the JSON as a tree so we can inspect the "kind" field + com.google.gson.JsonElement jsonElement = com.google.gson.JsonParser.parseReader(in); + if (!jsonElement.isJsonObject()) { + throw new JsonSyntaxException("StreamingEventKind must be a JSON object"); + } + + com.google.gson.JsonObject jsonObject = jsonElement.getAsJsonObject(); + com.google.gson.JsonElement kindElement = jsonObject.get("kind"); + if (kindElement == null || !kindElement.isJsonPrimitive()) { + throw new JsonSyntaxException("StreamingEventKind must have a 'kind' field"); + } + + String kind = kindElement.getAsString(); + // Use the delegate Gson to deserialize to the concrete type + return switch (kind) { + case "task" -> + delegateGson.fromJson(jsonElement, Task_v0_3.class); + case "message" -> + delegateGson.fromJson(jsonElement, Message_v0_3.class); + case "status-update" -> + delegateGson.fromJson(jsonElement, TaskStatusUpdateEvent_v0_3.class); + case "artifact-update" -> + delegateGson.fromJson(jsonElement, TaskArtifactUpdateEvent_v0_3.class); + default -> + throw new JsonSyntaxException("Unknown StreamingEventKind kind: " + kind); + }; + } + } + + /** + * Gson TypeAdapter for serializing and deserializing {@link SecurityScheme_v0_3} and its implementations. + *

+ * Discriminates based on the {@code "type"} field: + *

    + *
  • {@code "apiKey"} → {@link APIKeySecurityScheme_v0_3}
  • + *
  • {@code "http"} → {@link HTTPAuthSecurityScheme_v0_3}
  • + *
  • {@code "oauth2"} → {@link OAuth2SecurityScheme_v0_3}
  • + *
  • {@code "openIdConnect"} → {@link OpenIdConnectSecurityScheme_v0_3}
  • + *
  • {@code "mutualTLS"} → {@link MutualTLSSecurityScheme_v0_3}
  • + *
+ */ + static class SecuritySchemeTypeAdapter extends TypeAdapter { + + // Use a plain Gson to avoid circular initialization — SecurityScheme concrete types + // contain only simple fields (Strings, OAuthFlows) that need no custom adapters. + private final Gson delegateGson = new Gson(); + + @Override + public void write(JsonWriter out, SecurityScheme_v0_3 value) throws java.io.IOException { + if (value == null) { + out.nullValue(); + return; + } + if (value instanceof APIKeySecurityScheme_v0_3 v) { + delegateGson.toJson(v, APIKeySecurityScheme_v0_3.class, out); + } else if (value instanceof HTTPAuthSecurityScheme_v0_3 v) { + delegateGson.toJson(v, HTTPAuthSecurityScheme_v0_3.class, out); + } else if (value instanceof OAuth2SecurityScheme_v0_3 v) { + delegateGson.toJson(v, OAuth2SecurityScheme_v0_3.class, out); + } else if (value instanceof OpenIdConnectSecurityScheme_v0_3 v) { + delegateGson.toJson(v, OpenIdConnectSecurityScheme_v0_3.class, out); + } else if (value instanceof MutualTLSSecurityScheme_v0_3 v) { + delegateGson.toJson(v, MutualTLSSecurityScheme_v0_3.class, out); + } else { + throw new JsonSyntaxException("Unknown SecurityScheme implementation: " + value.getClass().getName()); + } + } + + @Override + public @Nullable SecurityScheme_v0_3 read(JsonReader in) throws java.io.IOException { + if (in.peek() == com.google.gson.stream.JsonToken.NULL) { + in.nextNull(); + return null; + } + + com.google.gson.JsonElement jsonElement = com.google.gson.JsonParser.parseReader(in); + if (!jsonElement.isJsonObject()) { + throw new JsonSyntaxException("SecurityScheme must be a JSON object"); + } + + com.google.gson.JsonObject jsonObject = jsonElement.getAsJsonObject(); + com.google.gson.JsonElement typeElement = jsonObject.get("type"); + if (typeElement == null || !typeElement.isJsonPrimitive()) { + throw new JsonSyntaxException("SecurityScheme must have a 'type' field"); + } + + String type = typeElement.getAsString(); + return switch (type) { + case APIKeySecurityScheme_v0_3.API_KEY -> + delegateGson.fromJson(jsonElement, APIKeySecurityScheme_v0_3.class); + case HTTPAuthSecurityScheme_v0_3.HTTP -> + delegateGson.fromJson(jsonElement, HTTPAuthSecurityScheme_v0_3.class); + case OAuth2SecurityScheme_v0_3.OAUTH2 -> + delegateGson.fromJson(jsonElement, OAuth2SecurityScheme_v0_3.class); + case OpenIdConnectSecurityScheme_v0_3.OPENID_CONNECT -> + delegateGson.fromJson(jsonElement, OpenIdConnectSecurityScheme_v0_3.class); + case MutualTLSSecurityScheme_v0_3.MUTUAL_TLS -> + delegateGson.fromJson(jsonElement, MutualTLSSecurityScheme_v0_3.class); + default -> + throw new JsonSyntaxException("Unknown SecurityScheme type: " + type); + }; + } + } + + /** + * Gson TypeAdapter for serializing and deserializing {@link FileContent_v0_3} and its implementations. + *

+ * This adapter handles polymorphic deserialization for the sealed FileContent interface, + * which permits two implementations: + *

    + *
  • {@link FileWithBytes_v0_3} - File content embedded as base64-encoded bytes
  • + *
  • {@link FileWithUri_v0_3} - File content referenced by URI
  • + *
+ *

+ * The adapter distinguishes between the two types by checking for the presence of + * "bytes" or "uri" fields in the JSON object. + * + * @see FileContent_v0_3 + * @see FileWithBytes_v0_3 + * @see FileWithUri_v0_3 + */ + static class FileContentTypeAdapter extends TypeAdapter { + + // Create separate Gson instance without the FileContent adapter to avoid recursion + private final Gson delegateGson = new Gson(); + + @Override + public void write(JsonWriter out, FileContent_v0_3 value) throws java.io.IOException { + if (value == null) { + out.nullValue(); + return; + } + // Delegate to Gson's default serialization for the concrete type + if (value instanceof FileWithBytes_v0_3 fileWithBytes) { + delegateGson.toJson(fileWithBytes, FileWithBytes_v0_3.class, out); + } else if (value instanceof FileWithUri_v0_3 fileWithUri) { + delegateGson.toJson(fileWithUri, FileWithUri_v0_3.class, out); + } else { + throw new JsonSyntaxException("Unknown FileContent implementation: " + value.getClass().getName()); + } + } + + @Override + public @Nullable + FileContent_v0_3 read(JsonReader in) throws java.io.IOException { + if (in.peek() == com.google.gson.stream.JsonToken.NULL) { + in.nextNull(); + return null; + } + + // Read the JSON as a tree to inspect the fields + com.google.gson.JsonElement jsonElement = com.google.gson.JsonParser.parseReader(in); + if (!jsonElement.isJsonObject()) { + throw new JsonSyntaxException("FileContent must be a JSON object"); + } + + com.google.gson.JsonObject jsonObject = jsonElement.getAsJsonObject(); + + // Distinguish between FileWithBytes and FileWithUri by checking for "bytes" or "uri" field + if (jsonObject.has("bytes")) { + return delegateGson.fromJson(jsonElement, FileWithBytes_v0_3.class); + } else if (jsonObject.has("uri")) { + return delegateGson.fromJson(jsonElement, FileWithUri_v0_3.class); + } else { + throw new JsonSyntaxException("FileContent must have either 'bytes' or 'uri' field"); + } + } + } + + /** + * Gson TypeAdapter for serializing and deserializing {@link AgentCapabilities_v0_3}. + *

+ * This adapter ensures that the {@code extensions} field is serialized as an empty array {@code []} + * when it is {@code null}, as required by the A2A v0.3 specification. + */ + static class AgentCapabilitiesTypeAdapter extends TypeAdapter { + + private final Gson delegateGson = new Gson(); + + @Override + public void write(JsonWriter out, AgentCapabilities_v0_3 value) throws java.io.IOException { + if (value == null) { + out.nullValue(); + return; + } + + out.beginObject(); + out.name("streaming").value(value.streaming()); + out.name("pushNotifications").value(value.pushNotifications()); + out.name("stateTransitionHistory").value(value.stateTransitionHistory()); + out.name("extensions"); + if (value.extensions() == null) { + out.beginArray(); + out.endArray(); + } else { + delegateGson.toJson(value.extensions(), List.class, out); + } + out.endObject(); + } + + @Override + public org.a2aproject.sdk.compat03.spec.@Nullable AgentCapabilities_v0_3 read(JsonReader in) throws java.io.IOException { + if (in.peek() == com.google.gson.stream.JsonToken.NULL) { + in.nextNull(); + return null; + } + + com.google.gson.JsonElement jsonElement = com.google.gson.JsonParser.parseReader(in); + return delegateGson.fromJson(jsonElement, AgentCapabilities_v0_3.class); + } + } + + static class VoidTypeAdapter extends TypeAdapter { + + + @Override + @SuppressWarnings("resource") + public void write(final JsonWriter out, final Void value) throws java.io.IOException { + out.nullValue(); + } + + @Override + public @Nullable Void read(final JsonReader in) throws java.io.IOException { + in.skipValue(); + return null; + } + + } + + /** + * Gson TypeAdapterFactory for serializing {@link JSONRPCResponse_v0_3} subclasses. + *

+ * JSON-RPC 2.0 requires that: + *

    + *
  • {@code result} MUST be present (possibly null) on success, and MUST NOT be present on error
  • + *
  • {@code error} MUST be present on error, and MUST NOT be present on success
  • + *
+ * Gson's default null-field-skipping behavior would omit {@code "result": null} for Void responses, + * so this factory writes the fields explicitly to comply with the spec. + */ + static class JSONRPCResponseTypeAdapterFactory implements TypeAdapterFactory { + + @Override + @SuppressWarnings({"unchecked", "rawtypes"}) + public @Nullable TypeAdapter create(Gson gson, TypeToken type) { + if (!JSONRPCResponse_v0_3.class.isAssignableFrom(type.getRawType())) { + return null; + } + + TypeAdapter delegateAdapter = gson.getDelegateAdapter(this, type); + TypeAdapter errorAdapter = gson.getAdapter(JSONRPCError_v0_3.class); + + return new TypeAdapter() { + @Override + public void write(JsonWriter out, T value) throws java.io.IOException { + if (value == null) { + out.nullValue(); + return; + } + + JSONRPCResponse_v0_3 response = (JSONRPCResponse_v0_3) value; + + out.beginObject(); + out.name("jsonrpc").value(response.getJsonrpc()); + + Object id = response.getId(); + out.name("id"); + if (id == null) { + out.nullValue(); + } else if (id instanceof Number n) { + out.value(n.longValue()); + } else { + out.value(id.toString()); + } + + JSONRPCError_v0_3 error = response.getError(); + if (error != null) { + out.name("error"); + errorAdapter.write(out, error); + } else { + out.name("result"); + Object result = response.getResult(); + if (result == null) { + // JsonWriter.nullValue() skips both name+value when serializeNulls=false, + // so we must temporarily enable it to write "result":null as required + // by JSON-RPC 2.0. + boolean prev = out.getSerializeNulls(); + out.setSerializeNulls(true); + out.nullValue(); + out.setSerializeNulls(prev); + } else { + TypeAdapter resultAdapter = gson.getAdapter(result.getClass()); + resultAdapter.write(out, result); + } + } + + out.endObject(); + } + + @Override + public T read(JsonReader in) throws java.io.IOException { + return delegateAdapter.read(in); + } + }; + } + } + +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/json/package-info.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/json/package-info.java new file mode 100644 index 000000000..b1b9a5b5c --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/json/package-info.java @@ -0,0 +1,8 @@ +/** + * JSON processing exceptions for the A2A Java SDK. + *

+ * This package provides custom exceptions that replace Jackson's JSON processing exceptions, + * allowing the SDK to be independent of any specific JSON library implementation. + */ +@org.jspecify.annotations.NullMarked +package org.a2aproject.sdk.compat03.json; diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AClientError_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AClientError_v0_3.java new file mode 100644 index 000000000..d5aeaa5e0 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AClientError_v0_3.java @@ -0,0 +1,17 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * Base exception for A2A Client errors. + */ +public class A2AClientError_v0_3 extends RuntimeException { + public A2AClientError_v0_3() { + } + + public A2AClientError_v0_3(String message) { + super(message); + } + + public A2AClientError_v0_3(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AClientException_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AClientException_v0_3.java new file mode 100644 index 000000000..676127971 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AClientException_v0_3.java @@ -0,0 +1,23 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * Exception to indicate a general failure related to an A2A client. + */ +public class A2AClientException_v0_3 extends A2AException_v0_3 { + + public A2AClientException_v0_3() { + super(); + } + + public A2AClientException_v0_3(final String msg) { + super(msg); + } + + public A2AClientException_v0_3(final Throwable cause) { + super(cause); + } + + public A2AClientException_v0_3(final String msg, final Throwable cause) { + super(msg, cause); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AClientHTTPError_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AClientHTTPError_v0_3.java new file mode 100644 index 000000000..40168cc2c --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AClientHTTPError_v0_3.java @@ -0,0 +1,34 @@ +package org.a2aproject.sdk.compat03.spec; + +import org.a2aproject.sdk.util.Assert; + +public class A2AClientHTTPError_v0_3 extends A2AClientError_v0_3 { + private final int code; + private final String message; + + public A2AClientHTTPError_v0_3(int code, String message, Object data) { + Assert.checkNotNullParam("code", code); + Assert.checkNotNullParam("message", message); + this.code = code; + this.message = message; + } + + /** + * Gets the error code + * + * @return the error code + */ + public int getCode() { + return code; + } + + /** + * Gets the error message + * + * @return the error message + */ + @Override + public String getMessage() { + return message; + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AClientInvalidArgsError_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AClientInvalidArgsError_v0_3.java new file mode 100644 index 000000000..0900d6a04 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AClientInvalidArgsError_v0_3.java @@ -0,0 +1,15 @@ +package org.a2aproject.sdk.compat03.spec; + +public class A2AClientInvalidArgsError_v0_3 extends A2AClientError_v0_3 { + + public A2AClientInvalidArgsError_v0_3() { + } + + public A2AClientInvalidArgsError_v0_3(String message) { + super("Invalid arguments error: " + message); + } + + public A2AClientInvalidArgsError_v0_3(String message, Throwable cause) { + super("Invalid arguments error: " + message, cause); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AClientInvalidStateError_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AClientInvalidStateError_v0_3.java new file mode 100644 index 000000000..4b94d442b --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AClientInvalidStateError_v0_3.java @@ -0,0 +1,15 @@ +package org.a2aproject.sdk.compat03.spec; + +public class A2AClientInvalidStateError_v0_3 extends A2AClientError_v0_3 { + + public A2AClientInvalidStateError_v0_3() { + } + + public A2AClientInvalidStateError_v0_3(String message) { + super("Invalid state error: " + message); + } + + public A2AClientInvalidStateError_v0_3(String message, Throwable cause) { + super("Invalid state error: " + message, cause); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AClientJSONError_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AClientJSONError_v0_3.java new file mode 100644 index 000000000..2c094e4d5 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AClientJSONError_v0_3.java @@ -0,0 +1,40 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * Client exception indicating a JSON serialization or deserialization error. + *

+ * This exception is thrown when the A2A client SDK encounters errors while + * parsing JSON responses from agents or serializing requests. This typically + * indicates: + *

    + *
  • Malformed JSON in agent responses
  • + *
  • Unexpected JSON structure or field types
  • + *
  • Missing required JSON fields
  • + *
  • JSON encoding/decoding errors
  • + *
+ *

+ * Usage example: + *

{@code
+ * try {
+ *     AgentCard card = objectMapper.readValue(json, AgentCard.class);
+ * } catch (org.a2aproject.sdk.compat03.json.JsonProcessingException e) {
+ *     throw new A2AClientJSONError("Failed to parse agent card", e);
+ * }
+ * }
+ * + * @see A2AClientError_v0_3 for the base client error class + * @see JSONParseError_v0_3 for protocol-level JSON errors + */ +public class A2AClientJSONError_v0_3 extends A2AClientError_v0_3 { + + public A2AClientJSONError_v0_3() { + } + + public A2AClientJSONError_v0_3(String message) { + super(message); + } + + public A2AClientJSONError_v0_3(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AErrorCodes_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AErrorCodes_v0_3.java new file mode 100644 index 000000000..13198bb53 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AErrorCodes_v0_3.java @@ -0,0 +1,22 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * All the error codes for A2A errors. + */ +public interface A2AErrorCodes_v0_3 { + + int TASK_NOT_FOUND_ERROR_CODE = -32001; + int TASK_NOT_CANCELABLE_ERROR_CODE = -32002; + int PUSH_NOTIFICATION_NOT_SUPPORTED_ERROR_CODE = -32003; + int UNSUPPORTED_OPERATION_ERROR_CODE = -32004; + int CONTENT_TYPE_NOT_SUPPORTED_ERROR_CODE = -32005; + int INVALID_AGENT_RESPONSE_ERROR_CODE = -32006; + int AUTHENTICATED_EXTENDED_CARD_NOT_CONFIGURED_ERROR_CODE = -32007; + + int INVALID_REQUEST_ERROR_CODE = -32600; + int METHOD_NOT_FOUND_ERROR_CODE = -32601; + int INVALID_PARAMS_ERROR_CODE = -32602; + int INTERNAL_ERROR_CODE = -32603; + + int JSON_PARSE_ERROR_CODE = -32700; +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AError_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AError_v0_3.java new file mode 100644 index 000000000..05986fa39 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AError_v0_3.java @@ -0,0 +1,4 @@ +package org.a2aproject.sdk.compat03.spec; + +public interface A2AError_v0_3 extends Event_v0_3 { +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AException_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AException_v0_3.java new file mode 100644 index 000000000..ae81343b2 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AException_v0_3.java @@ -0,0 +1,44 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * Exception to indicate a general failure related to the A2A protocol. + */ +public class A2AException_v0_3 extends RuntimeException { + + /** + * Constructs a new {@code A2AException} instance. The message is left blank ({@code null}), and no + * cause is specified. + */ + public A2AException_v0_3() { + } + + /** + * Constructs a new {@code A2AException} instance with an initial message. No cause is specified. + * + * @param msg the message + */ + public A2AException_v0_3(final String msg) { + super(msg); + } + + /** + * Constructs a new {@code A2AException} instance with an initial cause. If a non-{@code null} cause + * is specified, its message is used to initialize the message of this {@code A2AException}; otherwise + * the message is left blank ({@code null}). + * + * @param cause the cause + */ + public A2AException_v0_3(final Throwable cause) { + super(cause); + } + + /** + * Constructs a new {@code A2AException} instance with an initial message and cause. + * + * @param msg the message + * @param cause the cause + */ + public A2AException_v0_3(final String msg, final Throwable cause) { + super(msg, cause); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AServerException_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AServerException_v0_3.java new file mode 100644 index 000000000..174d9627c --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AServerException_v0_3.java @@ -0,0 +1,23 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * Exception to indicate a general failure related to an A2A server. + */ +public class A2AServerException_v0_3 extends A2AException_v0_3 { + + public A2AServerException_v0_3() { + super(); + } + + public A2AServerException_v0_3(final String msg) { + super(msg); + } + + public A2AServerException_v0_3(final Throwable cause) { + super(cause); + } + + public A2AServerException_v0_3(final String msg, final Throwable cause) { + super(msg, cause); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/APIKeySecurityScheme_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/APIKeySecurityScheme_v0_3.java new file mode 100644 index 000000000..33fde3d61 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/APIKeySecurityScheme_v0_3.java @@ -0,0 +1,110 @@ +package org.a2aproject.sdk.compat03.spec; + +import org.a2aproject.sdk.util.Assert; + +/** + * Defines a security scheme using an API key. + */ +public final class APIKeySecurityScheme_v0_3 implements SecurityScheme_v0_3 { + + public static final String API_KEY = "apiKey"; + private final String in; + private final String name; + private final String type; + private final String description; + + /** + * Represents the location of the API key. + */ + public enum Location { + COOKIE("cookie"), + HEADER("header"), + QUERY("query"); + + private final String location; + + Location(String location) { + this.location = location; + } + + public String asString() { + return location; + } + + public static Location fromString(String location) { + switch (location) { + case "cookie" -> { + return COOKIE; + } + case "header" -> { + return HEADER; + } + case "query" -> { + return QUERY; + } + default -> throw new IllegalArgumentException("Invalid API key location: " + location); + } + } + } + + public APIKeySecurityScheme_v0_3(String in, String name, String description) { + this(in, name, description, API_KEY); + } + + public APIKeySecurityScheme_v0_3(String in, String name, + String description, String type) { + Assert.checkNotNullParam("in", in); + Assert.checkNotNullParam("name", name); + Assert.checkNotNullParam("type", type); + if (! type.equals(API_KEY)) { + throw new IllegalArgumentException("Invalid type for APIKeySecurityScheme"); + } + this.in = in; + this.name = name; + this.description = description; + this.type = type; + } + + @Override + public String getDescription() { + return description; + } + + + public String getIn() { + return in; + } + + public String getName() { + return name; + } + + public String getType() { + return type; + } + + public static class Builder { + private String in; + private String name; + private String description; + + public Builder in(String in) { + this.in = in; + return this; + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder description(String description) { + this.description = description; + return this; + } + + public APIKeySecurityScheme_v0_3 build() { + return new APIKeySecurityScheme_v0_3(in, name, description); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentCapabilities_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentCapabilities_v0_3.java new file mode 100644 index 000000000..c69eb62e7 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentCapabilities_v0_3.java @@ -0,0 +1,42 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.List; + +/** + * Defines optional capabilities supported by an agent. + */ +public record AgentCapabilities_v0_3(boolean streaming, boolean pushNotifications, boolean stateTransitionHistory, + List extensions) { + + public static class Builder { + + private boolean streaming; + private boolean pushNotifications; + private boolean stateTransitionHistory; + private List extensions; + + public Builder streaming(boolean streaming) { + this.streaming = streaming; + return this; + } + + public Builder pushNotifications(boolean pushNotifications) { + this.pushNotifications = pushNotifications; + return this; + } + + public Builder stateTransitionHistory(boolean stateTransitionHistory) { + this.stateTransitionHistory = stateTransitionHistory; + return this; + } + + public Builder extensions(List extensions) { + this.extensions = extensions; + return this; + } + + public AgentCapabilities_v0_3 build() { + return new AgentCapabilities_v0_3(streaming, pushNotifications, stateTransitionHistory, extensions); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentCardSignature_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentCardSignature_v0_3.java new file mode 100644 index 000000000..eeda617ac --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentCardSignature_v0_3.java @@ -0,0 +1,44 @@ +package org.a2aproject.sdk.compat03.spec; + +import com.google.gson.annotations.SerializedName; +import java.util.Map; + +import org.a2aproject.sdk.util.Assert; + +/** + * Represents a JWS signature of an AgentCard. + * This follows the JSON format of an RFC 7515 JSON Web Signature (JWS). + */ +public record AgentCardSignature_v0_3(Map header, @SerializedName("protected")String protectedHeader, + String signature) { + + public AgentCardSignature_v0_3 { + Assert.checkNotNullParam("protectedHeader", protectedHeader); + Assert.checkNotNullParam("signature", signature); + } + + public static class Builder { + private Map header; + String protectedHeader; + String signature; + + public Builder header(Map header) { + this.header = header; + return this; + } + + public Builder protectedHeader(String protectedHeader) { + this.protectedHeader = protectedHeader; + return this; + } + + public Builder signature(String signature) { + this.signature = signature; + return this; + } + + public AgentCardSignature_v0_3 build() { + return new AgentCardSignature_v0_3(header, protectedHeader, signature); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentCard_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentCard_v0_3.java new file mode 100644 index 000000000..d5ab8010d --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentCard_v0_3.java @@ -0,0 +1,199 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.a2aproject.sdk.util.Assert; + +/** + * The AgentCard is a self-describing manifest for an agent. It provides essential + * metadata including the agent's identity, capabilities, skills, supported + * communication methods, and security requirements. + */ +public record AgentCard_v0_3(String name, String description, String url, AgentProvider_v0_3 provider, + String version, String documentationUrl, AgentCapabilities_v0_3 capabilities, + List defaultInputModes, List defaultOutputModes, List skills, + boolean supportsAuthenticatedExtendedCard, Map securitySchemes, + List>> security, String iconUrl, List additionalInterfaces, + String preferredTransport, String protocolVersion, List signatures) { + + private static final String DEFAULT_PROTOCOL_VERSION = "0.3.0"; + private static final TransportProtocol_v0_3 DEFAULT_TRANSPORT = TransportProtocol_v0_3.JSONRPC; + + public AgentCard_v0_3 { + Assert.checkNotNullParam("capabilities", capabilities); + Assert.checkNotNullParam("defaultInputModes", defaultInputModes); + Assert.checkNotNullParam("defaultOutputModes", defaultOutputModes); + Assert.checkNotNullParam("description", description); + Assert.checkNotNullParam("name", name); + Assert.checkNotNullParam("skills", skills); + Assert.checkNotNullParam("url", url); + Assert.checkNotNullParam("version", version); + if (protocolVersion == null) { + protocolVersion = DEFAULT_PROTOCOL_VERSION; + } + if (preferredTransport == null) { + preferredTransport = DEFAULT_TRANSPORT.asString(); + } + } + + public static class Builder { + private String name; + private String description; + private String url; + private AgentProvider_v0_3 provider; + private String version; + private String documentationUrl; + private AgentCapabilities_v0_3 capabilities; + private List defaultInputModes; + private List defaultOutputModes; + private List skills; + private boolean supportsAuthenticatedExtendedCard = false; + private Map securitySchemes; + private List>> security; + private String iconUrl; + private List additionalInterfaces; + private String preferredTransport; + private String protocolVersion; + private List signatures; + + /** + * Creates a new Builder. + */ + public Builder() { + + } + + /** + * Creates a new Builder as a copy of an existing AgentCard. + * + * @param card the AgentCard to copy + */ + public Builder(AgentCard_v0_3 card) { + this.name = card.name; + this.description = card.description; + this.url = card.url; + this.provider = card.provider; + this.version = card.version; + this.documentationUrl = card.documentationUrl; + this.capabilities = card.capabilities; + this.defaultInputModes = card.defaultInputModes != null ? new ArrayList<>(card.defaultInputModes) : null; + this.defaultOutputModes = card.defaultOutputModes != null ? new ArrayList<>(card.defaultOutputModes) : null; + this.skills = card.skills != null ? new ArrayList<>(card.skills) : null; + this.supportsAuthenticatedExtendedCard = card.supportsAuthenticatedExtendedCard; + this.securitySchemes = card.securitySchemes != null ? Map.copyOf(card.securitySchemes) : null; + this.security = card.security != null ? new ArrayList<>(card.security) : null; + this.iconUrl = card.iconUrl; + this.additionalInterfaces = card.additionalInterfaces != null ? new ArrayList<>(card.additionalInterfaces) : null; + this.preferredTransport = card.preferredTransport; + this.protocolVersion = card.protocolVersion; + this.signatures = card.signatures != null ? new ArrayList<>(card.signatures) : null; + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder description(String description) { + this.description = description; + return this; + } + + public Builder url(String url) { + this.url = url; + return this; + } + + public Builder provider(AgentProvider_v0_3 provider) { + this.provider = provider; + return this; + } + + public Builder version(String version) { + this.version = version; + return this; + } + + public Builder documentationUrl(String documentationUrl) { + this.documentationUrl = documentationUrl; + return this; + } + + public Builder capabilities(AgentCapabilities_v0_3 capabilities) { + this.capabilities = capabilities; + return this; + } + + public Builder defaultInputModes(List defaultInputModes) { + this.defaultInputModes = defaultInputModes; + return this; + } + + public Builder defaultOutputModes(List defaultOutputModes) { + this.defaultOutputModes = defaultOutputModes; + return this; + } + + public Builder skills(List skills) { + this.skills = skills; + return this; + } + + public Builder supportsAuthenticatedExtendedCard(boolean supportsAuthenticatedExtendedCard) { + this.supportsAuthenticatedExtendedCard = supportsAuthenticatedExtendedCard; + return this; + } + + public Builder securitySchemes(Map securitySchemes) { + this.securitySchemes = securitySchemes; + return this; + } + + public Builder security(List>> security) { + this.security = security; + return this; + } + + public Builder iconUrl(String iconUrl) { + this.iconUrl = iconUrl; + return this; + } + + public Builder additionalInterfaces(List additionalInterfaces) { + this.additionalInterfaces = additionalInterfaces; + return this; + } + + public Builder preferredTransport(String preferredTransport) { + this.preferredTransport = preferredTransport; + return this; + } + + public Builder protocolVersion(String protocolVersion) { + this.protocolVersion = protocolVersion; + return this; + } + + public Builder signatures(List signatures) { + this.signatures = signatures; + return this; + } + + public AgentCard_v0_3 build() { + if (preferredTransport == null) { + preferredTransport = DEFAULT_TRANSPORT.asString(); + } + if (additionalInterfaces == null) { + // should include an entry matching the main 'url' and 'preferredTransport' + additionalInterfaces = new ArrayList<>(); + additionalInterfaces.add(new AgentInterface_v0_3(preferredTransport, url)); + } + return new AgentCard_v0_3(name, description, url, provider, version, documentationUrl, + capabilities, defaultInputModes, defaultOutputModes, skills, + supportsAuthenticatedExtendedCard, securitySchemes, security, iconUrl, + additionalInterfaces, preferredTransport, protocolVersion, signatures); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentExtension_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentExtension_v0_3.java new file mode 100644 index 000000000..7b06c26b7 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentExtension_v0_3.java @@ -0,0 +1,47 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.Map; + +import org.a2aproject.sdk.util.Assert; + +/** + * A declaration of a protocol extension supported by an Agent. + */ +public record AgentExtension_v0_3(String description, Map params, boolean required, String uri) { + + public AgentExtension_v0_3 { + Assert.checkNotNullParam("uri", uri); + } + + public static class Builder { + String description; + Map params; + boolean required; + String uri; + + public Builder description(String description) { + this.description = description; + return this; + } + + public Builder params(Map params) { + this.params = params; + return this; + } + + public Builder required(boolean required) { + this.required = required; + return this; + } + + public Builder uri(String uri) { + this.uri = uri; + return this; + } + + public AgentExtension_v0_3 build() { + return new AgentExtension_v0_3(description, params, required, uri); + } + } + +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentInterface_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentInterface_v0_3.java new file mode 100644 index 000000000..839b7482d --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentInterface_v0_3.java @@ -0,0 +1,15 @@ +package org.a2aproject.sdk.compat03.spec; + + +import org.a2aproject.sdk.util.Assert; + +/** + * Declares a combination of a target URL and a transport protocol for interacting with the agent. + */ + +public record AgentInterface_v0_3(String transport, String url) { + public AgentInterface_v0_3 { + Assert.checkNotNullParam("transport", transport); + Assert.checkNotNullParam("url", url); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentProvider_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentProvider_v0_3.java new file mode 100644 index 000000000..3d70bab74 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentProvider_v0_3.java @@ -0,0 +1,14 @@ +package org.a2aproject.sdk.compat03.spec; + +import org.a2aproject.sdk.util.Assert; + +/** + * Represents the service provider of an agent. + */ +public record AgentProvider_v0_3(String organization, String url) { + + public AgentProvider_v0_3 { + Assert.checkNotNullParam("organization", organization); + Assert.checkNotNullParam("url", url); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentSkill_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentSkill_v0_3.java new file mode 100644 index 000000000..cbb40a0fd --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentSkill_v0_3.java @@ -0,0 +1,77 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.List; +import java.util.Map; + +import org.a2aproject.sdk.util.Assert; + +/** + * The set of skills, or distinct capabilities, that the agent can perform. + */ +public record AgentSkill_v0_3(String id, String name, String description, List tags, + List examples, List inputModes, List outputModes, + List>> security) { + + public AgentSkill_v0_3 { + Assert.checkNotNullParam("description", description); + Assert.checkNotNullParam("id", id); + Assert.checkNotNullParam("name", name); + Assert.checkNotNullParam("tags", tags); + } + + public static class Builder { + + private String id; + private String name; + private String description; + private List tags; + private List examples; + private List inputModes; + private List outputModes; + private List>> security; + + public Builder id(String id) { + this.id = id; + return this; + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder description(String description) { + this.description = description; + return this; + } + + public Builder tags(List tags) { + this.tags = tags; + return this; + } + + public Builder examples(List examples) { + this.examples = examples; + return this; + } + + public Builder inputModes(List inputModes) { + this.inputModes = inputModes; + return this; + } + + public Builder outputModes(List outputModes) { + this.outputModes = outputModes; + return this; + } + + public Builder security(List>> security) { + this.security = security; + return this; + } + + public AgentSkill_v0_3 build() { + return new AgentSkill_v0_3(id, name, description, tags, examples, inputModes, outputModes, security); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/Artifact_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/Artifact_v0_3.java new file mode 100644 index 000000000..a98a10074 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/Artifact_v0_3.java @@ -0,0 +1,82 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.List; +import java.util.Map; + +import org.a2aproject.sdk.util.Assert; + +/** + * Represents a file, data structure, or other resource generated by an agent during a task. + */ +public record Artifact_v0_3(String artifactId, String name, String description, List> parts, Map metadata, + List extensions) { + + public Artifact_v0_3 { + Assert.checkNotNullParam("artifactId", artifactId); + Assert.checkNotNullParam("parts", parts); + if (parts.isEmpty()) { + throw new IllegalArgumentException("Parts cannot be empty"); + } + } + + public static class Builder { + private String artifactId; + private String name; + private String description; + private List> parts; + private Map metadata; + private List extensions; + + public Builder(){ + } + + public Builder(Artifact_v0_3 existingArtifact) { + artifactId = existingArtifact.artifactId; + name = existingArtifact.name; + description = existingArtifact.description; + parts = existingArtifact.parts; + metadata = existingArtifact.metadata; + extensions = existingArtifact.extensions; + } + + public Builder artifactId(String artifactId) { + this.artifactId = artifactId; + return this; + } + + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder description(String description) { + this.description = description; + return this; + } + + public Builder parts(List> parts) { + this.parts = parts; + return this; + } + + public Builder parts(Part_v0_3... parts) { + this.parts = List.of(parts); + return this; + } + + public Builder metadata(Map metadata) { + this.metadata = metadata; + return this; + } + + public Builder extensions(List extensions) { + this.extensions = (extensions == null) ? null : List.copyOf(extensions); + return this; + } + + public Artifact_v0_3 build() { + return new Artifact_v0_3(artifactId, name, description, parts, metadata, extensions); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AuthenticatedExtendedCardNotConfiguredError_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AuthenticatedExtendedCardNotConfiguredError_v0_3.java new file mode 100644 index 000000000..2fb9b1928 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AuthenticatedExtendedCardNotConfiguredError_v0_3.java @@ -0,0 +1,20 @@ +package org.a2aproject.sdk.compat03.spec; + +import static org.a2aproject.sdk.compat03.util.Utils_v0_3.defaultIfNull; + + +/** + * An A2A-specific error indicating that the agent does not have an + * Authenticated Extended Card configured + */ +public class AuthenticatedExtendedCardNotConfiguredError_v0_3 extends JSONRPCError_v0_3 { + + public final static Integer DEFAULT_CODE = -32007; + + public AuthenticatedExtendedCardNotConfiguredError_v0_3(Integer code, String message, Object data) { + super( + defaultIfNull(code, DEFAULT_CODE), + defaultIfNull(message, "Authenticated Extended Card not configured"), + data); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AuthenticationInfo_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AuthenticationInfo_v0_3.java new file mode 100644 index 000000000..064cb3ec9 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AuthenticationInfo_v0_3.java @@ -0,0 +1,15 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.List; + +import org.a2aproject.sdk.util.Assert; + +/** + * The authentication info for an agent. + */ +public record AuthenticationInfo_v0_3(List schemes, String credentials) { + + public AuthenticationInfo_v0_3 { + Assert.checkNotNullParam("schemes", schemes); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AuthorizationCodeOAuthFlow_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AuthorizationCodeOAuthFlow_v0_3.java new file mode 100644 index 000000000..4dd875f0c --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AuthorizationCodeOAuthFlow_v0_3.java @@ -0,0 +1,19 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.Map; + + +import org.a2aproject.sdk.util.Assert; + +/** + * Defines configuration details for the OAuth 2.0 Authorization Code flow. + */ +public record AuthorizationCodeOAuthFlow_v0_3(String authorizationUrl, String refreshUrl, Map scopes, + String tokenUrl) { + + public AuthorizationCodeOAuthFlow_v0_3 { + Assert.checkNotNullParam("authorizationUrl", authorizationUrl); + Assert.checkNotNullParam("scopes", scopes); + Assert.checkNotNullParam("tokenUrl", tokenUrl); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/CancelTaskRequest_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/CancelTaskRequest_v0_3.java new file mode 100644 index 000000000..2aa02e9fe --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/CancelTaskRequest_v0_3.java @@ -0,0 +1,70 @@ +package org.a2aproject.sdk.compat03.spec; + +import static org.a2aproject.sdk.compat03.util.Utils_v0_3.defaultIfNull; + +import java.util.UUID; + + +import org.a2aproject.sdk.util.Assert; + +/** + * A request that can be used to cancel a task. + */ +public final class CancelTaskRequest_v0_3 extends NonStreamingJSONRPCRequest_v0_3 { + + public static final String METHOD = "tasks/cancel"; + + public CancelTaskRequest_v0_3(String jsonrpc, Object id, String method, TaskIdParams_v0_3 params) { + if (jsonrpc != null && ! jsonrpc.equals(JSONRPC_VERSION)) { + throw new IllegalArgumentException("Invalid JSON-RPC protocol version"); + } + Assert.checkNotNullParam("method", method); + if (! method.equals(METHOD)) { + throw new IllegalArgumentException("Invalid CancelTaskRequest method"); + } + Assert.checkNotNullParam("params", params); + Assert.isNullOrStringOrInteger(id); + this.jsonrpc = defaultIfNull(jsonrpc, JSONRPC_VERSION); + this.id = id; + this.method = method; + this.params = params; + } + + public CancelTaskRequest_v0_3(Object id, TaskIdParams_v0_3 params) { + this(null, id, METHOD, params); + } + + public static class Builder { + private String jsonrpc; + private Object id; + private String method = METHOD; + private TaskIdParams_v0_3 params; + + public CancelTaskRequest_v0_3.Builder jsonrpc(String jsonrpc) { + this.jsonrpc = jsonrpc; + return this; + } + + public CancelTaskRequest_v0_3.Builder id(Object id) { + this.id = id; + return this; + } + + public CancelTaskRequest_v0_3.Builder method(String method) { + this.method = method; + return this; + } + + public CancelTaskRequest_v0_3.Builder params(TaskIdParams_v0_3 params) { + this.params = params; + return this; + } + + public CancelTaskRequest_v0_3 build() { + if (id == null) { + id = UUID.randomUUID().toString(); + } + return new CancelTaskRequest_v0_3(jsonrpc, id, method, params); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/CancelTaskResponse_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/CancelTaskResponse_v0_3.java new file mode 100644 index 000000000..e4a58fe74 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/CancelTaskResponse_v0_3.java @@ -0,0 +1,21 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * A response to a cancel task request. + */ + +public final class CancelTaskResponse_v0_3 extends JSONRPCResponse_v0_3 { + + public CancelTaskResponse_v0_3(String jsonrpc, Object id, Task_v0_3 result, JSONRPCError_v0_3 error) { + super(jsonrpc, id, result, error, Task_v0_3.class); + } + + public CancelTaskResponse_v0_3(Object id, JSONRPCError_v0_3 error) { + this(null, id, null, error); + } + + + public CancelTaskResponse_v0_3(Object id, Task_v0_3 result) { + this(null, id, result, null); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/ClientCredentialsOAuthFlow_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/ClientCredentialsOAuthFlow_v0_3.java new file mode 100644 index 000000000..a0f8b31f3 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/ClientCredentialsOAuthFlow_v0_3.java @@ -0,0 +1,19 @@ +package org.a2aproject.sdk.compat03.spec; + + +import java.util.Map; + + +import org.a2aproject.sdk.util.Assert; + +/** + * Defines configuration details for the OAuth 2.0 Client Credentials flow. + */ +public record ClientCredentialsOAuthFlow_v0_3(String refreshUrl, Map scopes, String tokenUrl) { + + public ClientCredentialsOAuthFlow_v0_3 { + Assert.checkNotNullParam("scopes", scopes); + Assert.checkNotNullParam("tokenUrl", tokenUrl); + } + +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/ContentTypeNotSupportedError_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/ContentTypeNotSupportedError_v0_3.java new file mode 100644 index 000000000..028a80efe --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/ContentTypeNotSupportedError_v0_3.java @@ -0,0 +1,20 @@ +package org.a2aproject.sdk.compat03.spec; + +import static org.a2aproject.sdk.compat03.spec.A2AErrorCodes_v0_3.CONTENT_TYPE_NOT_SUPPORTED_ERROR_CODE; +import static org.a2aproject.sdk.compat03.util.Utils_v0_3.defaultIfNull; + + +/** + * An A2A-specific error indicating an incompatibility between the requested + * content types and the agent's capabilities. + */ +public class ContentTypeNotSupportedError_v0_3 extends JSONRPCError_v0_3 { + + public final static Integer DEFAULT_CODE = CONTENT_TYPE_NOT_SUPPORTED_ERROR_CODE; + + public ContentTypeNotSupportedError_v0_3(Integer code, String message, Object data) { + super(defaultIfNull(code, CONTENT_TYPE_NOT_SUPPORTED_ERROR_CODE), + defaultIfNull(message, "Incompatible content types"), + data); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/DataPart_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/DataPart_v0_3.java new file mode 100644 index 000000000..a53b55a60 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/DataPart_v0_3.java @@ -0,0 +1,43 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.Map; + +import org.a2aproject.sdk.util.Assert; + + +/** + * Represents a structured data segment (e.g., JSON) within a message or artifact. + */ +public class DataPart_v0_3 extends Part_v0_3> { + + public static final String DATA = "data"; + private final Map data; + private final Map metadata; + private final Kind kind; + + public DataPart_v0_3(Map data) { + this(data, null); + } + + public DataPart_v0_3(Map data, Map metadata) { + Assert.checkNotNullParam("data", data); + this.data = data; + this.metadata = metadata; + this.kind = Kind.DATA; + } + + @Override + public Kind getKind() { + return kind; + } + + public Map getData() { + return data; + } + + @Override + public Map getMetadata() { + return metadata; + } + +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/DeleteTaskPushNotificationConfigParams_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/DeleteTaskPushNotificationConfigParams_v0_3.java new file mode 100644 index 000000000..400ef8c25 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/DeleteTaskPushNotificationConfigParams_v0_3.java @@ -0,0 +1,46 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.Map; + + +import org.a2aproject.sdk.util.Assert; + +/** + * Parameters for removing pushNotificationConfiguration associated with a Task. + */ +public record DeleteTaskPushNotificationConfigParams_v0_3(String id, String pushNotificationConfigId, Map metadata) { + + public DeleteTaskPushNotificationConfigParams_v0_3 { + Assert.checkNotNullParam("id", id); + Assert.checkNotNullParam("pushNotificationConfigId", pushNotificationConfigId); + } + + public DeleteTaskPushNotificationConfigParams_v0_3(String id, String pushNotificationConfigId) { + this(id, pushNotificationConfigId, null); + } + + public static class Builder { + String id; + String pushNotificationConfigId; + Map metadata; + + public Builder id(String id) { + this.id = id; + return this; + } + + public Builder pushNotificationConfigId(String pushNotificationConfigId) { + this.pushNotificationConfigId = pushNotificationConfigId; + return this; + } + + public Builder metadata(Map metadata) { + this.metadata = metadata; + return this; + } + + public DeleteTaskPushNotificationConfigParams_v0_3 build() { + return new DeleteTaskPushNotificationConfigParams_v0_3(id, pushNotificationConfigId, metadata); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/DeleteTaskPushNotificationConfigRequest_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/DeleteTaskPushNotificationConfigRequest_v0_3.java new file mode 100644 index 000000000..a90894e54 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/DeleteTaskPushNotificationConfigRequest_v0_3.java @@ -0,0 +1,67 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.UUID; + +import org.a2aproject.sdk.util.Assert; +import org.a2aproject.sdk.compat03.util.Utils_v0_3; + +/** + * A delete task push notification config request. + */ +public final class DeleteTaskPushNotificationConfigRequest_v0_3 extends NonStreamingJSONRPCRequest_v0_3 { + + public static final String METHOD = "tasks/pushNotificationConfig/delete"; + + public DeleteTaskPushNotificationConfigRequest_v0_3(String jsonrpc, Object id, String method, DeleteTaskPushNotificationConfigParams_v0_3 params) { + if (jsonrpc != null && ! jsonrpc.equals(JSONRPC_VERSION)) { + throw new IllegalArgumentException("Invalid JSON-RPC protocol version"); + } + Assert.checkNotNullParam("method", method); + if (! method.equals(METHOD)) { + throw new IllegalArgumentException("Invalid DeleteTaskPushNotificationConfigRequest method"); + } + Assert.isNullOrStringOrInteger(id); + this.jsonrpc = Utils_v0_3.defaultIfNull(jsonrpc, JSONRPC_VERSION); + this.id = id; + this.method = method; + this.params = params; + } + + public DeleteTaskPushNotificationConfigRequest_v0_3(String id, DeleteTaskPushNotificationConfigParams_v0_3 params) { + this(null, id, METHOD, params); + } + + public static class Builder { + private String jsonrpc; + private Object id; + private String method; + private DeleteTaskPushNotificationConfigParams_v0_3 params; + + public Builder jsonrpc(String jsonrpc) { + this.jsonrpc = jsonrpc; + return this; + } + + public Builder id(Object id) { + this.id = id; + return this; + } + + public Builder method(String method) { + this.method = method; + return this; + } + + public Builder params(DeleteTaskPushNotificationConfigParams_v0_3 params) { + this.params = params; + return this; + } + + public DeleteTaskPushNotificationConfigRequest_v0_3 build() { + if (id == null) { + id = UUID.randomUUID().toString(); + } + return new DeleteTaskPushNotificationConfigRequest_v0_3(jsonrpc, id, method, params); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/DeleteTaskPushNotificationConfigResponse_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/DeleteTaskPushNotificationConfigResponse_v0_3.java new file mode 100644 index 000000000..e581bedaa --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/DeleteTaskPushNotificationConfigResponse_v0_3.java @@ -0,0 +1,20 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * A response for a delete task push notification config request. + */ +public final class DeleteTaskPushNotificationConfigResponse_v0_3 extends JSONRPCResponse_v0_3 { + + public DeleteTaskPushNotificationConfigResponse_v0_3(String jsonrpc, Object id, Void result, JSONRPCError_v0_3 error) { + super(jsonrpc, id, result, error, Void.class); + } + + public DeleteTaskPushNotificationConfigResponse_v0_3(Object id, JSONRPCError_v0_3 error) { + this(null, id, null, error); + } + + public DeleteTaskPushNotificationConfigResponse_v0_3(Object id) { + this(null, id, null, null); + } + +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/EventKind_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/EventKind_v0_3.java new file mode 100644 index 000000000..374120a33 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/EventKind_v0_3.java @@ -0,0 +1,25 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * Interface for events that can be returned from non-streaming A2A Protocol operations. + *

+ * EventKind represents events that are suitable for synchronous request-response patterns. + * These events provide complete state information and are typically returned as the final + * result of an operation. + *

+ * EventKind implementations use polymorphic JSON serialization with the "kind" discriminator + * to determine the concrete type during deserialization. + *

+ * Permitted implementations: + *

    + *
  • {@link Task_v0_3} - Complete task state with status and artifacts
  • + *
  • {@link Message_v0_3} - Full message with all content parts
  • + *
+ * + * @see StreamingEventKind_v0_3 + * @see Event_v0_3 + */ +public interface EventKind_v0_3 { + + String getKind(); +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/Event_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/Event_v0_3.java new file mode 100644 index 000000000..8aa7e6369 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/Event_v0_3.java @@ -0,0 +1,4 @@ +package org.a2aproject.sdk.compat03.spec; + +public interface Event_v0_3 { +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/FileContent_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/FileContent_v0_3.java new file mode 100644 index 000000000..387e6443b --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/FileContent_v0_3.java @@ -0,0 +1,32 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * Sealed interface representing file content in the A2A Protocol. + *

+ * FileContent provides a polymorphic abstraction for file data, allowing files to be + * represented either as embedded binary content or as URI references. This flexibility + * enables different strategies for file transmission based on size, security, and + * accessibility requirements. + *

+ * The sealed interface permits only two implementations: + *

    + *
  • {@link FileWithBytes_v0_3} - File content embedded as base64-encoded bytes (for small files or inline data)
  • + *
  • {@link FileWithUri_v0_3} - File content referenced by URI (for large files or external resources)
  • + *
+ *

+ * Both implementations must provide: + *

    + *
  • MIME type - Describes the file format (e.g., "image/png", "application/pdf")
  • + *
  • File name - The original or display name for the file
  • + *
+ * + * @see FilePart_v0_3 + * @see FileWithBytes_v0_3 + * @see FileWithUri_v0_3 + */ +public sealed interface FileContent_v0_3 permits FileWithBytes_v0_3, FileWithUri_v0_3 { + + String mimeType(); + + String name(); +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/FilePart_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/FilePart_v0_3.java new file mode 100644 index 000000000..bb2fba6ed --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/FilePart_v0_3.java @@ -0,0 +1,43 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.Map; + +import org.a2aproject.sdk.util.Assert; + +/** + * Represents a file segment within a message or artifact. The file content can be + * provided either directly as bytes or as a URI. + */ +public class FilePart_v0_3 extends Part_v0_3 { + + public static final String FILE = "file"; + private final FileContent_v0_3 file; + private final Map metadata; + private final Kind kind; + + public FilePart_v0_3(FileContent_v0_3 file) { + this(file, null); + } + + public FilePart_v0_3(FileContent_v0_3 file, Map metadata) { + Assert.checkNotNullParam("file", file); + this.file = file; + this.metadata = metadata; + this.kind = Kind.FILE; + } + + @Override + public Kind getKind() { + return kind; + } + + public FileContent_v0_3 getFile() { + return file; + } + + @Override + public Map getMetadata() { + return metadata; + } + +} \ No newline at end of file diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/FileWithBytes_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/FileWithBytes_v0_3.java new file mode 100644 index 000000000..5740908be --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/FileWithBytes_v0_3.java @@ -0,0 +1,7 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * Represents a file with its content provided directly as a base64-encoded string. + */ +public record FileWithBytes_v0_3(String mimeType, String name, String bytes) implements FileContent_v0_3 { +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/FileWithUri_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/FileWithUri_v0_3.java new file mode 100644 index 000000000..7f302f9e8 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/FileWithUri_v0_3.java @@ -0,0 +1,8 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * Represents a file with its content located at a specific URI. + */ +public record FileWithUri_v0_3(String mimeType, String name, String uri) implements FileContent_v0_3 { +} + diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetAuthenticatedExtendedCardRequest_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetAuthenticatedExtendedCardRequest_v0_3.java new file mode 100644 index 000000000..55a95d4a8 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetAuthenticatedExtendedCardRequest_v0_3.java @@ -0,0 +1,62 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.UUID; + + +import org.a2aproject.sdk.util.Assert; +import org.a2aproject.sdk.compat03.util.Utils_v0_3; + +/** + * Represents a JSON-RPC request for the `agent/getAuthenticatedExtendedCard` method. + */ +public final class GetAuthenticatedExtendedCardRequest_v0_3 extends NonStreamingJSONRPCRequest_v0_3 { + + public static final String METHOD = "agent/getAuthenticatedExtendedCard"; + + public GetAuthenticatedExtendedCardRequest_v0_3(String jsonrpc, Object id, String method, Void params) { + if (jsonrpc != null && ! jsonrpc.equals(JSONRPC_VERSION)) { + throw new IllegalArgumentException("Invalid JSON-RPC protocol version"); + } + Assert.checkNotNullParam("method", method); + if (! method.equals(METHOD)) { + throw new IllegalArgumentException("Invalid GetAuthenticatedExtendedCardRequest method"); + } + Assert.isNullOrStringOrInteger(id); + this.jsonrpc = Utils_v0_3.defaultIfNull(jsonrpc, JSONRPC_VERSION); + this.id = id; + this.method = method; + this.params = params; + } + + public GetAuthenticatedExtendedCardRequest_v0_3(String id) { + this(null, id, METHOD, null); + } + + public static class Builder { + private String jsonrpc; + private Object id; + private String method; + + public GetAuthenticatedExtendedCardRequest_v0_3.Builder jsonrpc(String jsonrpc) { + this.jsonrpc = jsonrpc; + return this; + } + + public GetAuthenticatedExtendedCardRequest_v0_3.Builder id(Object id) { + this.id = id; + return this; + } + + public GetAuthenticatedExtendedCardRequest_v0_3.Builder method(String method) { + this.method = method; + return this; + } + + public GetAuthenticatedExtendedCardRequest_v0_3 build() { + if (id == null) { + id = UUID.randomUUID().toString(); + } + return new GetAuthenticatedExtendedCardRequest_v0_3(jsonrpc, id, method, null); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetAuthenticatedExtendedCardResponse_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetAuthenticatedExtendedCardResponse_v0_3.java new file mode 100644 index 000000000..5a7db5167 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetAuthenticatedExtendedCardResponse_v0_3.java @@ -0,0 +1,20 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * A response for the `agent/getAuthenticatedExtendedCard` method. + */ +public final class GetAuthenticatedExtendedCardResponse_v0_3 extends JSONRPCResponse_v0_3 { + + public GetAuthenticatedExtendedCardResponse_v0_3(String jsonrpc, Object id, AgentCard_v0_3 result, JSONRPCError_v0_3 error) { + super(jsonrpc, id, result, error, AgentCard_v0_3.class); + } + + public GetAuthenticatedExtendedCardResponse_v0_3(Object id, JSONRPCError_v0_3 error) { + this(null, id, null, error); + } + + public GetAuthenticatedExtendedCardResponse_v0_3(Object id, AgentCard_v0_3 result) { + this(null, id, result, null); + } + +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetTaskPushNotificationConfigParams_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetTaskPushNotificationConfigParams_v0_3.java new file mode 100644 index 000000000..6a5687565 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetTaskPushNotificationConfigParams_v0_3.java @@ -0,0 +1,50 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.Map; + + +import org.a2aproject.sdk.util.Assert; +import org.jspecify.annotations.Nullable; + +/** + * Parameters for fetching a pushNotificationConfiguration associated with a Task. + */ +public record GetTaskPushNotificationConfigParams_v0_3(String id, @Nullable String pushNotificationConfigId, @Nullable Map metadata) { + + public GetTaskPushNotificationConfigParams_v0_3 { + Assert.checkNotNullParam("id", id); + } + + public GetTaskPushNotificationConfigParams_v0_3(String id) { + this(id, null, null); + } + + public GetTaskPushNotificationConfigParams_v0_3(String id, String pushNotificationConfigId) { + this(id, pushNotificationConfigId, null); + } + + public static class Builder { + String id; + String pushNotificationConfigId; + Map metadata; + + public Builder id(String id) { + this.id = id; + return this; + } + + public Builder pushNotificationConfigId(String pushNotificationConfigId) { + this.pushNotificationConfigId = pushNotificationConfigId; + return this; + } + + public Builder metadata(Map metadata) { + this.metadata = metadata; + return this; + } + + public GetTaskPushNotificationConfigParams_v0_3 build() { + return new GetTaskPushNotificationConfigParams_v0_3(id, pushNotificationConfigId, metadata); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetTaskPushNotificationConfigRequest_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetTaskPushNotificationConfigRequest_v0_3.java new file mode 100644 index 000000000..536423fe8 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetTaskPushNotificationConfigRequest_v0_3.java @@ -0,0 +1,67 @@ +package org.a2aproject.sdk.compat03.spec; + +import org.a2aproject.sdk.util.Assert; +import org.a2aproject.sdk.compat03.util.Utils_v0_3; + +import java.util.UUID; + +/** + * A get task push notification request. + */ +public final class GetTaskPushNotificationConfigRequest_v0_3 extends NonStreamingJSONRPCRequest_v0_3 { + + public static final String METHOD = "tasks/pushNotificationConfig/get"; + + public GetTaskPushNotificationConfigRequest_v0_3(String jsonrpc, Object id, String method, GetTaskPushNotificationConfigParams_v0_3 params) { + if (jsonrpc != null && ! jsonrpc.equals(JSONRPC_VERSION)) { + throw new IllegalArgumentException("Invalid JSON-RPC protocol version"); + } + Assert.checkNotNullParam("method", method); + if (! method.equals(METHOD)) { + throw new IllegalArgumentException("Invalid GetTaskPushNotificationRequest method"); + } + Assert.isNullOrStringOrInteger(id); + this.jsonrpc = Utils_v0_3.defaultIfNull(jsonrpc, JSONRPC_VERSION); + this.id = id; + this.method = method; + this.params = params; + } + + public GetTaskPushNotificationConfigRequest_v0_3(String id, GetTaskPushNotificationConfigParams_v0_3 params) { + this(null, id, METHOD, params); + } + + public static class Builder { + private String jsonrpc; + private Object id; + private String method; + private GetTaskPushNotificationConfigParams_v0_3 params; + + public GetTaskPushNotificationConfigRequest_v0_3.Builder jsonrpc(String jsonrpc) { + this.jsonrpc = jsonrpc; + return this; + } + + public GetTaskPushNotificationConfigRequest_v0_3.Builder id(Object id) { + this.id = id; + return this; + } + + public GetTaskPushNotificationConfigRequest_v0_3.Builder method(String method) { + this.method = method; + return this; + } + + public GetTaskPushNotificationConfigRequest_v0_3.Builder params(GetTaskPushNotificationConfigParams_v0_3 params) { + this.params = params; + return this; + } + + public GetTaskPushNotificationConfigRequest_v0_3 build() { + if (id == null) { + id = UUID.randomUUID().toString(); + } + return new GetTaskPushNotificationConfigRequest_v0_3(jsonrpc, id, method, params); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetTaskPushNotificationConfigResponse_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetTaskPushNotificationConfigResponse_v0_3.java new file mode 100644 index 000000000..d817cf844 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetTaskPushNotificationConfigResponse_v0_3.java @@ -0,0 +1,20 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * A response for a get task push notification request. + */ +public final class GetTaskPushNotificationConfigResponse_v0_3 extends JSONRPCResponse_v0_3 { + + public GetTaskPushNotificationConfigResponse_v0_3(String jsonrpc, Object id, TaskPushNotificationConfig_v0_3 result, JSONRPCError_v0_3 error) { + super(jsonrpc, id, result, error, TaskPushNotificationConfig_v0_3.class); + } + + public GetTaskPushNotificationConfigResponse_v0_3(Object id, JSONRPCError_v0_3 error) { + this(null, id, null, error); + } + + public GetTaskPushNotificationConfigResponse_v0_3(Object id, TaskPushNotificationConfig_v0_3 result) { + this(null, id, result, null); + } + +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetTaskRequest_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetTaskRequest_v0_3.java new file mode 100644 index 000000000..ac097bdcb --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetTaskRequest_v0_3.java @@ -0,0 +1,71 @@ +package org.a2aproject.sdk.compat03.spec; + +import static org.a2aproject.sdk.compat03.util.Utils_v0_3.defaultIfNull; + +import java.util.UUID; + + +import org.a2aproject.sdk.util.Assert; + +/** + * A get task request. + */ +public final class GetTaskRequest_v0_3 extends NonStreamingJSONRPCRequest_v0_3 { + + public static final String METHOD = "tasks/get"; + + public GetTaskRequest_v0_3(String jsonrpc, Object id, String method, TaskQueryParams_v0_3 params) { + if (jsonrpc != null && ! jsonrpc.equals(JSONRPC_VERSION)) { + throw new IllegalArgumentException("Invalid JSON-RPC protocol version"); + } + Assert.checkNotNullParam("method", method); + if (! method.equals(METHOD)) { + throw new IllegalArgumentException("Invalid GetTaskRequest method"); + } + Assert.checkNotNullParam("params", params); + Assert.isNullOrStringOrInteger(id); + this.jsonrpc = defaultIfNull(jsonrpc, JSONRPC_VERSION); + this.id = id; + this.method = method; + this.params = params; + } + + public GetTaskRequest_v0_3(Object id, TaskQueryParams_v0_3 params) { + this(null, id, METHOD, params); + } + + + public static class Builder { + private String jsonrpc; + private Object id; + private String method = "tasks/get"; + private TaskQueryParams_v0_3 params; + + public GetTaskRequest_v0_3.Builder jsonrpc(String jsonrpc) { + this.jsonrpc = jsonrpc; + return this; + } + + public GetTaskRequest_v0_3.Builder id(Object id) { + this.id = id; + return this; + } + + public GetTaskRequest_v0_3.Builder method(String method) { + this.method = method; + return this; + } + + public GetTaskRequest_v0_3.Builder params(TaskQueryParams_v0_3 params) { + this.params = params; + return this; + } + + public GetTaskRequest_v0_3 build() { + if (id == null) { + id = UUID.randomUUID().toString(); + } + return new GetTaskRequest_v0_3(jsonrpc, id, method, params); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetTaskResponse_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetTaskResponse_v0_3.java new file mode 100644 index 000000000..68f768bcc --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetTaskResponse_v0_3.java @@ -0,0 +1,19 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * The response for a get task request. + */ +public final class GetTaskResponse_v0_3 extends JSONRPCResponse_v0_3 { + + public GetTaskResponse_v0_3(String jsonrpc, Object id, Task_v0_3 result, JSONRPCError_v0_3 error) { + super(jsonrpc, id, result, error, Task_v0_3.class); + } + + public GetTaskResponse_v0_3(Object id, JSONRPCError_v0_3 error) { + this(null, id, null, error); + } + + public GetTaskResponse_v0_3(Object id, Task_v0_3 result) { + this(null, id, result, null); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/HTTPAuthSecurityScheme_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/HTTPAuthSecurityScheme_v0_3.java new file mode 100644 index 000000000..15729a7d6 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/HTTPAuthSecurityScheme_v0_3.java @@ -0,0 +1,73 @@ +package org.a2aproject.sdk.compat03.spec; + +import org.a2aproject.sdk.util.Assert; + +/** + * Defines a security scheme using HTTP authentication. + */ +public final class HTTPAuthSecurityScheme_v0_3 implements SecurityScheme_v0_3 { + + public static final String HTTP = "http"; + private final String bearerFormat; + private final String scheme; + private final String description; + private final String type; + + public HTTPAuthSecurityScheme_v0_3(String bearerFormat, String scheme, String description) { + this(bearerFormat, scheme, description, HTTP); + } + + public HTTPAuthSecurityScheme_v0_3(String bearerFormat, String scheme, String description, String type) { + Assert.checkNotNullParam("scheme", scheme); + Assert.checkNotNullParam("type", type); + if (! HTTP.equals(type)) { + throw new IllegalArgumentException("Invalid type for HTTPAuthSecurityScheme"); + } + this.bearerFormat = bearerFormat; + this.scheme = scheme; + this.description = description; + this.type = type; + } + + @Override + public String getDescription() { + return description; + } + + public String getBearerFormat() { + return bearerFormat; + } + + public String getScheme() { + return scheme; + } + + public String getType() { + return type; + } + + public static class Builder { + private String bearerFormat; + private String scheme; + private String description; + + public Builder bearerFormat(String bearerFormat) { + this.bearerFormat = bearerFormat; + return this; + } + + public Builder scheme(String scheme) { + this.scheme = scheme; + return this; + } + + public Builder description(String description) { + this.description = description; + return this; + } + + public HTTPAuthSecurityScheme_v0_3 build() { + return new HTTPAuthSecurityScheme_v0_3(bearerFormat, scheme, description); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/IdJsonMappingException_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/IdJsonMappingException_v0_3.java new file mode 100644 index 000000000..c0971fcb0 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/IdJsonMappingException_v0_3.java @@ -0,0 +1,22 @@ +package org.a2aproject.sdk.compat03.spec; + +import org.a2aproject.sdk.compat03.json.JsonMappingException_v0_3; + +public class IdJsonMappingException_v0_3 extends JsonMappingException_v0_3 { + + Object id; + + public IdJsonMappingException_v0_3(String msg, Object id) { + super(msg); + this.id = id; + } + + public IdJsonMappingException_v0_3(String msg, Throwable cause, Object id) { + super(msg, cause); + this.id = id; + } + + public Object getId() { + return id; + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/ImplicitOAuthFlow_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/ImplicitOAuthFlow_v0_3.java new file mode 100644 index 000000000..200abacbe --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/ImplicitOAuthFlow_v0_3.java @@ -0,0 +1,17 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.Map; + + +import org.a2aproject.sdk.util.Assert; + +/** + * Defines configuration details for the OAuth 2.0 Implicit flow. + */ +public record ImplicitOAuthFlow_v0_3(String authorizationUrl, String refreshUrl, Map scopes) { + + public ImplicitOAuthFlow_v0_3 { + Assert.checkNotNullParam("authorizationUrl", authorizationUrl); + Assert.checkNotNullParam("scopes", scopes); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/IntegerJsonrpcId_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/IntegerJsonrpcId_v0_3.java new file mode 100644 index 000000000..c84c65cac --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/IntegerJsonrpcId_v0_3.java @@ -0,0 +1,4 @@ +package org.a2aproject.sdk.compat03.spec; + +public class IntegerJsonrpcId_v0_3 { +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/InternalError_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/InternalError_v0_3.java new file mode 100644 index 000000000..ac01992b3 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/InternalError_v0_3.java @@ -0,0 +1,23 @@ +package org.a2aproject.sdk.compat03.spec; + +import static org.a2aproject.sdk.compat03.util.Utils_v0_3.defaultIfNull; + + +/** + * An error indicating an internal error on the server. + */ +public class InternalError_v0_3 extends JSONRPCError_v0_3 { + + public final static Integer DEFAULT_CODE = A2AErrorCodes_v0_3.INTERNAL_ERROR_CODE; + + public InternalError_v0_3(Integer code, String message, Object data) { + super( + defaultIfNull(code, A2AErrorCodes_v0_3.INTERNAL_ERROR_CODE), + defaultIfNull(message, "Internal Error"), + data); + } + + public InternalError_v0_3(String message) { + this(null, message, null); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/InvalidAgentResponseError_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/InvalidAgentResponseError_v0_3.java new file mode 100644 index 000000000..ee222fe71 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/InvalidAgentResponseError_v0_3.java @@ -0,0 +1,50 @@ +package org.a2aproject.sdk.compat03.spec; + +import static org.a2aproject.sdk.compat03.util.Utils_v0_3.defaultIfNull; + + +/** + * A2A Protocol error indicating that an agent returned a response not conforming to protocol specifications. + *

+ * This error is typically raised by client implementations when validating agent responses. + * It indicates that the agent's response structure, content, or format violates the A2A Protocol + * requirements for the invoked method. + *

+ * Common violations: + *

    + *
  • Missing required fields in response objects
  • + *
  • Invalid field types or values
  • + *
  • Malformed event stream data
  • + *
  • Response doesn't match declared agent capabilities
  • + *
+ *

+ * Corresponds to A2A-specific error code {@code -32006}. + *

+ * Usage example: + *

{@code
+ * SendMessageResponse response = client.sendMessage(request);
+ * if (response.task() == null) {
+ *     throw new InvalidAgentResponseError(
+ *         null,
+ *         "Response missing required 'task' field",
+ *         null
+ *     );
+ * }
+ * }
+ * + * @see JSONRPCResponse_v0_3 for response structure + * @see SendMessageResponse_v0_3 for message send response + * @see A2A Protocol Specification + + */ +public class InvalidAgentResponseError_v0_3 extends JSONRPCError_v0_3 { + + public final static Integer DEFAULT_CODE = A2AErrorCodes_v0_3.INVALID_AGENT_RESPONSE_ERROR_CODE; + + public InvalidAgentResponseError_v0_3(Integer code, String message, Object data) { + super( + defaultIfNull(code, A2AErrorCodes_v0_3.INVALID_AGENT_RESPONSE_ERROR_CODE), + defaultIfNull(message, "Invalid agent response"), + data); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/InvalidParamsError_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/InvalidParamsError_v0_3.java new file mode 100644 index 000000000..a7864a9ac --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/InvalidParamsError_v0_3.java @@ -0,0 +1,50 @@ +package org.a2aproject.sdk.compat03.spec; + +import static org.a2aproject.sdk.compat03.util.Utils_v0_3.defaultIfNull; + +/** + * JSON-RPC error indicating that method parameters are invalid or missing required fields. + *

+ * This error is returned when a JSON-RPC method is called with parameters that fail validation. + * Common causes include: + *

    + *
  • Missing required parameters
  • + *
  • Parameters of incorrect type
  • + *
  • Parameter values outside acceptable ranges
  • + *
  • Malformed parameter structures
  • + *
+ *

+ * Corresponds to JSON-RPC 2.0 error code {@code -32602}. + *

+ * Usage example: + *

{@code
+ * // Default error with standard message
+ * throw new InvalidParamsError();
+ *
+ * // Custom error message
+ * throw new InvalidParamsError("taskId parameter is required");
+ * }
+ * + * @see JSONRPCError_v0_3 for the base error class + * @see A2AError_v0_3 for the error marker interface + * @see JSON-RPC 2.0 Error Codes + */ +public class InvalidParamsError_v0_3 extends JSONRPCError_v0_3 { + + public final static Integer DEFAULT_CODE = A2AErrorCodes_v0_3.INVALID_PARAMS_ERROR_CODE; + + public InvalidParamsError_v0_3(Integer code, String message, Object data) { + super( + defaultIfNull(code, A2AErrorCodes_v0_3.INVALID_PARAMS_ERROR_CODE), + defaultIfNull(message, "Invalid parameters"), + data); + } + + public InvalidParamsError_v0_3(String message) { + this(null, message, null); + } + + public InvalidParamsError_v0_3() { + this(null, null, null); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/InvalidParamsJsonMappingException_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/InvalidParamsJsonMappingException_v0_3.java new file mode 100644 index 000000000..3ebb2e505 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/InvalidParamsJsonMappingException_v0_3.java @@ -0,0 +1,12 @@ +package org.a2aproject.sdk.compat03.spec; + +public class InvalidParamsJsonMappingException_v0_3 extends IdJsonMappingException_v0_3 { + + public InvalidParamsJsonMappingException_v0_3(String msg, Object id) { + super(msg, id); + } + + public InvalidParamsJsonMappingException_v0_3(String msg, Throwable cause, Object id) { + super(msg, cause, id); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/InvalidRequestError_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/InvalidRequestError_v0_3.java new file mode 100644 index 000000000..f86c2de48 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/InvalidRequestError_v0_3.java @@ -0,0 +1,51 @@ +package org.a2aproject.sdk.compat03.spec; + +import static org.a2aproject.sdk.compat03.util.Utils_v0_3.defaultIfNull; + + +/** + * JSON-RPC error indicating that the request payload is not a valid JSON-RPC Request object. + *

+ * This error is returned when the JSON-RPC request fails structural validation. + * Common causes include: + *

    + *
  • Missing required JSON-RPC fields (jsonrpc, method, id)
  • + *
  • Invalid JSON-RPC version (must be "2.0")
  • + *
  • Malformed request structure
  • + *
  • Type mismatches in required fields
  • + *
+ *

+ * Corresponds to JSON-RPC 2.0 error code {@code -32600}. + *

+ * Usage example: + *

{@code
+ * // Default error with standard message
+ * throw new InvalidRequestError();
+ *
+ * // Custom error message
+ * throw new InvalidRequestError("Missing 'method' field in request");
+ * }
+ * + * @see JSONRPCError_v0_3 for the base error class + * @see A2AError_v0_3 for the error marker interface + * @see JSON-RPC 2.0 Error Codes + */ +public class InvalidRequestError_v0_3 extends JSONRPCError_v0_3 { + + public final static Integer DEFAULT_CODE = A2AErrorCodes_v0_3.INVALID_REQUEST_ERROR_CODE; + + public InvalidRequestError_v0_3() { + this(null, null, null); + } + + public InvalidRequestError_v0_3(Integer code, String message, Object data) { + super( + defaultIfNull(code, A2AErrorCodes_v0_3.INVALID_REQUEST_ERROR_CODE), + defaultIfNull(message, "Request payload validation error"), + data); + } + + public InvalidRequestError_v0_3(String message) { + this(null, message, null); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONErrorResponse_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONErrorResponse_v0_3.java new file mode 100644 index 000000000..acf16d9a8 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONErrorResponse_v0_3.java @@ -0,0 +1,19 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * A simplified error response wrapper for non-JSON-RPC error scenarios. + *

+ * This record provides a lightweight error response format for cases where + * a full JSON-RPC error structure is not appropriate, such as HTTP-level + * errors or transport-layer failures. + *

+ * Unlike {@link JSONRPCErrorResponse_v0_3}, this is not part of the JSON-RPC 2.0 + * specification but serves as a utility for simpler error reporting in the + * A2A Java SDK implementation. + * + * @param error a human-readable error message + * @see JSONRPCErrorResponse_v0_3 + * @see JSONRPCError_v0_3 + */ +public record JSONErrorResponse_v0_3(String error) { +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONParseError_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONParseError_v0_3.java new file mode 100644 index 000000000..78c1d398b --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONParseError_v0_3.java @@ -0,0 +1,50 @@ +package org.a2aproject.sdk.compat03.spec; + + +import static org.a2aproject.sdk.compat03.util.Utils_v0_3.defaultIfNull; + +/** + * JSON-RPC error indicating that the server received invalid JSON that could not be parsed. + *

+ * This error is returned when the request payload is not valid JSON, such as malformed syntax, + * unexpected tokens, or encoding issues. This is distinct from {@link InvalidRequestError_v0_3}, + * which indicates structurally valid JSON that doesn't conform to the JSON-RPC specification. + *

+ * Corresponds to JSON-RPC 2.0 error code {@code -32700}. + *

+ * Usage example: + *

{@code
+ * try {
+ *     objectMapper.readValue(payload, JSONRPCRequest.class);
+ * } catch (org.a2aproject.sdk.compat03.json.JsonProcessingException e) {
+ *     throw new JSONParseError("Malformed JSON: " + e.getMessage());
+ * }
+ * }
+ * + * @see JSONRPCError_v0_3 for the base error class + * @see A2AError_v0_3 for the error marker interface + * @see InvalidRequestError_v0_3 for structurally valid but invalid requests + * @see JSON-RPC 2.0 Error Codes + */ +public class JSONParseError_v0_3 extends JSONRPCError_v0_3 implements A2AError_v0_3 { + + public final static Integer DEFAULT_CODE = -32700; + + public JSONParseError_v0_3() { + this(null, null, null); + } + + public JSONParseError_v0_3(String message) { + this(null, message, null); + } + + public JSONParseError_v0_3( + Integer code, + String message, + Object data) { + super( + defaultIfNull(code, DEFAULT_CODE), + defaultIfNull(message, "Invalid JSON payload"), + data); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONRPCErrorResponse_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONRPCErrorResponse_v0_3.java new file mode 100644 index 000000000..87548fd73 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONRPCErrorResponse_v0_3.java @@ -0,0 +1,33 @@ +package org.a2aproject.sdk.compat03.spec; + +import org.a2aproject.sdk.util.Assert; + +/** + * A JSON RPC error response. + */ +public final class JSONRPCErrorResponse_v0_3 extends JSONRPCResponse_v0_3 { + + /** + * Constructs a JSON-RPC error response with all fields. + *

+ * This constructor is used for JSON deserialization. + * + * @param jsonrpc the JSON-RPC version (must be "2.0") + * @param id the request ID, or null if the ID could not be determined from the request + * @param result must be null for error responses + * @param error the error object describing what went wrong (required) + * @throws IllegalArgumentException if error is null + */ + public JSONRPCErrorResponse_v0_3(String jsonrpc, Object id, Void result, JSONRPCError_v0_3 error) { + super(jsonrpc, id, result, error, Void.class); + Assert.checkNotNullParam("error", error); + } + + public JSONRPCErrorResponse_v0_3(Object id, JSONRPCError_v0_3 error) { + this(null, id, null, error); + } + + public JSONRPCErrorResponse_v0_3(JSONRPCError_v0_3 error) { + this(null, null, null, error); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONRPCError_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONRPCError_v0_3.java new file mode 100644 index 000000000..3dcde042a --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONRPCError_v0_3.java @@ -0,0 +1,49 @@ +package org.a2aproject.sdk.compat03.spec; + + +import org.a2aproject.sdk.util.Assert; + +/** + * Represents a JSON-RPC 2.0 Error object, included in an error response. + */ +public class JSONRPCError_v0_3 extends Error implements Event_v0_3, A2AError_v0_3 { + + private final Integer code; + private final Object data; + + /** + * Constructs a JSON-RPC error with the specified code, message, and optional data. + *

+ * This constructor is used by Jackson for JSON deserialization. + * + * @param code the numeric error code (required, see JSON-RPC 2.0 spec for standard codes) + * @param message the human-readable error message (required) + * @param data additional error information, structure defined by the error code (optional) + * @throws IllegalArgumentException if code or message is null + */ + public JSONRPCError_v0_3(Integer code, String message, Object data) { + super(message); + Assert.checkNotNullParam("code", code); + Assert.checkNotNullParam("message", message); + this.code = code; + this.data = data; + } + + /** + * Gets the error code + * + * @return the error code + */ + public Integer getCode() { + return code; + } + + /** + * Gets the data associated with the error. + * + * @return the data. May be {@code null} + */ + public Object getData() { + return data; + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONRPCMessage_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONRPCMessage_v0_3.java new file mode 100644 index 000000000..10e4da716 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONRPCMessage_v0_3.java @@ -0,0 +1,13 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * Defines the base structure for any JSON-RPC 2.0 request, response, or notification. + */ +public sealed interface JSONRPCMessage_v0_3 permits JSONRPCRequest_v0_3, JSONRPCResponse_v0_3 { + + String JSONRPC_VERSION = "2.0"; + + String getJsonrpc(); + Object getId(); + +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONRPCRequest_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONRPCRequest_v0_3.java new file mode 100644 index 000000000..fc5fc58bf --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONRPCRequest_v0_3.java @@ -0,0 +1,47 @@ +package org.a2aproject.sdk.compat03.spec; + +import static org.a2aproject.sdk.compat03.util.Utils_v0_3.defaultIfNull; + +import org.a2aproject.sdk.util.Assert; + +/** + * Represents a JSONRPC request. + */ +public abstract sealed class JSONRPCRequest_v0_3 implements JSONRPCMessage_v0_3 permits NonStreamingJSONRPCRequest_v0_3, StreamingJSONRPCRequest_v0_3 { + + protected String jsonrpc; + protected Object id; + protected String method; + protected T params; + + public JSONRPCRequest_v0_3() { + } + + public JSONRPCRequest_v0_3(String jsonrpc, Object id, String method, T params) { + Assert.checkNotNullParam("jsonrpc", jsonrpc); + Assert.checkNotNullParam("method", method); + Assert.isNullOrStringOrInteger(id); + this.jsonrpc = defaultIfNull(jsonrpc, JSONRPC_VERSION); + this.id = id; + this.method = method; + this.params = params; + } + + @Override + public String getJsonrpc() { + return this.jsonrpc; + } + + @Override + public Object getId() { + return this.id; + } + + public String getMethod() { + return this.method; + } + + public T getParams() { + return this.params; + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONRPCResponse_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONRPCResponse_v0_3.java new file mode 100644 index 000000000..58822eea1 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONRPCResponse_v0_3.java @@ -0,0 +1,57 @@ +package org.a2aproject.sdk.compat03.spec; + +import static org.a2aproject.sdk.compat03.util.Utils_v0_3.defaultIfNull; + +import org.a2aproject.sdk.util.Assert; + +/** + * Represents a JSONRPC response. + */ +public abstract sealed class JSONRPCResponse_v0_3 implements JSONRPCMessage_v0_3 permits SendStreamingMessageResponse_v0_3, + GetTaskResponse_v0_3, CancelTaskResponse_v0_3, SetTaskPushNotificationConfigResponse_v0_3, GetTaskPushNotificationConfigResponse_v0_3, + SendMessageResponse_v0_3, DeleteTaskPushNotificationConfigResponse_v0_3, ListTaskPushNotificationConfigResponse_v0_3, JSONRPCErrorResponse_v0_3, + GetAuthenticatedExtendedCardResponse_v0_3 { + + protected String jsonrpc; + protected Object id; + protected T result; + protected JSONRPCError_v0_3 error; + + public JSONRPCResponse_v0_3() { + } + + public JSONRPCResponse_v0_3(String jsonrpc, Object id, T result, JSONRPCError_v0_3 error, Class resultType) { + if (jsonrpc != null && ! jsonrpc.equals(JSONRPC_VERSION)) { + throw new IllegalArgumentException("Invalid JSON-RPC protocol version"); + } + if (error != null && result != null) { + throw new IllegalArgumentException("Invalid JSON-RPC error response"); + } + if (error == null && result == null && ! Void.class.equals(resultType)) { + throw new IllegalArgumentException("Invalid JSON-RPC success response"); + } + Assert.isNullOrStringOrInteger(id); + this.jsonrpc = defaultIfNull(jsonrpc, JSONRPC_VERSION); + this.id = id; + this.result = result; + this.error = error; + } + + @Override + public String getJsonrpc() { + return this.jsonrpc; + } + + @Override + public Object getId() { + return this.id; + } + + public T getResult() { + return this.result; + } + + public JSONRPCError_v0_3 getError() { + return this.error; + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JsonrpcId_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JsonrpcId_v0_3.java new file mode 100644 index 000000000..1817c46f2 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JsonrpcId_v0_3.java @@ -0,0 +1,4 @@ +package org.a2aproject.sdk.compat03.spec; + +public interface JsonrpcId_v0_3 { +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/ListTaskPushNotificationConfigParams_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/ListTaskPushNotificationConfigParams_v0_3.java new file mode 100644 index 000000000..b68456343 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/ListTaskPushNotificationConfigParams_v0_3.java @@ -0,0 +1,19 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.Map; + +import org.a2aproject.sdk.util.Assert; + +/** + * Parameters for getting list of pushNotificationConfigurations associated with a Task. + */ +public record ListTaskPushNotificationConfigParams_v0_3(String id, Map metadata) { + + public ListTaskPushNotificationConfigParams_v0_3 { + Assert.checkNotNullParam("id", id); + } + + public ListTaskPushNotificationConfigParams_v0_3(String id) { + this(id, null); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/ListTaskPushNotificationConfigRequest_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/ListTaskPushNotificationConfigRequest_v0_3.java new file mode 100644 index 000000000..f8c1b597e --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/ListTaskPushNotificationConfigRequest_v0_3.java @@ -0,0 +1,67 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.UUID; + +import org.a2aproject.sdk.util.Assert; +import org.a2aproject.sdk.compat03.util.Utils_v0_3; + +/** + * A list task push notification config request. + */ +public final class ListTaskPushNotificationConfigRequest_v0_3 extends NonStreamingJSONRPCRequest_v0_3 { + + public static final String METHOD = "tasks/pushNotificationConfig/list"; + + public ListTaskPushNotificationConfigRequest_v0_3(String jsonrpc, Object id, String method, ListTaskPushNotificationConfigParams_v0_3 params) { + if (jsonrpc != null && ! jsonrpc.equals(JSONRPC_VERSION)) { + throw new IllegalArgumentException("Invalid JSON-RPC protocol version"); + } + Assert.checkNotNullParam("method", method); + if (! method.equals(METHOD)) { + throw new IllegalArgumentException("Invalid ListTaskPushNotificationConfigRequest method"); + } + Assert.isNullOrStringOrInteger(id); + this.jsonrpc = Utils_v0_3.defaultIfNull(jsonrpc, JSONRPC_VERSION); + this.id = id; + this.method = method; + this.params = params; + } + + public ListTaskPushNotificationConfigRequest_v0_3(String id, ListTaskPushNotificationConfigParams_v0_3 params) { + this(null, id, METHOD, params); + } + + public static class Builder { + private String jsonrpc; + private Object id; + private String method; + private ListTaskPushNotificationConfigParams_v0_3 params; + + public Builder jsonrpc(String jsonrpc) { + this.jsonrpc = jsonrpc; + return this; + } + + public Builder id(Object id) { + this.id = id; + return this; + } + + public Builder method(String method) { + this.method = method; + return this; + } + + public Builder params(ListTaskPushNotificationConfigParams_v0_3 params) { + this.params = params; + return this; + } + + public ListTaskPushNotificationConfigRequest_v0_3 build() { + if (id == null) { + id = UUID.randomUUID().toString(); + } + return new ListTaskPushNotificationConfigRequest_v0_3(jsonrpc, id, method, params); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/ListTaskPushNotificationConfigResponse_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/ListTaskPushNotificationConfigResponse_v0_3.java new file mode 100644 index 000000000..447fe02de --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/ListTaskPushNotificationConfigResponse_v0_3.java @@ -0,0 +1,22 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.List; + +/** + * A response for a list task push notification config request. + */ +public final class ListTaskPushNotificationConfigResponse_v0_3 extends JSONRPCResponse_v0_3> { + + public ListTaskPushNotificationConfigResponse_v0_3(String jsonrpc, Object id, List result, JSONRPCError_v0_3 error) { + super(jsonrpc, id, result, error, (Class>) (Class) List.class); + } + + public ListTaskPushNotificationConfigResponse_v0_3(Object id, JSONRPCError_v0_3 error) { + this(null, id, null, error); + } + + public ListTaskPushNotificationConfigResponse_v0_3(Object id, List result) { + this(null, id, result, null); + } + +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/MessageSendConfiguration_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/MessageSendConfiguration_v0_3.java new file mode 100644 index 000000000..6ca4cef69 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/MessageSendConfiguration_v0_3.java @@ -0,0 +1,54 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.List; + +import org.jspecify.annotations.NonNull; +import org.jspecify.annotations.Nullable; + +/** + * Defines configuration options for a `message/send` or `message/stream` request. + */ +public record MessageSendConfiguration_v0_3(List acceptedOutputModes, Integer historyLength, + PushNotificationConfig_v0_3 pushNotificationConfig, Boolean blocking) { + + public MessageSendConfiguration_v0_3 { + if (historyLength != null && historyLength < 0) { + throw new IllegalArgumentException("Invalid history length"); + } + } + + public static class Builder { + + List acceptedOutputModes; + Integer historyLength; + PushNotificationConfig_v0_3 pushNotificationConfig; + Boolean blocking = true; + + public Builder acceptedOutputModes(List acceptedOutputModes) { + this.acceptedOutputModes = acceptedOutputModes; + return this; + } + + public Builder pushNotificationConfig(@Nullable PushNotificationConfig_v0_3 pushNotificationConfig) { + this.pushNotificationConfig = pushNotificationConfig; + return this; + } + + public Builder historyLength(@Nullable Integer historyLength) { + if (historyLength != null && historyLength < 0) { + throw new IllegalArgumentException("Invalid history length"); + } + this.historyLength = historyLength; + return this; + } + + public Builder blocking(@NonNull Boolean blocking) { + this.blocking = blocking; + return this; + } + + public MessageSendConfiguration_v0_3 build() { + return new MessageSendConfiguration_v0_3(acceptedOutputModes, historyLength, pushNotificationConfig, blocking); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/MessageSendParams_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/MessageSendParams_v0_3.java new file mode 100644 index 000000000..3b5571c52 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/MessageSendParams_v0_3.java @@ -0,0 +1,47 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.Map; + +import org.a2aproject.sdk.util.Assert; + +/** + * Defines the parameters for a request to send a message to an agent. This can be used + * to create a new task, continue an existing one, or restart a task. + */ +public record MessageSendParams_v0_3(Message_v0_3 message, MessageSendConfiguration_v0_3 configuration, + Map metadata) { + + public MessageSendParams_v0_3 { + Assert.checkNotNullParam("message", message); + } + + public void check() { + Assert.checkNotNullParam("message", message); + message.check(); + } + + public static class Builder { + Message_v0_3 message; + MessageSendConfiguration_v0_3 configuration; + Map metadata; + + public Builder message(Message_v0_3 message) { + this.message = message; + return this; + } + + public Builder configuration(MessageSendConfiguration_v0_3 configuration) { + this.configuration = configuration; + return this; + } + + public Builder metadata(Map metadata) { + this.metadata = metadata; + return this; + } + + public MessageSendParams_v0_3 build() { + return new MessageSendParams_v0_3(message, configuration, metadata); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/Message_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/Message_v0_3.java new file mode 100644 index 000000000..16dc0ad8e --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/Message_v0_3.java @@ -0,0 +1,209 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import org.a2aproject.sdk.util.Assert; + +/** + * Represents a single message in the conversation between a user and an agent. + */ +public final class Message_v0_3 implements EventKind_v0_3, StreamingEventKind_v0_3 { + + public static final String MESSAGE = "message"; + private final Role role; + private final List> parts; + private final String messageId; + private String contextId; + private String taskId; + private final Map metadata; + private final String kind; + private final List referenceTaskIds; + private final List extensions; + + public Message_v0_3(Role role, List> parts, String messageId, String contextId, String taskId, + List referenceTaskIds, Map metadata, List extensions) { + this(role, parts, messageId, contextId, taskId, referenceTaskIds, metadata, extensions, MESSAGE); + } + + public Message_v0_3(Role role, List> parts, + String messageId, String contextId, + String taskId, List referenceTaskIds, + Map metadata, List extensions, + String kind) { + Assert.checkNotNullParam("kind", kind); + Assert.checkNotNullParam("parts", parts); + if (parts.isEmpty()) { + throw new IllegalArgumentException("Parts cannot be empty"); + } + Assert.checkNotNullParam("role", role); + if (! kind.equals(MESSAGE)) { + throw new IllegalArgumentException("Invalid Message"); + } + Assert.checkNotNullParam("messageId", messageId); + this.role = role; + this.parts = parts; + this.messageId = messageId; + this.contextId = contextId; + this.taskId = taskId; + this.referenceTaskIds = referenceTaskIds; + this.metadata = metadata; + this.extensions = extensions; + this.kind = kind; + } + + public void check() { + Assert.checkNotNullParam("kind", kind); + Assert.checkNotNullParam("parts", parts); + if (parts.isEmpty()) { + throw new IllegalArgumentException("Parts cannot be empty"); + } + Assert.checkNotNullParam("role", role); + if (!kind.equals(MESSAGE)) { + throw new IllegalArgumentException("Invalid Message"); + } + Assert.checkNotNullParam("messageId", messageId); + } + + public Role getRole() { + return role; + } + + public List> getParts() { + return parts; + } + + public String getMessageId() { + return messageId; + } + + public String getContextId() { + return contextId; + } + + public String getTaskId() { + return taskId; + } + + public Map getMetadata() { + return metadata; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public void setContextId(String contextId) { + this.contextId = contextId; + } + + public List getReferenceTaskIds() { + return referenceTaskIds; + } + + public List getExtensions() { + return extensions; + } + + @Override + public String getKind() { + return kind; + } + + public enum Role { + USER("user"), + AGENT("agent"); + + private final String role; + + Role(String role) { + this.role = role; + } + + /** + * Returns the string representation of the role for JSON serialization. + * + * @return the role as a string ("user" or "agent") + */ + public String asString() { + return this.role; + } + } + + public static class Builder { + + private Role role; + private List> parts; + private String messageId; + private String contextId; + private String taskId; + private List referenceTaskIds; + private Map metadata; + private List extensions; + + public Builder() { + } + + public Builder(Message_v0_3 message) { + role = message.role; + parts = message.parts; + messageId = message.messageId; + contextId = message.contextId; + taskId = message.taskId; + referenceTaskIds = message.referenceTaskIds; + metadata = message.metadata; + extensions = message.extensions; + } + + public Builder role(Role role) { + this.role = role; + return this; + } + + public Builder parts(List> parts) { + this.parts = parts; + return this; + } + + public Builder parts(Part_v0_3...parts) { + this.parts = List.of(parts); + return this; + } + + public Builder messageId(String messageId) { + this.messageId = messageId; + return this; + } + + public Builder contextId(String contextId) { + this.contextId = contextId; + return this; + } + + public Builder taskId(String taskId) { + this.taskId = taskId; + return this; + } + + public Builder referenceTaskIds(List referenceTaskIds) { + this.referenceTaskIds = referenceTaskIds; + return this; + } + + public Builder metadata(Map metadata) { + this.metadata = metadata; + return this; + } + + public Builder extensions(List extensions) { + this.extensions = (extensions == null) ? null : List.copyOf(extensions); + return this; + } + + public Message_v0_3 build() { + return new Message_v0_3(role, parts, messageId == null ? UUID.randomUUID().toString() : messageId, + contextId, taskId, referenceTaskIds, metadata, extensions); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/MethodNotFoundError_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/MethodNotFoundError_v0_3.java new file mode 100644 index 000000000..1ceba9637 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/MethodNotFoundError_v0_3.java @@ -0,0 +1,20 @@ +package org.a2aproject.sdk.compat03.spec; + +import static org.a2aproject.sdk.compat03.spec.A2AErrorCodes_v0_3.METHOD_NOT_FOUND_ERROR_CODE; +import static org.a2aproject.sdk.compat03.util.Utils_v0_3.defaultIfNull; + +/** + * An error indicating that the requested method does not exist or is not available. + */ +public class MethodNotFoundError_v0_3 extends JSONRPCError_v0_3 { + + public final static Integer DEFAULT_CODE = METHOD_NOT_FOUND_ERROR_CODE; + + public MethodNotFoundError_v0_3(Integer code, String message, Object data) { + super(defaultIfNull(code, METHOD_NOT_FOUND_ERROR_CODE), defaultIfNull(message, "Method not found"), data); + } + + public MethodNotFoundError_v0_3() { + this(METHOD_NOT_FOUND_ERROR_CODE, null, null); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/MethodNotFoundJsonMappingException_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/MethodNotFoundJsonMappingException_v0_3.java new file mode 100644 index 000000000..819b72b4d --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/MethodNotFoundJsonMappingException_v0_3.java @@ -0,0 +1,12 @@ +package org.a2aproject.sdk.compat03.spec; + +public class MethodNotFoundJsonMappingException_v0_3 extends IdJsonMappingException_v0_3 { + + public MethodNotFoundJsonMappingException_v0_3(String msg, Object id) { + super(msg, id); + } + + public MethodNotFoundJsonMappingException_v0_3(String msg, Throwable cause, Object id) { + super(msg, cause, id); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/MutualTLSSecurityScheme_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/MutualTLSSecurityScheme_v0_3.java new file mode 100644 index 000000000..dd7ca56ec --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/MutualTLSSecurityScheme_v0_3.java @@ -0,0 +1,40 @@ +package org.a2aproject.sdk.compat03.spec; + +import org.a2aproject.sdk.util.Assert; + +/** + * Defines a security scheme using mTLS authentication. + */ +public final class MutualTLSSecurityScheme_v0_3 implements SecurityScheme_v0_3 { + + public static final String MUTUAL_TLS = "mutualTLS"; + private final String description; + private final String type; + + public MutualTLSSecurityScheme_v0_3(String description) { + this(description, MUTUAL_TLS); + } + + public MutualTLSSecurityScheme_v0_3() { + this(null, MUTUAL_TLS); + } + + public MutualTLSSecurityScheme_v0_3(String description, String type) { + Assert.checkNotNullParam("type", type); + if (!type.equals(MUTUAL_TLS)) { + throw new IllegalArgumentException("Invalid type for MutualTLSSecurityScheme"); + } + this.description = description; + this.type = type; + } + + @Override + public String getDescription() { + return description; + } + + public String getType() { + return type; + } + +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/NonStreamingJSONRPCRequest_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/NonStreamingJSONRPCRequest_v0_3.java new file mode 100644 index 000000000..972a1fb39 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/NonStreamingJSONRPCRequest_v0_3.java @@ -0,0 +1,10 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * Represents a non-streaming JSON-RPC request. + */ +public abstract sealed class NonStreamingJSONRPCRequest_v0_3 extends JSONRPCRequest_v0_3 permits GetTaskRequest_v0_3, + CancelTaskRequest_v0_3, SetTaskPushNotificationConfigRequest_v0_3, GetTaskPushNotificationConfigRequest_v0_3, + SendMessageRequest_v0_3, DeleteTaskPushNotificationConfigRequest_v0_3, ListTaskPushNotificationConfigRequest_v0_3, + GetAuthenticatedExtendedCardRequest_v0_3 { +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/OAuth2SecurityScheme_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/OAuth2SecurityScheme_v0_3.java new file mode 100644 index 000000000..c0f1de56e --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/OAuth2SecurityScheme_v0_3.java @@ -0,0 +1,73 @@ +package org.a2aproject.sdk.compat03.spec; + +import org.a2aproject.sdk.util.Assert; + +/** + * Defines a security scheme using OAuth 2.0. + */ +public final class OAuth2SecurityScheme_v0_3 implements SecurityScheme_v0_3 { + + public static final String OAUTH2 = "oauth2"; + private final OAuthFlows_v0_3 flows; + private final String description; + private final String type; + private final String oauth2MetadataUrl; + + public OAuth2SecurityScheme_v0_3(OAuthFlows_v0_3 flows, String description, String oauth2MetadataUrl) { + this(flows, description, oauth2MetadataUrl, OAUTH2); + } + + public OAuth2SecurityScheme_v0_3(OAuthFlows_v0_3 flows, String description, String oauth2MetadataUrl, String type) { + Assert.checkNotNullParam("flows", flows); + Assert.checkNotNullParam("type", type); + if (!type.equals(OAUTH2)) { + throw new IllegalArgumentException("Invalid type for OAuth2SecurityScheme"); + } + this.flows = flows; + this.description = description; + this.oauth2MetadataUrl = oauth2MetadataUrl; + this.type = type; + } + + @Override + public String getDescription() { + return description; + } + + public OAuthFlows_v0_3 getFlows() { + return flows; + } + + public String getType() { + return type; + } + + public String getOauth2MetadataUrl() { + return oauth2MetadataUrl; + } + + public static class Builder { + private OAuthFlows_v0_3 flows; + private String description; + private String oauth2MetadataUrl; + + public Builder flows(OAuthFlows_v0_3 flows) { + this.flows = flows; + return this; + } + + public Builder description(String description) { + this.description = description; + return this; + } + + public Builder oauth2MetadataUrl(String oauth2MetadataUrl) { + this.oauth2MetadataUrl = oauth2MetadataUrl; + return this; + } + + public OAuth2SecurityScheme_v0_3 build() { + return new OAuth2SecurityScheme_v0_3(flows, description, oauth2MetadataUrl); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/OAuthFlows_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/OAuthFlows_v0_3.java new file mode 100644 index 000000000..1acf64c57 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/OAuthFlows_v0_3.java @@ -0,0 +1,39 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * Defines the configuration for the supported OAuth 2.0 flows. + */ +public record OAuthFlows_v0_3(AuthorizationCodeOAuthFlow_v0_3 authorizationCode, ClientCredentialsOAuthFlow_v0_3 clientCredentials, + ImplicitOAuthFlow_v0_3 implicit, PasswordOAuthFlow_v0_3 password) { + + public static class Builder { + private AuthorizationCodeOAuthFlow_v0_3 authorizationCode; + private ClientCredentialsOAuthFlow_v0_3 clientCredentials; + private ImplicitOAuthFlow_v0_3 implicit; + private PasswordOAuthFlow_v0_3 password; + + public Builder authorizationCode(AuthorizationCodeOAuthFlow_v0_3 authorizationCode) { + this.authorizationCode = authorizationCode; + return this; + } + + public Builder clientCredentials(ClientCredentialsOAuthFlow_v0_3 clientCredentials) { + this.clientCredentials = clientCredentials; + return this; + } + + public Builder implicit(ImplicitOAuthFlow_v0_3 implicit) { + this.implicit = implicit; + return this; + } + + public Builder password(PasswordOAuthFlow_v0_3 password) { + this.password = password; + return this; + } + + public OAuthFlows_v0_3 build() { + return new OAuthFlows_v0_3(authorizationCode, clientCredentials, implicit, password); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/OpenIdConnectSecurityScheme_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/OpenIdConnectSecurityScheme_v0_3.java new file mode 100644 index 000000000..81cbcc4c4 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/OpenIdConnectSecurityScheme_v0_3.java @@ -0,0 +1,62 @@ +package org.a2aproject.sdk.compat03.spec; + +import org.a2aproject.sdk.util.Assert; + +/** + * Defines a security scheme using OpenID Connect. + */ +public final class OpenIdConnectSecurityScheme_v0_3 implements SecurityScheme_v0_3 { + + public static final String OPENID_CONNECT = "openIdConnect"; + private final String openIdConnectUrl; + private final String description; + private final String type; + + public OpenIdConnectSecurityScheme_v0_3(String openIdConnectUrl, String description) { + this(openIdConnectUrl, description, OPENID_CONNECT); + } + + public OpenIdConnectSecurityScheme_v0_3(String openIdConnectUrl, String description, String type) { + Assert.checkNotNullParam("type", type); + Assert.checkNotNullParam("openIdConnectUrl", openIdConnectUrl); + if (!type.equals(OPENID_CONNECT)) { + throw new IllegalArgumentException("Invalid type for OpenIdConnectSecurityScheme"); + } + this.openIdConnectUrl = openIdConnectUrl; + this.description = description; + this.type = type; + } + + @Override + public String getDescription() { + return description; + } + + public String getOpenIdConnectUrl() { + return openIdConnectUrl; + } + + public String getType() { + return type; + } + + public static class Builder { + private String openIdConnectUrl; + private String description; + + public Builder openIdConnectUrl(String openIdConnectUrl) { + this.openIdConnectUrl = openIdConnectUrl; + return this; + } + + public Builder description(String description) { + this.description = description; + return this; + } + + public OpenIdConnectSecurityScheme_v0_3 build() { + return new OpenIdConnectSecurityScheme_v0_3(openIdConnectUrl, description); + } + } + +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/Part_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/Part_v0_3.java new file mode 100644 index 000000000..79d3df4d7 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/Part_v0_3.java @@ -0,0 +1,35 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.Map; + +/** + * A fundamental unit with a Message or Artifact. + * @param the type of unit + */ +public abstract class Part_v0_3 { + public enum Kind { + TEXT("text"), + FILE("file"), + DATA("data"); + + private final String kind; + + Kind(String kind) { + this.kind = kind; + } + + /** + * Returns the string representation of the kind for JSON serialization. + * + * @return the kind as a string + */ + public String asString() { + return this.kind; + } + } + + public abstract Kind getKind(); + + public abstract Map getMetadata(); + +} \ No newline at end of file diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/PasswordOAuthFlow_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/PasswordOAuthFlow_v0_3.java new file mode 100644 index 000000000..eb1dec150 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/PasswordOAuthFlow_v0_3.java @@ -0,0 +1,16 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.Map; + +import org.a2aproject.sdk.util.Assert; + +/** + * Defines configuration details for the OAuth 2.0 Resource Owner Password flow. + */ +public record PasswordOAuthFlow_v0_3(String refreshUrl, Map scopes, String tokenUrl) { + + public PasswordOAuthFlow_v0_3 { + Assert.checkNotNullParam("scopes", scopes); + Assert.checkNotNullParam("tokenUrl", tokenUrl); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/PushNotificationAuthenticationInfo_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/PushNotificationAuthenticationInfo_v0_3.java new file mode 100644 index 000000000..e4f9d235a --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/PushNotificationAuthenticationInfo_v0_3.java @@ -0,0 +1,14 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.List; +import org.a2aproject.sdk.util.Assert; + +/** + * Defines authentication details for a push notification endpoint. + */ +public record PushNotificationAuthenticationInfo_v0_3(List schemes, String credentials) { + + public PushNotificationAuthenticationInfo_v0_3 { + Assert.checkNotNullParam("schemes", schemes); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/PushNotificationConfig_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/PushNotificationConfig_v0_3.java new file mode 100644 index 000000000..de8c7a68e --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/PushNotificationConfig_v0_3.java @@ -0,0 +1,54 @@ +package org.a2aproject.sdk.compat03.spec; + +import org.a2aproject.sdk.util.Assert; + +/** + * Defines the configuration for setting up push notifications for task updates. + */ +public record PushNotificationConfig_v0_3(String url, String token, PushNotificationAuthenticationInfo_v0_3 authentication, String id) { + + public PushNotificationConfig_v0_3 { + Assert.checkNotNullParam("url", url); + } + + public static class Builder { + private String url; + private String token; + private PushNotificationAuthenticationInfo_v0_3 authentication; + private String id; + + public Builder() { + } + + public Builder(PushNotificationConfig_v0_3 notificationConfig) { + this.url = notificationConfig.url; + this.token = notificationConfig.token; + this.authentication = notificationConfig.authentication; + this.id = notificationConfig.id; + } + + public Builder url(String url) { + this.url = url; + return this; + } + + public Builder token(String token) { + this.token = token; + return this; + } + + public Builder authenticationInfo(PushNotificationAuthenticationInfo_v0_3 authenticationInfo) { + this.authentication = authenticationInfo; + return this; + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public PushNotificationConfig_v0_3 build() { + return new PushNotificationConfig_v0_3(url, token, authentication, id); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/PushNotificationNotSupportedError_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/PushNotificationNotSupportedError_v0_3.java new file mode 100644 index 000000000..1b660e287 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/PushNotificationNotSupportedError_v0_3.java @@ -0,0 +1,25 @@ +package org.a2aproject.sdk.compat03.spec; + +import static org.a2aproject.sdk.compat03.util.Utils_v0_3.defaultIfNull; + +/** + * An A2A-specific error indicating that the agent does not support push notifications. + */ +public class PushNotificationNotSupportedError_v0_3 extends JSONRPCError_v0_3 { + + public final static Integer DEFAULT_CODE = -32003; + + public PushNotificationNotSupportedError_v0_3() { + this(null, null, null); + } + + public PushNotificationNotSupportedError_v0_3( + Integer code, + String message, + Object data) { + super( + defaultIfNull(code, DEFAULT_CODE), + defaultIfNull(message, "Push Notification is not supported"), + data); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SecurityScheme_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SecurityScheme_v0_3.java new file mode 100644 index 000000000..36903e849 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SecurityScheme_v0_3.java @@ -0,0 +1,11 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * Defines a security scheme that can be used to secure an agent's endpoints. + * This is a discriminated union type based on the OpenAPI 3.0 Security Scheme Object. + */ +public sealed interface SecurityScheme_v0_3 permits APIKeySecurityScheme_v0_3, HTTPAuthSecurityScheme_v0_3, OAuth2SecurityScheme_v0_3, + OpenIdConnectSecurityScheme_v0_3, MutualTLSSecurityScheme_v0_3 { + + String getDescription(); +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SendMessageRequest_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SendMessageRequest_v0_3.java new file mode 100644 index 000000000..c57a6cba9 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SendMessageRequest_v0_3.java @@ -0,0 +1,100 @@ +package org.a2aproject.sdk.compat03.spec; + +import static org.a2aproject.sdk.compat03.util.Utils_v0_3.defaultIfNull; + +import java.util.UUID; + +import org.a2aproject.sdk.util.Assert; + +/** + * Used to send a message request. + */ +public final class SendMessageRequest_v0_3 extends NonStreamingJSONRPCRequest_v0_3 { + + public static final String METHOD = "message/send"; + + /** + * Constructs a SendMessageRequest with the specified JSON-RPC fields. + *

+ * This constructor is used for JSON deserialization and validates + * that the method name is exactly "SendMessage". + * + * @param jsonrpc the JSON-RPC version (must be "2.0") + * @param id the request correlation identifier (String, Integer, or null) + * @param method the method name (must be {@value #METHOD}) + * @param params the message send parameters (required) + * @throws IllegalArgumentException if validation fails + */ + public SendMessageRequest_v0_3(String jsonrpc, Object id, String method, MessageSendParams_v0_3 params) { + if (jsonrpc == null || jsonrpc.isEmpty()) { + throw new IllegalArgumentException("JSON-RPC protocol version cannot be null or empty"); + } + if (jsonrpc != null && ! jsonrpc.equals(JSONRPC_VERSION)) { + throw new IllegalArgumentException("Invalid JSON-RPC protocol version"); + } + Assert.checkNotNullParam("method", method); + if (! method.equals(METHOD)) { + throw new IllegalArgumentException("Invalid SendMessageRequest method"); + } + Assert.checkNotNullParam("params", params); + Assert.isNullOrStringOrInteger(id); + this.jsonrpc = defaultIfNull(jsonrpc, JSONRPC_VERSION); + this.id = id; + this.method = method; + this.params = params; + } + + public void check() { + if (jsonrpc == null || jsonrpc.isEmpty()) { + throw new IllegalArgumentException("JSON-RPC protocol version cannot be null or empty"); + } + if (jsonrpc != null && !jsonrpc.equals(JSONRPC_VERSION)) { + throw new IllegalArgumentException("Invalid JSON-RPC protocol version"); + } + Assert.checkNotNullParam("method", method); + if (!method.equals(METHOD)) { + throw new IllegalArgumentException("Invalid SendMessageRequest method"); + } + Assert.checkNotNullParam("params", params); + Assert.isNullOrStringOrInteger(id); + params.check(); + } + + public SendMessageRequest_v0_3(Object id, MessageSendParams_v0_3 params) { + this(JSONRPC_VERSION, id, METHOD, params); + } + + public static class Builder { + private String jsonrpc; + private Object id; + private String method; + private MessageSendParams_v0_3 params; + + public Builder jsonrpc(String jsonrpc) { + this.jsonrpc = jsonrpc; + return this; + } + + public Builder id(Object id) { + this.id = id; + return this; + } + + public Builder method(String method) { + this.method = method; + return this; + } + + public Builder params(MessageSendParams_v0_3 params) { + this.params = params; + return this; + } + + public SendMessageRequest_v0_3 build() { + if (id == null) { + id = UUID.randomUUID().toString(); + } + return new SendMessageRequest_v0_3(jsonrpc, id, method, params); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SendMessageResponse_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SendMessageResponse_v0_3.java new file mode 100644 index 000000000..b779bca00 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SendMessageResponse_v0_3.java @@ -0,0 +1,19 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * The response after receiving a send message request. + */ +public final class SendMessageResponse_v0_3 extends JSONRPCResponse_v0_3 { + + public SendMessageResponse_v0_3(String jsonrpc, Object id, EventKind_v0_3 result, JSONRPCError_v0_3 error) { + super(jsonrpc, id, result, error, EventKind_v0_3.class); + } + + public SendMessageResponse_v0_3(Object id, EventKind_v0_3 result) { + this(null, id, result, null); + } + + public SendMessageResponse_v0_3(Object id, JSONRPCError_v0_3 error) { + this(null, id, null, error); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SendStreamingMessageRequest_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SendStreamingMessageRequest_v0_3.java new file mode 100644 index 000000000..91e7f3260 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SendStreamingMessageRequest_v0_3.java @@ -0,0 +1,82 @@ +package org.a2aproject.sdk.compat03.spec; + +import static org.a2aproject.sdk.compat03.util.Utils_v0_3.defaultIfNull; + +import org.a2aproject.sdk.util.Assert; + +import java.util.UUID; + +/** + * Used to initiate a task with streaming. + */ +public final class SendStreamingMessageRequest_v0_3 extends StreamingJSONRPCRequest_v0_3 { + + public static final String METHOD = "message/stream"; + + public SendStreamingMessageRequest_v0_3(String jsonrpc, Object id, String method, MessageSendParams_v0_3 params) { + if (jsonrpc != null && ! jsonrpc.equals(JSONRPC_VERSION)) { + throw new IllegalArgumentException("Invalid JSON-RPC protocol version"); + } + Assert.checkNotNullParam("method", method); + if (! method.equals(METHOD)) { + throw new IllegalArgumentException("Invalid SendStreamingMessageRequest method"); + } + Assert.checkNotNullParam("params", params); + Assert.isNullOrStringOrInteger(id); + this.jsonrpc = defaultIfNull(jsonrpc, JSONRPC_VERSION); + this.id = id; + this.method = method; + this.params = params; + } + + public void check() { + if (jsonrpc != null && !jsonrpc.equals(JSONRPC_VERSION)) { + throw new IllegalArgumentException("Invalid JSON-RPC protocol version"); + } + Assert.checkNotNullParam("method", method); + if (!method.equals(METHOD)) { + throw new IllegalArgumentException("Invalid SendStreamingMessageRequest method"); + } + Assert.checkNotNullParam("params", params); + Assert.isNullOrStringOrInteger(id); + params.check(); + } + + public SendStreamingMessageRequest_v0_3(Object id, MessageSendParams_v0_3 params) { + this(null, id, METHOD, params); + } + + public static class Builder { + private String jsonrpc; + private Object id; + private String method = METHOD; + private MessageSendParams_v0_3 params; + + public Builder jsonrpc(String jsonrpc) { + this.jsonrpc = jsonrpc; + return this; + } + + public Builder id(Object id) { + this.id = id; + return this; + } + + public Builder method(String method) { + this.method = method; + return this; + } + + public Builder params(MessageSendParams_v0_3 params) { + this.params = params; + return this; + } + + public SendStreamingMessageRequest_v0_3 build() { + if (id == null) { + id = UUID.randomUUID().toString(); + } + return new SendStreamingMessageRequest_v0_3(jsonrpc, id, method, params); + } + } + } diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SendStreamingMessageResponse_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SendStreamingMessageResponse_v0_3.java new file mode 100644 index 000000000..75df3f983 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SendStreamingMessageResponse_v0_3.java @@ -0,0 +1,19 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * The response after receiving a request to initiate a task with streaming. + */ +public final class SendStreamingMessageResponse_v0_3 extends JSONRPCResponse_v0_3 { + + public SendStreamingMessageResponse_v0_3(String jsonrpc, Object id, StreamingEventKind_v0_3 result, JSONRPCError_v0_3 error) { + super(jsonrpc, id, result, error, StreamingEventKind_v0_3.class); + } + + public SendStreamingMessageResponse_v0_3(Object id, StreamingEventKind_v0_3 result) { + this(null, id, result, null); + } + + public SendStreamingMessageResponse_v0_3(Object id, JSONRPCError_v0_3 error) { + this(null, id, null, error); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SetTaskPushNotificationConfigRequest_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SetTaskPushNotificationConfigRequest_v0_3.java new file mode 100644 index 000000000..130831b0e --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SetTaskPushNotificationConfigRequest_v0_3.java @@ -0,0 +1,69 @@ +package org.a2aproject.sdk.compat03.spec; + +import static org.a2aproject.sdk.compat03.util.Utils_v0_3.defaultIfNull; + +import java.util.UUID; + +import org.a2aproject.sdk.util.Assert; + +/** + * Used to set a task push notification request. + */ +public final class SetTaskPushNotificationConfigRequest_v0_3 extends NonStreamingJSONRPCRequest_v0_3 { + + public static final String METHOD = "tasks/pushNotificationConfig/set"; + + public SetTaskPushNotificationConfigRequest_v0_3(String jsonrpc, Object id, String method, TaskPushNotificationConfig_v0_3 params) { + if (jsonrpc != null && ! jsonrpc.equals(JSONRPC_VERSION)) { + throw new IllegalArgumentException("Invalid JSON-RPC protocol version"); + } + Assert.checkNotNullParam("method", method); + if (! method.equals(METHOD)) { + throw new IllegalArgumentException("Invalid SetTaskPushNotificationRequest method"); + } + Assert.checkNotNullParam("params", params); + Assert.isNullOrStringOrInteger(id); + this.jsonrpc = defaultIfNull(jsonrpc, JSONRPC_VERSION); + this.id = id; + this.method = method; + this.params = params; + } + + public SetTaskPushNotificationConfigRequest_v0_3(String id, TaskPushNotificationConfig_v0_3 taskPushConfig) { + this(null, id, METHOD, taskPushConfig); + } + + public static class Builder { + private String jsonrpc; + private Object id; + private String method = METHOD; + private TaskPushNotificationConfig_v0_3 params; + + public SetTaskPushNotificationConfigRequest_v0_3.Builder jsonrpc(String jsonrpc) { + this.jsonrpc = jsonrpc; + return this; + } + + public SetTaskPushNotificationConfigRequest_v0_3.Builder id(Object id) { + this.id = id; + return this; + } + + public SetTaskPushNotificationConfigRequest_v0_3.Builder method(String method) { + this.method = method; + return this; + } + + public SetTaskPushNotificationConfigRequest_v0_3.Builder params(TaskPushNotificationConfig_v0_3 params) { + this.params = params; + return this; + } + + public SetTaskPushNotificationConfigRequest_v0_3 build() { + if (id == null) { + id = UUID.randomUUID().toString(); + } + return new SetTaskPushNotificationConfigRequest_v0_3(jsonrpc, id, method, params); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SetTaskPushNotificationConfigResponse_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SetTaskPushNotificationConfigResponse_v0_3.java new file mode 100644 index 000000000..054826f72 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SetTaskPushNotificationConfigResponse_v0_3.java @@ -0,0 +1,19 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * The response after receiving a set task push notification request. + */ +public final class SetTaskPushNotificationConfigResponse_v0_3 extends JSONRPCResponse_v0_3 { + + public SetTaskPushNotificationConfigResponse_v0_3(String jsonrpc, Object id, TaskPushNotificationConfig_v0_3 result, JSONRPCError_v0_3 error) { + super(jsonrpc, id, result, error, TaskPushNotificationConfig_v0_3.class); + } + + public SetTaskPushNotificationConfigResponse_v0_3(Object id, JSONRPCError_v0_3 error) { + this(null, id, null, error); + } + + public SetTaskPushNotificationConfigResponse_v0_3(Object id, TaskPushNotificationConfig_v0_3 result) { + this(null, id, result, null); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/StreamingEventKind_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/StreamingEventKind_v0_3.java new file mode 100644 index 000000000..ffc40df0e --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/StreamingEventKind_v0_3.java @@ -0,0 +1,35 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * Sealed interface for events that can be emitted during streaming A2A Protocol operations. + *

+ * StreamingEventKind represents events suitable for asynchronous, progressive updates during + * agent task execution. Streaming allows agents to provide incremental feedback as work progresses, + * rather than waiting until task completion. + *

+ * Streaming events use polymorphic JSON serialization with the "kind" discriminator to determine + * the concrete type during deserialization. + *

+ * Permitted implementations: + *

    + *
  • {@link Task_v0_3} - Complete task state (typically the final event in a stream)
  • + *
  • {@link Message_v0_3} - Full message (complete message in the stream)
  • + *
  • {@link TaskStatusUpdateEvent_v0_3} - Incremental status updates (e.g., SUBMITTED → WORKING → COMPLETED)
  • + *
  • {@link TaskArtifactUpdateEvent_v0_3} - Incremental artifact updates (partial results, chunks)
  • + *
+ *

+ * Streaming events enable patterns like: + *

    + *
  • Progressive text generation (chunks of response as generated)
  • + *
  • Status notifications (task state transitions)
  • + *
  • Partial results (early artifacts before task completion)
  • + *
+ * + * @see Event_v0_3 + * @see EventKind_v0_3 + * @see UpdateEvent_v0_3 + */ +public sealed interface StreamingEventKind_v0_3 extends Event_v0_3 permits Task_v0_3, Message_v0_3, TaskStatusUpdateEvent_v0_3, TaskArtifactUpdateEvent_v0_3 { + + String getKind(); +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/StreamingJSONRPCRequest_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/StreamingJSONRPCRequest_v0_3.java new file mode 100644 index 000000000..956fd8aab --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/StreamingJSONRPCRequest_v0_3.java @@ -0,0 +1,10 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * Represents a streaming JSON-RPC request. + */ + +public abstract sealed class StreamingJSONRPCRequest_v0_3 extends JSONRPCRequest_v0_3 permits TaskResubscriptionRequest_v0_3, + SendStreamingMessageRequest_v0_3 { + +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/StringJsonrpcId_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/StringJsonrpcId_v0_3.java new file mode 100644 index 000000000..f4ced0850 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/StringJsonrpcId_v0_3.java @@ -0,0 +1,4 @@ +package org.a2aproject.sdk.compat03.spec; + +public class StringJsonrpcId_v0_3 { +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskArtifactUpdateEvent_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskArtifactUpdateEvent_v0_3.java new file mode 100644 index 000000000..397756a2b --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskArtifactUpdateEvent_v0_3.java @@ -0,0 +1,128 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.Map; + +import org.a2aproject.sdk.util.Assert; + +/** + * An event sent by the agent to notify the client that an artifact has been + * generated or updated. This is typically used in streaming models. + */ +public final class TaskArtifactUpdateEvent_v0_3 implements EventKind_v0_3, StreamingEventKind_v0_3, UpdateEvent_v0_3 { + + public static final String ARTIFACT_UPDATE = "artifact-update"; + private final String taskId; + private final Boolean append; + private final Boolean lastChunk; + private final Artifact_v0_3 artifact; + private final String contextId; + private final Map metadata; + private final String kind; + + public TaskArtifactUpdateEvent_v0_3(String taskId, Artifact_v0_3 artifact, String contextId, Boolean append, Boolean lastChunk, Map metadata) { + this(taskId, artifact, contextId, append, lastChunk, metadata, ARTIFACT_UPDATE); + } + + public TaskArtifactUpdateEvent_v0_3(String taskId, Artifact_v0_3 artifact, String contextId, Boolean append, Boolean lastChunk, Map metadata, String kind) { + Assert.checkNotNullParam("taskId", taskId); + Assert.checkNotNullParam("artifact", artifact); + Assert.checkNotNullParam("contextId", contextId); + Assert.checkNotNullParam("kind", kind); + if (! kind.equals(ARTIFACT_UPDATE)) { + throw new IllegalArgumentException("Invalid TaskArtifactUpdateEvent"); + } + this.taskId = taskId; + this.artifact = artifact; + this.contextId = contextId; + this.append = append; + this.lastChunk = lastChunk; + this.metadata = metadata; + this.kind = kind; + } + + public String getTaskId() { + return taskId; + } + + public Artifact_v0_3 getArtifact() { + return artifact; + } + + public String getContextId() { + return contextId; + } + + public Boolean isAppend() { + return append; + } + + public Boolean isLastChunk() { + return lastChunk; + } + + public Map getMetadata() { + return metadata; + } + + @Override + public String getKind() { + return kind; + } + + public static class Builder { + + private String taskId; + private Artifact_v0_3 artifact; + private String contextId; + private Boolean append; + private Boolean lastChunk; + private Map metadata; + + public Builder() { + } + + public Builder(TaskArtifactUpdateEvent_v0_3 existingTaskArtifactUpdateEvent) { + this.taskId = existingTaskArtifactUpdateEvent.taskId; + this.artifact = existingTaskArtifactUpdateEvent.artifact; + this.contextId = existingTaskArtifactUpdateEvent.contextId; + this.append = existingTaskArtifactUpdateEvent.append; + this.lastChunk = existingTaskArtifactUpdateEvent.lastChunk; + this.metadata = existingTaskArtifactUpdateEvent.metadata; + } + + public Builder taskId(String taskId) { + this.taskId = taskId; + return this; + } + + public Builder artifact(Artifact_v0_3 artifact) { + this.artifact = artifact; + return this; + } + + public Builder contextId(String contextId) { + this.contextId = contextId; + return this; + } + + public Builder append(Boolean append) { + this.append = append; + return this; + } + + public Builder lastChunk(Boolean lastChunk) { + this.lastChunk = lastChunk; + return this; + } + + + public Builder metadata(Map metadata) { + this.metadata = metadata; + return this; + } + + public TaskArtifactUpdateEvent_v0_3 build() { + return new TaskArtifactUpdateEvent_v0_3(taskId, artifact, contextId, append, lastChunk, metadata); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskIdParams_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskIdParams_v0_3.java new file mode 100644 index 000000000..5c44557da --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskIdParams_v0_3.java @@ -0,0 +1,19 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.Map; + +import org.a2aproject.sdk.util.Assert; + +/** + * Defines parameters containing a task ID, used for simple task operations. + */ +public record TaskIdParams_v0_3(String id, Map metadata) { + + public TaskIdParams_v0_3 { + Assert.checkNotNullParam("id", id); + } + + public TaskIdParams_v0_3(String id) { + this(id, null); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskNotCancelableError_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskNotCancelableError_v0_3.java new file mode 100644 index 000000000..859f3c004 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskNotCancelableError_v0_3.java @@ -0,0 +1,30 @@ +package org.a2aproject.sdk.compat03.spec; + +import static org.a2aproject.sdk.compat03.util.Utils_v0_3.defaultIfNull; + +/** + * An A2A-specific error indicating that the task is in a state where it cannot be canceled. + */ +public class TaskNotCancelableError_v0_3 extends JSONRPCError_v0_3 { + + public final static Integer DEFAULT_CODE = -32002; + + public TaskNotCancelableError_v0_3() { + this(null, null, null); + } + + public TaskNotCancelableError_v0_3( + Integer code, + String message, + Object data) { + super( + defaultIfNull(code, DEFAULT_CODE), + defaultIfNull(message, "Task cannot be canceled"), + data); + } + + public TaskNotCancelableError_v0_3(String message) { + this(null, message, null); + } + +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskNotFoundError_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskNotFoundError_v0_3.java new file mode 100644 index 000000000..b0786e906 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskNotFoundError_v0_3.java @@ -0,0 +1,22 @@ +package org.a2aproject.sdk.compat03.spec; + +import static org.a2aproject.sdk.compat03.util.Utils_v0_3.defaultIfNull; + +/** + * An A2A-specific error indicating that the requested task ID was not found. + */ +public class TaskNotFoundError_v0_3 extends JSONRPCError_v0_3 { + + public final static Integer DEFAULT_CODE = A2AErrorCodes_v0_3.TASK_NOT_FOUND_ERROR_CODE; + + public TaskNotFoundError_v0_3() { + this(null, null, null); + } + + public TaskNotFoundError_v0_3(Integer code, String message, Object data) { + super( + defaultIfNull(code, A2AErrorCodes_v0_3.TASK_NOT_FOUND_ERROR_CODE), + defaultIfNull(message, "Task not found"), + data); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskPushNotificationConfig_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskPushNotificationConfig_v0_3.java new file mode 100644 index 000000000..2efbe9a6f --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskPushNotificationConfig_v0_3.java @@ -0,0 +1,14 @@ +package org.a2aproject.sdk.compat03.spec; + +import org.a2aproject.sdk.util.Assert; + +/** + * A container associating a push notification configuration with a specific task. + */ +public record TaskPushNotificationConfig_v0_3(String taskId, PushNotificationConfig_v0_3 pushNotificationConfig) { + + public TaskPushNotificationConfig_v0_3 { + Assert.checkNotNullParam("taskId", taskId); + Assert.checkNotNullParam("pushNotificationConfig", pushNotificationConfig); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskQueryParams_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskQueryParams_v0_3.java new file mode 100644 index 000000000..b96bfa8c2 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskQueryParams_v0_3.java @@ -0,0 +1,30 @@ +package org.a2aproject.sdk.compat03.spec; + +import org.a2aproject.sdk.util.Assert; +import java.util.Map; +import org.jspecify.annotations.Nullable; + +/** + * Defines parameters for querying a task, with an option to limit history length. + * + * @param id the ID for the task to be queried + * @param historyLength the maximum number of items of history for the task to include in the response + * @param metadata additional properties + */ +public record TaskQueryParams_v0_3(String id, int historyLength, @Nullable Map metadata) { + + public TaskQueryParams_v0_3 { + Assert.checkNotNullParam("id", id); + if (historyLength < 0) { + throw new IllegalArgumentException("Invalid history length"); + } + } + + public TaskQueryParams_v0_3(String id) { + this(id, 0, null); + } + + public TaskQueryParams_v0_3(String id, int historyLength) { + this(id, historyLength, null); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskResubscriptionRequest_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskResubscriptionRequest_v0_3.java new file mode 100644 index 000000000..d9bfbb7ed --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskResubscriptionRequest_v0_3.java @@ -0,0 +1,68 @@ +package org.a2aproject.sdk.compat03.spec; + +import static org.a2aproject.sdk.compat03.util.Utils_v0_3.defaultIfNull; + +import org.a2aproject.sdk.util.Assert; + +import java.util.UUID; + +/** + * Used to resubscribe to a task. + */ +public final class TaskResubscriptionRequest_v0_3 extends StreamingJSONRPCRequest_v0_3 { + + public static final String METHOD = "tasks/resubscribe"; + + public TaskResubscriptionRequest_v0_3(String jsonrpc, Object id, String method, TaskIdParams_v0_3 params) { + if (jsonrpc != null && ! jsonrpc.equals(JSONRPC_VERSION)) { + throw new IllegalArgumentException("Invalid JSON-RPC protocol version"); + } + Assert.checkNotNullParam("method", method); + if (! method.equals(METHOD)) { + throw new IllegalArgumentException("Invalid TaskResubscriptionRequest method"); + } + Assert.checkNotNullParam("params", params); + this.jsonrpc = defaultIfNull(jsonrpc, JSONRPC_VERSION); + this.id = id == null ? UUID.randomUUID().toString() : id; + this.method = method; + this.params = params; + } + + public TaskResubscriptionRequest_v0_3(Object id, TaskIdParams_v0_3 params) { + this(null, id, METHOD, params); + } + + public static class Builder { + private String jsonrpc; + private Object id; + private String method = METHOD; + private TaskIdParams_v0_3 params; + + public TaskResubscriptionRequest_v0_3.Builder jsonrpc(String jsonrpc) { + this.jsonrpc = jsonrpc; + return this; + } + + public TaskResubscriptionRequest_v0_3.Builder id(Object id) { + this.id = id; + return this; + } + + public TaskResubscriptionRequest_v0_3.Builder method(String method) { + this.method = method; + return this; + } + + public TaskResubscriptionRequest_v0_3.Builder params(TaskIdParams_v0_3 params) { + this.params = params; + return this; + } + + public TaskResubscriptionRequest_v0_3 build() { + if (id == null) { + id = UUID.randomUUID().toString(); + } + return new TaskResubscriptionRequest_v0_3(jsonrpc, id, method, params); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskState_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskState_v0_3.java new file mode 100644 index 000000000..0bcbaa54d --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskState_v0_3.java @@ -0,0 +1,69 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * Defines the lifecycle states of a Task. + */ +public enum TaskState_v0_3 { + SUBMITTED("submitted"), + WORKING("working"), + INPUT_REQUIRED("input-required"), + AUTH_REQUIRED("auth-required"), + COMPLETED("completed", true), + CANCELED("canceled", true), + FAILED("failed", true), + REJECTED("rejected", true), + UNKNOWN("unknown", true); + + private final String state; + private final boolean isFinal; + + TaskState_v0_3(String state) { + this(state, false); + } + + TaskState_v0_3(String state, boolean isFinal) { + this.state = state; + this.isFinal = isFinal; + } + + /** + * Returns the string representation of this task state for JSON serialization. + *

+ * This method is used to serialize TaskState values to their + * wire format (e.g., "working", "completed"). + * + * @return the string representation of this state + */ + public String asString() { + return state; + } + + public boolean isFinal(){ + return isFinal; + } + + /** + * Deserializes a string value into a TaskState enum constant. + *

+ * This method is used to deserialize TaskState values from their + * wire format during JSON parsing. + * + * @param state the string representation of the state + * @return the corresponding TaskState enum constant + * @throws IllegalArgumentException if the state string is not recognized + */ + public static TaskState_v0_3 fromString(String state) { + return switch (state) { + case "submitted" -> SUBMITTED; + case "working" -> WORKING; + case "input-required" -> INPUT_REQUIRED; + case "auth-required" -> AUTH_REQUIRED; + case "completed" -> COMPLETED; + case "canceled" -> CANCELED; + case "failed" -> FAILED; + case "rejected" -> REJECTED; + case "unknown" -> UNKNOWN; + default -> throw new IllegalArgumentException("Invalid TaskState: " + state); + }; + } +} \ No newline at end of file diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskStatusUpdateEvent_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskStatusUpdateEvent_v0_3.java new file mode 100644 index 000000000..f337169f6 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskStatusUpdateEvent_v0_3.java @@ -0,0 +1,116 @@ +package org.a2aproject.sdk.compat03.spec; + +import com.google.gson.annotations.SerializedName; +import java.util.Map; + +import org.a2aproject.sdk.util.Assert; + +/** + * An event sent by the agent to notify the client of a change in a task's status. + * This is typically used in streaming or subscription models. + */ +public final class TaskStatusUpdateEvent_v0_3 implements EventKind_v0_3, StreamingEventKind_v0_3, UpdateEvent_v0_3 { + + public static final String STATUS_UPDATE = "status-update"; + private final String taskId; + private final TaskStatus_v0_3 status; + private final String contextId; + @SerializedName("final") + private final boolean isFinal; + private final Map metadata; + private final String kind; + + + public TaskStatusUpdateEvent_v0_3(String taskId, TaskStatus_v0_3 status, String contextId, boolean isFinal, + Map metadata) { + this(taskId, status, contextId, isFinal, metadata, STATUS_UPDATE); + } + + public TaskStatusUpdateEvent_v0_3(String taskId, TaskStatus_v0_3 status, String contextId, boolean isFinal, Map metadata, String kind) { + Assert.checkNotNullParam("taskId", taskId); + Assert.checkNotNullParam("status", status); + Assert.checkNotNullParam("contextId", contextId); + Assert.checkNotNullParam("kind", kind); + if (! kind.equals(STATUS_UPDATE)) { + throw new IllegalArgumentException("Invalid TaskStatusUpdateEvent"); + } + this.taskId = taskId; + this.status = status; + this.contextId = contextId; + this.isFinal = isFinal; + this.metadata = metadata; + this.kind = kind; + } + + public String getTaskId() { + return taskId; + } + + public TaskStatus_v0_3 getStatus() { + return status; + } + + public String getContextId() { + return contextId; + } + + public boolean isFinal() { + return isFinal; + } + + public Map getMetadata() { + return metadata; + } + + @Override + public String getKind() { + return kind; + } + + public static class Builder { + private String taskId; + private TaskStatus_v0_3 status; + private String contextId; + private boolean isFinal; + private Map metadata; + + public Builder() { + } + + public Builder(TaskStatusUpdateEvent_v0_3 existingTaskStatusUpdateEvent) { + this.taskId = existingTaskStatusUpdateEvent.taskId; + this.status = existingTaskStatusUpdateEvent.status; + this.contextId = existingTaskStatusUpdateEvent.contextId; + this.isFinal = existingTaskStatusUpdateEvent.isFinal; + this.metadata = existingTaskStatusUpdateEvent.metadata; + } + public Builder taskId(String id) { + this.taskId = id; + return this; + } + + public Builder status(TaskStatus_v0_3 status) { + this.status = status; + return this; + } + + public Builder contextId(String contextId) { + this.contextId = contextId; + return this; + } + + public Builder isFinal(boolean isFinal) { + this.isFinal = isFinal; + return this; + } + + public Builder metadata(Map metadata) { + this.metadata = metadata; + return this; + } + + public TaskStatusUpdateEvent_v0_3 build() { + return new TaskStatusUpdateEvent_v0_3(taskId, status, contextId, isFinal, metadata); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskStatus_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskStatus_v0_3.java new file mode 100644 index 000000000..6ffa77ac3 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskStatus_v0_3.java @@ -0,0 +1,31 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.time.OffsetDateTime; +import java.time.ZoneOffset; + +import org.a2aproject.sdk.util.Assert; + +/** + * Represents the status of a task at a specific point in time. + */ +public record TaskStatus_v0_3(TaskState_v0_3 state, Message_v0_3 message, + OffsetDateTime timestamp) { + + public TaskStatus_v0_3 { + Assert.checkNotNullParam("state", state); + timestamp = timestamp == null ? OffsetDateTime.now(ZoneOffset.UTC) : timestamp; + } + + public TaskStatus_v0_3(TaskState_v0_3 state) { + this(state, null, null); + } + + /** + * Constructor for testing purposes. + * @param state the task state + * @param timestamp timestamp generation + */ + TaskStatus_v0_3(TaskState_v0_3 state, OffsetDateTime timestamp) { + this(state, null, timestamp); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/Task_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/Task_v0_3.java new file mode 100644 index 000000000..87e486013 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/Task_v0_3.java @@ -0,0 +1,136 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.List; +import java.util.Map; + +import org.a2aproject.sdk.util.Assert; + +/** + * Represents a single, stateful operation or conversation between a client and an agent. + */ +public final class Task_v0_3 implements EventKind_v0_3, StreamingEventKind_v0_3 { + + public static final String TASK = "task"; + private final String id; + private final String contextId; + private final TaskStatus_v0_3 status; + private final List artifacts; + private final List history; + private final Map metadata; + private final String kind; + + public Task_v0_3(String id, String contextId, TaskStatus_v0_3 status, List artifacts, + List history, Map metadata) { + this(id, contextId, status, artifacts, history, metadata, TASK); + } + + public Task_v0_3(String id, String contextId, TaskStatus_v0_3 status, + List artifacts, List history, + Map metadata, String kind) { + Assert.checkNotNullParam("id", id); + Assert.checkNotNullParam("contextId", contextId); + Assert.checkNotNullParam("status", status); + Assert.checkNotNullParam("kind", kind); + if (! kind.equals(TASK)) { + throw new IllegalArgumentException("Invalid Task"); + } + this.id = id; + this.contextId = contextId; + this.status = status; + this.artifacts = artifacts != null ? List.copyOf(artifacts) : List.of(); + this.history = history != null ? List.copyOf(history) : List.of(); + this.metadata = metadata; + this.kind = kind; + } + + public String getId() { + return id; + } + + public String getContextId() { + return contextId; + } + + public TaskStatus_v0_3 getStatus() { + return status; + } + + public List getArtifacts() { + return artifacts; + } + + public List getHistory() { + return history; + } + + public Map getMetadata() { + return metadata; + } + + @Override + public String getKind() { + return kind; + } + + public static class Builder { + private String id; + private String contextId; + private TaskStatus_v0_3 status; + private List artifacts; + private List history; + private Map metadata; + + public Builder() { + + } + + public Builder(Task_v0_3 task) { + id = task.id; + contextId = task.contextId; + status = task.status; + artifacts = task.artifacts; + history = task.history; + metadata = task.metadata; + + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public Builder contextId(String contextId) { + this.contextId = contextId; + return this; + } + + public Builder status(TaskStatus_v0_3 status) { + this.status = status; + return this; + } + + public Builder artifacts(List artifacts) { + this.artifacts = artifacts; + return this; + } + + public Builder history(List history) { + this.history = history; + return this; + } + + public Builder history(Message_v0_3... history) { + this.history = List.of(history); + return this; + } + + public Builder metadata(Map metadata) { + this.metadata = metadata; + return this; + } + + public Task_v0_3 build() { + return new Task_v0_3(id, contextId, status, artifacts, history, metadata); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TextPart_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TextPart_v0_3.java new file mode 100644 index 000000000..4d5b604ce --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TextPart_v0_3.java @@ -0,0 +1,41 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.Map; + +import org.a2aproject.sdk.util.Assert; + +/** + * Represents a text segment within a message or artifact. + */ +public class TextPart_v0_3 extends Part_v0_3 { + + public static final String TEXT = "text"; + private final String text; + private final Map metadata; + private final Kind kind; + + public TextPart_v0_3(String text) { + this(text, null); + } + + public TextPart_v0_3(String text, Map metadata) { + Assert.checkNotNullParam("text", text); + this.text = text; + this.metadata = metadata; + this.kind = Kind.TEXT; + } + + @Override + public Kind getKind() { + return kind; + } + + public String getText() { + return text; + } + + @Override + public Map getMetadata() { + return metadata; + } +} \ No newline at end of file diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TransportProtocol_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TransportProtocol_v0_3.java new file mode 100644 index 000000000..f6368f9cc --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TransportProtocol_v0_3.java @@ -0,0 +1,45 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * Supported A2A transport protocols. + */ +public enum TransportProtocol_v0_3 { + JSONRPC("JSONRPC"), + GRPC("GRPC"), + HTTP_JSON("HTTP+JSON"); + + private final String transport; + + TransportProtocol_v0_3(String transport) { + this.transport = transport; + } + + /** + * Returns the string representation of this transport protocol. + *

+ * Used for JSON serialization. + * + * @return the transport protocol name as a string + */ + public String asString() { + return transport; + } + + /** + * Parses a string into a {@link TransportProtocol_v0_3} enum constant. + *

+ * Used for JSON deserialization. + * + * @param transport the transport protocol string (e.g., "JSONRPC", "GRPC", "HTTP+JSON") + * @return the corresponding TransportProtocol enum constant + * @throws IllegalArgumentException if the transport string is not recognized + */ + public static TransportProtocol_v0_3 fromString(String transport) { + return switch (transport) { + case "JSONRPC" -> JSONRPC; + case "GRPC" -> GRPC; + case "HTTP+JSON" -> HTTP_JSON; + default -> throw new IllegalArgumentException("Invalid transport: " + transport); + }; + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/UnsupportedOperationError_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/UnsupportedOperationError_v0_3.java new file mode 100644 index 000000000..434aab21c --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/UnsupportedOperationError_v0_3.java @@ -0,0 +1,22 @@ +package org.a2aproject.sdk.compat03.spec; + +import static org.a2aproject.sdk.compat03.util.Utils_v0_3.defaultIfNull; + +/** + * An A2A-specific error indicating that the requested operation is not supported by the agent. + */ +public class UnsupportedOperationError_v0_3 extends JSONRPCError_v0_3 { + + public final static Integer DEFAULT_CODE = A2AErrorCodes_v0_3.UNSUPPORTED_OPERATION_ERROR_CODE; + + public UnsupportedOperationError_v0_3(Integer code, String message, Object data) { + super( + defaultIfNull(code, A2AErrorCodes_v0_3.UNSUPPORTED_OPERATION_ERROR_CODE), + defaultIfNull(message, "This operation is not supported"), + data); + } + + public UnsupportedOperationError_v0_3() { + this(null, null, null); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/UpdateEvent_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/UpdateEvent_v0_3.java new file mode 100644 index 000000000..d2f7b8e7f --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/UpdateEvent_v0_3.java @@ -0,0 +1,4 @@ +package org.a2aproject.sdk.compat03.spec; + +public sealed interface UpdateEvent_v0_3 permits TaskStatusUpdateEvent_v0_3, TaskArtifactUpdateEvent_v0_3 { +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/util/Utils_v0_3.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/util/Utils_v0_3.java new file mode 100644 index 000000000..38df3adfc --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/util/Utils_v0_3.java @@ -0,0 +1,168 @@ +package org.a2aproject.sdk.compat03.util; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.Gson; +import org.a2aproject.sdk.compat03.json.JsonProcessingException_v0_3; +import org.a2aproject.sdk.compat03.json.JsonUtil_v0_3; + +import org.a2aproject.sdk.compat03.spec.Artifact_v0_3; +import org.a2aproject.sdk.compat03.spec.Task_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskArtifactUpdateEvent_v0_3; +import org.a2aproject.sdk.compat03.spec.Part_v0_3; +import java.util.logging.Logger; + + + +/** + * Utility class providing common helper methods for A2A Protocol operations. + *

+ * This class contains static utility methods for JSON serialization/deserialization, + * null-safe operations, artifact management, and other common tasks used throughout + * the A2A Java SDK. + *

+ * Key capabilities: + *

    + *
  • JSON processing with pre-configured {@link Gson}
  • + *
  • Null-safe value defaults via {@link #defaultIfNull(Object, Object)}
  • + *
  • Artifact streaming support via {@link #appendArtifactToTask(Task_v0_3, TaskArtifactUpdateEvent_v0_3, String)}
  • + *
  • Type-safe exception rethrowing via {@link #rethrow(Throwable)}
  • + *
+ * + * @see Gson for JSON processing + * @see TaskArtifactUpdateEvent_v0_3 for streaming artifact updates + */ +public class Utils_v0_3 { + + + private static final Logger log = Logger.getLogger(Utils_v0_3.class.getName()); + + /** + * Deserializes JSON string into a typed object using Gson. + *

+ * This method uses the pre-configured {@link JsonUtil_v0_3#OBJECT_MAPPER} to parse JSON. + * + * @param the target type + * @param data JSON string to deserialize + * @param typeRef class reference specifying the target type + * @return deserialized object of type T + * @throws JsonProcessingException_v0_3 if JSON parsing fails + */ + public static T unmarshalFrom(String data, Class typeRef) throws JsonProcessingException_v0_3 { + return JsonUtil_v0_3.fromJson(data, typeRef); + } + + public static String toJsonString(Object data) { + try { + return JsonUtil_v0_3.toJson(data); + } catch (JsonProcessingException_v0_3 e) { + throw new RuntimeException("Failed to serialize to JSON", e); + } + } + + public static T defaultIfNull(T value, T defaultValue) { + if (value == null) { + return defaultValue; + } + return value; + } + + public static void rethrow(Throwable t) throws T { + throw (T) t; + } + + /** + * Appends or updates an artifact in a task based on a {@link TaskArtifactUpdateEvent_v0_3}. + *

+ * This method handles streaming artifact updates, supporting both: + *

    + *
  • Adding new artifacts to the task
  • + *
  • Replacing existing artifacts (when {@code append=false})
  • + *
  • Appending parts to existing artifacts (when {@code append=true})
  • + *
+ *

+ * The {@code append} flag in the event determines the behavior: + *

    + *
  • {@code false} or {@code null}: Replace/add the entire artifact
  • + *
  • {@code true}: Append the new artifact's parts to an existing artifact with matching {@code artifactId}
  • + *
+ * + * @param task the current task to update + * @param event the artifact update event containing the new/updated artifact + * @param taskId the task ID (for logging purposes) + * @return a new Task instance with the updated artifacts list + * @see TaskArtifactUpdateEvent_v0_3 for streaming artifact updates + * @see Artifact_v0_3 for artifact structure + */ + public static Task_v0_3 appendArtifactToTask(Task_v0_3 task, TaskArtifactUpdateEvent_v0_3 event, String taskId) { + // Append artifacts + List artifacts = task.getArtifacts() == null ? new ArrayList<>() : new ArrayList<>(task.getArtifacts()); + + Artifact_v0_3 newArtifact = event.getArtifact(); + String artifactId = newArtifact.artifactId(); + boolean appendParts = event.isAppend() != null && event.isAppend(); + + Artifact_v0_3 existingArtifact = null; + int existingArtifactIndex = -1; + + for (int i = 0; i < artifacts.size(); i++) { + Artifact_v0_3 curr = artifacts.get(i); + if (curr.artifactId() != null && curr.artifactId().equals(artifactId)) { + existingArtifact = curr; + existingArtifactIndex = i; + break; + } + } + + if (!appendParts) { + // This represents the first chunk for this artifact index + if (existingArtifactIndex >= 0) { + // Replace the existing artifact entirely with the new artifact + log.fine(String.format("Replacing artifact at id %s for task %s", artifactId, taskId)); + artifacts.set(existingArtifactIndex, newArtifact); + } else { + // Append the new artifact since no artifact with this id/index exists yet + log.fine(String.format("Adding artifact at id %s for task %s", artifactId, taskId)); + artifacts.add(newArtifact); + } + + } else if (existingArtifact != null) { + // Append new parts to the existing artifact's parts list + // Do this to a copy + log.fine(String.format("Appending parts to artifact id %s for task %s", artifactId, taskId)); + List> parts = new ArrayList<>(existingArtifact.parts()); + parts.addAll(newArtifact.parts()); + Artifact_v0_3 updated = new Artifact_v0_3.Builder(existingArtifact) + .parts(parts) + .build(); + artifacts.set(existingArtifactIndex, updated); + } else { + // We received a chunk to append, but we don't have an existing artifact. + // We will ignore this chunk + log.warning( + String.format("Received append=true for nonexistent artifact index for artifact %s in task %s. Ignoring chunk.", + artifactId, taskId)); + } + + return new Task_v0_3.Builder(task) + .artifacts(artifacts) + .build(); + + } + + /** + * Get the first defined URL in the supported interaces of the agent card. + * + * @param agentCard the agentcard where the interfaces are defined. + * @return the first defined URL in the supported interaces of the agent card. + * @throws A2AClientException + */ +// public static String getFavoriteInterface(AgentCard agentCard) throws A2AClientException { +// if (agentCard.supportedInterfaces() == null || agentCard.supportedInterfaces().isEmpty()) { +// throw new A2AClientException("No server interface available in the AgentCard"); +// } +// return agentCard.supportedInterfaces().get(0).url(); +// } + +} diff --git a/compat-0.3/spec/src/main/resources/META-INF/beans.xml b/compat-0.3/spec/src/main/resources/META-INF/beans.xml new file mode 100644 index 000000000..e69de29bb diff --git a/compat-0.3/spec/src/test/java/org/a2aproject/sdk/compat03/spec/JSONRPCErrorSerialization_v0_3_Test.java b/compat-0.3/spec/src/test/java/org/a2aproject/sdk/compat03/spec/JSONRPCErrorSerialization_v0_3_Test.java new file mode 100644 index 000000000..5060770b8 --- /dev/null +++ b/compat-0.3/spec/src/test/java/org/a2aproject/sdk/compat03/spec/JSONRPCErrorSerialization_v0_3_Test.java @@ -0,0 +1,82 @@ +package org.a2aproject.sdk.compat03.spec; + +import org.junit.jupiter.api.Test; + +import java.util.List; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.a2aproject.sdk.compat03.json.JsonProcessingException_v0_3; +import org.a2aproject.sdk.compat03.json.JsonUtil_v0_3; + + +public class JSONRPCErrorSerialization_v0_3_Test { + @Test + public void shouldDeserializeToCorrectJSONRPCErrorSubclass() throws JsonProcessingException_v0_3 { + String jsonTemplate = """ + {"code": %s, "message": "error", "data": "anything"} + """; + + record ErrorCase(int code, Class clazz) {} + + List cases = List.of( + new ErrorCase(JSONParseError_v0_3.DEFAULT_CODE, JSONParseError_v0_3.class), + new ErrorCase(InvalidRequestError_v0_3.DEFAULT_CODE, InvalidRequestError_v0_3.class), + new ErrorCase(MethodNotFoundError_v0_3.DEFAULT_CODE, MethodNotFoundError_v0_3.class), + new ErrorCase(InvalidParamsError_v0_3.DEFAULT_CODE, InvalidParamsError_v0_3.class), + new ErrorCase(InternalError_v0_3.DEFAULT_CODE, InternalError_v0_3.class), + new ErrorCase(PushNotificationNotSupportedError_v0_3.DEFAULT_CODE, PushNotificationNotSupportedError_v0_3.class), + new ErrorCase(UnsupportedOperationError_v0_3.DEFAULT_CODE, UnsupportedOperationError_v0_3.class), + new ErrorCase(ContentTypeNotSupportedError_v0_3.DEFAULT_CODE, ContentTypeNotSupportedError_v0_3.class), + new ErrorCase(InvalidAgentResponseError_v0_3.DEFAULT_CODE, InvalidAgentResponseError_v0_3.class), + new ErrorCase(TaskNotCancelableError_v0_3.DEFAULT_CODE, TaskNotCancelableError_v0_3.class), + new ErrorCase(TaskNotFoundError_v0_3.DEFAULT_CODE, TaskNotFoundError_v0_3.class), + new ErrorCase(Integer.MAX_VALUE, JSONRPCError_v0_3.class) // Any unknown code will be treated as JSONRPCError + ); + + for (ErrorCase errorCase : cases) { + String json = jsonTemplate.formatted(errorCase.code()); + JSONRPCError_v0_3 error = JsonUtil_v0_3.fromJson(json, JSONRPCError_v0_3.class); + assertInstanceOf(errorCase.clazz(), error); + assertEquals("error", error.getMessage()); + assertEquals("anything", error.getData().toString()); + } + } + + @Test + @SuppressWarnings("unchecked") + void deleteTaskPushNotificationConfigSuccessResponseSerializesResultAsNull() throws JsonProcessingException_v0_3 { + DeleteTaskPushNotificationConfigResponse_v0_3 response = + new DeleteTaskPushNotificationConfigResponse_v0_3("req-123"); + + String json = JsonUtil_v0_3.toJson(response); + Map map = JsonUtil_v0_3.fromJson(json, Map.class); + + assertEquals("2.0", map.get("jsonrpc")); + assertEquals("req-123", map.get("id")); + assertTrue(map.containsKey("result"), "result field must be present in success response"); + assertEquals(null, map.get("result"), "result must be null for delete response"); + assertFalse(map.containsKey("error"), "error field must not be present in success response"); + } + + @Test + @SuppressWarnings("unchecked") + void deleteTaskPushNotificationConfigErrorResponseSerializesErrorWithoutResult() throws JsonProcessingException_v0_3 { + DeleteTaskPushNotificationConfigResponse_v0_3 response = + new DeleteTaskPushNotificationConfigResponse_v0_3("req-456", new TaskNotFoundError_v0_3()); + + String json = JsonUtil_v0_3.toJson(response); + Map map = JsonUtil_v0_3.fromJson(json, Map.class); + + assertEquals("2.0", map.get("jsonrpc")); + assertEquals("req-456", map.get("id")); + assertTrue(map.containsKey("error"), "error field must be present in error response"); + assertFalse(map.containsKey("result"), "result field must not be present in error response"); + } + + +} diff --git a/compat-0.3/spec/src/test/java/org/a2aproject/sdk/compat03/spec/SubTypeSerialization_v0_3_Test.java b/compat-0.3/spec/src/test/java/org/a2aproject/sdk/compat03/spec/SubTypeSerialization_v0_3_Test.java new file mode 100644 index 000000000..96c89c152 --- /dev/null +++ b/compat-0.3/spec/src/test/java/org/a2aproject/sdk/compat03/spec/SubTypeSerialization_v0_3_Test.java @@ -0,0 +1,102 @@ +package org.a2aproject.sdk.compat03.spec; + +import org.a2aproject.sdk.compat03.json.JsonProcessingException_v0_3; +import org.a2aproject.sdk.compat03.json.JsonUtil_v0_3; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import java.util.Map; +import java.util.stream.Stream; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class SubTypeSerialization_v0_3_Test { + + private static final Task_v0_3 MINIMAL_TASK = new Task_v0_3.Builder() + .id("task-123") + .contextId("session-xyz") + .status(new TaskStatus_v0_3(TaskState_v0_3.SUBMITTED)) + .build(); + + @ParameterizedTest + @MethodSource("serializationTestCases") + void testSubtypeSerialization(Object objectToSerialize, String typePropertyName, String expectedTypeValue) throws JsonProcessingException_v0_3 { + String json = JsonUtil_v0_3.toJson(objectToSerialize); + @SuppressWarnings("unchecked") + Map map = JsonUtil_v0_3.fromJson(json, Map.class); + assertEquals(expectedTypeValue, map.get(typePropertyName)); + } + + private static Stream serializationTestCases() { + return Stream.of( + Arguments.of( + new TaskStatusUpdateEvent_v0_3.Builder() + .taskId(MINIMAL_TASK.getId()) + .contextId(MINIMAL_TASK.getContextId()) + .status(new TaskStatus_v0_3(TaskState_v0_3.COMPLETED)) + .isFinal(true) + .build(), "kind", TaskStatusUpdateEvent_v0_3.STATUS_UPDATE + ), + Arguments.of( + new TaskArtifactUpdateEvent_v0_3.Builder() + .taskId(MINIMAL_TASK.getId()) + .contextId(MINIMAL_TASK.getContextId()) + .artifact(new Artifact_v0_3.Builder() + .artifactId("11") + .parts(new TextPart_v0_3("text")) + .build()) + .build(), "kind", TaskArtifactUpdateEvent_v0_3.ARTIFACT_UPDATE + ), + Arguments.of( + MINIMAL_TASK, "kind", Task_v0_3.TASK + ), + Arguments.of( + new Message_v0_3.Builder() + .role(Message_v0_3.Role.USER) + .parts(new TextPart_v0_3("tell me some jokes")) + .contextId("context-1234") + .messageId("message-1234") + .build(), "kind", Message_v0_3.MESSAGE + ), + Arguments.of( + new TextPart_v0_3("text"), "kind", TextPart_v0_3.TEXT + ), + Arguments.of( + new FilePart_v0_3(new FileWithUri_v0_3( + "image/jpeg", null, "file:///path/to/image.jpg")), + "kind", FilePart_v0_3.FILE + ), + Arguments.of( + new DataPart_v0_3(Map.of("chartType", "bar")), "kind", DataPart_v0_3.DATA + ), + Arguments.of( + new APIKeySecurityScheme_v0_3.Builder() + .in("test").name("name").description("description").build(), + "type", APIKeySecurityScheme_v0_3.API_KEY + ), + Arguments.of( + new HTTPAuthSecurityScheme_v0_3.Builder() + .scheme("basic").description("Basic Auth").build(), + "type", HTTPAuthSecurityScheme_v0_3.HTTP + ), + Arguments.of( + new OAuth2SecurityScheme_v0_3.Builder() + .flows(new OAuthFlows_v0_3.Builder().build()) + .description("oAuth2SecurityScheme").build(), + "type", OAuth2SecurityScheme_v0_3.OAUTH2 + ), + Arguments.of( + new OpenIdConnectSecurityScheme_v0_3.Builder() + .openIdConnectUrl("https://accounts.google.com/.well-known/openid-configuration") + .description("OpenId").build(), + "type", OpenIdConnectSecurityScheme_v0_3.OPENID_CONNECT + ), + Arguments.of( + new MutualTLSSecurityScheme_v0_3("mutual tls test"), + "type", MutualTLSSecurityScheme_v0_3.MUTUAL_TLS + ) + ); + } + +} diff --git a/compat-0.3/spec/src/test/java/org/a2aproject/sdk/compat03/spec/TaskSerialization_v0_3_Test.java b/compat-0.3/spec/src/test/java/org/a2aproject/sdk/compat03/spec/TaskSerialization_v0_3_Test.java new file mode 100644 index 000000000..f1ed534a9 --- /dev/null +++ b/compat-0.3/spec/src/test/java/org/a2aproject/sdk/compat03/spec/TaskSerialization_v0_3_Test.java @@ -0,0 +1,713 @@ +package org.a2aproject.sdk.compat03.spec; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +import org.junit.jupiter.api.Test; + +import org.a2aproject.sdk.compat03.json.JsonProcessingException_v0_3; +import org.a2aproject.sdk.compat03.json.JsonUtil_v0_3; + +/** + * Tests for Task serialization and deserialization using Gson. + */ +class TaskSerialization_v0_3_Test { + + @Test + void testBasicTaskSerialization() throws JsonProcessingException_v0_3 { + // Create a basic task + Task_v0_3 task = new Task_v0_3.Builder() + .id("task-123") + .contextId("context-456") + .status(new TaskStatus_v0_3(TaskState_v0_3.SUBMITTED)) + .build(); + + // Serialize to JSON + String json = JsonUtil_v0_3.toJson(task); + + // Verify JSON contains expected fields + assertNotNull(json); + assertTrue(json.contains("\"id\":\"task-123\"")); + assertTrue(json.contains("\"state\":\"submitted\"")); + + // Deserialize back to Task + Task_v0_3 deserialized = JsonUtil_v0_3.fromJson(json, Task_v0_3.class); + + // Verify deserialized task matches original + assertEquals(task.getId(), deserialized.getId()); + assertEquals(task.getStatus().state(), deserialized.getStatus().state()); + } + + @Test + void testTaskWithTimestamp() throws JsonProcessingException_v0_3 { + OffsetDateTime timestamp = OffsetDateTime.now(); + + Task_v0_3 task = new Task_v0_3.Builder() + .id("task-123") + .contextId("context-456") + .status(new TaskStatus_v0_3(TaskState_v0_3.WORKING, null, timestamp)) + .build(); + + // Serialize + String json = JsonUtil_v0_3.toJson(task); + + // Deserialize + Task_v0_3 deserialized = JsonUtil_v0_3.fromJson(json, Task_v0_3.class); + + // Verify OffsetDateTime timestamp is preserved + assertNotNull(deserialized.getStatus().timestamp()); + assertEquals(task.getStatus().timestamp(), deserialized.getStatus().timestamp()); + } + + @Test + void testTaskWithArtifacts() throws JsonProcessingException_v0_3 { + Artifact_v0_3 artifact = new Artifact_v0_3.Builder() + .artifactId("artifact-1") + .name("Test Artifact") + .description("Description of artifact") + .parts(List.of( + new TextPart_v0_3("Hello"), + new TextPart_v0_3("World") + )) + .build(); + + Task_v0_3 task = new Task_v0_3.Builder() + .id("task-123") + .contextId("context-456") + .status(new TaskStatus_v0_3(TaskState_v0_3.COMPLETED)) + .artifacts(List.of(artifact)) + .build(); + + // Serialize + String json = JsonUtil_v0_3.toJson(task); + + // Verify JSON contains artifact data + assertTrue(json.contains("\"artifactId\":\"artifact-1\"")); + assertTrue(json.contains("Hello")); + assertTrue(json.contains("World")); + + // Deserialize + Task_v0_3 deserialized = JsonUtil_v0_3.fromJson(json, Task_v0_3.class); + + // Verify artifacts are preserved + assertNotNull(deserialized.getArtifacts()); + assertEquals(1, deserialized.getArtifacts().size()); + assertEquals("artifact-1", deserialized.getArtifacts().get(0).artifactId()); + assertEquals(2, deserialized.getArtifacts().get(0).parts().size()); + } + + @Test + void testTaskWithHistory() throws JsonProcessingException_v0_3 { + Message_v0_3 message = new Message_v0_3.Builder() + .role(Message_v0_3.Role.USER) + .parts(List.of(new TextPart_v0_3("Test message"))) + .build(); + + Task_v0_3 task = new Task_v0_3.Builder() + .id("task-123") + .contextId("context-456") + .status(new TaskStatus_v0_3(TaskState_v0_3.WORKING)) + .history(List.of(message)) + .build(); + + // Serialize + String json = JsonUtil_v0_3.toJson(task); + + // Verify JSON contains history data + assertTrue(json.contains("\"role\":\"user\"")); + assertTrue(json.contains("Test message")); + + // Deserialize + Task_v0_3 deserialized = JsonUtil_v0_3.fromJson(json, Task_v0_3.class); + + // Verify history is preserved + assertNotNull(deserialized.getHistory()); + assertEquals(1, deserialized.getHistory().size()); + assertEquals(Message_v0_3.Role.USER, deserialized.getHistory().get(0).getRole()); + assertEquals(1, deserialized.getHistory().get(0).getParts().size()); + } + + @Test + void testTaskWithAllFields() throws JsonProcessingException_v0_3 { + OffsetDateTime timestamp = OffsetDateTime.now(); + + Task_v0_3 task = new Task_v0_3.Builder() + .id("task-123") + .contextId("context-789") + .status(new TaskStatus_v0_3(TaskState_v0_3.WORKING, null, timestamp)) + .history(List.of( + new Message_v0_3.Builder() + .role(Message_v0_3.Role.USER) + .parts(List.of(new TextPart_v0_3("User message"))) + .build(), + new Message_v0_3.Builder() + .role(Message_v0_3.Role.AGENT) + .parts(List.of(new TextPart_v0_3("Agent response"))) + .build() + )) + .artifacts(List.of( + new Artifact_v0_3.Builder() + .artifactId("artifact-1") + .parts(List.of(new TextPart_v0_3("Artifact content"))) + .build() + )) + .metadata(Map.of("key1", "value1", "key2", 42)) + .build(); + + // Serialize + String json = JsonUtil_v0_3.toJson(task); + + // Deserialize + Task_v0_3 deserialized = JsonUtil_v0_3.fromJson(json, Task_v0_3.class); + + // Verify all fields are preserved + assertEquals(task.getId(), deserialized.getId()); + assertEquals(task.getContextId(), deserialized.getContextId()); + assertEquals(task.getStatus().state(), deserialized.getStatus().state()); + assertEquals(task.getStatus().timestamp(), deserialized.getStatus().timestamp()); + assertEquals(task.getHistory().size(), deserialized.getHistory().size()); + assertEquals(task.getArtifacts().size(), deserialized.getArtifacts().size()); + assertNotNull(deserialized.getMetadata()); + assertEquals("value1", deserialized.getMetadata().get("key1")); + } + + @Test + void testTaskWithDifferentStates() throws JsonProcessingException_v0_3 { + for (TaskState_v0_3 state : TaskState_v0_3.values()) { + Task_v0_3 task = new Task_v0_3.Builder() + .id("task-" + state.asString()) + .contextId("context-123") + .status(new TaskStatus_v0_3(state)) + .build(); + + // Serialize + String json = JsonUtil_v0_3.toJson(task); + + // Verify state is serialized correctly + assertTrue(json.contains("\"state\":\"" + state.asString() + "\"")); + + // Deserialize + Task_v0_3 deserialized = JsonUtil_v0_3.fromJson(json, Task_v0_3.class); + + // Verify state is preserved + assertEquals(state, deserialized.getStatus().state()); + } + } + + @Test + void testTaskWithNullOptionalFields() throws JsonProcessingException_v0_3 { + Task_v0_3 task = new Task_v0_3.Builder() + .id("task-123") + .contextId("context-456") + .status(new TaskStatus_v0_3(TaskState_v0_3.SUBMITTED)) + // artifacts, history, metadata not set + .build(); + + // Serialize + String json = JsonUtil_v0_3.toJson(task); + + // Deserialize + Task_v0_3 deserialized = JsonUtil_v0_3.fromJson(json, Task_v0_3.class); + + // Verify required fields are present + assertEquals("task-123", deserialized.getId()); + assertEquals("context-456", deserialized.getContextId()); + assertEquals(TaskState_v0_3.SUBMITTED, deserialized.getStatus().state()); + + // Verify optional lists default to empty + assertNotNull(deserialized.getArtifacts()); + assertEquals(0, deserialized.getArtifacts().size()); + assertNotNull(deserialized.getHistory()); + assertEquals(0, deserialized.getHistory().size()); + } + + @Test + void testTaskWithFilePartBytes() throws JsonProcessingException_v0_3 { + FilePart_v0_3 filePart = new FilePart_v0_3(new FileWithBytes_v0_3("application/pdf", "document.pdf", "base64data")); + + Artifact_v0_3 artifact = new Artifact_v0_3.Builder() + .artifactId("file-artifact") + .parts(List.of(filePart)) + .build(); + + Task_v0_3 task = new Task_v0_3.Builder() + .id("task-123") + .contextId("context-456") + .status(new TaskStatus_v0_3(TaskState_v0_3.COMPLETED)) + .artifacts(List.of(artifact)) + .build(); + + // Serialize + String json = JsonUtil_v0_3.toJson(task); + + // Verify JSON contains file part data + assertTrue(json.contains("\"kind\":\"file\"")); + assertTrue(json.contains("document.pdf")); + assertTrue(json.contains("application/pdf")); + + // Deserialize + Task_v0_3 deserialized = JsonUtil_v0_3.fromJson(json, Task_v0_3.class); + + // Verify file part is preserved + Part_v0_3 part = deserialized.getArtifacts().get(0).parts().get(0); + assertTrue(part instanceof FilePart_v0_3); + FilePart_v0_3 deserializedFilePart = (FilePart_v0_3) part; + assertTrue(deserializedFilePart.getFile() instanceof FileWithBytes_v0_3); + FileWithBytes_v0_3 fileWithBytes = (FileWithBytes_v0_3) deserializedFilePart.getFile(); + assertEquals("document.pdf", fileWithBytes.name()); + assertEquals("application/pdf", fileWithBytes.mimeType()); + } + + @Test + void testTaskWithFilePartUri() throws JsonProcessingException_v0_3 { + FilePart_v0_3 filePart = new FilePart_v0_3(new FileWithUri_v0_3("image/png", "photo.png", "https://example.com/photo.png")); + + Artifact_v0_3 artifact = new Artifact_v0_3.Builder() + .artifactId("uri-artifact") + .parts(List.of(filePart)) + .build(); + + Task_v0_3 task = new Task_v0_3.Builder() + .id("task-123") + .contextId("context-456") + .status(new TaskStatus_v0_3(TaskState_v0_3.COMPLETED)) + .artifacts(List.of(artifact)) + .build(); + + // Serialize + String json = JsonUtil_v0_3.toJson(task); + + // Verify JSON contains URI + assertTrue(json.contains("https://example.com/photo.png")); + + // Deserialize + Task_v0_3 deserialized = JsonUtil_v0_3.fromJson(json, Task_v0_3.class); + + // Verify file part URI is preserved + Part_v0_3 part = deserialized.getArtifacts().get(0).parts().get(0); + assertTrue(part instanceof FilePart_v0_3); + FilePart_v0_3 deserializedFilePart = (FilePart_v0_3) part; + assertTrue(deserializedFilePart.getFile() instanceof FileWithUri_v0_3); + FileWithUri_v0_3 fileWithUri = (FileWithUri_v0_3) deserializedFilePart.getFile(); + assertEquals("https://example.com/photo.png", fileWithUri.uri()); + } + + @Test + void testTaskWithDataPart() throws JsonProcessingException_v0_3 { + DataPart_v0_3 dataPart = new DataPart_v0_3(Map.of("temperature", 22.5, "humidity", 65)); + + Artifact_v0_3 artifact = new Artifact_v0_3.Builder() + .artifactId("data-artifact") + .parts(List.of(dataPart)) + .build(); + + Task_v0_3 task = new Task_v0_3.Builder() + .id("task-123") + .contextId("context-456") + .status(new TaskStatus_v0_3(TaskState_v0_3.COMPLETED)) + .artifacts(List.of(artifact)) + .build(); + + // Serialize + String json = JsonUtil_v0_3.toJson(task); + + // Verify JSON contains data part + assertTrue(json.contains("\"kind\":\"data\"")); + assertTrue(json.contains("temperature")); + + // Deserialize + Task_v0_3 deserialized = JsonUtil_v0_3.fromJson(json, Task_v0_3.class); + + // Verify data part is preserved + Part_v0_3 part = deserialized.getArtifacts().get(0).parts().get(0); + assertTrue(part instanceof DataPart_v0_3); + DataPart_v0_3 deserializedDataPart = (DataPart_v0_3) part; + assertNotNull(deserializedDataPart.getData()); + } + + @Test + void testTaskRoundTrip() throws JsonProcessingException_v0_3 { + // Create a comprehensive task with all part types + OffsetDateTime timestamp = OffsetDateTime.now(); + + Task_v0_3 original = new Task_v0_3.Builder() + .id("task-123") + .contextId("context-789") + .status(new TaskStatus_v0_3(TaskState_v0_3.WORKING, null, timestamp)) + .history(List.of( + new Message_v0_3.Builder() + .role(Message_v0_3.Role.USER) + .parts(List.of( + new TextPart_v0_3("Text"), + new FilePart_v0_3(new FileWithBytes_v0_3("text/plain", "file.txt", "data")), + new DataPart_v0_3(Map.of("key", "value")) + )) + .build() + )) + .artifacts(List.of( + new Artifact_v0_3.Builder() + .artifactId("artifact-1") + .parts(List.of(new TextPart_v0_3("Content"))) + .build() + )) + .metadata(Map.of("meta1", "value1")) + .build(); + + // Serialize to JSON + String json = JsonUtil_v0_3.toJson(original); + + // Deserialize back to Task + Task_v0_3 deserialized = JsonUtil_v0_3.fromJson(json, Task_v0_3.class); + + // Serialize again + String json2 = JsonUtil_v0_3.toJson(deserialized); + + // Deserialize again + Task_v0_3 deserialized2 = JsonUtil_v0_3.fromJson(json2, Task_v0_3.class); + + // Verify multiple round-trips produce identical results + assertEquals(deserialized.getId(), deserialized2.getId()); + assertEquals(deserialized.getContextId(), deserialized2.getContextId()); + assertEquals(deserialized.getStatus().state(), deserialized2.getStatus().state()); + assertEquals(deserialized.getHistory().size(), deserialized2.getHistory().size()); + assertEquals(deserialized.getArtifacts().size(), deserialized2.getArtifacts().size()); + } + + @Test + void testTaskStatusWithMessage() throws JsonProcessingException_v0_3 { + Message_v0_3 statusMessage = new Message_v0_3.Builder() + .role(Message_v0_3.Role.AGENT) + .parts(List.of(new TextPart_v0_3("Processing complete"))) + .build(); + + Task_v0_3 task = new Task_v0_3.Builder() + .id("task-123") + .contextId("context-456") + .status(new TaskStatus_v0_3(TaskState_v0_3.COMPLETED, statusMessage, null)) + .build(); + + // Serialize + String json = JsonUtil_v0_3.toJson(task); + + // Verify JSON contains status message + assertTrue(json.contains("\"state\":\"completed\"")); + assertTrue(json.contains("Processing complete")); + + // Deserialize + Task_v0_3 deserialized = JsonUtil_v0_3.fromJson(json, Task_v0_3.class); + + // Verify status message is preserved + assertEquals(TaskState_v0_3.COMPLETED, deserialized.getStatus().state()); + assertNotNull(deserialized.getStatus().message()); + assertEquals(Message_v0_3.Role.AGENT, deserialized.getStatus().message().getRole()); + assertTrue(deserialized.getStatus().message().getParts().get(0) instanceof TextPart_v0_3); + } + + @Test + void testDeserializeTaskFromJson() throws JsonProcessingException_v0_3 { + String json = """ + { + "id": "task-123", + "contextId": "context-456", + "status": { + "state": "submitted" + }, + "kind": "task" + } + """; + + Task_v0_3 task = JsonUtil_v0_3.fromJson(json, Task_v0_3.class); + + assertEquals("task-123", task.getId()); + assertEquals("context-456", task.getContextId()); + assertEquals(TaskState_v0_3.SUBMITTED, task.getStatus().state()); + assertNull(task.getStatus().message()); + // TaskStatus automatically sets timestamp to current time if not provided + assertNotNull(task.getStatus().timestamp()); + } + + @Test + void testDeserializeTaskWithArtifactsFromJson() throws JsonProcessingException_v0_3 { + String json = """ + { + "id": "task-123", + "contextId": "context-456", + "status": { + "state": "completed" + }, + "artifacts": [ + { + "artifactId": "artifact-1", + "name": "Result", + "parts": [ + { + "kind": "text", + "text": "Hello World" + } + ] + } + ], + "kind": "task" + } + """; + + Task_v0_3 task = JsonUtil_v0_3.fromJson(json, Task_v0_3.class); + + assertEquals("task-123", task.getId()); + assertEquals(TaskState_v0_3.COMPLETED, task.getStatus().state()); + assertEquals(1, task.getArtifacts().size()); + assertEquals("artifact-1", task.getArtifacts().get(0).artifactId()); + assertEquals("Result", task.getArtifacts().get(0).name()); + assertEquals(1, task.getArtifacts().get(0).parts().size()); + assertTrue(task.getArtifacts().get(0).parts().get(0) instanceof TextPart_v0_3); + assertEquals("Hello World", ((TextPart_v0_3) task.getArtifacts().get(0).parts().get(0)).getText()); + } + + @Test + void testDeserializeTaskWithFilePartBytesFromJson() throws JsonProcessingException_v0_3 { + String json = """ + { + "id": "task-123", + "contextId": "context-456", + "status": { + "state": "completed" + }, + "artifacts": [ + { + "artifactId": "file-artifact", + "parts": [ + { + "kind": "file", + "file": { + "mimeType": "application/pdf", + "name": "document.pdf", + "bytes": "base64encodeddata" + } + } + ] + } + ], + "kind": "task" + } + """; + + Task_v0_3 task = JsonUtil_v0_3.fromJson(json, Task_v0_3.class); + + assertEquals("task-123", task.getId()); + assertEquals(1, task.getArtifacts().size()); + Part_v0_3 part = task.getArtifacts().get(0).parts().get(0); + assertTrue(part instanceof FilePart_v0_3); + FilePart_v0_3 filePart = (FilePart_v0_3) part; + assertTrue(filePart.getFile() instanceof FileWithBytes_v0_3); + FileWithBytes_v0_3 fileWithBytes = (FileWithBytes_v0_3) filePart.getFile(); + assertEquals("application/pdf", fileWithBytes.mimeType()); + assertEquals("document.pdf", fileWithBytes.name()); + assertEquals("base64encodeddata", fileWithBytes.bytes()); + } + + @Test + void testDeserializeTaskWithFilePartUriFromJson() throws JsonProcessingException_v0_3 { + String json = """ + { + "id": "task-123", + "contextId": "context-456", + "status": { + "state": "completed" + }, + "artifacts": [ + { + "artifactId": "uri-artifact", + "parts": [ + { + "kind": "file", + "file": { + "mimeType": "image/png", + "name": "photo.png", + "uri": "https://example.com/photo.png" + } + } + ] + } + ], + "kind": "task" + } + """; + + Task_v0_3 task = JsonUtil_v0_3.fromJson(json, Task_v0_3.class); + + assertEquals("task-123", task.getId()); + Part_v0_3 part = task.getArtifacts().get(0).parts().get(0); + assertTrue(part instanceof FilePart_v0_3); + FilePart_v0_3 filePart = (FilePart_v0_3) part; + assertTrue(filePart.getFile() instanceof FileWithUri_v0_3); + FileWithUri_v0_3 fileWithUri = (FileWithUri_v0_3) filePart.getFile(); + assertEquals("image/png", fileWithUri.mimeType()); + assertEquals("photo.png", fileWithUri.name()); + assertEquals("https://example.com/photo.png", fileWithUri.uri()); + } + + @Test + void testDeserializeTaskWithDataPartFromJson() throws JsonProcessingException_v0_3 { + String json = """ + { + "id": "task-123", + "contextId": "context-456", + "status": { + "state": "completed" + }, + "artifacts": [ + { + "artifactId": "data-artifact", + "parts": [ + { + "kind": "data", + "data": { + "temperature": 22.5, + "humidity": 65 + } + } + ] + } + ], + "kind": "task" + } + """; + + Task_v0_3 task = JsonUtil_v0_3.fromJson(json, Task_v0_3.class); + + assertEquals("task-123", task.getId()); + Part_v0_3 part = task.getArtifacts().get(0).parts().get(0); + assertTrue(part instanceof DataPart_v0_3); + DataPart_v0_3 dataPart = (DataPart_v0_3) part; + assertNotNull(dataPart.getData()); + } + + @Test + void testDeserializeTaskWithHistoryFromJson() throws JsonProcessingException_v0_3 { + String json = """ + { + "id": "task-123", + "contextId": "context-456", + "status": { + "state": "working" + }, + "history": [ + { + "role": "user", + "parts": [ + { + "kind": "text", + "text": "User message" + } + ] + }, + { + "role": "agent", + "parts": [ + { + "kind": "text", + "text": "Agent response" + } + ] + } + ], + "kind": "task" + } + """; + + Task_v0_3 task = JsonUtil_v0_3.fromJson(json, Task_v0_3.class); + + assertEquals("task-123", task.getId()); + assertEquals(2, task.getHistory().size()); + assertEquals(Message_v0_3.Role.USER, task.getHistory().get(0).getRole()); + assertEquals(Message_v0_3.Role.AGENT, task.getHistory().get(1).getRole()); + assertTrue(task.getHistory().get(0).getParts().get(0) instanceof TextPart_v0_3); + assertEquals("User message", ((TextPart_v0_3) task.getHistory().get(0).getParts().get(0)).getText()); + } + + @Test + void testDeserializeTaskWithTimestampFromJson() throws JsonProcessingException_v0_3 { + String json = """ + { + "id": "task-123", + "contextId": "context-456", + "status": { + "state": "working", + "timestamp": "2023-10-01T12:00:00.234-05:00" + }, + "kind": "task" + } + """; + + Task_v0_3 task = JsonUtil_v0_3.fromJson(json, Task_v0_3.class); + + assertEquals("task-123", task.getId()); + assertEquals(TaskState_v0_3.WORKING, task.getStatus().state()); + assertNotNull(task.getStatus().timestamp()); + assertEquals("2023-10-01T12:00:00.234-05:00", task.getStatus().timestamp().toString()); + } + + @Test + void testDeserializeTaskWithMetadataFromJson() throws JsonProcessingException_v0_3 { + String json = """ + { + "id": "task-123", + "contextId": "context-456", + "status": { + "state": "completed" + }, + "metadata": { + "key1": "value1", + "key2": 42 + }, + "kind": "task" + } + """; + + Task_v0_3 task = JsonUtil_v0_3.fromJson(json, Task_v0_3.class); + + assertEquals("task-123", task.getId()); + assertNotNull(task.getMetadata()); + assertEquals("value1", task.getMetadata().get("key1")); + } + + @Test + void testTaskWithMixedPartTypes() throws JsonProcessingException_v0_3 { + Artifact_v0_3 artifact = new Artifact_v0_3.Builder() + .artifactId("mixed-artifact") + .parts(List.of( + new TextPart_v0_3("Text content"), + new FilePart_v0_3(new FileWithBytes_v0_3("application/json", "data.json", "{}")), + new DataPart_v0_3(Map.of("result", 42)), + new FilePart_v0_3(new FileWithUri_v0_3("image/png", "image.png", "https://example.com/img.png")) + )) + .build(); + + Task_v0_3 task = new Task_v0_3.Builder() + .id("task-123") + .contextId("context-456") + .status(new TaskStatus_v0_3(TaskState_v0_3.COMPLETED)) + .artifacts(List.of(artifact)) + .build(); + + // Serialize + String json = JsonUtil_v0_3.toJson(task); + + // Deserialize + Task_v0_3 deserialized = JsonUtil_v0_3.fromJson(json, Task_v0_3.class); + + // Verify all part types are preserved + List> parts = deserialized.getArtifacts().get(0).parts(); + assertEquals(4, parts.size()); + assertTrue(parts.get(0) instanceof TextPart_v0_3); + assertTrue(parts.get(1) instanceof FilePart_v0_3); + assertTrue(parts.get(2) instanceof DataPart_v0_3); + assertTrue(parts.get(3) instanceof FilePart_v0_3); + } +} diff --git a/compat-0.3/tck/pom.xml b/compat-0.3/tck/pom.xml new file mode 100644 index 000000000..b0cb5c5c8 --- /dev/null +++ b/compat-0.3/tck/pom.xml @@ -0,0 +1,70 @@ + + + 4.0.0 + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-parent + 1.0.0.Beta2-SNAPSHOT + .. + + + a2a-compat-0.3-tck-server + + Java SDK A2A Compat 0.3 TCK Server + Server example to use with the A2A TCK + + + + ${project.groupId} + a2a-java-sdk-server-common + + + ${project.groupId} + a2a-java-sdk-compat-0.3-reference-jsonrpc + + + ${project.groupId} + a2a-java-sdk-compat-0.3-reference-grpc + + + ${project.groupId} + a2a-java-sdk-compat-0.3-reference-rest + + + io.quarkus + quarkus-rest-jackson + provided + + + jakarta.enterprise + jakarta.enterprise.cdi-api + provided + + + jakarta.ws.rs + jakarta.ws.rs-api + + + + + + + io.quarkus + quarkus-maven-plugin + true + + + + build + generate-code + generate-code-tests + + + + + + + diff --git a/compat-0.3/tck/src/main/java/org/a2aproject/sdk/compat03/tck/server/AgentCardProducer_v0_3.java b/compat-0.3/tck/src/main/java/org/a2aproject/sdk/compat03/tck/server/AgentCardProducer_v0_3.java new file mode 100644 index 000000000..14b1f1528 --- /dev/null +++ b/compat-0.3/tck/src/main/java/org/a2aproject/sdk/compat03/tck/server/AgentCardProducer_v0_3.java @@ -0,0 +1,61 @@ +package org.a2aproject.sdk.compat03.tck.server; + +import java.util.Collections; +import java.util.List; + +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.enterprise.inject.Produces; + +import org.a2aproject.sdk.server.PublicAgentCard; +import org.a2aproject.sdk.compat03.spec.AgentCapabilities_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentCard_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentInterface_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentSkill_v0_3; +import org.a2aproject.sdk.compat03.spec.TransportProtocol_v0_3; + +@ApplicationScoped +public class AgentCardProducer_v0_3 { + + private static final String DEFAULT_SUT_URL = "http://localhost:9999"; + + @Produces + @PublicAgentCard + public AgentCard_v0_3 agentCard() { + + String sutJsonRpcUrl = getEnvOrDefault("SUT_JSONRPC_URL", DEFAULT_SUT_URL); + String sutGrpcUrl = getEnvOrDefault("SUT_GRPC_URL", DEFAULT_SUT_URL); + String sutRestcUrl = getEnvOrDefault("SUT_REST_URL", DEFAULT_SUT_URL); + return new AgentCard_v0_3.Builder() + .name("Hello World Agent") + .description("Just a hello world agent") + .url(sutJsonRpcUrl) + .version("1.0.0") + .documentationUrl("http://example.com/docs") + .capabilities(new AgentCapabilities_v0_3.Builder() + .streaming(true) + .pushNotifications(true) + .stateTransitionHistory(true) + .build()) + .defaultInputModes(Collections.singletonList("text")) + .defaultOutputModes(Collections.singletonList("text")) + .skills(Collections.singletonList(new AgentSkill_v0_3.Builder() + .id("hello_world") + .name("Returns hello world") + .description("just returns hello world") + .tags(Collections.singletonList("hello world")) + .examples(List.of("hi", "hello world")) + .build())) + .protocolVersion("0.3.0") + .additionalInterfaces(List.of( + new AgentInterface_v0_3(TransportProtocol_v0_3.JSONRPC.asString(), sutJsonRpcUrl), + new AgentInterface_v0_3(TransportProtocol_v0_3.GRPC.asString(), sutGrpcUrl), + new AgentInterface_v0_3(TransportProtocol_v0_3.HTTP_JSON.asString(), sutRestcUrl))) + .build(); + } + + private static String getEnvOrDefault(String envVar, String defaultValue) { + String value = System.getenv(envVar); + return value == null || value.isBlank() ? defaultValue : value; + } +} + diff --git a/compat-0.3/tck/src/main/java/org/a2aproject/sdk/compat03/tck/server/AgentExecutorProducer_v0_3.java b/compat-0.3/tck/src/main/java/org/a2aproject/sdk/compat03/tck/server/AgentExecutorProducer_v0_3.java new file mode 100644 index 000000000..9f89162c7 --- /dev/null +++ b/compat-0.3/tck/src/main/java/org/a2aproject/sdk/compat03/tck/server/AgentExecutorProducer_v0_3.java @@ -0,0 +1,84 @@ +package org.a2aproject.sdk.compat03.tck.server; + +import jakarta.annotation.PreDestroy; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.enterprise.inject.Produces; + +import org.a2aproject.sdk.server.agentexecution.AgentExecutor; +import org.a2aproject.sdk.server.agentexecution.RequestContext; +import org.a2aproject.sdk.server.tasks.AgentEmitter; +import org.a2aproject.sdk.spec.A2AError; +import org.a2aproject.sdk.spec.Message; +import org.a2aproject.sdk.spec.Task; +import org.a2aproject.sdk.spec.TaskNotCancelableError; +import org.a2aproject.sdk.spec.TaskState; +import org.a2aproject.sdk.util.Assert; + +@ApplicationScoped +public class AgentExecutorProducer_v0_3 { + + @Produces + public AgentExecutor agentExecutor() { + return new FireAndForgetAgentExecutor(); + } + + private static class FireAndForgetAgentExecutor implements AgentExecutor { + @Override + public void execute(RequestContext context, AgentEmitter emitter) throws A2AError { + Task task = context.getTask(); + + if (task == null) { + // The 0.3 TCK requires the initial message to be part of the Task history + // However, the 1.0 spec says it is up to the agent what is saved + emitter.submit(context.getMessage()); + } + + // Sleep to allow task state persistence before TCK resubscribe test + Message message = context.getMessage(); + if (message != null && message.messageId() != null && message.messageId().startsWith("test-resubscribe-message-id")) { + int timeoutMs = Integer.parseInt(System.getenv().getOrDefault("RESUBSCRIBE_TIMEOUT_MS", "3000")); + System.out.println("====> task id starts with test-resubscribe-message-id, sleeping for " + timeoutMs + " ms"); + try { + Thread.sleep(timeoutMs); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + } + + // Immediately set to WORKING state + emitter.startWork(); + System.out.println("====> task set to WORKING, starting background execution"); + + // Method returns immediately - task continues in background + System.out.println("====> execute() method returning immediately, task running in background"); + } + + @Override + public void cancel(RequestContext context, AgentEmitter emitter) throws A2AError { + System.out.println("====> task cancel request received"); + Task task = Assert.checkNotNullParam("task", context.getTask()); + + if (task.status().state() == TaskState.TASK_STATE_CANCELED) { + System.out.println("====> task already canceled"); + throw new TaskNotCancelableError(); + } + + if (task.status().state() == TaskState.TASK_STATE_COMPLETED) { + System.out.println("====> task already completed"); + throw new TaskNotCancelableError(); + } + + emitter.cancel(); + + System.out.println("====> task canceled"); + } + + /** + * Cleanup method for proper resource management + */ + @PreDestroy + public void cleanup() { + System.out.println("====> shutting down task executor"); + } + } +} \ No newline at end of file diff --git a/compat-0.3/tck/src/main/java/org/a2aproject/sdk/compat03/tck/server/package-info.java b/compat-0.3/tck/src/main/java/org/a2aproject/sdk/compat03/tck/server/package-info.java new file mode 100644 index 000000000..4539f9136 --- /dev/null +++ b/compat-0.3/tck/src/main/java/org/a2aproject/sdk/compat03/tck/server/package-info.java @@ -0,0 +1,10 @@ +@NullMarked +package org.a2aproject.sdk.compat03.tck.server; + +import org.jspecify.annotations.NullMarked; + +//The following had @Nullable annotation applied from JSpecify +//AgentCardProducer.java getEnvOrDefault method, +//AgentExecutorProducer.java execute method +// + diff --git a/compat-0.3/tck/src/main/resources/application.properties b/compat-0.3/tck/src/main/resources/application.properties new file mode 100644 index 000000000..c68793be4 --- /dev/null +++ b/compat-0.3/tck/src/main/resources/application.properties @@ -0,0 +1,20 @@ +# Use the new gRPC implementation which uses the main HTTP port +quarkus.grpc.server.use-separate-server=false +%dev.quarkus.http.port=9999 + +# Thread pool configuration for TCK testing +# Limit max threads to prevent resource exhaustion in CI environments +a2a.executor.core-pool-size=5 +a2a.executor.max-pool-size=15 +a2a.executor.keep-alive-seconds=60 + +# Enable debug logging for troubleshooting TCK failures +quarkus.log.category."io.a2a.server.requesthandlers".level=DEBUG +quarkus.log.category."io.a2a.server.events".level=DEBUG +quarkus.log.category."io.a2a.server.tasks".level=DEBUG + +# Log to file for analysis +quarkus.log.file.enable=true +quarkus.log.file.path=target/tck-test.log +quarkus.log.file.level=DEBUG +quarkus.log.console.level=INFO diff --git a/compat-0.3/transport/grpc/pom.xml b/compat-0.3/transport/grpc/pom.xml new file mode 100644 index 000000000..7ad780db3 --- /dev/null +++ b/compat-0.3/transport/grpc/pom.xml @@ -0,0 +1,93 @@ + + + 4.0.0 + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-parent + 1.0.0.Beta2-SNAPSHOT + ../.. + + a2a-java-sdk-compat-0.3-transport-grpc + + jar + + Java SDK A2A Compat 0.3 Transport: gRPC + Java SDK for the Agent2Agent Protocol (A2A) - gRPC + + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec + + + ${project.groupId} + a2a-java-sdk-server-common + + + ${project.groupId} + a2a-java-sdk-server-common + test-jar + test + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec-grpc + + + ${project.groupId} + a2a-java-sdk-compat-0.3-server-conversion + + + ${project.groupId} + a2a-java-sdk-compat-0.3-server-conversion + ${project.version} + test-jar + test + + + com.google.protobuf + protobuf-java + + + io.grpc + grpc-protobuf + + + io.grpc + grpc-stub + + + jakarta.enterprise + jakarta.enterprise.cdi-api + + + jakarta.inject + jakarta.inject-api + + + ch.qos.logback + logback-classic + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.mockito + mockito-core + test + + + io.grpc + grpc-testing + test + + + + + diff --git a/compat-0.3/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/transport/grpc/context/GrpcContextKeys_v0_3.java b/compat-0.3/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/transport/grpc/context/GrpcContextKeys_v0_3.java new file mode 100644 index 000000000..178725bc3 --- /dev/null +++ b/compat-0.3/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/transport/grpc/context/GrpcContextKeys_v0_3.java @@ -0,0 +1,45 @@ +package org.a2aproject.sdk.compat03.transport.grpc.context; + +import io.grpc.Context; + +/** + * Shared gRPC context keys for A2A protocol data. + * + * These keys provide access to gRPC context information similar to + * Python's grpc.aio.ServicerContext, enabling rich context access + * in service method implementations. + */ +public final class GrpcContextKeys_v0_3 { + + /** + * Context key for storing the X-A2A-Extensions header value. + * Set by server interceptors and accessed by service handlers. + */ + public static final Context.Key EXTENSIONS_HEADER_KEY = + Context.key("x-a2a-extensions"); + + /** + * Context key for storing the complete gRPC Metadata object. + * Provides access to all request headers and metadata. + */ + public static final Context.Key METADATA_KEY = + Context.key("grpc-metadata"); + + /** + * Context key for storing the method name being called. + * Equivalent to Python's context.method() functionality. + */ + public static final Context.Key METHOD_NAME_KEY = + Context.key("grpc-method-name"); + + /** + * Context key for storing the peer information. + * Provides access to client connection details. + */ + public static final Context.Key PEER_INFO_KEY = + Context.key("grpc-peer-info"); + + private GrpcContextKeys_v0_3() { + // Utility class + } +} diff --git a/compat-0.3/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/transport/grpc/handler/CallContextFactory_v0_3.java b/compat-0.3/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/transport/grpc/handler/CallContextFactory_v0_3.java new file mode 100644 index 000000000..c5dc184cc --- /dev/null +++ b/compat-0.3/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/transport/grpc/handler/CallContextFactory_v0_3.java @@ -0,0 +1,12 @@ +package org.a2aproject.sdk.compat03.transport.grpc.handler; + +import org.a2aproject.sdk.server.ServerCallContext; +import io.grpc.stub.StreamObserver; + +/** + * Factory interface for creating ServerCallContext from gRPC StreamObserver. + * Implementations can provide custom context creation logic. + */ +public interface CallContextFactory_v0_3 { + ServerCallContext create(StreamObserver responseObserver); +} diff --git a/compat-0.3/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/transport/grpc/handler/GrpcHandler_v0_3.java b/compat-0.3/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/transport/grpc/handler/GrpcHandler_v0_3.java new file mode 100644 index 000000000..369835f55 --- /dev/null +++ b/compat-0.3/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/transport/grpc/handler/GrpcHandler_v0_3.java @@ -0,0 +1,403 @@ +package org.a2aproject.sdk.compat03.transport.grpc.handler; + +import static org.a2aproject.sdk.compat03.grpc.utils.ProtoUtils_v0_3.FromProto; +import static org.a2aproject.sdk.compat03.grpc.utils.ProtoUtils_v0_3.ToProto; + +import jakarta.enterprise.inject.Vetoed; + +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Executor; +import java.util.concurrent.Flow; + +import com.google.protobuf.Empty; +import org.a2aproject.sdk.compat03.conversion.Convert_v0_3_To10RequestHandler; +import org.a2aproject.sdk.compat03.conversion.ErrorConverter_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentCard_v0_3; +import org.a2aproject.sdk.compat03.spec.ContentTypeNotSupportedError_v0_3; +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigParams_v0_3; +import org.a2aproject.sdk.compat03.spec.EventKind_v0_3; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigParams_v0_3; +import org.a2aproject.sdk.compat03.spec.InternalError_v0_3; +import org.a2aproject.sdk.compat03.spec.InvalidAgentResponseError_v0_3; +import org.a2aproject.sdk.compat03.spec.InvalidParamsError_v0_3; +import org.a2aproject.sdk.compat03.spec.InvalidRequestError_v0_3; +import org.a2aproject.sdk.compat03.spec.JSONParseError_v0_3; +import org.a2aproject.sdk.compat03.spec.JSONRPCError_v0_3; +import org.a2aproject.sdk.compat03.spec.ListTaskPushNotificationConfigParams_v0_3; +import org.a2aproject.sdk.compat03.spec.MessageSendParams_v0_3; +import org.a2aproject.sdk.compat03.spec.MethodNotFoundError_v0_3; +import org.a2aproject.sdk.compat03.spec.PushNotificationNotSupportedError_v0_3; +import org.a2aproject.sdk.compat03.spec.StreamingEventKind_v0_3; +import org.a2aproject.sdk.compat03.spec.Task_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskIdParams_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskNotCancelableError_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskNotFoundError_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskQueryParams_v0_3; +import org.a2aproject.sdk.compat03.spec.UnsupportedOperationError_v0_3; +import org.a2aproject.sdk.server.ServerCallContext; +import org.a2aproject.sdk.server.auth.UnauthenticatedUser; +import org.a2aproject.sdk.server.auth.User; +import org.a2aproject.sdk.spec.A2AError; +import io.grpc.Status; +import io.grpc.stub.StreamObserver; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * Abstract gRPC handler for v0.3 protocol with translation layer to v1.0. + */ +@Vetoed +public abstract class GrpcHandler_v0_3 extends org.a2aproject.sdk.compat03.grpc.A2AServiceGrpc.A2AServiceImplBase { + + private Convert_v0_3_To10RequestHandler requestHandler; + + // Hook so testing can wait until streaming is subscribed. + // Without this we get intermittent failures + private static volatile Runnable streamingSubscribedRunnable; + + protected abstract AgentCard_v0_3 getAgentCard(); + + protected abstract CallContextFactory_v0_3 getCallContextFactory(); + + protected abstract Executor getExecutor(); + + protected Convert_v0_3_To10RequestHandler getRequestHandler() { + return requestHandler; + } + + protected void setRequestHandler(Convert_v0_3_To10RequestHandler requestHandler) { + this.requestHandler = requestHandler; + } + + @Override + public void sendMessage(org.a2aproject.sdk.compat03.grpc.SendMessageRequest request, + StreamObserver responseObserver) { + try { + ServerCallContext context = createCallContext(responseObserver); + MessageSendParams_v0_3 params = FromProto.messageSendParams(request); + EventKind_v0_3 taskOrMessage = requestHandler.onMessageSend(params, context); + org.a2aproject.sdk.compat03.grpc.SendMessageResponse response = ToProto.taskOrMessage(taskOrMessage); + responseObserver.onNext(response); + responseObserver.onCompleted(); + } catch (A2AError e) { + handleError(responseObserver, ErrorConverter_v0_3.convertA2AError(e)); + } catch (JSONRPCError_v0_3 e) { + handleError(responseObserver, e); + } catch (Throwable t) { + handleInternalError(responseObserver, t); + } + } + + @Override + public void getTask(org.a2aproject.sdk.compat03.grpc.GetTaskRequest request, + StreamObserver responseObserver) { + try { + ServerCallContext context = createCallContext(responseObserver); + TaskQueryParams_v0_3 params = FromProto.taskQueryParams(request); + Task_v0_3 task = requestHandler.onGetTask(params, context); + if (task != null) { + responseObserver.onNext(ToProto.task(task)); + responseObserver.onCompleted(); + } else { + handleError(responseObserver, new TaskNotFoundError_v0_3()); + } + } catch (A2AError e) { + handleError(responseObserver, ErrorConverter_v0_3.convertA2AError(e)); + } catch (JSONRPCError_v0_3 e) { + handleError(responseObserver, e); + } catch (Throwable t) { + handleInternalError(responseObserver, t); + } + } + + @Override + public void cancelTask(org.a2aproject.sdk.compat03.grpc.CancelTaskRequest request, + StreamObserver responseObserver) { + try { + ServerCallContext context = createCallContext(responseObserver); + TaskIdParams_v0_3 params = FromProto.taskIdParams(request); + Task_v0_3 task = requestHandler.onCancelTask(params, context); + if (task != null) { + responseObserver.onNext(ToProto.task(task)); + responseObserver.onCompleted(); + } else { + handleError(responseObserver, new TaskNotFoundError_v0_3()); + } + } catch (A2AError e) { + handleError(responseObserver, ErrorConverter_v0_3.convertA2AError(e)); + } catch (JSONRPCError_v0_3 e) { + handleError(responseObserver, e); + } catch (Throwable t) { + handleInternalError(responseObserver, t); + } + } + + @Override + public void createTaskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest request, + StreamObserver responseObserver) { + if (!getAgentCard().capabilities().pushNotifications()) { + handleError(responseObserver, new PushNotificationNotSupportedError_v0_3()); + return; + } + + try { + ServerCallContext context = createCallContext(responseObserver); + TaskPushNotificationConfig_v0_3 config = FromProto.taskPushNotificationConfig(request); + TaskPushNotificationConfig_v0_3 responseConfig = requestHandler.onSetTaskPushNotificationConfig(config, context); + responseObserver.onNext(ToProto.taskPushNotificationConfig(responseConfig)); + responseObserver.onCompleted(); + } catch (A2AError e) { + handleError(responseObserver, ErrorConverter_v0_3.convertA2AError(e)); + } catch (JSONRPCError_v0_3 e) { + handleError(responseObserver, e); + } catch (Throwable t) { + handleInternalError(responseObserver, t); + } + } + + @Override + public void getTaskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest request, + StreamObserver responseObserver) { + if (!getAgentCard().capabilities().pushNotifications()) { + handleError(responseObserver, new PushNotificationNotSupportedError_v0_3()); + return; + } + + try { + ServerCallContext context = createCallContext(responseObserver); + GetTaskPushNotificationConfigParams_v0_3 params = FromProto.getTaskPushNotificationConfigParams(request); + TaskPushNotificationConfig_v0_3 config = requestHandler.onGetTaskPushNotificationConfig(params, context); + responseObserver.onNext(ToProto.taskPushNotificationConfig(config)); + responseObserver.onCompleted(); + } catch (A2AError e) { + handleError(responseObserver, ErrorConverter_v0_3.convertA2AError(e)); + } catch (JSONRPCError_v0_3 e) { + handleError(responseObserver, e); + } catch (Throwable t) { + handleInternalError(responseObserver, t); + } + } + + @Override + public void listTaskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest request, + StreamObserver responseObserver) { + if (!getAgentCard().capabilities().pushNotifications()) { + handleError(responseObserver, new PushNotificationNotSupportedError_v0_3()); + return; + } + + try { + ServerCallContext context = createCallContext(responseObserver); + ListTaskPushNotificationConfigParams_v0_3 params = FromProto.listTaskPushNotificationConfigParams(request); + List configList = requestHandler.onListTaskPushNotificationConfig(params, context); + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse.Builder responseBuilder = + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse.newBuilder(); + for (TaskPushNotificationConfig_v0_3 config : configList) { + responseBuilder.addConfigs(ToProto.taskPushNotificationConfig(config)); + } + responseObserver.onNext(responseBuilder.build()); + responseObserver.onCompleted(); + } catch (A2AError e) { + handleError(responseObserver, ErrorConverter_v0_3.convertA2AError(e)); + } catch (JSONRPCError_v0_3 e) { + handleError(responseObserver, e); + } catch (Throwable t) { + handleInternalError(responseObserver, t); + } + } + + @Override + public void sendStreamingMessage(org.a2aproject.sdk.compat03.grpc.SendMessageRequest request, + StreamObserver responseObserver) { + if (!getAgentCard().capabilities().streaming()) { + handleError(responseObserver, new InvalidRequestError_v0_3("Streaming is not supported by the agent")); + return; + } + + try { + ServerCallContext context = createCallContext(responseObserver); + MessageSendParams_v0_3 params = FromProto.messageSendParams(request); + Flow.Publisher publisher = requestHandler.onMessageSendStream(params, context); + convertToStreamResponse(publisher, responseObserver); + } catch (A2AError e) { + handleError(responseObserver, ErrorConverter_v0_3.convertA2AError(e)); + } catch (JSONRPCError_v0_3 e) { + handleError(responseObserver, e); + } catch (Throwable t) { + handleInternalError(responseObserver, t); + } + } + + @Override + public void taskSubscription(org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest request, + StreamObserver responseObserver) { + if (!getAgentCard().capabilities().streaming()) { + handleError(responseObserver, new InvalidRequestError_v0_3("Streaming is not supported by the agent")); + return; + } + + try { + ServerCallContext context = createCallContext(responseObserver); + TaskIdParams_v0_3 params = FromProto.taskIdParams(request); + Flow.Publisher publisher = requestHandler.onResubscribeToTask(params, context); + convertToStreamResponse(publisher, responseObserver); + } catch (A2AError e) { + handleError(responseObserver, ErrorConverter_v0_3.convertA2AError(e)); + } catch (JSONRPCError_v0_3 e) { + handleError(responseObserver, e); + } catch (Throwable t) { + handleInternalError(responseObserver, t); + } + } + + private void convertToStreamResponse(Flow.Publisher publisher, + StreamObserver responseObserver) { + CompletableFuture.runAsync(() -> { + publisher.subscribe(new Flow.Subscriber() { + private Flow.Subscription subscription; + + @Override + public void onSubscribe(Flow.Subscription subscription) { + this.subscription = subscription; + if (streamingSubscribedRunnable != null) { + streamingSubscribedRunnable.run(); + } + subscription.request(1); + } + + @Override + public void onNext(StreamingEventKind_v0_3 event) { + org.a2aproject.sdk.compat03.grpc.StreamResponse response = ToProto.streamResponse(event); + responseObserver.onNext(response); + if (response.hasStatusUpdate() && response.getStatusUpdate().getFinal()) { + responseObserver.onCompleted(); + } else { + subscription.request(1); + } + } + + @Override + public void onError(Throwable throwable) { + if (throwable instanceof A2AError a2aError) { + handleError(responseObserver, ErrorConverter_v0_3.convertA2AError(a2aError)); + } else if (throwable instanceof JSONRPCError_v0_3 jsonrpcError) { + handleError(responseObserver, jsonrpcError); + } else { + handleInternalError(responseObserver, throwable); + } + responseObserver.onCompleted(); + } + + @Override + public void onComplete() { + responseObserver.onCompleted(); + } + }); + }, getExecutor()); + } + + @Override + public void getAgentCard(org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest request, + StreamObserver responseObserver) { + try { + responseObserver.onNext(ToProto.agentCard(getAgentCard())); + responseObserver.onCompleted(); + } catch (Throwable t) { + handleInternalError(responseObserver, t); + } + } + + @Override + public void deleteTaskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest request, + StreamObserver responseObserver) { + if (!getAgentCard().capabilities().pushNotifications()) { + handleError(responseObserver, new PushNotificationNotSupportedError_v0_3()); + return; + } + + try { + ServerCallContext context = createCallContext(responseObserver); + DeleteTaskPushNotificationConfigParams_v0_3 params = FromProto.deleteTaskPushNotificationConfigParams(request); + requestHandler.onDeleteTaskPushNotificationConfig(params, context); + // void response + responseObserver.onNext(Empty.getDefaultInstance()); + responseObserver.onCompleted(); + } catch (A2AError e) { + handleError(responseObserver, ErrorConverter_v0_3.convertA2AError(e)); + } catch (JSONRPCError_v0_3 e) { + handleError(responseObserver, e); + } catch (Throwable t) { + handleInternalError(responseObserver, t); + } + } + + private ServerCallContext createCallContext(StreamObserver responseObserver) { + CallContextFactory_v0_3 factory = getCallContextFactory(); + if (factory == null) { + // Default implementation when no custom CallContextFactory is provided + User user = UnauthenticatedUser.INSTANCE; + Map state = new HashMap<>(); + state.put("grpc_response_observer", responseObserver); + Set requestedExtensions = new HashSet<>(); + return new ServerCallContext(user, state, requestedExtensions); + } else { + return factory.create(responseObserver); + } + } + + private void handleError(StreamObserver responseObserver, JSONRPCError_v0_3 error) { + Status status; + String description; + if (error instanceof InvalidRequestError_v0_3) { + status = Status.INVALID_ARGUMENT; + description = "InvalidRequestError: " + error.getMessage(); + } else if (error instanceof MethodNotFoundError_v0_3) { + status = Status.NOT_FOUND; + description = "MethodNotFoundError: " + error.getMessage(); + } else if (error instanceof InvalidParamsError_v0_3) { + status = Status.INVALID_ARGUMENT; + description = "InvalidParamsError: " + error.getMessage(); + } else if (error instanceof InternalError_v0_3) { + status = Status.INTERNAL; + description = "InternalError: " + error.getMessage(); + } else if (error instanceof TaskNotFoundError_v0_3) { + status = Status.NOT_FOUND; + description = "TaskNotFoundError: " + error.getMessage(); + } else if (error instanceof TaskNotCancelableError_v0_3) { + status = Status.UNIMPLEMENTED; + description = "TaskNotCancelableError: " + error.getMessage(); + } else if (error instanceof PushNotificationNotSupportedError_v0_3) { + status = Status.UNIMPLEMENTED; + description = "PushNotificationNotSupportedError: " + error.getMessage(); + } else if (error instanceof UnsupportedOperationError_v0_3) { + status = Status.UNIMPLEMENTED; + description = "UnsupportedOperationError: " + error.getMessage(); + } else if (error instanceof JSONParseError_v0_3) { + status = Status.INTERNAL; + description = "JSONParseError: " + error.getMessage(); + } else if (error instanceof ContentTypeNotSupportedError_v0_3) { + status = Status.UNIMPLEMENTED; + description = "ContentTypeNotSupportedError: " + error.getMessage(); + } else if (error instanceof InvalidAgentResponseError_v0_3) { + status = Status.INTERNAL; + description = "InvalidAgentResponseError: " + error.getMessage(); + } else { + status = Status.UNKNOWN; + description = "Unknown error type: " + error.getMessage(); + } + responseObserver.onError(status.withDescription(description).asRuntimeException()); + } + + private void handleInternalError(StreamObserver responseObserver, Throwable t) { + handleError(responseObserver, new InternalError_v0_3(t.getMessage())); + } + + public static void setStreamingSubscribedRunnable(Runnable runnable) { + streamingSubscribedRunnable = runnable; + } +} diff --git a/compat-0.3/transport/grpc/src/test/java/org/a2aproject/sdk/compat03/transport/grpc/handler/GrpcHandler_v0_3_Test.java b/compat-0.3/transport/grpc/src/test/java/org/a2aproject/sdk/compat03/transport/grpc/handler/GrpcHandler_v0_3_Test.java new file mode 100644 index 000000000..5a422c3bd --- /dev/null +++ b/compat-0.3/transport/grpc/src/test/java/org/a2aproject/sdk/compat03/transport/grpc/handler/GrpcHandler_v0_3_Test.java @@ -0,0 +1,555 @@ +package org.a2aproject.sdk.compat03.transport.grpc.handler; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +import org.a2aproject.sdk.compat03.conversion.AbstractA2ARequestHandlerTest_v0_3; +import org.a2aproject.sdk.compat03.conversion.Convert_v0_3_To10RequestHandler; +import org.a2aproject.sdk.compat03.conversion.mappers.domain.TaskMapper_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentCapabilities_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentCard_v0_3; +import org.a2aproject.sdk.compat03.spec.MessageSendParams_v0_3; +import org.a2aproject.sdk.compat03.spec.TextPart_v0_3; +import org.a2aproject.sdk.server.ServerCallContext; +import org.a2aproject.sdk.server.auth.UnauthenticatedUser; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; + +// gRPC test imports +import io.grpc.Status; +import io.grpc.StatusRuntimeException; +import io.grpc.testing.StreamRecorder; + +// v0.3 gRPC proto imports +import org.a2aproject.sdk.compat03.grpc.CancelTaskRequest; +import org.a2aproject.sdk.compat03.grpc.GetTaskRequest; +import org.a2aproject.sdk.compat03.grpc.Message; +import org.a2aproject.sdk.compat03.grpc.Part; +import org.a2aproject.sdk.compat03.grpc.Role; +import org.a2aproject.sdk.compat03.grpc.SendMessageRequest; +import org.a2aproject.sdk.compat03.grpc.SendMessageResponse; +import org.a2aproject.sdk.compat03.grpc.StreamResponse; +import org.a2aproject.sdk.compat03.grpc.Task; +import org.a2aproject.sdk.compat03.grpc.TaskState; +import org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest; + +/** + * Test suite for v0.3 GrpcHandler with v1.0 backend. + *

+ * Tests verify that v0.3 gRPC clients can successfully communicate with the v1.0 backend + * via the {@link Convert_v0_3_To10RequestHandler} conversion layer. + *

+ *

+ * Phase 3 Focus: Core non-streaming tests (GetTask, SendMessage, CancelTask). + * Streaming tests are deferred to Phase 4. + *

+ */ +public class GrpcHandler_v0_3_Test extends AbstractA2ARequestHandlerTest_v0_3 { + + // gRPC Message fixture (protobuf format) + private static final Message GRPC_MESSAGE = Message.newBuilder() + .setTaskId(MINIMAL_TASK.getId()) + .setContextId(MINIMAL_TASK.getContextId()) + .setMessageId(MESSAGE.getMessageId()) + .setRole(Role.ROLE_AGENT) + .addContent(Part.newBuilder().setText(((TextPart_v0_3) MESSAGE.getParts().get(0)).getText()).build()) + .build(); + + private final ServerCallContext callContext = new ServerCallContext( + UnauthenticatedUser.INSTANCE, Map.of("foo", "bar"), new HashSet<>()); + + // ======================================== + // GetTask Tests + // ======================================== + + @Test + public void testOnGetTaskSuccess() throws Exception { + TestGrpcHandler handler = new TestGrpcHandler(CARD, convert03To10Handler, internalExecutor); + + // Save v0.3 task by converting to v1.0 + taskStore.save(TaskMapper_v0_3.INSTANCE.toV10(MINIMAL_TASK), false); + + GetTaskRequest request = GetTaskRequest.newBuilder() + .setName("tasks/" + MINIMAL_TASK.getId()) + .build(); + + StreamRecorder streamRecorder = StreamRecorder.create(); + handler.getTask(request, streamRecorder); + streamRecorder.awaitCompletion(5, TimeUnit.SECONDS); + + Assertions.assertNull(streamRecorder.getError()); + List result = streamRecorder.getValues(); + Assertions.assertEquals(1, result.size()); + Task task = result.get(0); + assertEquals(MINIMAL_TASK.getId(), task.getId()); + assertEquals(MINIMAL_TASK.getContextId(), task.getContextId()); + } + + @Test + public void testOnGetTaskNotFound() throws Exception { + TestGrpcHandler handler = new TestGrpcHandler(CARD, convert03To10Handler, internalExecutor); + + GetTaskRequest request = GetTaskRequest.newBuilder() + .setName("tasks/" + MINIMAL_TASK.getId()) + .build(); + + StreamRecorder streamRecorder = StreamRecorder.create(); + handler.getTask(request, streamRecorder); + streamRecorder.awaitCompletion(5, TimeUnit.SECONDS); + + assertGrpcError(streamRecorder, Status.Code.NOT_FOUND); + } + + // ======================================== + // CancelTask Tests + // ======================================== + + @Test + public void testOnCancelTaskSuccess() throws Exception { + TestGrpcHandler handler = new TestGrpcHandler(CARD, convert03To10Handler, internalExecutor); + + // Save v0.3 task by converting to v1.0 + taskStore.save(TaskMapper_v0_3.INSTANCE.toV10(MINIMAL_TASK), false); + + // Configure agent to cancel the task + agentExecutorCancel = (context, emitter) -> { + emitter.cancel(); + }; + + CancelTaskRequest request = CancelTaskRequest.newBuilder() + .setName("tasks/" + MINIMAL_TASK.getId()) + .build(); + + StreamRecorder streamRecorder = StreamRecorder.create(); + handler.cancelTask(request, streamRecorder); + streamRecorder.awaitCompletion(5, TimeUnit.SECONDS); + + Assertions.assertNull(streamRecorder.getError()); + List result = streamRecorder.getValues(); + Assertions.assertEquals(1, result.size()); + Task task = result.get(0); + assertEquals(MINIMAL_TASK.getId(), task.getId()); + assertEquals(MINIMAL_TASK.getContextId(), task.getContextId()); + assertEquals(TaskState.TASK_STATE_CANCELLED, task.getStatus().getState()); + } + + @Test + public void testOnCancelTaskNotSupported() throws Exception { + TestGrpcHandler handler = new TestGrpcHandler(CARD, convert03To10Handler, internalExecutor); + + // Save v0.3 task by converting to v1.0 + taskStore.save(TaskMapper_v0_3.INSTANCE.toV10(MINIMAL_TASK), false); + + // Configure agent to throw UnsupportedOperationError + agentExecutorCancel = (context, emitter) -> { + throw new org.a2aproject.sdk.spec.UnsupportedOperationError(); + }; + + CancelTaskRequest request = CancelTaskRequest.newBuilder() + .setName("tasks/" + MINIMAL_TASK.getId()) + .build(); + + StreamRecorder streamRecorder = StreamRecorder.create(); + handler.cancelTask(request, streamRecorder); + streamRecorder.awaitCompletion(5, TimeUnit.SECONDS); + + assertGrpcError(streamRecorder, Status.Code.UNIMPLEMENTED); + } + + @Test + public void testOnCancelTaskNotFound() throws Exception { + TestGrpcHandler handler = new TestGrpcHandler(CARD, convert03To10Handler, internalExecutor); + + CancelTaskRequest request = CancelTaskRequest.newBuilder() + .setName("tasks/" + MINIMAL_TASK.getId()) + .build(); + + StreamRecorder streamRecorder = StreamRecorder.create(); + handler.cancelTask(request, streamRecorder); + streamRecorder.awaitCompletion(5, TimeUnit.SECONDS); + + assertGrpcError(streamRecorder, Status.Code.NOT_FOUND); + } + + // ======================================== + // SendMessage Tests (Non-Streaming) + // ======================================== + + @Test + public void testOnMessageNewMessageSuccess() throws Exception { + TestGrpcHandler handler = new TestGrpcHandler(CARD, convert03To10Handler, internalExecutor); + + // Save existing task + taskStore.save(TaskMapper_v0_3.INSTANCE.toV10(MINIMAL_TASK), false); + + // Configure agent to echo the message back + agentExecutorExecute = (context, emitter) -> { + emitter.emitEvent(context.getMessage()); + }; + + StreamRecorder streamRecorder = sendMessageRequest(handler); + + Assertions.assertNull(streamRecorder.getError()); + List result = streamRecorder.getValues(); + Assertions.assertEquals(1, result.size()); + SendMessageResponse response = result.get(0); + Assertions.assertTrue(response.hasMsg()); + Message message = response.getMsg(); + assertEquals(GRPC_MESSAGE.getMessageId(), message.getMessageId()); + } + + @Test + public void testOnMessageNewMessageWithExistingTaskSuccess() throws Exception { + TestGrpcHandler handler = new TestGrpcHandler(CARD, convert03To10Handler, internalExecutor); + + // Save existing task + taskStore.save(TaskMapper_v0_3.INSTANCE.toV10(MINIMAL_TASK), false); + + // Configure agent to emit message + agentExecutorExecute = (context, emitter) -> { + emitter.emitEvent(context.getMessage()); + }; + + StreamRecorder streamRecorder = sendMessageRequest(handler); + + Assertions.assertNull(streamRecorder.getError()); + List result = streamRecorder.getValues(); + Assertions.assertEquals(1, result.size()); + SendMessageResponse response = result.get(0); + Assertions.assertTrue(response.hasMsg()); + Message message = response.getMsg(); + assertEquals(GRPC_MESSAGE.getMessageId(), message.getMessageId()); + } + + @Test + public void testOnMessageError() throws Exception { + TestGrpcHandler handler = new TestGrpcHandler(CARD, convert03To10Handler, internalExecutor); + + // Save existing task + taskStore.save(TaskMapper_v0_3.INSTANCE.toV10(MINIMAL_TASK), false); + + // Configure agent to throw error + agentExecutorExecute = (context, emitter) -> { + emitter.emitEvent(new org.a2aproject.sdk.spec.UnsupportedOperationError()); + }; + + StreamRecorder streamRecorder = sendMessageRequest(handler); + + assertGrpcError(streamRecorder, Status.Code.UNIMPLEMENTED); + } + + // ======================================== + // Streaming Tests + // ======================================== + + @Test + public void testOnMessageStreamNewMessageSuccess() throws Exception { + TestGrpcHandler handler = new TestGrpcHandler(CARD, convert03To10Handler, internalExecutor); + + // Save existing task + taskStore.save(TaskMapper_v0_3.INSTANCE.toV10(MINIMAL_TASK), false); + + // Configure agent to emit the message back (v1.0 context contains v1.0 Message) + agentExecutorExecute = (context, emitter) -> { + emitter.emitEvent(context.getMessage()); + }; + + StreamRecorder streamRecorder = sendStreamingMessageRequest(handler); + + assertNull(streamRecorder.getError(), "No error should occur"); + List result = streamRecorder.getValues(); + assertNotNull(result, "Result should not be null"); + assertEquals(1, result.size(), "Should receive exactly 1 event"); + + StreamResponse response = result.get(0); + assertTrue(response.hasMsg(), "Response should contain a message"); + Message message = response.getMsg(); + assertEquals(GRPC_MESSAGE.getMessageId(), message.getMessageId()); + } + + @Test + public void testStreamingNotSupportedError() throws Exception { + // Create agent card with streaming disabled + AgentCard_v0_3 nonStreamingCard = + new AgentCard_v0_3.Builder(CARD) + .capabilities(new AgentCapabilities_v0_3(false, true, false, null)) + .build(); + + TestGrpcHandler handler = new TestGrpcHandler(nonStreamingCard, convert03To10Handler, internalExecutor); + + StreamRecorder streamRecorder = sendStreamingMessageRequest(handler); + + // Should receive INVALID_ARGUMENT status + assertGrpcError(streamRecorder, Status.Code.INVALID_ARGUMENT); + } + + @Test + public void testStreamingNotSupportedErrorOnResubscribeToTask() throws Exception { + // Create agent card with streaming disabled + AgentCard_v0_3 nonStreamingCard = + new AgentCard_v0_3.Builder(CARD) + .capabilities(new AgentCapabilities_v0_3(false, true, false, null)) + .build(); + + TestGrpcHandler handler = new TestGrpcHandler(nonStreamingCard, convert03To10Handler, internalExecutor); + + TaskSubscriptionRequest request = TaskSubscriptionRequest.newBuilder() + .setName("tasks/" + MINIMAL_TASK.getId()) + .build(); + + StreamRecorder streamRecorder = StreamRecorder.create(); + handler.taskSubscription(request, streamRecorder); + streamRecorder.awaitCompletion(5, TimeUnit.SECONDS); + + // Should receive INVALID_ARGUMENT status + assertGrpcError(streamRecorder, Status.Code.INVALID_ARGUMENT); + } + + @Test + public void testOnMessageStreamInternalError() throws Exception { + // Mock the Convert03To10RequestHandler to throw InternalError + Convert_v0_3_To10RequestHandler mockedHandler = Mockito.mock(Convert_v0_3_To10RequestHandler.class); + Mockito.doThrow(new org.a2aproject.sdk.spec.InternalError("Internal Error")) + .when(mockedHandler) + .onMessageSendStream( + Mockito.any(MessageSendParams_v0_3.class), + Mockito.any(ServerCallContext.class)); + + TestGrpcHandler handler = new TestGrpcHandler(CARD, mockedHandler, internalExecutor); + + StreamRecorder streamRecorder = sendStreamingMessageRequest(handler); + + // Should receive INTERNAL status + assertGrpcError(streamRecorder, Status.Code.INTERNAL); + } + + // ======================================== + // Push Notification Tests + // ======================================== + + @Test + public void testSetPushNotificationConfigSuccess() throws Exception { + TestGrpcHandler handler = new TestGrpcHandler(CARD, convert03To10Handler, internalExecutor); + + String NAME = "tasks/" + MINIMAL_TASK.getId() + "/pushNotificationConfigs/config456"; + StreamRecorder streamRecorder = + createTaskPushNotificationConfigRequest(handler, NAME); + + assertNull(streamRecorder.getError()); + List result = streamRecorder.getValues(); + assertNotNull(result); + assertEquals(1, result.size()); + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig response = result.get(0); + assertEquals(NAME, response.getName()); + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig responseConfig = response.getPushNotificationConfig(); + assertEquals("config456", responseConfig.getId()); + assertEquals("http://example.com", responseConfig.getUrl()); + } + + @Test + public void testGetPushNotificationConfigSuccess() throws Exception { + TestGrpcHandler handler = new TestGrpcHandler(CARD, convert03To10Handler, internalExecutor); + + agentExecutorExecute = (context, agentEmitter) -> { + agentEmitter.emitEvent(context.getTask() != null ? context.getTask() : context.getMessage()); + }; + + String NAME = "tasks/" + MINIMAL_TASK.getId() + "/pushNotificationConfigs/config456"; + + // First set the task push notification config + StreamRecorder streamRecorder = + createTaskPushNotificationConfigRequest(handler, NAME); + assertNull(streamRecorder.getError()); + + // Then get the task push notification config + streamRecorder = getTaskPushNotificationConfigRequest(handler, NAME); + assertNull(streamRecorder.getError()); + List result = streamRecorder.getValues(); + assertNotNull(result); + assertEquals(1, result.size()); + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig response = result.get(0); + assertEquals(NAME, response.getName()); + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig responseConfig = response.getPushNotificationConfig(); + assertEquals("config456", responseConfig.getId()); + assertEquals("http://example.com", responseConfig.getUrl()); + } + + @Test + public void testPushNotificationsNotSupportedError() throws Exception { + AgentCard_v0_3 card = createAgentCard(true, false, false); + TestGrpcHandler handler = new TestGrpcHandler(card, convert03To10Handler, internalExecutor); + + String NAME = "tasks/" + MINIMAL_TASK.getId() + "/pushNotificationConfigs/" + MINIMAL_TASK.getId(); + StreamRecorder streamRecorder = + createTaskPushNotificationConfigRequest(handler, NAME); + + assertNotNull(streamRecorder.getError()); + assertInstanceOf(StatusRuntimeException.class, streamRecorder.getError()); + StatusRuntimeException error = (StatusRuntimeException) streamRecorder.getError(); + assertEquals(Status.Code.UNIMPLEMENTED, error.getStatus().getCode()); + } + + @Test + public void testDeletePushNotificationConfig() throws Exception { + TestGrpcHandler handler = new TestGrpcHandler(CARD, convert03To10Handler, internalExecutor); + + // Save task to v1.0 backend + taskStore.save(TaskMapper_v0_3.INSTANCE.toV10(MINIMAL_TASK), false); + + String NAME = "tasks/" + MINIMAL_TASK.getId() + "/pushNotificationConfigs/" + MINIMAL_TASK.getId(); + org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest request = + org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest.newBuilder() + .setName(NAME) + .build(); + + StreamRecorder streamRecorder = StreamRecorder.create(); + handler.deleteTaskPushNotificationConfig(request, streamRecorder); + streamRecorder.awaitCompletion(5, TimeUnit.SECONDS); + + assertNull(streamRecorder.getError()); + List result = streamRecorder.getValues(); + assertEquals(1, result.size()); + } + + @Test + public void testListPushNotificationConfig() throws Exception { + TestGrpcHandler handler = new TestGrpcHandler(CARD, convert03To10Handler, internalExecutor); + + // Save task to v1.0 backend + taskStore.save(TaskMapper_v0_3.INSTANCE.toV10(MINIMAL_TASK), false); + + String PARENT = "tasks/" + MINIMAL_TASK.getId(); + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest request = + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest.newBuilder() + .setParent(PARENT) + .build(); + + StreamRecorder streamRecorder = StreamRecorder.create(); + handler.listTaskPushNotificationConfig(request, streamRecorder); + streamRecorder.awaitCompletion(5, TimeUnit.SECONDS); + + assertNull(streamRecorder.getError()); + List result = streamRecorder.getValues(); + assertEquals(1, result.size()); + } + + // ======================================== + // Helper Methods + // ======================================== + + private StreamRecorder sendMessageRequest(TestGrpcHandler handler) throws Exception { + SendMessageRequest request = SendMessageRequest.newBuilder() + .setRequest(GRPC_MESSAGE) + .build(); + StreamRecorder streamRecorder = StreamRecorder.create(); + handler.sendMessage(request, streamRecorder); + streamRecorder.awaitCompletion(5, TimeUnit.SECONDS); + return streamRecorder; + } + + private StreamRecorder sendStreamingMessageRequest(TestGrpcHandler handler) throws Exception { + SendMessageRequest request = SendMessageRequest.newBuilder() + .setRequest(GRPC_MESSAGE) + .build(); + StreamRecorder streamRecorder = StreamRecorder.create(); + handler.sendStreamingMessage(request, streamRecorder); + streamRecorder.awaitCompletion(5, TimeUnit.SECONDS); + return streamRecorder; + } + + private void assertGrpcError(StreamRecorder streamRecorder, Status.Code expectedStatusCode) { + Assertions.assertNotNull(streamRecorder.getError()); + Assertions.assertInstanceOf(StatusRuntimeException.class, streamRecorder.getError()); + Assertions.assertEquals(expectedStatusCode, ((StatusRuntimeException) streamRecorder.getError()).getStatus().getCode()); + Assertions.assertTrue(streamRecorder.getValues().isEmpty()); + } + + + private StreamRecorder createTaskPushNotificationConfigRequest( + TestGrpcHandler handler, String name) throws Exception { + // Save task to v1.0 backend + taskStore.save(TaskMapper_v0_3.INSTANCE.toV10(MINIMAL_TASK), false); + + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig config = + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.newBuilder() + .setUrl("http://example.com") + .build(); + + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig taskPushNotificationConfig = + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.newBuilder() + .setName(name) + .setPushNotificationConfig(config) + .build(); + + org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest setRequest = + org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest.newBuilder() + .setConfig(taskPushNotificationConfig) + .build(); + + StreamRecorder streamRecorder = StreamRecorder.create(); + handler.createTaskPushNotificationConfig(setRequest, streamRecorder); + streamRecorder.awaitCompletion(5, TimeUnit.SECONDS); + return streamRecorder; + } + + private StreamRecorder getTaskPushNotificationConfigRequest( + TestGrpcHandler handler, String name) throws Exception { + org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest request = + org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest.newBuilder() + .setName(name) + .build(); + + StreamRecorder streamRecorder = StreamRecorder.create(); + handler.getTaskPushNotificationConfig(request, streamRecorder); + streamRecorder.awaitCompletion(5, TimeUnit.SECONDS); + return streamRecorder; + } + // ======================================== + // Test Handler Implementation + // ======================================== + + private static class TestGrpcHandler extends GrpcHandler_v0_3 { + private final AgentCard_v0_3 card; + private final Convert_v0_3_To10RequestHandler handler; + private final java.util.concurrent.Executor executor; + + TestGrpcHandler(AgentCard_v0_3 card, + Convert_v0_3_To10RequestHandler handler, + java.util.concurrent.Executor executor) { + this.card = card; + this.handler = handler; + this.executor = executor; + setRequestHandler(handler); + } + + @Override + protected AgentCard_v0_3 getAgentCard() { + return card; + } + + @Override + protected Convert_v0_3_To10RequestHandler getRequestHandler() { + return handler; + } + + @Override + protected CallContextFactory_v0_3 getCallContextFactory() { + return null; + } + + @Override + protected java.util.concurrent.Executor getExecutor() { + return executor; + } + } + +} diff --git a/compat-0.3/transport/grpc/src/test/java/org/a2aproject/sdk/compat03/transport/grpc/handler/GrpcTestTransportMetadata_v0_3.java b/compat-0.3/transport/grpc/src/test/java/org/a2aproject/sdk/compat03/transport/grpc/handler/GrpcTestTransportMetadata_v0_3.java new file mode 100644 index 000000000..55ebd84cd --- /dev/null +++ b/compat-0.3/transport/grpc/src/test/java/org/a2aproject/sdk/compat03/transport/grpc/handler/GrpcTestTransportMetadata_v0_3.java @@ -0,0 +1,9 @@ +package org.a2aproject.sdk.compat03.transport.grpc.handler; + +// TODO: Uncomment when server-common is ported + +/** + * Placeholder stub - awaiting server-common port. + */ +public class GrpcTestTransportMetadata_v0_3 { +} diff --git a/compat-0.3/transport/jsonrpc/pom.xml b/compat-0.3/transport/jsonrpc/pom.xml new file mode 100644 index 000000000..fc5b918b3 --- /dev/null +++ b/compat-0.3/transport/jsonrpc/pom.xml @@ -0,0 +1,64 @@ + + + 4.0.0 + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-parent + 1.0.0.Beta2-SNAPSHOT + ../.. + + a2a-java-sdk-compat-0.3-transport-jsonrpc + + jar + + Java SDK A2A Compat 0.3 Transport: JSONRPC + Java SDK for the Agent2Agent Protocol (A2A) - JSONRPC + + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec + + + ${project.groupId} + a2a-java-sdk-compat-0.3-server-conversion + + + ${project.groupId} + a2a-java-sdk-server-common + + + ${project.groupId} + a2a-java-sdk-server-common + test-jar + test + + + ${project.groupId} + a2a-java-sdk-compat-0.3-server-conversion + ${project.version} + test-jar + test + + + ch.qos.logback + logback-classic + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.mockito + mockito-core + test + + + + + diff --git a/compat-0.3/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/transport/jsonrpc/context/JSONRPCContextKeys_v0_3.java b/compat-0.3/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/transport/jsonrpc/context/JSONRPCContextKeys_v0_3.java new file mode 100644 index 000000000..b73763a87 --- /dev/null +++ b/compat-0.3/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/transport/jsonrpc/context/JSONRPCContextKeys_v0_3.java @@ -0,0 +1,24 @@ +package org.a2aproject.sdk.compat03.transport.jsonrpc.context; + +/** + * Shared JSON-RPC context keys for A2A protocol data. + * + * These keys provide access to JSON-RPC context information, + * enabling rich context access in service method implementations. + */ +public final class JSONRPCContextKeys_v0_3 { + + /** + * Context key for storing the headers. + */ + public static final String HEADERS_KEY = "headers"; + + /** + * Context key for storing the method name being called. + */ + public static final String METHOD_NAME_KEY = "method"; + + private JSONRPCContextKeys_v0_3() { + // Utility class + } +} diff --git a/compat-0.3/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/transport/jsonrpc/handler/JSONRPCHandler_v0_3.java b/compat-0.3/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/transport/jsonrpc/handler/JSONRPCHandler_v0_3.java new file mode 100644 index 000000000..a5b1bbe4f --- /dev/null +++ b/compat-0.3/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/transport/jsonrpc/handler/JSONRPCHandler_v0_3.java @@ -0,0 +1,283 @@ +package org.a2aproject.sdk.compat03.transport.jsonrpc.handler; + +import static org.a2aproject.sdk.server.util.async.AsyncUtils.createTubeConfig; + +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.enterprise.inject.Instance; +import jakarta.inject.Inject; + +import java.util.List; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Executor; +import java.util.concurrent.Flow; + +import org.a2aproject.sdk.server.ExtendedAgentCard; +import org.a2aproject.sdk.server.PublicAgentCard; +import org.a2aproject.sdk.server.ServerCallContext; +import org.a2aproject.sdk.compat03.spec.AgentCard_v0_3; +import org.a2aproject.sdk.compat03.spec.AuthenticatedExtendedCardNotConfiguredError_v0_3; +import org.a2aproject.sdk.compat03.spec.CancelTaskRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.CancelTaskResponse_v0_3; +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigResponse_v0_3; +import org.a2aproject.sdk.compat03.spec.EventKind_v0_3; +import org.a2aproject.sdk.compat03.spec.GetAuthenticatedExtendedCardRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.GetAuthenticatedExtendedCardResponse_v0_3; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigResponse_v0_3; +import org.a2aproject.sdk.compat03.spec.GetTaskRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.GetTaskResponse_v0_3; +import org.a2aproject.sdk.compat03.spec.InternalError_v0_3; +import org.a2aproject.sdk.compat03.spec.InvalidParamsError_v0_3; +import org.a2aproject.sdk.compat03.spec.InvalidRequestError_v0_3; +import org.a2aproject.sdk.compat03.spec.JSONRPCError_v0_3; +import org.a2aproject.sdk.compat03.spec.ListTaskPushNotificationConfigRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.ListTaskPushNotificationConfigResponse_v0_3; +import org.a2aproject.sdk.compat03.spec.PushNotificationNotSupportedError_v0_3; +import org.a2aproject.sdk.compat03.spec.SendMessageRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.SendMessageResponse_v0_3; +import org.a2aproject.sdk.compat03.spec.SendStreamingMessageRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.SendStreamingMessageResponse_v0_3; +import org.a2aproject.sdk.compat03.spec.SetTaskPushNotificationConfigRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.SetTaskPushNotificationConfigResponse_v0_3; +import org.a2aproject.sdk.compat03.spec.StreamingEventKind_v0_3; +import org.a2aproject.sdk.compat03.spec.Task_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskResubscriptionRequest_v0_3; +import org.a2aproject.sdk.server.util.async.Internal; +import org.a2aproject.sdk.compat03.conversion.Convert_v0_3_To10RequestHandler; +import org.a2aproject.sdk.compat03.conversion.ErrorConverter_v0_3; +import org.a2aproject.sdk.spec.A2AError; +import mutiny.zero.ZeroPublisher; + +@ApplicationScoped +public class JSONRPCHandler_v0_3 { + + private AgentCard_v0_3 agentCard; + private Instance extendedAgentCard; + private Convert_v0_3_To10RequestHandler requestHandler; + private final Executor executor; + + protected JSONRPCHandler_v0_3() { + this.executor = null; + } + + @Inject + public JSONRPCHandler_v0_3(@PublicAgentCard AgentCard_v0_3 agentCard, @ExtendedAgentCard Instance extendedAgentCard, + @Internal Executor executor, Convert_v0_3_To10RequestHandler requestHandler) { + this.agentCard = agentCard; + this.extendedAgentCard = extendedAgentCard; + this.requestHandler = requestHandler; + this.executor = executor; + + // TODO: Port AgentCardValidator for v0.3 AgentCard or skip validation in compat layer + // AgentCardValidator.validateTransportConfiguration(agentCard); + } + + public JSONRPCHandler_v0_3(@PublicAgentCard AgentCard_v0_3 agentCard, Executor executor, Convert_v0_3_To10RequestHandler requestHandler) { + this(agentCard, null, executor, requestHandler); + } + + public SendMessageResponse_v0_3 onMessageSend(SendMessageRequest_v0_3 request, ServerCallContext context) { + try { + request.check(); + EventKind_v0_3 result = requestHandler.onMessageSend(request.getParams(), context); + return new SendMessageResponse_v0_3(request.getId(), result); + } catch (A2AError e) { + return new SendMessageResponse_v0_3(request.getId(), ErrorConverter_v0_3.convertA2AError(e)); + } catch (IllegalArgumentException t) { + return new SendMessageResponse_v0_3(request.getId(), new InvalidParamsError_v0_3(t.getMessage())); + } catch (Throwable t) { + return new SendMessageResponse_v0_3(request.getId(), new InternalError_v0_3(t.getMessage())); + } + } + + public Flow.Publisher onMessageSendStream( + SendStreamingMessageRequest_v0_3 request, ServerCallContext context) { + if (!agentCard.capabilities().streaming()) { + return ZeroPublisher.fromItems( + new SendStreamingMessageResponse_v0_3( + request.getId(), + new InvalidRequestError_v0_3("Streaming is not supported by the agent"))); + } + try { + request.check(); + Flow.Publisher publisher = requestHandler.onMessageSendStream(request.getParams(), context); + return convertToSendStreamingMessageResponse(request.getId(), publisher); + } catch (A2AError e) { + return ZeroPublisher.fromItems(new SendStreamingMessageResponse_v0_3(request.getId(), ErrorConverter_v0_3.convertA2AError(e))); + } catch (Throwable t) { + return ZeroPublisher.fromItems(new SendStreamingMessageResponse_v0_3(request.getId(), new InternalError_v0_3(t.getMessage()))); + } + } + + public CancelTaskResponse_v0_3 onCancelTask(CancelTaskRequest_v0_3 request, ServerCallContext context) { + try { + Task_v0_3 result = requestHandler.onCancelTask(request.getParams(), context); + return new CancelTaskResponse_v0_3(request.getId(), result); + } catch (A2AError e) { + return new CancelTaskResponse_v0_3(request.getId(), ErrorConverter_v0_3.convertA2AError(e)); + } catch (Throwable t) { + return new CancelTaskResponse_v0_3(request.getId(), new InternalError_v0_3(t.getMessage())); + } + } + + public Flow.Publisher onResubscribeToTask( + TaskResubscriptionRequest_v0_3 request, ServerCallContext context) { + if (!agentCard.capabilities().streaming()) { + return ZeroPublisher.fromItems( + new SendStreamingMessageResponse_v0_3( + request.getId(), + new InvalidRequestError_v0_3("Streaming is not supported by the agent"))); + } + + try { + Flow.Publisher publisher = requestHandler.onResubscribeToTask(request.getParams(), context); + return convertToSendStreamingMessageResponse(request.getId(), publisher); + } catch (A2AError e) { + return ZeroPublisher.fromItems(new SendStreamingMessageResponse_v0_3(request.getId(), ErrorConverter_v0_3.convertA2AError(e))); + } catch (Throwable t) { + return ZeroPublisher.fromItems(new SendStreamingMessageResponse_v0_3(request.getId(), new InternalError_v0_3(t.getMessage()))); + } + } + + public GetTaskPushNotificationConfigResponse_v0_3 getPushNotificationConfig( + GetTaskPushNotificationConfigRequest_v0_3 request, ServerCallContext context) { + if (!agentCard.capabilities().pushNotifications()) { + return new GetTaskPushNotificationConfigResponse_v0_3(request.getId(), + new PushNotificationNotSupportedError_v0_3()); + } + try { + TaskPushNotificationConfig_v0_3 result = requestHandler.onGetTaskPushNotificationConfig(request.getParams(), context); + return new GetTaskPushNotificationConfigResponse_v0_3(request.getId(), result); + } catch (A2AError e) { + return new GetTaskPushNotificationConfigResponse_v0_3(request.getId(), ErrorConverter_v0_3.convertA2AError(e)); + } catch (Throwable t) { + return new GetTaskPushNotificationConfigResponse_v0_3(request.getId(), new InternalError_v0_3(t.getMessage())); + } + } + + public SetTaskPushNotificationConfigResponse_v0_3 setPushNotificationConfig( + SetTaskPushNotificationConfigRequest_v0_3 request, ServerCallContext context) { + if (!agentCard.capabilities().pushNotifications()) { + return new SetTaskPushNotificationConfigResponse_v0_3(request.getId(), + new PushNotificationNotSupportedError_v0_3()); + } + try { + TaskPushNotificationConfig_v0_3 result = requestHandler.onSetTaskPushNotificationConfig(request.getParams(), context); + return new SetTaskPushNotificationConfigResponse_v0_3(request.getId(), result); + } catch (A2AError e) { + return new SetTaskPushNotificationConfigResponse_v0_3(request.getId(), ErrorConverter_v0_3.convertA2AError(e)); + } catch (Throwable t) { + return new SetTaskPushNotificationConfigResponse_v0_3(request.getId(), new InternalError_v0_3(t.getMessage())); + } + } + + public GetTaskResponse_v0_3 onGetTask(GetTaskRequest_v0_3 request, ServerCallContext context) { + try { + Task_v0_3 result = requestHandler.onGetTask(request.getParams(), context); + return new GetTaskResponse_v0_3(request.getId(), result); + } catch (A2AError e) { + return new GetTaskResponse_v0_3(request.getId(), ErrorConverter_v0_3.convertA2AError(e)); + } catch (Throwable t) { + return new GetTaskResponse_v0_3(request.getId(), new InternalError_v0_3(t.getMessage())); + } + } + + public ListTaskPushNotificationConfigResponse_v0_3 listPushNotificationConfig( + ListTaskPushNotificationConfigRequest_v0_3 request, ServerCallContext context) { + if (!agentCard.capabilities().pushNotifications()) { + return new ListTaskPushNotificationConfigResponse_v0_3(request.getId(), + new PushNotificationNotSupportedError_v0_3()); + } + try { + List pushNotificationConfigList = + requestHandler.onListTaskPushNotificationConfig(request.getParams(), context); + return new ListTaskPushNotificationConfigResponse_v0_3(request.getId(), pushNotificationConfigList); + } catch (A2AError e) { + return new ListTaskPushNotificationConfigResponse_v0_3(request.getId(), ErrorConverter_v0_3.convertA2AError(e)); + } catch (Throwable t) { + return new ListTaskPushNotificationConfigResponse_v0_3(request.getId(), new InternalError_v0_3(t.getMessage())); + } + } + + public DeleteTaskPushNotificationConfigResponse_v0_3 deletePushNotificationConfig( + DeleteTaskPushNotificationConfigRequest_v0_3 request, ServerCallContext context) { + if (!agentCard.capabilities().pushNotifications()) { + return new DeleteTaskPushNotificationConfigResponse_v0_3(request.getId(), + new PushNotificationNotSupportedError_v0_3()); + } + try { + requestHandler.onDeleteTaskPushNotificationConfig(request.getParams(), context); + return new DeleteTaskPushNotificationConfigResponse_v0_3(request.getId()); + } catch (A2AError e) { + return new DeleteTaskPushNotificationConfigResponse_v0_3(request.getId(), ErrorConverter_v0_3.convertA2AError(e)); + } catch (Throwable t) { + return new DeleteTaskPushNotificationConfigResponse_v0_3(request.getId(), new InternalError_v0_3(t.getMessage())); + } + } + + // TODO: Add authentication (https://github.com/a2aproject/a2a-java/issues/77) + public GetAuthenticatedExtendedCardResponse_v0_3 onGetAuthenticatedExtendedCardRequest( + GetAuthenticatedExtendedCardRequest_v0_3 request, ServerCallContext context) { + if (!agentCard.supportsAuthenticatedExtendedCard() || !extendedAgentCard.isResolvable()) { + return new GetAuthenticatedExtendedCardResponse_v0_3(request.getId(), + new AuthenticatedExtendedCardNotConfiguredError_v0_3(null, "Authenticated Extended Card not configured", null)); + } + try { + return new GetAuthenticatedExtendedCardResponse_v0_3(request.getId(), extendedAgentCard.get()); + } catch (JSONRPCError_v0_3 e) { + return new GetAuthenticatedExtendedCardResponse_v0_3(request.getId(), e); + } catch (Throwable t) { + return new GetAuthenticatedExtendedCardResponse_v0_3(request.getId(), new InternalError_v0_3(t.getMessage())); + } + } + + public AgentCard_v0_3 getAgentCard() { + return agentCard; + } + + private Flow.Publisher convertToSendStreamingMessageResponse( + Object requestId, + Flow.Publisher publisher) { + // We can't use the normal convertingProcessor since that propagates any errors as an error handled + // via Subscriber.onError() rather than as part of the SendStreamingResponse payload + return ZeroPublisher.create(createTubeConfig(), tube -> { + CompletableFuture.runAsync(() -> { + publisher.subscribe(new Flow.Subscriber() { + Flow.Subscription subscription; + + @Override + public void onSubscribe(Flow.Subscription subscription) { + this.subscription = subscription; + subscription.request(1); + } + + @Override + public void onNext(StreamingEventKind_v0_3 item) { + tube.send(new SendStreamingMessageResponse_v0_3(requestId, item)); + subscription.request(1); + } + + @Override + public void onError(Throwable throwable) { + if (throwable instanceof JSONRPCError_v0_3 jsonrpcError) { + tube.send(new SendStreamingMessageResponse_v0_3(requestId, jsonrpcError)); + } else { + tube.send( + new SendStreamingMessageResponse_v0_3( + requestId, new + InternalError_v0_3(throwable.getMessage()))); + } + onComplete(); + } + + @Override + public void onComplete() { + tube.complete(); + } + }); + }, executor); + }); + } +} diff --git a/compat-0.3/transport/jsonrpc/src/main/resources/META-INF/beans.xml b/compat-0.3/transport/jsonrpc/src/main/resources/META-INF/beans.xml new file mode 100644 index 000000000..548d44b72 --- /dev/null +++ b/compat-0.3/transport/jsonrpc/src/main/resources/META-INF/beans.xml @@ -0,0 +1,6 @@ + + + diff --git a/compat-0.3/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/transport/jsonrpc/handler/JSONRPCHandler_v0_3_Test.java b/compat-0.3/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/transport/jsonrpc/handler/JSONRPCHandler_v0_3_Test.java new file mode 100644 index 000000000..a564905d4 --- /dev/null +++ b/compat-0.3/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/transport/jsonrpc/handler/JSONRPCHandler_v0_3_Test.java @@ -0,0 +1,1150 @@ +package org.a2aproject.sdk.compat03.transport.jsonrpc.handler; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.Executors; +import java.util.concurrent.Flow; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicReference; + +import org.a2aproject.sdk.compat03.conversion.AbstractA2ARequestHandlerTest_v0_3; +import org.a2aproject.sdk.compat03.conversion.Convert_v0_3_To10RequestHandler; +import org.a2aproject.sdk.compat03.conversion.mappers.domain.TaskArtifactUpdateEventMapper_v0_3; +import org.a2aproject.sdk.compat03.conversion.mappers.domain.TaskMapper_v0_3; +import org.a2aproject.sdk.compat03.conversion.mappers.domain.TaskStatusUpdateEventMapper_v0_3; +import org.a2aproject.sdk.compat03.spec.EventKind_v0_3; +import org.a2aproject.sdk.compat03.spec.Event_v0_3; +import org.a2aproject.sdk.server.ServerCallContext; +import org.a2aproject.sdk.server.auth.UnauthenticatedUser; +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; + +// V0.3 spec imports (client perspective) +import org.a2aproject.sdk.compat03.spec.AgentCapabilities_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentCard_v0_3; +import org.a2aproject.sdk.compat03.spec.Artifact_v0_3; +import org.a2aproject.sdk.compat03.spec.CancelTaskRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.CancelTaskResponse_v0_3; +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigParams_v0_3; +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigResponse_v0_3; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigParams_v0_3; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigResponse_v0_3; +import org.a2aproject.sdk.compat03.spec.GetTaskRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.GetTaskResponse_v0_3; +import org.a2aproject.sdk.compat03.spec.InternalError_v0_3; +import org.a2aproject.sdk.compat03.spec.InvalidRequestError_v0_3; +import org.a2aproject.sdk.compat03.spec.Message_v0_3; +import org.a2aproject.sdk.compat03.spec.MessageSendParams_v0_3; +import org.a2aproject.sdk.compat03.spec.PushNotificationConfig_v0_3; +import org.a2aproject.sdk.compat03.spec.PushNotificationNotSupportedError_v0_3; +import org.a2aproject.sdk.compat03.spec.SendMessageRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.SendMessageResponse_v0_3; +import org.a2aproject.sdk.compat03.spec.SetTaskPushNotificationConfigRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.SetTaskPushNotificationConfigResponse_v0_3; +import org.a2aproject.sdk.compat03.spec.SendStreamingMessageRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.SendStreamingMessageResponse_v0_3; +import org.a2aproject.sdk.compat03.spec.StreamingEventKind_v0_3; +import org.a2aproject.sdk.compat03.spec.Task_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskArtifactUpdateEvent_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskIdParams_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskNotFoundError_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskQueryParams_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskResubscriptionRequest_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskState_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskStatus_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskStatusUpdateEvent_v0_3; +import org.a2aproject.sdk.compat03.spec.TextPart_v0_3; +import org.a2aproject.sdk.compat03.spec.UnsupportedOperationError_v0_3; + +/** + * Test suite for v0.3 JSONRPCHandler with v1.0 backend. + *

+ * Tests verify that v0.3 clients can successfully communicate with the v1.0 backend + * via the {@link Convert_v0_3_To10RequestHandler} conversion layer. + *

+ *

+ * Phase 2 Focus: Core non-streaming tests (GetTask, SendMessage, CancelTask). + * Streaming tests and push notification tests are deferred to later phases. + *

+ */ +public class JSONRPCHandler_v0_3_Test extends AbstractA2ARequestHandlerTest_v0_3 { + + private final ServerCallContext callContext = new ServerCallContext( + UnauthenticatedUser.INSTANCE, Map.of("foo", "bar"), new HashSet<>()); + + // ======================================== + // GetTask Tests + // ======================================== + + @Test + public void testOnGetTaskSuccess() throws Exception { + JSONRPCHandler_v0_3 handler = new JSONRPCHandler_v0_3(CARD, internalExecutor, convert03To10Handler); + + // Save v0.3 task by converting to v1.0 for taskStore + taskStore.save(TaskMapper_v0_3.INSTANCE.toV10(MINIMAL_TASK), false); + + GetTaskRequest_v0_3 request = new GetTaskRequest_v0_3("1", new TaskQueryParams_v0_3(MINIMAL_TASK.getId())); + GetTaskResponse_v0_3 response = handler.onGetTask(request, callContext); + + assertEquals(request.getId(), response.getId()); + assertNull(response.getError()); + + // Response should contain v0.3 task (converted back from v1.0) + Task_v0_3 result = response.getResult(); + assertEquals(MINIMAL_TASK.getId(), result.getId()); + assertEquals(MINIMAL_TASK.getContextId(), result.getContextId()); + } + + @Test + public void testOnGetTaskNotFound() throws Exception { + JSONRPCHandler_v0_3 handler = new JSONRPCHandler_v0_3(CARD, internalExecutor, convert03To10Handler); + + GetTaskRequest_v0_3 request = new GetTaskRequest_v0_3("1", new TaskQueryParams_v0_3(MINIMAL_TASK.getId())); + GetTaskResponse_v0_3 response = handler.onGetTask(request, callContext); + + assertEquals(request.getId(), response.getId()); + assertInstanceOf(TaskNotFoundError_v0_3.class, response.getError()); + assertNull(response.getResult()); + } + + // ======================================== + // CancelTask Tests + // ======================================== + + @Test + public void testOnCancelTaskSuccess() throws Exception { + JSONRPCHandler_v0_3 handler = new JSONRPCHandler_v0_3(CARD, internalExecutor, convert03To10Handler); + + // Save v0.3 task by converting to v1.0 + taskStore.save(TaskMapper_v0_3.INSTANCE.toV10(MINIMAL_TASK), false); + + // Configure agent to cancel the task + // In v1.0, we use AgentEmitter.cancel() instead of TaskUpdater + agentExecutorCancel = (context, emitter) -> { + emitter.cancel(); + }; + + CancelTaskRequest_v0_3 request = new CancelTaskRequest_v0_3("111", new TaskIdParams_v0_3(MINIMAL_TASK.getId())); + CancelTaskResponse_v0_3 response = handler.onCancelTask(request, callContext); + + assertNull(response.getError()); + assertEquals(request.getId(), response.getId()); + + // Verify task was canceled + Task_v0_3 task = response.getResult(); + assertEquals(MINIMAL_TASK.getId(), task.getId()); + assertEquals(MINIMAL_TASK.getContextId(), task.getContextId()); + assertEquals(TaskState_v0_3.CANCELED, task.getStatus().state()); + } + + @Test + public void testOnCancelTaskNotSupported() { + JSONRPCHandler_v0_3 handler = new JSONRPCHandler_v0_3(CARD, internalExecutor, convert03To10Handler); + + // Save v0.3 task by converting to v1.0 + taskStore.save(TaskMapper_v0_3.INSTANCE.toV10(MINIMAL_TASK), false); + + // Configure agent to throw UnsupportedOperationError + agentExecutorCancel = (context, emitter) -> { + throw new org.a2aproject.sdk.spec.UnsupportedOperationError(); + }; + + CancelTaskRequest_v0_3 request = new CancelTaskRequest_v0_3("1", new TaskIdParams_v0_3(MINIMAL_TASK.getId())); + CancelTaskResponse_v0_3 response = handler.onCancelTask(request, callContext); + + assertEquals(request.getId(), response.getId()); + assertNull(response.getResult()); + assertInstanceOf(UnsupportedOperationError_v0_3.class, response.getError()); + } + + @Test + public void testOnCancelTaskNotFound() { + JSONRPCHandler_v0_3 handler = new JSONRPCHandler_v0_3(CARD, internalExecutor, convert03To10Handler); + + CancelTaskRequest_v0_3 request = new CancelTaskRequest_v0_3("1", new TaskIdParams_v0_3(MINIMAL_TASK.getId())); + CancelTaskResponse_v0_3 response = handler.onCancelTask(request, callContext); + + assertEquals(request.getId(), response.getId()); + assertNull(response.getResult()); + assertInstanceOf(TaskNotFoundError_v0_3.class, response.getError()); + } + + // ======================================== + // SendMessage Tests (Non-Streaming) + // ======================================== + + @Test + public void testOnMessageSendSuccess() { + JSONRPCHandler_v0_3 handler = new JSONRPCHandler_v0_3(CARD, internalExecutor, convert03To10Handler); + + // Save existing task + taskStore.save(TaskMapper_v0_3.INSTANCE.toV10(MINIMAL_TASK), false); + + // Configure agent to echo the message back + agentExecutorExecute = (context, emitter) -> { + // Note: context.getMessage() contains v1.0 Message (already converted by Convert03To10RequestHandler) + // Emit the v1.0 message, it will be converted back to v0.3 in the response + emitter.emitEvent(context.getMessage()); + }; + + Message_v0_3 message = new Message_v0_3.Builder(MESSAGE) + .taskId(MINIMAL_TASK.getId()) + .contextId(MINIMAL_TASK.getContextId()) + .build(); + + SendMessageRequest_v0_3 request = new SendMessageRequest_v0_3("1", new MessageSendParams_v0_3(message, null, null)); + SendMessageResponse_v0_3 response = handler.onMessageSend(request, callContext); + + assertNull(response.getError()); + // Response should contain the message (converted back from v1.0) + EventKind_v0_3 result = response.getResult(); + if (result instanceof Message_v0_3) { + assertEquals(message.getMessageId(), ((Message_v0_3) result).getMessageId()); + } + } + + @Test + public void testOnMessageSendWithExistingTaskSuccess() { + JSONRPCHandler_v0_3 handler = new JSONRPCHandler_v0_3(CARD, internalExecutor, convert03To10Handler); + + // Save existing task + taskStore.save(TaskMapper_v0_3.INSTANCE.toV10(MINIMAL_TASK), false); + + // Configure agent to emit message + agentExecutorExecute = (context, emitter) -> { + // Emit v1.0 message from context + emitter.emitEvent(context.getMessage()); + }; + + Message_v0_3 message = new Message_v0_3.Builder(MESSAGE) + .taskId(MINIMAL_TASK.getId()) + .contextId(MINIMAL_TASK.getContextId()) + .build(); + + SendMessageRequest_v0_3 request = new SendMessageRequest_v0_3("1", new MessageSendParams_v0_3(message, null, null)); + SendMessageResponse_v0_3 response = handler.onMessageSend(request, callContext); + + assertNull(response.getError()); + EventKind_v0_3 result = response.getResult(); + if (result instanceof Message_v0_3) { + assertEquals(message.getMessageId(), ((Message_v0_3) result).getMessageId()); + } + } + + @Test + public void testOnMessageSendError() { + JSONRPCHandler_v0_3 handler = new JSONRPCHandler_v0_3(CARD, internalExecutor, convert03To10Handler); + + // Save existing task + taskStore.save(TaskMapper_v0_3.INSTANCE.toV10(MINIMAL_TASK), false); + + // Configure agent to throw error + agentExecutorExecute = (context, emitter) -> { + emitter.emitEvent(new org.a2aproject.sdk.spec.UnsupportedOperationError()); + }; + + Message_v0_3 message = new Message_v0_3.Builder(MESSAGE) + .taskId(MINIMAL_TASK.getId()) + .contextId(MINIMAL_TASK.getContextId()) + .build(); + + SendMessageRequest_v0_3 request = new SendMessageRequest_v0_3("1", new MessageSendParams_v0_3(message, null, null)); + SendMessageResponse_v0_3 response = handler.onMessageSend(request, callContext); + + assertInstanceOf(UnsupportedOperationError_v0_3.class, response.getError()); + assertNull(response.getResult()); + } + + // ======================================== + // Streaming Tests + // ======================================== + + @Test + public void testOnMessageSendStreamSuccess() throws InterruptedException { + JSONRPCHandler_v0_3 handler = new JSONRPCHandler_v0_3(CARD, internalExecutor, convert03To10Handler); + + // Save existing task + taskStore.save(TaskMapper_v0_3.INSTANCE.toV10(MINIMAL_TASK), false); + + // Configure agent to emit the message back (v1.0 context contains v1.0 Message) + agentExecutorExecute = (context, emitter) -> { + // Emit v1.0 message - will be converted to v0.3 StreamingEventKind + emitter.emitEvent(context.getMessage()); + }; + + Message_v0_3 message = new Message_v0_3.Builder(MESSAGE) + .taskId(MINIMAL_TASK.getId()) + .contextId(MINIMAL_TASK.getContextId()) + .build(); + + SendStreamingMessageRequest_v0_3 request = new SendStreamingMessageRequest_v0_3( + "1", new MessageSendParams_v0_3(message, null, null)); + Flow.Publisher response = handler.onMessageSendStream(request, callContext); + + List results = new ArrayList<>(); + CountDownLatch latch = new CountDownLatch(1); + AtomicReference error = new AtomicReference<>(); + + response.subscribe(new Flow.Subscriber<>() { + private Flow.Subscription subscription; + + @Override + public void onSubscribe(Flow.Subscription subscription) { + this.subscription = subscription; + subscription.request(1); + } + + @Override + public void onNext(SendStreamingMessageResponse_v0_3 item) { + results.add(item.getResult()); + subscription.request(1); + latch.countDown(); + } + + @Override + public void onError(Throwable throwable) { + error.set(throwable); + subscription.cancel(); + // Release latch to prevent timeout + while (latch.getCount() > 0) { + latch.countDown(); + } + } + + @Override + public void onComplete() { + subscription.cancel(); + } + }); + + // Wait for event to be received + assertTrue(latch.await(2, TimeUnit.SECONDS), "Expected to receive 1 event within timeout"); + + // Assert no error occurred during streaming + assertNull(error.get(), "No error should occur during streaming"); + + // Verify that the message was received + assertEquals(1, results.size(), "Should have received exactly 1 event"); + + // Verify the event is the message (converted back from v1.0) + Message_v0_3 receivedMessage = assertInstanceOf(Message_v0_3.class, results.get(0), "Event should be a Message"); + assertEquals(message.getMessageId(), receivedMessage.getMessageId()); + } + + @Test + public void testOnMessageSendStreamMultipleEventsSuccess() throws InterruptedException { + JSONRPCHandler_v0_3 handler = new JSONRPCHandler_v0_3(CARD, internalExecutor, convert03To10Handler); + + // Save existing task + taskStore.save(TaskMapper_v0_3.INSTANCE.toV10(MINIMAL_TASK), false); + + // Create v0.3 events for reference (we'll emit v1.0 equivalents) + Task_v0_3 v03TaskEvent = new Task_v0_3.Builder(MINIMAL_TASK) + .status(new TaskStatus_v0_3(TaskState_v0_3.WORKING)) + .build(); + + TaskArtifactUpdateEvent_v0_3 v03ArtifactEvent = new TaskArtifactUpdateEvent_v0_3.Builder() + .taskId(MINIMAL_TASK.getId()) + .contextId(MINIMAL_TASK.getContextId()) + .artifact(new Artifact_v0_3.Builder() + .artifactId("artifact-1") + .parts(new TextPart_v0_3("Generated artifact content")) + .build()) + .build(); + + TaskStatusUpdateEvent_v0_3 v03StatusEvent = new TaskStatusUpdateEvent_v0_3.Builder() + .taskId(MINIMAL_TASK.getId()) + .contextId(MINIMAL_TASK.getContextId()) + .status(new TaskStatus_v0_3(TaskState_v0_3.COMPLETED)) + .isFinal(true) // Must be true for COMPLETED state in v1.0 + .build(); + + // Configure the agent executor to emit multiple v1.0 events + agentExecutorExecute = (context, emitter) -> { + // Convert v0.3 events to v1.0 and emit them + // The emitter will convert them back to v0.3 StreamingEventKind for the response + emitter.emitEvent(TaskMapper_v0_3.INSTANCE.toV10(v03TaskEvent)); + emitter.emitEvent(TaskArtifactUpdateEventMapper_v0_3.INSTANCE.toV10(v03ArtifactEvent)); + emitter.emitEvent(TaskStatusUpdateEventMapper_v0_3.INSTANCE.toV10(v03StatusEvent)); + }; + + Message_v0_3 message = new Message_v0_3.Builder(MESSAGE) + .taskId(MINIMAL_TASK.getId()) + .contextId(MINIMAL_TASK.getContextId()) + .build(); + + SendStreamingMessageRequest_v0_3 request = new SendStreamingMessageRequest_v0_3( + "1", new MessageSendParams_v0_3(message, null, null)); + Flow.Publisher response = handler.onMessageSendStream(request, callContext); + + List results = new ArrayList<>(); + CountDownLatch latch = new CountDownLatch(3); // Expect 3 events + AtomicReference error = new AtomicReference<>(); + + response.subscribe(new Flow.Subscriber<>() { + private Flow.Subscription subscription; + + @Override + public void onSubscribe(Flow.Subscription subscription) { + this.subscription = subscription; + subscription.request(1); + } + + @Override + public void onNext(SendStreamingMessageResponse_v0_3 item) { + results.add(item.getResult()); + subscription.request(1); + latch.countDown(); + } + + @Override + public void onError(Throwable throwable) { + error.set(throwable); + subscription.cancel(); + // Release latch to prevent timeout + while (latch.getCount() > 0) { + latch.countDown(); + } + } + + @Override + public void onComplete() { + subscription.cancel(); + } + }); + + // Wait for all events to be received + assertTrue(latch.await(2, TimeUnit.SECONDS), "Expected to receive 3 events within timeout"); + + // Assert no error occurred during streaming + assertNull(error.get(), "No error should occur during streaming"); + + // Verify that all 3 events were received + assertEquals(3, results.size(), "Should have received exactly 3 events"); + + // Verify the first event is the task + Task_v0_3 receivedTask = assertInstanceOf(Task_v0_3.class, results.get(0), "First event should be a Task"); + assertEquals(MINIMAL_TASK.getId(), receivedTask.getId()); + assertEquals(MINIMAL_TASK.getContextId(), receivedTask.getContextId()); + assertEquals(TaskState_v0_3.WORKING, receivedTask.getStatus().state()); + + // Verify the second event is the artifact update + TaskArtifactUpdateEvent_v0_3 receivedArtifact = assertInstanceOf(TaskArtifactUpdateEvent_v0_3.class, results.get(1), + "Second event should be a TaskArtifactUpdateEvent"); + assertEquals(MINIMAL_TASK.getId(), receivedArtifact.getTaskId()); + assertEquals("artifact-1", receivedArtifact.getArtifact().artifactId()); + + // Verify the third event is the status update + TaskStatusUpdateEvent_v0_3 receivedStatus = assertInstanceOf(TaskStatusUpdateEvent_v0_3.class, results.get(2), + "Third event should be a TaskStatusUpdateEvent"); + assertEquals(MINIMAL_TASK.getId(), receivedStatus.getTaskId()); + assertEquals(TaskState_v0_3.COMPLETED, receivedStatus.getStatus().state()); + } + + @Test + public void testOnMessageSendStreamExistingTaskSuccess() throws InterruptedException { + JSONRPCHandler_v0_3 handler = new JSONRPCHandler_v0_3(CARD, internalExecutor, convert03To10Handler); + + // Configure agent to emit the task (v1.0 context contains v1.0 Task) + agentExecutorExecute = (context, emitter) -> { + // Emit v1.0 task - will be converted to v0.3 StreamingEventKind + emitter.emitEvent(context.getTask()); + }; + + // Save existing v0.3 task (convert to v1.0 for storage) + Task_v0_3 v03Task = new Task_v0_3.Builder(MINIMAL_TASK) + .history(new ArrayList<>()) + .build(); + taskStore.save(TaskMapper_v0_3.INSTANCE.toV10(v03Task), false); + + Message_v0_3 message = new Message_v0_3.Builder(MESSAGE) + .taskId(v03Task.getId()) + .contextId(v03Task.getContextId()) + .build(); + + SendStreamingMessageRequest_v0_3 request = new SendStreamingMessageRequest_v0_3( + "1", new MessageSendParams_v0_3(message, null, null)); + Flow.Publisher response = handler.onMessageSendStream(request, callContext); + + // For non-final tasks, the publisher doesn't complete, so we subscribe in a new thread + // and manually cancel after receiving the first event + final List results = new ArrayList<>(); + final AtomicReference subscriptionRef = new AtomicReference<>(); + final CountDownLatch latch = new CountDownLatch(1); + final AtomicReference error = new AtomicReference<>(); + + Executors.newSingleThreadExecutor().execute(() -> { + response.subscribe(new Flow.Subscriber<>() { + @Override + public void onSubscribe(Flow.Subscription subscription) { + subscriptionRef.set(subscription); + subscription.request(1); + } + + @Override + public void onNext(SendStreamingMessageResponse_v0_3 item) { + results.add(item.getResult()); + subscriptionRef.get().request(1); + latch.countDown(); + } + + @Override + public void onError(Throwable throwable) { + error.set(throwable); + subscriptionRef.get().cancel(); + // Release latch to prevent timeout + while (latch.getCount() > 0) { + latch.countDown(); + } + } + + @Override + public void onComplete() { + subscriptionRef.get().cancel(); + } + }); + }); + + // Wait for the first event + assertTrue(latch.await(2, TimeUnit.SECONDS), "Expected to receive 1 event within timeout"); + subscriptionRef.get().cancel(); + + // Assert no error occurred during streaming + assertNull(error.get(), "No error should occur during streaming"); + + // Verify the task was received + assertEquals(1, results.size(), "Should have received exactly 1 event"); + Task_v0_3 receivedTask = assertInstanceOf(Task_v0_3.class, results.get(0), "Event should be a Task"); + assertEquals(v03Task.getId(), receivedTask.getId()); + assertEquals(v03Task.getContextId(), receivedTask.getContextId()); + // Note: v1.0 backend manages task history differently than v0.3 + // The key assertion is that we received a Task event for the existing task + } + + // ======================================== + // Streaming Error Tests + // ======================================== + + @Test + public void testStreamingNotSupportedError() { + // Create agent card with streaming disabled + AgentCard_v0_3 nonStreamingCard = new AgentCard_v0_3.Builder(CARD) + .capabilities(new AgentCapabilities_v0_3(false, true, false, null)) + .build(); + + JSONRPCHandler_v0_3 handler = new JSONRPCHandler_v0_3(nonStreamingCard, internalExecutor, convert03To10Handler); + + SendStreamingMessageRequest_v0_3 request = new SendStreamingMessageRequest_v0_3( + "1", new MessageSendParams_v0_3(MESSAGE, null, null)); + Flow.Publisher response = handler.onMessageSendStream(request, callContext); + + List results = new ArrayList<>(); + AtomicReference error = new AtomicReference<>(); + + response.subscribe(new Flow.Subscriber<>() { + private Flow.Subscription subscription; + + @Override + public void onSubscribe(Flow.Subscription subscription) { + this.subscription = subscription; + subscription.request(1); + } + + @Override + public void onNext(SendStreamingMessageResponse_v0_3 item) { + results.add(item); + subscription.request(1); + } + + @Override + public void onError(Throwable throwable) { + error.set(throwable); + subscription.cancel(); + } + + @Override + public void onComplete() { + subscription.cancel(); + } + }); + + // Verify that an error response was returned + assertEquals(1, results.size(), "Should receive exactly one error response"); + SendStreamingMessageResponse_v0_3 errorResponse = results.get(0); + assertNotNull(errorResponse.getError(), "Response should contain an error"); + assertInstanceOf(InvalidRequestError_v0_3.class, errorResponse.getError(), "Error should be InvalidRequestError"); + assertEquals("Streaming is not supported by the agent", + ((InvalidRequestError_v0_3) errorResponse.getError()).getMessage()); + } + + @Test + public void testOnMessageStreamTaskIdMismatch() { + JSONRPCHandler_v0_3 handler = new JSONRPCHandler_v0_3(CARD, internalExecutor, convert03To10Handler); + + // Save existing task + taskStore.save(TaskMapper_v0_3.INSTANCE.toV10(MINIMAL_TASK), false); + + // Configure agent to emit a task with DIFFERENT task ID than the message + agentExecutorExecute = (context, emitter) -> { + // Emit MINIMAL_TASK (which has different ID from MESSAGE) + emitter.emitEvent(context.getTask()); + }; + + // Send MESSAGE (which has a different task ID) + SendStreamingMessageRequest_v0_3 request = new SendStreamingMessageRequest_v0_3( + "1", new MessageSendParams_v0_3(MESSAGE, null, null)); + Flow.Publisher response = handler.onMessageSendStream(request, callContext); + + CompletableFuture future = new CompletableFuture<>(); + List results = new ArrayList<>(); + AtomicReference error = new AtomicReference<>(); + + response.subscribe(new Flow.Subscriber<>() { + private Flow.Subscription subscription; + + @Override + public void onSubscribe(Flow.Subscription subscription) { + this.subscription = subscription; + subscription.request(1); + } + + @Override + public void onNext(SendStreamingMessageResponse_v0_3 item) { + results.add(item); + subscription.request(1); + } + + @Override + public void onError(Throwable throwable) { + error.set(throwable); + subscription.cancel(); + future.completeExceptionally(throwable); + } + + @Override + public void onComplete() { + subscription.cancel(); + future.complete(null); + } + }); + + future.join(); + + // Stream should complete without throwing + assertNull(error.get(), "No exception should be thrown"); + + // Should receive an error response for the task ID mismatch + assertEquals(1, results.size(), "Should receive exactly one error response"); + SendStreamingMessageResponse_v0_3 errorResponse = results.get(0); + assertInstanceOf(InternalError_v0_3.class, errorResponse.getError(), + "Task ID mismatch should result in InternalError"); + } + + @Test + public void testOnMessageStreamInternalError() { + // Mock the Convert03To10RequestHandler to throw InternalError + Convert_v0_3_To10RequestHandler mockedHandler = Mockito.mock(Convert_v0_3_To10RequestHandler.class); + Mockito.doThrow(new org.a2aproject.sdk.spec.InternalError("Internal Error")) + .when(mockedHandler) + .onMessageSendStream( + Mockito.any(MessageSendParams_v0_3.class), + Mockito.any(ServerCallContext.class)); + + JSONRPCHandler_v0_3 handler = new JSONRPCHandler_v0_3(CARD, internalExecutor, mockedHandler); + + SendStreamingMessageRequest_v0_3 request = new SendStreamingMessageRequest_v0_3("1", new MessageSendParams_v0_3(MESSAGE, null, null)); + Flow.Publisher response = handler.onMessageSendStream(request, callContext); + + List results = new ArrayList<>(); + AtomicReference error = new AtomicReference<>(); + + response.subscribe(new Flow.Subscriber<>() { + private Flow.Subscription subscription; + + @Override + public void onSubscribe(Flow.Subscription subscription) { + this.subscription = subscription; + subscription.request(1); + } + + @Override + public void onNext(SendStreamingMessageResponse_v0_3 item) { + results.add(item); + subscription.request(1); + } + + @Override + public void onError(Throwable throwable) { + error.set(throwable); + subscription.cancel(); + } + + @Override + public void onComplete() { + subscription.cancel(); + } + }); + + // Verify that an InternalError response was returned + assertEquals(1, results.size(), "Should receive exactly one error response"); + assertInstanceOf(InternalError_v0_3.class, results.get(0).getError(), "Error should be InternalError"); + } + + @Test + public void testStreamingNotSupportedErrorOnResubscribeToTask() { + // Create agent card with streaming disabled + AgentCard_v0_3 nonStreamingCard = new AgentCard_v0_3.Builder(CARD) + .capabilities(new AgentCapabilities_v0_3(false, true, false, null)) + .build(); + + JSONRPCHandler_v0_3 handler = new JSONRPCHandler_v0_3(nonStreamingCard, internalExecutor, convert03To10Handler); + + TaskResubscriptionRequest_v0_3 request = new TaskResubscriptionRequest_v0_3("1", new TaskIdParams_v0_3(MINIMAL_TASK.getId())); + Flow.Publisher response = handler.onResubscribeToTask(request, callContext); + + List results = new ArrayList<>(); + AtomicReference error = new AtomicReference<>(); + + response.subscribe(new Flow.Subscriber<>() { + private Flow.Subscription subscription; + + @Override + public void onSubscribe(Flow.Subscription subscription) { + this.subscription = subscription; + subscription.request(1); + } + + @Override + public void onNext(SendStreamingMessageResponse_v0_3 item) { + results.add(item); + subscription.request(1); + } + + @Override + public void onError(Throwable throwable) { + error.set(throwable); + subscription.cancel(); + } + + @Override + public void onComplete() { + subscription.cancel(); + } + }); + + // Verify that an error response was returned + assertEquals(1, results.size(), "Should receive exactly one error response"); + SendStreamingMessageResponse_v0_3 errorResponse = results.get(0); + assertNotNull(errorResponse.getError(), "Response should contain an error"); + assertInstanceOf(InvalidRequestError_v0_3.class, errorResponse.getError(), "Error should be InvalidRequestError"); + assertEquals("Streaming is not supported by the agent", + ((InvalidRequestError_v0_3) errorResponse.getError()).getMessage()); + } + + // ======================================== + // Push Notification Tests + // ======================================== + + @Test + public void testSetPushNotificationConfigSuccess() { + JSONRPCHandler_v0_3 handler = new JSONRPCHandler_v0_3(CARD, internalExecutor, convert03To10Handler); + + // Save task to v1.0 backend (conversion happens internally) + org.a2aproject.sdk.spec.Task v10Task = TaskMapper_v0_3.INSTANCE.toV10(MINIMAL_TASK); + taskStore.save(v10Task, false); + + TaskPushNotificationConfig_v0_3 taskPushConfig = + new TaskPushNotificationConfig_v0_3( + MINIMAL_TASK.getId(), + new PushNotificationConfig_v0_3.Builder() + .url("http://example.com") + .build()); + SetTaskPushNotificationConfigRequest_v0_3 request = new SetTaskPushNotificationConfigRequest_v0_3("1", taskPushConfig); + SetTaskPushNotificationConfigResponse_v0_3 response = handler.setPushNotificationConfig(request, callContext); + + assertNull(response.getError(), "Error: " + response.getError()); + assertNotNull(response.getResult()); + + TaskPushNotificationConfig_v0_3 taskPushConfigResult = + new TaskPushNotificationConfig_v0_3( + MINIMAL_TASK.getId(), + new PushNotificationConfig_v0_3.Builder() + .url("http://example.com") + .id(MINIMAL_TASK.getId()) + .build()); + assertEquals(taskPushConfigResult, response.getResult()); + } + + @Test + public void testGetPushNotificationConfigSuccess() { + JSONRPCHandler_v0_3 handler = new JSONRPCHandler_v0_3(CARD, internalExecutor, convert03To10Handler); + + // Save task to v1.0 backend + org.a2aproject.sdk.spec.Task v10Task = TaskMapper_v0_3.INSTANCE.toV10(MINIMAL_TASK); + taskStore.save(v10Task, false); + + agentExecutorExecute = (context, agentEmitter) -> { + agentEmitter.emitEvent(context.getTask() != null ? context.getTask() : context.getMessage()); + }; + + TaskPushNotificationConfig_v0_3 taskPushConfig = + new TaskPushNotificationConfig_v0_3( + MINIMAL_TASK.getId(), + new PushNotificationConfig_v0_3.Builder() + .url("http://example.com") + .build()); + + SetTaskPushNotificationConfigRequest_v0_3 request = new SetTaskPushNotificationConfigRequest_v0_3("1", taskPushConfig); + handler.setPushNotificationConfig(request, callContext); + + GetTaskPushNotificationConfigRequest_v0_3 getRequest = + new GetTaskPushNotificationConfigRequest_v0_3("111", new GetTaskPushNotificationConfigParams_v0_3(MINIMAL_TASK.getId())); + GetTaskPushNotificationConfigResponse_v0_3 getResponse = handler.getPushNotificationConfig(getRequest, callContext); + + TaskPushNotificationConfig_v0_3 expectedConfig = new TaskPushNotificationConfig_v0_3(MINIMAL_TASK.getId(), + new PushNotificationConfig_v0_3.Builder().id(MINIMAL_TASK.getId()).url("http://example.com").build()); + assertEquals(expectedConfig, getResponse.getResult()); + } + + @Test + public void testDeletePushNotificationConfig() { + JSONRPCHandler_v0_3 handler = new JSONRPCHandler_v0_3(CARD, internalExecutor, convert03To10Handler); + + // Save task to v1.0 backend + org.a2aproject.sdk.spec.Task v10Task = TaskMapper_v0_3.INSTANCE.toV10(MINIMAL_TASK); + taskStore.save(v10Task, false); + + agentExecutorExecute = (context, agentEmitter) -> { + agentEmitter.emitEvent(context.getTask() != null ? context.getTask() : context.getMessage()); + }; + + TaskPushNotificationConfig_v0_3 taskPushConfig = + new TaskPushNotificationConfig_v0_3( + MINIMAL_TASK.getId(), + new PushNotificationConfig_v0_3.Builder() + .url("http://example.com") + .id(MINIMAL_TASK.getId()) + .build()); + SetTaskPushNotificationConfigRequest_v0_3 request = new SetTaskPushNotificationConfigRequest_v0_3("1", taskPushConfig); + handler.setPushNotificationConfig(request, callContext); + + DeleteTaskPushNotificationConfigRequest_v0_3 deleteRequest = + new DeleteTaskPushNotificationConfigRequest_v0_3("111", new DeleteTaskPushNotificationConfigParams_v0_3(MINIMAL_TASK.getId(), MINIMAL_TASK.getId())); + DeleteTaskPushNotificationConfigResponse_v0_3 deleteResponse = + handler.deletePushNotificationConfig(deleteRequest, callContext); + + assertEquals("111", deleteResponse.getId()); + assertNull(deleteResponse.getError()); + assertNull(deleteResponse.getResult()); + } + + @Test + public void testOnGetPushNotificationNoPushNotifierConfig() { + // Create v1.0 request handler without push config store + org.a2aproject.sdk.server.requesthandlers.DefaultRequestHandler v10Handler = + org.a2aproject.sdk.server.requesthandlers.DefaultRequestHandler.create( + agentExecutor, taskStore, queueManager, null, mainEventBusProcessor, + internalExecutor, internalExecutor); + + // Wrap in v0.3 conversion handler + Convert_v0_3_To10RequestHandler handlerWithoutPushConfig = new Convert_v0_3_To10RequestHandler(); + handlerWithoutPushConfig.v10Handler = v10Handler; + + AgentCard_v0_3 card = createAgentCard(false, true, false); + JSONRPCHandler_v0_3 handler = new JSONRPCHandler_v0_3(card, internalExecutor, handlerWithoutPushConfig); + + // Save task to v1.0 backend + org.a2aproject.sdk.spec.Task v10Task = TaskMapper_v0_3.INSTANCE.toV10(MINIMAL_TASK); + taskStore.save(v10Task, false); + + GetTaskPushNotificationConfigRequest_v0_3 request = + new GetTaskPushNotificationConfigRequest_v0_3("id", new GetTaskPushNotificationConfigParams_v0_3(MINIMAL_TASK.getId())); + GetTaskPushNotificationConfigResponse_v0_3 response = handler.getPushNotificationConfig(request, callContext); + + assertNotNull(response.getError()); + assertInstanceOf(UnsupportedOperationError_v0_3.class, response.getError()); + assertEquals("This operation is not supported", response.getError().getMessage()); + } + + @Test + public void testOnSetPushNotificationNoPushNotifierConfig() { + // Create v1.0 request handler without push config store + org.a2aproject.sdk.server.requesthandlers.DefaultRequestHandler v10Handler = + org.a2aproject.sdk.server.requesthandlers.DefaultRequestHandler.create( + agentExecutor, taskStore, queueManager, null, mainEventBusProcessor, + internalExecutor, internalExecutor); + + // Wrap in v0.3 conversion handler + Convert_v0_3_To10RequestHandler handlerWithoutPushConfig = new Convert_v0_3_To10RequestHandler(); + handlerWithoutPushConfig.v10Handler = v10Handler; + + AgentCard_v0_3 card = createAgentCard(false, true, false); + JSONRPCHandler_v0_3 handler = new JSONRPCHandler_v0_3(card, internalExecutor, handlerWithoutPushConfig); + + // Save task to v1.0 backend + org.a2aproject.sdk.spec.Task v10Task = TaskMapper_v0_3.INSTANCE.toV10(MINIMAL_TASK); + taskStore.save(v10Task, false); + + TaskPushNotificationConfig_v0_3 config = + new TaskPushNotificationConfig_v0_3( + MINIMAL_TASK.getId(), + new PushNotificationConfig_v0_3.Builder() + .url("http://example.com") + .build()); + + SetTaskPushNotificationConfigRequest_v0_3 request = new SetTaskPushNotificationConfigRequest_v0_3.Builder() + .params(config) + .build(); + SetTaskPushNotificationConfigResponse_v0_3 response = handler.setPushNotificationConfig(request, callContext); + + assertInstanceOf(UnsupportedOperationError_v0_3.class, response.getError()); + assertEquals("This operation is not supported", response.getError().getMessage()); + } + + @Test + public void testDeletePushNotificationConfigNotSupported() { + AgentCard_v0_3 card = createAgentCard(true, false, false); + JSONRPCHandler_v0_3 handler = new JSONRPCHandler_v0_3(card, internalExecutor, convert03To10Handler); + + // Save task to v1.0 backend + org.a2aproject.sdk.spec.Task v10Task = TaskMapper_v0_3.INSTANCE.toV10(MINIMAL_TASK); + taskStore.save(v10Task, false); + + agentExecutorExecute = (context, agentEmitter) -> { + agentEmitter.emitEvent(context.getTask() != null ? context.getTask() : context.getMessage()); + }; + + TaskPushNotificationConfig_v0_3 taskPushConfig = + new TaskPushNotificationConfig_v0_3( + MINIMAL_TASK.getId(), + new PushNotificationConfig_v0_3.Builder() + .url("http://example.com") + .id(MINIMAL_TASK.getId()) + .build()); + SetTaskPushNotificationConfigRequest_v0_3 request = new SetTaskPushNotificationConfigRequest_v0_3("1", taskPushConfig); + handler.setPushNotificationConfig(request, callContext); + + DeleteTaskPushNotificationConfigRequest_v0_3 deleteRequest = + new DeleteTaskPushNotificationConfigRequest_v0_3("111", new DeleteTaskPushNotificationConfigParams_v0_3(MINIMAL_TASK.getId(), MINIMAL_TASK.getId())); + DeleteTaskPushNotificationConfigResponse_v0_3 deleteResponse = + handler.deletePushNotificationConfig(deleteRequest, callContext); + + assertEquals("111", deleteResponse.getId()); + assertNull(deleteResponse.getResult()); + assertInstanceOf(PushNotificationNotSupportedError_v0_3.class, deleteResponse.getError()); + } + + @Test + public void testDeletePushNotificationConfigNoPushConfigStore() { + // Create v1.0 request handler without push config store + org.a2aproject.sdk.server.requesthandlers.DefaultRequestHandler v10Handler = + org.a2aproject.sdk.server.requesthandlers.DefaultRequestHandler.create( + agentExecutor, taskStore, queueManager, null, mainEventBusProcessor, + internalExecutor, internalExecutor); + + // Wrap in v0.3 conversion handler + Convert_v0_3_To10RequestHandler handlerWithoutPushConfig = new Convert_v0_3_To10RequestHandler(); + handlerWithoutPushConfig.v10Handler = v10Handler; + + JSONRPCHandler_v0_3 handler = new JSONRPCHandler_v0_3(CARD, internalExecutor, handlerWithoutPushConfig); + + // Save task to v1.0 backend + org.a2aproject.sdk.spec.Task v10Task = TaskMapper_v0_3.INSTANCE.toV10(MINIMAL_TASK); + taskStore.save(v10Task, false); + + agentExecutorExecute = (context, agentEmitter) -> { + agentEmitter.emitEvent(context.getTask() != null ? context.getTask() : context.getMessage()); + }; + + TaskPushNotificationConfig_v0_3 taskPushConfig = + new TaskPushNotificationConfig_v0_3( + MINIMAL_TASK.getId(), + new PushNotificationConfig_v0_3.Builder() + .url("http://example.com") + .id(MINIMAL_TASK.getId()) + .build()); + SetTaskPushNotificationConfigRequest_v0_3 request = new SetTaskPushNotificationConfigRequest_v0_3("1", taskPushConfig); + handler.setPushNotificationConfig(request, callContext); + + DeleteTaskPushNotificationConfigRequest_v0_3 deleteRequest = + new DeleteTaskPushNotificationConfigRequest_v0_3("111", new DeleteTaskPushNotificationConfigParams_v0_3(MINIMAL_TASK.getId(), MINIMAL_TASK.getId())); + DeleteTaskPushNotificationConfigResponse_v0_3 deleteResponse = + handler.deletePushNotificationConfig(deleteRequest, callContext); + + assertEquals("111", deleteResponse.getId()); + assertNull(deleteResponse.getResult()); + assertInstanceOf(UnsupportedOperationError_v0_3.class, deleteResponse.getError()); + } + + @Test + public void testOnMessageStreamNewMessageSendPushNotificationSuccess() throws Exception { + // Use synchronous executor for push notifications to ensure deterministic ordering + // Without this, async push notifications can execute out of order, causing test flakiness + mainEventBusProcessor.setPushNotificationExecutor(Runnable::run); + + try { + JSONRPCHandler_v0_3 handler = new JSONRPCHandler_v0_3(CARD, internalExecutor, convert03To10Handler); + + // Save task to v1.0 backend + org.a2aproject.sdk.spec.Task v10Task = TaskMapper_v0_3.INSTANCE.toV10(MINIMAL_TASK); + taskStore.save(v10Task, false); + + // Clear any previous events from httpClient + httpClient.events.clear(); + + // Create v0.3 events that the agent executor will emit + List events = List.of( + MINIMAL_TASK, + new TaskArtifactUpdateEvent_v0_3.Builder() + .taskId(MINIMAL_TASK.getId()) + .contextId(MINIMAL_TASK.getContextId()) + .artifact(new Artifact_v0_3.Builder() + .artifactId("11") + .parts(new TextPart_v0_3("text")) + .build()) + .build(), + new TaskStatusUpdateEvent_v0_3.Builder() + .taskId(MINIMAL_TASK.getId()) + .contextId(MINIMAL_TASK.getContextId()) + .status(new TaskStatus_v0_3(TaskState_v0_3.COMPLETED)) + .isFinal(true) + .build()); + + agentExecutorExecute = (context, agentEmitter) -> { + // Convert v0.3 events to v1.0 and emit + for (Event_v0_3 event : events) { + if (event instanceof Task_v0_3) { + agentEmitter.emitEvent(TaskMapper_v0_3.INSTANCE.toV10((Task_v0_3) event)); + } else if (event instanceof TaskArtifactUpdateEvent_v0_3) { + agentEmitter.emitEvent(TaskArtifactUpdateEventMapper_v0_3.INSTANCE.toV10((TaskArtifactUpdateEvent_v0_3) event)); + } else if (event instanceof TaskStatusUpdateEvent_v0_3) { + agentEmitter.emitEvent(TaskStatusUpdateEventMapper_v0_3.INSTANCE.toV10((TaskStatusUpdateEvent_v0_3) event)); + } + } + }; + + // Set push notification config + TaskPushNotificationConfig_v0_3 config = new TaskPushNotificationConfig_v0_3( + MINIMAL_TASK.getId(), + new PushNotificationConfig_v0_3.Builder().url("http://example.com").build()); + SetTaskPushNotificationConfigRequest_v0_3 stpnRequest = new SetTaskPushNotificationConfigRequest_v0_3("1", config); + SetTaskPushNotificationConfigResponse_v0_3 stpnResponse = handler.setPushNotificationConfig(stpnRequest, callContext); + assertNull(stpnResponse.getError()); + + // Send streaming message + Message_v0_3 msg = new Message_v0_3.Builder(MESSAGE) + .taskId(MINIMAL_TASK.getId()) + .build(); + SendStreamingMessageRequest_v0_3 request = new SendStreamingMessageRequest_v0_3("1", new MessageSendParams_v0_3(msg, null, null)); + Flow.Publisher response = handler.onMessageSendStream(request, callContext); + + final List results = Collections.synchronizedList(new ArrayList<>()); + final AtomicReference subscriptionRef = new AtomicReference<>(); + final CountDownLatch latch = new CountDownLatch(6); // 3 streaming responses + 3 push notifications + httpClient.latch = latch; + + Executors.newSingleThreadExecutor().execute(() -> { + response.subscribe(new Flow.Subscriber<>() { + @Override + public void onSubscribe(Flow.Subscription subscription) { + subscriptionRef.set(subscription); + subscription.request(1); + } + + @Override + public void onNext(SendStreamingMessageResponse_v0_3 item) { + results.add(item.getResult()); + subscriptionRef.get().request(1); + latch.countDown(); + } + + @Override + public void onError(Throwable throwable) { + subscriptionRef.get().cancel(); + } + + @Override + public void onComplete() { + subscriptionRef.get().cancel(); + } + }); + }); + + boolean timedOut = !latch.await(5, TimeUnit.SECONDS); + if (timedOut) { + System.out.println("Test timed out! Received " + results.size() + " streaming responses, " + + httpClient.events.size() + " push notifications. Latch count: " + latch.getCount()); + System.out.println("Push notifications received:"); + for (int i = 0; i < httpClient.events.size(); i++) { + org.a2aproject.sdk.spec.StreamingEventKind event = httpClient.events.get(i); + if (event instanceof org.a2aproject.sdk.spec.Task) { + System.out.println(" [" + i + "] Task"); + } else if (event instanceof org.a2aproject.sdk.spec.TaskArtifactUpdateEvent) { + System.out.println(" [" + i + "] TaskArtifactUpdateEvent"); + } else if (event instanceof org.a2aproject.sdk.spec.TaskStatusUpdateEvent) { + System.out.println(" [" + i + "] TaskStatusUpdateEvent"); + } else if (event instanceof org.a2aproject.sdk.spec.Message) { + System.out.println(" [" + i + "] Message"); + } + } + } + assertTrue(!timedOut, "Test timed out waiting for events. Received " + results.size() + " streaming responses, " + + httpClient.events.size() + " push notifications"); + subscriptionRef.get().cancel(); + + // Verify streaming responses (v0.3 format) + assertEquals(3, results.size()); + + // Verify push notifications were sent (v1.0 StreamingEventKind format) + assertEquals(3, httpClient.events.size()); + + // First event: task + org.a2aproject.sdk.spec.StreamingEventKind pushEvent0 = httpClient.events.get(0); + assertTrue(pushEvent0 instanceof org.a2aproject.sdk.spec.Task); + org.a2aproject.sdk.spec.Task v10PushedTask0 = (org.a2aproject.sdk.spec.Task) pushEvent0; + assertEquals(MINIMAL_TASK.getId(), v10PushedTask0.id()); + assertEquals(MINIMAL_TASK.getContextId(), v10PushedTask0.contextId()); + // v0.3 SUBMITTED maps to v1.0 TASK_STATE_SUBMITTED + assertEquals(org.a2aproject.sdk.spec.TaskState.TASK_STATE_SUBMITTED, v10PushedTask0.status().state()); + assertTrue(v10PushedTask0.artifacts() == null || v10PushedTask0.artifacts().isEmpty()); + + // Second event: artifact update + org.a2aproject.sdk.spec.StreamingEventKind pushEvent1 = httpClient.events.get(1); + assertTrue(pushEvent1 instanceof org.a2aproject.sdk.spec.TaskArtifactUpdateEvent); + org.a2aproject.sdk.spec.TaskArtifactUpdateEvent v10ArtifactUpdate = (org.a2aproject.sdk.spec.TaskArtifactUpdateEvent) pushEvent1; + assertEquals(MINIMAL_TASK.getId(), v10ArtifactUpdate.taskId()); + assertEquals(MINIMAL_TASK.getContextId(), v10ArtifactUpdate.contextId()); + assertNotNull(v10ArtifactUpdate.artifact()); + assertEquals(1, v10ArtifactUpdate.artifact().parts().size()); + assertEquals("text", ((org.a2aproject.sdk.spec.TextPart) v10ArtifactUpdate.artifact().parts().get(0)).text()); + + // Third event: status update + org.a2aproject.sdk.spec.StreamingEventKind pushEvent2 = httpClient.events.get(2); + assertTrue(pushEvent2 instanceof org.a2aproject.sdk.spec.TaskStatusUpdateEvent); + org.a2aproject.sdk.spec.TaskStatusUpdateEvent v10StatusUpdate = (org.a2aproject.sdk.spec.TaskStatusUpdateEvent) pushEvent2; + assertEquals(MINIMAL_TASK.getId(), v10StatusUpdate.taskId()); + assertEquals(MINIMAL_TASK.getContextId(), v10StatusUpdate.contextId()); + assertEquals(org.a2aproject.sdk.spec.TaskState.TASK_STATE_COMPLETED, v10StatusUpdate.status().state()); + } finally { + // Reset push notification executor to async + mainEventBusProcessor.setPushNotificationExecutor(null); + } + } + + // TODO Phase 6: Add authenticated extended card tests +} diff --git a/compat-0.3/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/transport/jsonrpc/handler/JSONRPCTestTransportMetadata_v0_3.java b/compat-0.3/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/transport/jsonrpc/handler/JSONRPCTestTransportMetadata_v0_3.java new file mode 100644 index 000000000..ab9e169ee --- /dev/null +++ b/compat-0.3/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/transport/jsonrpc/handler/JSONRPCTestTransportMetadata_v0_3.java @@ -0,0 +1,19 @@ +package org.a2aproject.sdk.compat03.transport.jsonrpc.handler; + +// TODO: Uncomment when server-common is ported + +// import org.a2aproject.sdk.compat03.server.TransportMetadata; +// import org.a2aproject.sdk.compat03.spec.TransportProtocol; + +// public class JSONRPCTestTransportMetadata implements TransportMetadata { +// @Override +// public String getTransportProtocol() { +// return TransportProtocol.JSONRPC.asString(); +// } +// } + +/** + * Placeholder stub - awaiting server-common port. + */ +public class JSONRPCTestTransportMetadata_v0_3 { +} diff --git a/compat-0.3/transport/rest/pom.xml b/compat-0.3/transport/rest/pom.xml new file mode 100644 index 000000000..fe31a68fb --- /dev/null +++ b/compat-0.3/transport/rest/pom.xml @@ -0,0 +1,81 @@ + + + 4.0.0 + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-parent + 1.0.0.Beta2-SNAPSHOT + ../.. + + a2a-java-sdk-compat-0.3-transport-rest + + jar + + Java SDK A2A Compat 0.3 Transport: JSON+HTTP/REST + Java SDK for the Agent2Agent Protocol (A2A) - JSON+HTTP/REST Transport + + + + ${project.groupId} + a2a-java-sdk-server-common + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec-grpc + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec + + + ${project.groupId} + a2a-java-sdk-compat-0.3-server-conversion + + + ${project.groupId} + a2a-java-sdk-server-common + test-jar + test + + + ${project.groupId} + a2a-java-sdk-compat-0.3-server-conversion + ${project.version} + test-jar + test + + + ch.qos.logback + logback-classic + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.mockito + mockito-core + test + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + + + com.google.protobuf + protobuf-java-util + + + org.slf4j + slf4j-jdk14 + test + + + + + \ No newline at end of file diff --git a/compat-0.3/transport/rest/src/main/java/org/a2aproject/sdk/compat03/transport/rest/context/RestContextKeys_v0_3.java b/compat-0.3/transport/rest/src/main/java/org/a2aproject/sdk/compat03/transport/rest/context/RestContextKeys_v0_3.java new file mode 100644 index 000000000..8ec416605 --- /dev/null +++ b/compat-0.3/transport/rest/src/main/java/org/a2aproject/sdk/compat03/transport/rest/context/RestContextKeys_v0_3.java @@ -0,0 +1,24 @@ +package org.a2aproject.sdk.compat03.transport.rest.context; + +/** + * Shared REST context keys for A2A protocol data. + * + * These keys provide access to REST context information, + * enabling rich context access in service method implementations. + */ +public final class RestContextKeys_v0_3 { + + /** + * Context key for storing the headers. + */ + public static final String HEADERS_KEY = "headers"; + + /** + * Context key for storing the method name being called. + */ + public static final String METHOD_NAME_KEY = "method"; + + private RestContextKeys_v0_3() { + // Utility class + } +} diff --git a/compat-0.3/transport/rest/src/main/java/org/a2aproject/sdk/compat03/transport/rest/handler/RestHandler_v0_3.java b/compat-0.3/transport/rest/src/main/java/org/a2aproject/sdk/compat03/transport/rest/handler/RestHandler_v0_3.java new file mode 100644 index 000000000..39be61aee --- /dev/null +++ b/compat-0.3/transport/rest/src/main/java/org/a2aproject/sdk/compat03/transport/rest/handler/RestHandler_v0_3.java @@ -0,0 +1,451 @@ +package org.a2aproject.sdk.compat03.transport.rest.handler; + +import static org.a2aproject.sdk.server.util.async.AsyncUtils.createTubeConfig; + +import com.google.gson.JsonParser; +import com.google.gson.JsonSyntaxException; +import com.google.protobuf.InvalidProtocolBufferException; +import com.google.protobuf.util.JsonFormat; +import org.a2aproject.sdk.compat03.grpc.utils.ProtoUtils_v0_3; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; + +import java.util.List; +import java.util.concurrent.Flow; + +import org.a2aproject.sdk.server.ExtendedAgentCard; +import org.a2aproject.sdk.server.PublicAgentCard; +import org.a2aproject.sdk.server.ServerCallContext; +import org.a2aproject.sdk.compat03.spec.AgentCard_v0_3; +import org.a2aproject.sdk.compat03.spec.AuthenticatedExtendedCardNotConfiguredError_v0_3; +import org.a2aproject.sdk.compat03.spec.ContentTypeNotSupportedError_v0_3; +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigParams_v0_3; +import org.a2aproject.sdk.compat03.spec.EventKind_v0_3; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigParams_v0_3; +import org.a2aproject.sdk.compat03.spec.InternalError_v0_3; +import org.a2aproject.sdk.compat03.spec.InvalidAgentResponseError_v0_3; +import org.a2aproject.sdk.compat03.spec.InvalidParamsError_v0_3; +import org.a2aproject.sdk.compat03.spec.InvalidRequestError_v0_3; +import org.a2aproject.sdk.compat03.spec.JSONParseError_v0_3; +import org.a2aproject.sdk.compat03.spec.JSONRPCError_v0_3; +import org.a2aproject.sdk.compat03.spec.ListTaskPushNotificationConfigParams_v0_3; +import org.a2aproject.sdk.compat03.spec.MethodNotFoundError_v0_3; +import org.a2aproject.sdk.compat03.spec.PushNotificationNotSupportedError_v0_3; +import org.a2aproject.sdk.compat03.spec.StreamingEventKind_v0_3; +import org.a2aproject.sdk.compat03.spec.Task_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskIdParams_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskNotCancelableError_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskNotFoundError_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig_v0_3; +import org.a2aproject.sdk.compat03.spec.TaskQueryParams_v0_3; +import org.a2aproject.sdk.compat03.spec.UnsupportedOperationError_v0_3; +import org.a2aproject.sdk.server.util.async.Internal; +import org.a2aproject.sdk.compat03.json.JsonUtil_v0_3; +import org.a2aproject.sdk.compat03.conversion.Convert_v0_3_To10RequestHandler; +import org.a2aproject.sdk.compat03.conversion.ErrorConverter_v0_3; +import org.a2aproject.sdk.spec.A2AError; +import jakarta.enterprise.inject.Instance; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Executor; +import java.util.logging.Level; +import java.util.logging.Logger; +import mutiny.zero.ZeroPublisher; +import org.jspecify.annotations.Nullable; + +@ApplicationScoped +public class RestHandler_v0_3 { + + private static final Logger log = Logger.getLogger(RestHandler_v0_3.class.getName()); + private AgentCard_v0_3 agentCard; + private @Nullable + Instance extendedAgentCard; + private Convert_v0_3_To10RequestHandler requestHandler; + private final Executor executor; + + @SuppressWarnings("NullAway") + protected RestHandler_v0_3() { + // For CDI + this.executor = null; + } + + @Inject + public RestHandler_v0_3(@PublicAgentCard AgentCard_v0_3 agentCard, @ExtendedAgentCard Instance extendedAgentCard, + @Internal Executor executor, Convert_v0_3_To10RequestHandler requestHandler) { + this.agentCard = agentCard; + this.extendedAgentCard = extendedAgentCard; + this.requestHandler = requestHandler; + this.executor = executor; + + // TODO: Port AgentCardValidator for v0.3 AgentCard or skip validation in compat layer + // AgentCardValidator.validateTransportConfiguration(agentCard); + } + + public RestHandler_v0_3(AgentCard_v0_3 agentCard, Executor executor, Convert_v0_3_To10RequestHandler requestHandler) { + this.agentCard = agentCard; + this.executor = executor; + this.requestHandler = requestHandler; + } + + public HTTPRestResponse sendMessage(String body, ServerCallContext context) { + try { + org.a2aproject.sdk.compat03.grpc.SendMessageRequest.Builder request = org.a2aproject.sdk.compat03.grpc.SendMessageRequest.newBuilder(); + parseRequestBody(body, request); + EventKind_v0_3 result = requestHandler.onMessageSend(ProtoUtils_v0_3.FromProto.messageSendParams(request), context); + return createSuccessResponse(200, org.a2aproject.sdk.compat03.grpc.SendMessageResponse.newBuilder(ProtoUtils_v0_3.ToProto.taskOrMessage(result))); + } catch (A2AError e) { + return createErrorResponse(ErrorConverter_v0_3.convertA2AError(e)); + } catch (JSONRPCError_v0_3 e) { + return createErrorResponse(e); + } catch (Throwable throwable) { + return createErrorResponse(new InternalError_v0_3(throwable.getMessage())); + } + } + + public HTTPRestResponse sendStreamingMessage(String body, ServerCallContext context) { + try { + if (!agentCard.capabilities().streaming()) { + return createErrorResponse(new InvalidRequestError_v0_3("Streaming is not supported by the agent")); + } + org.a2aproject.sdk.compat03.grpc.SendMessageRequest.Builder request = org.a2aproject.sdk.compat03.grpc.SendMessageRequest.newBuilder(); + parseRequestBody(body, request); + Flow.Publisher publisher = requestHandler.onMessageSendStream(ProtoUtils_v0_3.FromProto.messageSendParams(request), context); + return createStreamingResponse(publisher); + } catch (A2AError e) { + return new HTTPRestStreamingResponse(ZeroPublisher.fromItems(new HTTPRestErrorResponse(ErrorConverter_v0_3.convertA2AError(e)).toJson())); + } catch (JSONRPCError_v0_3 e) { + return new HTTPRestStreamingResponse(ZeroPublisher.fromItems(new HTTPRestErrorResponse(e).toJson())); + } catch (Throwable throwable) { + return new HTTPRestStreamingResponse(ZeroPublisher.fromItems(new HTTPRestErrorResponse(new InternalError_v0_3(throwable.getMessage())).toJson())); + } + } + + public HTTPRestResponse cancelTask(String taskId, ServerCallContext context) { + try { + if (taskId == null || taskId.isEmpty()) { + throw new InvalidParamsError_v0_3(); + } + TaskIdParams_v0_3 params = new TaskIdParams_v0_3(taskId); + Task_v0_3 task = requestHandler.onCancelTask(params, context); + if (task != null) { + return createSuccessResponse(200, org.a2aproject.sdk.compat03.grpc.Task.newBuilder(ProtoUtils_v0_3.ToProto.task(task))); + } + throw new UnsupportedOperationError_v0_3(); + } catch (A2AError e) { + return createErrorResponse(ErrorConverter_v0_3.convertA2AError(e)); + } catch (JSONRPCError_v0_3 e) { + return createErrorResponse(e); + } catch (Throwable throwable) { + return createErrorResponse(new InternalError_v0_3(throwable.getMessage())); + } + } + + public HTTPRestResponse setTaskPushNotificationConfiguration(String taskId, String body, ServerCallContext context) { + try { + if (!agentCard.capabilities().pushNotifications()) { + throw new PushNotificationNotSupportedError_v0_3(); + } + org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest.Builder builder = org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest.newBuilder(); + parseRequestBody(body, builder); + TaskPushNotificationConfig_v0_3 result = requestHandler.onSetTaskPushNotificationConfig(ProtoUtils_v0_3.FromProto.taskPushNotificationConfig(builder), context); + return createSuccessResponse(201, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.newBuilder(ProtoUtils_v0_3.ToProto.taskPushNotificationConfig(result))); + } catch (A2AError e) { + return createErrorResponse(ErrorConverter_v0_3.convertA2AError(e)); + } catch (JSONRPCError_v0_3 e) { + return createErrorResponse(e); + } catch (Throwable throwable) { + return createErrorResponse(new InternalError_v0_3(throwable.getMessage())); + } + } + + public HTTPRestResponse resubscribeTask(String taskId, ServerCallContext context) { + try { + if (!agentCard.capabilities().streaming()) { + return createErrorResponse(new InvalidRequestError_v0_3("Streaming is not supported by the agent")); + } + TaskIdParams_v0_3 params = new TaskIdParams_v0_3(taskId); + Flow.Publisher publisher = requestHandler.onResubscribeToTask(params, context); + return createStreamingResponse(publisher); + } catch (A2AError e) { + return new HTTPRestStreamingResponse(ZeroPublisher.fromItems(new HTTPRestErrorResponse(ErrorConverter_v0_3.convertA2AError(e)).toJson())); + } catch (JSONRPCError_v0_3 e) { + return new HTTPRestStreamingResponse(ZeroPublisher.fromItems(new HTTPRestErrorResponse(e).toJson())); + } catch (Throwable throwable) { + return new HTTPRestStreamingResponse(ZeroPublisher.fromItems(new HTTPRestErrorResponse(new InternalError_v0_3(throwable.getMessage())).toJson())); + } + } + + public HTTPRestResponse getTask(String taskId, int historyLength, ServerCallContext context) { + try { + TaskQueryParams_v0_3 params = new TaskQueryParams_v0_3(taskId, historyLength); + Task_v0_3 task = requestHandler.onGetTask(params, context); + if (task != null) { + return createSuccessResponse(200, org.a2aproject.sdk.compat03.grpc.Task.newBuilder(ProtoUtils_v0_3.ToProto.task(task))); + } + throw new TaskNotFoundError_v0_3(); + } catch (A2AError e) { + return createErrorResponse(ErrorConverter_v0_3.convertA2AError(e)); + } catch (JSONRPCError_v0_3 e) { + return createErrorResponse(e); + } catch (Throwable throwable) { + return createErrorResponse(new InternalError_v0_3(throwable.getMessage())); + } + } + + public HTTPRestResponse getTaskPushNotificationConfiguration(String taskId, @Nullable String configId, ServerCallContext context) { + try { + if (!agentCard.capabilities().pushNotifications()) { + throw new PushNotificationNotSupportedError_v0_3(); + } + GetTaskPushNotificationConfigParams_v0_3 params = new GetTaskPushNotificationConfigParams_v0_3(taskId, configId); + TaskPushNotificationConfig_v0_3 config = requestHandler.onGetTaskPushNotificationConfig(params, context); + return createSuccessResponse(200, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.newBuilder(ProtoUtils_v0_3.ToProto.taskPushNotificationConfig(config))); + } catch (A2AError e) { + return createErrorResponse(ErrorConverter_v0_3.convertA2AError(e)); + } catch (JSONRPCError_v0_3 e) { + return createErrorResponse(e); + } catch (Throwable throwable) { + return createErrorResponse(new InternalError_v0_3(throwable.getMessage())); + } + } + + public HTTPRestResponse listTaskPushNotificationConfigurations(String taskId, ServerCallContext context) { + try { + if (!agentCard.capabilities().pushNotifications()) { + throw new PushNotificationNotSupportedError_v0_3(); + } + ListTaskPushNotificationConfigParams_v0_3 params = new ListTaskPushNotificationConfigParams_v0_3(taskId); + List configs = requestHandler.onListTaskPushNotificationConfig(params, context); + return createSuccessResponse(200, org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse.newBuilder(ProtoUtils_v0_3.ToProto.listTaskPushNotificationConfigResponse(configs))); + } catch (A2AError e) { + return createErrorResponse(ErrorConverter_v0_3.convertA2AError(e)); + } catch (JSONRPCError_v0_3 e) { + return createErrorResponse(e); + } catch (Throwable throwable) { + return createErrorResponse(new InternalError_v0_3(throwable.getMessage())); + } + } + + public HTTPRestResponse deleteTaskPushNotificationConfiguration(String taskId, String configId, ServerCallContext context) { + try { + if (!agentCard.capabilities().pushNotifications()) { + throw new PushNotificationNotSupportedError_v0_3(); + } + DeleteTaskPushNotificationConfigParams_v0_3 params = new DeleteTaskPushNotificationConfigParams_v0_3(taskId, configId); + requestHandler.onDeleteTaskPushNotificationConfig(params, context); + return new HTTPRestResponse(204, "application/json", ""); + } catch (A2AError e) { + return createErrorResponse(ErrorConverter_v0_3.convertA2AError(e)); + } catch (JSONRPCError_v0_3 e) { + return createErrorResponse(e); + } catch (Throwable throwable) { + return createErrorResponse(new InternalError_v0_3(throwable.getMessage())); + } + } + + private void parseRequestBody(String body, com.google.protobuf.Message.Builder builder) throws JSONRPCError_v0_3 { + try { + if (body == null || body.trim().isEmpty()) { + throw new InvalidRequestError_v0_3("Request body is required"); + } + validate(body); + JsonFormat.parser().merge(body, builder); + } catch (InvalidProtocolBufferException e) { + log.log(Level.SEVERE, "Error parsing JSON request body: {0}", body); + log.log(Level.SEVERE, "Parse error details", e); + throw new InvalidParamsError_v0_3("Failed to parse request body: " + e.getMessage()); + } + } + + private void validate(String json) { + try { + JsonParser.parseString(json); + } catch (JsonSyntaxException e) { + throw new JSONParseError_v0_3(JSONParseError_v0_3.DEFAULT_CODE, "Failed to parse json", e.getMessage()); + } + } + + private HTTPRestResponse createSuccessResponse(int statusCode, com.google.protobuf.Message.Builder builder) { + try { + String jsonBody = JsonFormat.printer().print(builder); + return new HTTPRestResponse(statusCode, "application/json", jsonBody); + } catch (InvalidProtocolBufferException e) { + return createErrorResponse(new InternalError_v0_3("Failed to serialize response: " + e.getMessage())); + } + } + + public HTTPRestResponse createErrorResponse(JSONRPCError_v0_3 error) { + int statusCode = mapErrorToHttpStatus(error); + return createErrorResponse(statusCode, error); + } + + private HTTPRestResponse createErrorResponse(int statusCode, JSONRPCError_v0_3 error) { + String jsonBody = new HTTPRestErrorResponse(error).toJson(); + return new HTTPRestResponse(statusCode, "application/json", jsonBody); + } + + private HTTPRestStreamingResponse createStreamingResponse(Flow.Publisher publisher) { + return new HTTPRestStreamingResponse(convertToSendStreamingMessageResponse(publisher)); + } + + @SuppressWarnings("FutureReturnValueIgnored") + private Flow.Publisher convertToSendStreamingMessageResponse( + Flow.Publisher publisher) { + // We can't use the normal convertingProcessor since that propagates any errors as an error handled + // via Subscriber.onError() rather than as part of the SendStreamingResponse payload + return ZeroPublisher.create(createTubeConfig(), tube -> { + CompletableFuture.runAsync(() -> { + publisher.subscribe(new Flow.Subscriber() { + Flow.@Nullable Subscription subscription; + + @Override + public void onSubscribe(Flow.Subscription subscription) { + this.subscription = subscription; + subscription.request(1); + } + + @Override + public void onNext(StreamingEventKind_v0_3 item) { + try { + String payload = JsonFormat.printer().omittingInsignificantWhitespace().print(ProtoUtils_v0_3.ToProto.taskOrMessageStream(item)); + tube.send(payload); + if (subscription != null) { + subscription.request(1); + } + } catch (InvalidProtocolBufferException ex) { + onError(ex); + } + } + + @Override + public void onError(Throwable throwable) { + if (throwable instanceof JSONRPCError_v0_3 jsonrpcError) { + tube.send(new HTTPRestErrorResponse(jsonrpcError).toJson()); + } else { + tube.send(new HTTPRestErrorResponse(new InternalError_v0_3(throwable.getMessage())).toJson()); + } + onComplete(); + } + + @Override + public void onComplete() { + tube.complete(); + } + }); + }, executor); + }); + } + + private int mapErrorToHttpStatus(JSONRPCError_v0_3 error) { + if (error instanceof InvalidRequestError_v0_3 || error instanceof JSONParseError_v0_3) { + return 400; + } + if (error instanceof InvalidParamsError_v0_3) { + return 422; + } + if (error instanceof MethodNotFoundError_v0_3 || error instanceof TaskNotFoundError_v0_3 || error instanceof AuthenticatedExtendedCardNotConfiguredError_v0_3) { + return 404; + } + if (error instanceof TaskNotCancelableError_v0_3) { + return 409; + } + if (error instanceof PushNotificationNotSupportedError_v0_3 || error instanceof UnsupportedOperationError_v0_3) { + return 501; + } + if (error instanceof ContentTypeNotSupportedError_v0_3) { + return 415; + } + if (error instanceof InvalidAgentResponseError_v0_3) { + return 502; + } + if (error instanceof InternalError_v0_3) { + return 500; + } + return 500; + } + + public HTTPRestResponse getAuthenticatedExtendedCard() { + try { + if (!agentCard.supportsAuthenticatedExtendedCard() || extendedAgentCard == null || !extendedAgentCard.isResolvable()) { + throw new AuthenticatedExtendedCardNotConfiguredError_v0_3(null, "Authenticated Extended Card not configured", null); + } + return new HTTPRestResponse(200, "application/json", JsonUtil_v0_3.toJson(extendedAgentCard.get())); + } catch (JSONRPCError_v0_3 e) { + return createErrorResponse(e); + } catch (Throwable t) { + return createErrorResponse(500, new InternalError_v0_3(t.getMessage())); + } + } + + public HTTPRestResponse getAgentCard() { + try { + return new HTTPRestResponse(200, "application/json", JsonUtil_v0_3.toJson(agentCard)); + } catch (Throwable t) { + return createErrorResponse(500, new InternalError_v0_3(t.getMessage())); + } + } + + public static class HTTPRestResponse { + + private final int statusCode; + private final String contentType; + private final String body; + + public HTTPRestResponse(int statusCode, String contentType, String body) { + this.statusCode = statusCode; + this.contentType = contentType; + this.body = body; + } + + public int getStatusCode() { + return statusCode; + } + + public String getContentType() { + return contentType; + } + + public String getBody() { + return body; + } + + @Override + public String toString() { + return "HTTPRestResponse{" + "statusCode=" + statusCode + ", contentType=" + contentType + ", body=" + body + '}'; + } + } + + public static class HTTPRestStreamingResponse extends HTTPRestResponse { + + private final Flow.Publisher publisher; + + public HTTPRestStreamingResponse(Flow.Publisher publisher) { + super(200, "text/event-stream", ""); + this.publisher = publisher; + } + + public Flow.Publisher getPublisher() { + return publisher; + } + } + + private static class HTTPRestErrorResponse { + + private final String error; + private final @Nullable + String message; + + private HTTPRestErrorResponse(JSONRPCError_v0_3 jsonRpcError) { + this.error = jsonRpcError.getClass().getName(); + this.message = jsonRpcError.getMessage(); + } + + private String toJson() { + return "{\"error\": \"" + error + "\", \"message\": \"" + message + "\"}"; + } + + @Override + public String toString() { + return "HTTPRestErrorResponse{" + "error=" + error + ", message=" + message + '}'; + } + } +} diff --git a/compat-0.3/transport/rest/src/main/java/org/a2aproject/sdk/compat03/transport/rest/handler/package-info.java b/compat-0.3/transport/rest/src/main/java/org/a2aproject/sdk/compat03/transport/rest/handler/package-info.java new file mode 100644 index 000000000..43cf2bd7d --- /dev/null +++ b/compat-0.3/transport/rest/src/main/java/org/a2aproject/sdk/compat03/transport/rest/handler/package-info.java @@ -0,0 +1,4 @@ +@NullMarked +package org.a2aproject.sdk.compat03.transport.rest.handler; + +import org.jspecify.annotations.NullMarked; diff --git a/compat-0.3/transport/rest/src/main/resources/META-INF/beans.xml b/compat-0.3/transport/rest/src/main/resources/META-INF/beans.xml new file mode 100644 index 000000000..548d44b72 --- /dev/null +++ b/compat-0.3/transport/rest/src/main/resources/META-INF/beans.xml @@ -0,0 +1,6 @@ + + + diff --git a/compat-0.3/transport/rest/src/test/java/org/a2aproject/sdk/compat03/transport/rest/handler/RestHandler_v0_3_Test.java b/compat-0.3/transport/rest/src/test/java/org/a2aproject/sdk/compat03/transport/rest/handler/RestHandler_v0_3_Test.java new file mode 100644 index 000000000..a76f2259d --- /dev/null +++ b/compat-0.3/transport/rest/src/test/java/org/a2aproject/sdk/compat03/transport/rest/handler/RestHandler_v0_3_Test.java @@ -0,0 +1,376 @@ +package org.a2aproject.sdk.compat03.transport.rest.handler; + +import java.util.HashSet; +import java.util.Map; + +import org.a2aproject.sdk.compat03.conversion.AbstractA2ARequestHandlerTest_v0_3; +import org.a2aproject.sdk.compat03.conversion.Convert_v0_3_To10RequestHandler; +import org.a2aproject.sdk.compat03.conversion.mappers.domain.TaskMapper_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentCapabilities_v0_3; +import org.a2aproject.sdk.compat03.spec.AgentCard_v0_3; +import org.a2aproject.sdk.server.ServerCallContext; +import org.a2aproject.sdk.server.auth.UnauthenticatedUser; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +/** + * Test suite for v0.3 RestHandler with v1.0 backend. + *

+ * Tests verify that v0.3 REST clients can successfully communicate with the v1.0 backend + * via the {@link Convert_v0_3_To10RequestHandler} conversion layer. + *

+ *

+ * Phase 3 Focus: Core non-streaming tests (GetTask, SendMessage, CancelTask). + * Streaming tests are deferred to Phase 4. + *

+ */ +public class RestHandler_v0_3_Test extends AbstractA2ARequestHandlerTest_v0_3 { + + private final ServerCallContext callContext = new ServerCallContext( + UnauthenticatedUser.INSTANCE, Map.of("foo", "bar"), new HashSet<>()); + + // ======================================== + // GetTask Tests + // ======================================== + + @Test + public void testGetTaskSuccess() { + RestHandler_v0_3 handler = new RestHandler_v0_3(CARD, internalExecutor, convert03To10Handler); + + // Save v0.3 task by converting to v1.0 + taskStore.save(TaskMapper_v0_3.INSTANCE.toV10(MINIMAL_TASK), false); + + RestHandler_v0_3.HTTPRestResponse response = handler.getTask(MINIMAL_TASK.getId(), 0, callContext); + + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals("application/json", response.getContentType()); + Assertions.assertTrue(response.getBody().contains(MINIMAL_TASK.getId())); + + // Test with different version parameter + response = handler.getTask(MINIMAL_TASK.getId(), 2, callContext); + + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals("application/json", response.getContentType()); + Assertions.assertTrue(response.getBody().contains(MINIMAL_TASK.getId())); + } + + @Test + public void testGetTaskNotFound() { + RestHandler_v0_3 handler = new RestHandler_v0_3(CARD, internalExecutor, convert03To10Handler); + + RestHandler_v0_3.HTTPRestResponse response = handler.getTask("nonexistent", 0, callContext); + + Assertions.assertEquals(404, response.getStatusCode()); + Assertions.assertEquals("application/json", response.getContentType()); + Assertions.assertTrue(response.getBody().contains("TaskNotFoundError")); + } + + // ======================================== + // SendMessage Tests + // ======================================== + + @Test + public void testSendMessage() { + RestHandler_v0_3 handler = new RestHandler_v0_3(CARD, internalExecutor, convert03To10Handler); + + // Configure agent to echo the message back + agentExecutorExecute = (context, emitter) -> { + emitter.emitEvent(context.getMessage()); + }; + + String requestBody = """ + { + "message": + { + "messageId": "message-1234", + "contextId": "context-1234", + "role": "ROLE_USER", + "content": [{ + "text": "tell me a joke" + }], + "metadata": { + } + }, + "configuration": + { + "blocking": true + } + }"""; + + RestHandler_v0_3.HTTPRestResponse response = handler.sendMessage(requestBody, callContext); + + Assertions.assertEquals(200, response.getStatusCode(), response.toString()); + Assertions.assertEquals("application/json", response.getContentType()); + Assertions.assertNotNull(response.getBody()); + } + + @Test + public void testSendMessageInvalidBody() { + RestHandler_v0_3 handler = new RestHandler_v0_3(CARD, internalExecutor, convert03To10Handler); + + String invalidBody = "invalid json"; + RestHandler_v0_3.HTTPRestResponse response = handler.sendMessage(invalidBody, callContext); + + Assertions.assertEquals(400, response.getStatusCode()); + Assertions.assertEquals("application/json", response.getContentType()); + Assertions.assertTrue(response.getBody().contains("JSONParseError"), response.getBody()); + } + + @Test + public void testSendMessageWrongValueBody() { + RestHandler_v0_3 handler = new RestHandler_v0_3(CARD, internalExecutor, convert03To10Handler); + + // Invalid role value "user" instead of "ROLE_USER" + String requestBody = """ + { + "message": + { + "messageId": "message-1234", + "contextId": "context-1234", + "role": "user", + "content": [{ + "text": "tell me a joke" + }], + "metadata": { + } + } + }"""; + + RestHandler_v0_3.HTTPRestResponse response = handler.sendMessage(requestBody, callContext); + + Assertions.assertEquals(422, response.getStatusCode()); + Assertions.assertEquals("application/json", response.getContentType()); + Assertions.assertTrue(response.getBody().contains("InvalidParamsError")); + } + + @Test + public void testSendMessageEmptyBody() { + RestHandler_v0_3 handler = new RestHandler_v0_3(CARD, internalExecutor, convert03To10Handler); + + RestHandler_v0_3.HTTPRestResponse response = handler.sendMessage("", callContext); + + Assertions.assertEquals(400, response.getStatusCode()); + Assertions.assertEquals("application/json", response.getContentType()); + Assertions.assertTrue(response.getBody().contains("InvalidRequestError")); + } + + // ======================================== + // CancelTask Tests + // ======================================== + + @Test + public void testCancelTaskSuccess() { + RestHandler_v0_3 handler = new RestHandler_v0_3(CARD, internalExecutor, convert03To10Handler); + + // Save v0.3 task by converting to v1.0 + taskStore.save(TaskMapper_v0_3.INSTANCE.toV10(MINIMAL_TASK), false); + + // Configure agent to cancel the task + agentExecutorCancel = (context, emitter) -> { + emitter.cancel(); + }; + + RestHandler_v0_3.HTTPRestResponse response = handler.cancelTask(MINIMAL_TASK.getId(), callContext); + + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals("application/json", response.getContentType()); + Assertions.assertTrue(response.getBody().contains(MINIMAL_TASK.getId())); + } + + @Test + public void testCancelTaskNotFound() { + RestHandler_v0_3 handler = new RestHandler_v0_3(CARD, internalExecutor, convert03To10Handler); + + RestHandler_v0_3.HTTPRestResponse response = handler.cancelTask("nonexistent", callContext); + + Assertions.assertEquals(404, response.getStatusCode()); + Assertions.assertEquals("application/json", response.getContentType()); + Assertions.assertTrue(response.getBody().contains("TaskNotFoundError")); + } + + // ======================================== + // Streaming Tests + // ======================================== + + @Test + public void testSendStreamingMessageSuccess() { + RestHandler_v0_3 handler = new RestHandler_v0_3(CARD, internalExecutor, convert03To10Handler); + + // Configure agent to emit the message back + agentExecutorExecute = (context, emitter) -> { + emitter.emitEvent(context.getMessage()); + }; + + String requestBody = """ + { + "message": { + "role": "ROLE_USER", + "content": [ + { + "text": "tell me some jokes" + } + ], + "messageId": "message-1234", + "contextId": "context-1234" + }, + "configuration": { + "acceptedOutputModes": ["text"] + } + }"""; + + RestHandler_v0_3.HTTPRestResponse response = handler.sendStreamingMessage(requestBody, callContext); + + // Verify streaming response + assertEquals(200, response.getStatusCode(), response.toString()); + assertInstanceOf(RestHandler_v0_3.HTTPRestStreamingResponse.class, response, + "Response should be HTTPRestStreamingResponse"); + + RestHandler_v0_3.HTTPRestStreamingResponse streamingResponse = + (RestHandler_v0_3.HTTPRestStreamingResponse) response; + assertNotNull(streamingResponse.getPublisher(), "Publisher should not be null"); + assertEquals("text/event-stream", streamingResponse.getContentType(), + "Content type should be text/event-stream for SSE"); + } + + @Test + public void testSendStreamingMessageNotSupported() { + // Create agent card with streaming disabled + AgentCard_v0_3 nonStreamingCard = new AgentCard_v0_3.Builder(CARD) + .capabilities(new AgentCapabilities_v0_3(false, true, false, null)) + .build(); + + RestHandler_v0_3 handler = new RestHandler_v0_3(nonStreamingCard, internalExecutor, convert03To10Handler); + + String requestBody = """ + { + "message": { + "contextId": "ctx123", + "role": "ROLE_USER", + "content": [{ + "text": "Hello" + }] + } + }"""; + + RestHandler_v0_3.HTTPRestResponse response = handler.sendStreamingMessage(requestBody, callContext); + + // Verify error response + assertEquals(400, response.getStatusCode(), "Should return 400 for streaming not supported"); + assertTrue(response.getBody().contains("InvalidRequestError"), + "Error should be InvalidRequestError"); + assertTrue(response.getBody().contains("Streaming is not supported by the agent"), + "Error message should indicate streaming not supported"); + } + + // ======================================== + // Push Notification Tests + // ======================================== + + @Test + public void testPushNotificationConfigSuccess() { + RestHandler_v0_3 handler = new RestHandler_v0_3(CARD, internalExecutor, convert03To10Handler); + + // Save task to v1.0 backend + taskStore.save(TaskMapper_v0_3.INSTANCE.toV10(MINIMAL_TASK), false); + + String requestBody = """ + { + "parent": "tasks/%s", + "config": { + "name": "tasks/%s/pushNotificationConfigs/", + "pushNotificationConfig": { + "url": "https://example.com/callback", + "authentication": { + "schemes": ["jwt"] + } + } + } + }""".formatted(MINIMAL_TASK.getId(), MINIMAL_TASK.getId()); + + RestHandler_v0_3.HTTPRestResponse response = handler.setTaskPushNotificationConfiguration(MINIMAL_TASK.getId(), requestBody, callContext); + + assertEquals(201, response.getStatusCode(), response.toString()); + assertEquals("application/json", response.getContentType()); + assertNotNull(response.getBody()); + } + + @Test + public void testPushNotificationConfigNotSupported() { + AgentCard_v0_3 card = createAgentCard(true, false, false); + RestHandler_v0_3 handler = new RestHandler_v0_3(card, internalExecutor, convert03To10Handler); + + String requestBody = """ + { + "taskId": "%s", + "pushNotificationConfig": { + "url": "http://example.com" + } + } + """.formatted(MINIMAL_TASK.getId()); + + RestHandler_v0_3.HTTPRestResponse response = handler.setTaskPushNotificationConfiguration(MINIMAL_TASK.getId(), requestBody, callContext); + + assertEquals(501, response.getStatusCode()); + assertTrue(response.getBody().contains("PushNotificationNotSupportedError")); + } + + @Test + public void testGetPushNotificationConfig() { + RestHandler_v0_3 handler = new RestHandler_v0_3(CARD, internalExecutor, convert03To10Handler); + + // Save task to v1.0 backend + taskStore.save(TaskMapper_v0_3.INSTANCE.toV10(MINIMAL_TASK), false); + + // First, create a push notification config + String createRequestBody = """ + { + "parent": "tasks/%s", + "config": { + "name": "tasks/%s/pushNotificationConfigs/", + "pushNotificationConfig": { + "url": "https://example.com/callback", + "authentication": { + "schemes": ["jwt"] + } + } + } + }""".formatted(MINIMAL_TASK.getId(), MINIMAL_TASK.getId()); + RestHandler_v0_3.HTTPRestResponse response = handler.setTaskPushNotificationConfiguration(MINIMAL_TASK.getId(), createRequestBody, callContext); + assertEquals(201, response.getStatusCode(), response.toString()); + assertEquals("application/json", response.getContentType()); + + // Now get it (using taskId as configId since that's the default) + response = handler.getTaskPushNotificationConfiguration(MINIMAL_TASK.getId(), MINIMAL_TASK.getId(), callContext); + assertEquals(200, response.getStatusCode(), response.toString()); + assertEquals("application/json", response.getContentType()); + } + + @Test + public void testDeletePushNotificationConfig() { + RestHandler_v0_3 handler = new RestHandler_v0_3(CARD, internalExecutor, convert03To10Handler); + + // Save task to v1.0 backend + taskStore.save(TaskMapper_v0_3.INSTANCE.toV10(MINIMAL_TASK), false); + + RestHandler_v0_3.HTTPRestResponse response = handler.deleteTaskPushNotificationConfiguration(MINIMAL_TASK.getId(), MINIMAL_TASK.getId(), callContext); + assertEquals(204, response.getStatusCode()); + } + + @Test + public void testListPushNotificationConfigs() { + RestHandler_v0_3 handler = new RestHandler_v0_3(CARD, internalExecutor, convert03To10Handler); + + // Save task to v1.0 backend + taskStore.save(TaskMapper_v0_3.INSTANCE.toV10(MINIMAL_TASK), false); + + RestHandler_v0_3.HTTPRestResponse response = handler.listTaskPushNotificationConfigurations(MINIMAL_TASK.getId(), callContext); + + assertEquals(200, response.getStatusCode()); + assertEquals("application/json", response.getContentType()); + } +} diff --git a/compat-0.3/transport/rest/src/test/java/org/a2aproject/sdk/compat03/transport/rest/handler/RestTestTransportMetadata_v0_3.java b/compat-0.3/transport/rest/src/test/java/org/a2aproject/sdk/compat03/transport/rest/handler/RestTestTransportMetadata_v0_3.java new file mode 100644 index 000000000..65484b4ed --- /dev/null +++ b/compat-0.3/transport/rest/src/test/java/org/a2aproject/sdk/compat03/transport/rest/handler/RestTestTransportMetadata_v0_3.java @@ -0,0 +1,9 @@ +package org.a2aproject.sdk.compat03.transport.rest.handler; + +// TODO: Uncomment when server-common is ported + +/** + * Placeholder stub - awaiting server-common port. + */ +public class RestTestTransportMetadata_v0_3 { +} diff --git a/pom.xml b/pom.xml index 006996c22..c04be32a7 100644 --- a/pom.xml +++ b/pom.xml @@ -576,6 +576,9 @@ transport/grpc transport/rest + + compat-0.3 + boms/extras boms/reference diff --git a/server-common/src/main/java/org/a2aproject/sdk/server/ServerCallContext.java b/server-common/src/main/java/org/a2aproject/sdk/server/ServerCallContext.java index aed6827ed..ff4652158 100644 --- a/server-common/src/main/java/org/a2aproject/sdk/server/ServerCallContext.java +++ b/server-common/src/main/java/org/a2aproject/sdk/server/ServerCallContext.java @@ -15,6 +15,14 @@ public class ServerCallContext { */ public static final String TRANSPORT_KEY = "transport"; + /** + * Key for context ID validation mode in the state map. + * Value should be a {@link Boolean}. + * If true or absent, strict validation is enabled (v1.0 behavior). + * If false, context ID mismatch validation is skipped (v0.3 compatibility). + */ + public static final String STRICT_CONTEXT_VALIDATION_KEY = "strictContextValidation"; + // TODO Not totally sure yet about these field types private final Map modelConfig = new ConcurrentHashMap<>(); private final Map state; @@ -30,7 +38,8 @@ public ServerCallContext(User user, Map state, Set reque public ServerCallContext(User user, Map state, Set requestedExtensions, @Nullable String requestedProtocolVersion) { this.user = user; - this.state = state; + this.state = new ConcurrentHashMap<>(); + this.state.putAll(state); this.requestedExtensions = new HashSet<>(requestedExtensions); this.activatedExtensions = new HashSet<>(); // Always starts empty, populated later by application code this.requestedProtocolVersion = requestedProtocolVersion; diff --git a/server-common/src/main/java/org/a2aproject/sdk/server/requesthandlers/DefaultRequestHandler.java b/server-common/src/main/java/org/a2aproject/sdk/server/requesthandlers/DefaultRequestHandler.java index 0e3aab7f4..66431f5d8 100644 --- a/server-common/src/main/java/org/a2aproject/sdk/server/requesthandlers/DefaultRequestHandler.java +++ b/server-common/src/main/java/org/a2aproject/sdk/server/requesthandlers/DefaultRequestHandler.java @@ -1021,7 +1021,7 @@ private CompletableFuture cleanupProducer(@Nullable CompletableFuture