Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
86cb85e
wip
guglielmo-san Dec 16, 2025
8f549ae
wip
guglielmo-san Dec 16, 2025
9b60ee7
wip
guglielmo-san Dec 17, 2025
ed3c51f
wip
guglielmo-san Dec 17, 2025
9cbf7de
wip
guglielmo-san Dec 17, 2025
5bb7a83
wip
guglielmo-san Dec 17, 2025
fd6e0c0
wip
guglielmo-san Dec 18, 2025
583319d
wip
guglielmo-san Dec 18, 2025
16d00dd
wip
guglielmo-san Dec 18, 2025
926cb78
wip
guglielmo-san Dec 18, 2025
4c6a043
wip
guglielmo-san Dec 18, 2025
7df1553
wip tests
guglielmo-san Dec 18, 2025
2e531f3
wip tests
guglielmo-san Dec 18, 2025
91f5b63
fix tests
guglielmo-san Dec 18, 2025
21669ab
revert modification on sample
guglielmo-san Dec 18, 2025
343af4e
Update src/server/grpc/grpc_handler.ts
guglielmo-san Dec 18, 2025
7f8f0f1
Update src/server/grpc/grpc_handler.ts
guglielmo-san Dec 18, 2025
7529971
run linter
guglielmo-san Dec 18, 2025
b92d070
fix typo
guglielmo-san Dec 19, 2025
b0b27b2
Merge branch 'main' into guglielmoc/ts-proto-for-grpc
guglielmo-san Dec 19, 2025
a467720
update error types
guglielmo-san Dec 19, 2025
24184a1
regenerate package lock
guglielmo-san Dec 19, 2025
e5b3bd2
split proto utils
guglielmo-san Dec 19, 2025
4385e1b
fix tests
guglielmo-san Dec 19, 2025
2f10f81
run linter
guglielmo-san Dec 19, 2025
8b9d93e
Merge branch 'main' into guglielmoc/ts-proto-for-grpc
guglielmo-san Dec 19, 2025
ad9a917
fix typo
guglielmo-san Dec 19, 2025
55cdd36
add tests
guglielmo-san Dec 19, 2025
16acf39
exclude edge tests
guglielmo-san Dec 19, 2025
b280877
update proto converters
guglielmo-san Dec 19, 2025
8894059
run linter
guglielmo-san Dec 19, 2025
a70768c
fix tests
guglielmo-san Dec 19, 2025
ed73c01
generate grpc type with buf
guglielmo-san Dec 19, 2025
e479531
add package dependency
guglielmo-san Dec 19, 2025
96c2e00
updates to proto converters
guglielmo-san Dec 19, 2025
af5f536
wip tck
guglielmo-san Dec 19, 2025
12cc825
fix linter
guglielmo-san Dec 19, 2025
3e0122f
improve error format
guglielmo-san Dec 19, 2025
3c18811
fix error codes
guglielmo-san Dec 21, 2025
55b6a18
added optional description to peerDependencies
guglielmo-san Dec 21, 2025
9374358
fix typo
guglielmo-san Dec 21, 2025
2ff522e
Add GRPC to run-tck.yaml
ishymko Dec 22, 2025
73c92b7
Sync package-lock.json (add peerDependenciesMeta for new packages)
ishymko Dec 22, 2025
47dfebd
Update src/server/grpc/grpc_handler.ts
guglielmo-san Dec 29, 2025
9b31a00
move tests to a new location
guglielmo-san Dec 29, 2025
0dd6d60
rename grpc transport handlers
guglielmo-san Dec 29, 2025
f5986ef
refactor from and to proto
guglielmo-san Dec 29, 2025
d04b654
revert package json samples
guglielmo-san Dec 29, 2025
31ef47a
fix typo
guglielmo-san Dec 29, 2025
f5bd2a8
create grpc userBuilder
guglielmo-san Dec 29, 2025
44f1dbe
add example for grpc handler
guglielmo-san Dec 29, 2025
929b8dd
fix tests
guglielmo-san Dec 29, 2025
ae7d2c2
fix typo
guglielmo-san Dec 29, 2025
d0e9b67
Merge branch 'main' into guglielmoc/ts-proto-for-grpc
guglielmo-san Dec 29, 2025
ca8e775
run linter
guglielmo-san Dec 29, 2025
ee204d0
change id regex
guglielmo-san Dec 29, 2025
736fa52
update regex id extraction
guglielmo-san Dec 29, 2025
1e8316f
run linter
guglielmo-san Dec 29, 2025
02a424a
add a2a error code to returned error
guglielmo-san Dec 30, 2025
fd19905
rename proto converters
guglielmo-san Dec 30, 2025
bb92ee0
Merge branch 'main' into guglielmoc/ts-proto-for-grpc
guglielmo-san Jan 14, 2026
b32a6ff
refactor: remove manual protobuf conversion utilities and migrate to …
guglielmo-san Jan 14, 2026
28352a3
Refactor code structure for improved readability and maintainability
guglielmo-san Jan 14, 2026
b7dc1de
refactor: unify method naming for consistency in FromProto and ToProt…
guglielmo-san Jan 14, 2026
b0493b6
refactor: update FromProto method to createTaskPushNotificationConfig…
guglielmo-san Jan 14, 2026
04207ea
rename a2a proto generated types
guglielmo-san Jan 14, 2026
50e7ce5
add grpc to capabilities test
guglielmo-san Jan 14, 2026
79dd873
fix comments
guglielmo-san Jan 14, 2026
87d031b
run lint fix
guglielmo-san Jan 14, 2026
2b40faa
Merge branch 'main' into guglielmoc/ts-proto-for-grpc
guglielmo-san Jan 14, 2026
11416ea
add instructions for buf generations
guglielmo-san Jan 15, 2026
40da640
Merge branch 'main' into guglielmoc/ts-proto-for-grpc
guglielmo-san Jan 15, 2026
76ef04c
refactor: remove GrpcTransportHandler and simplify grpcService implem…
guglielmo-san Jan 15, 2026
51eda5c
fix tests
guglielmo-san Jan 15, 2026
876d75c
Update vitest.config.ts
guglielmo-san Jan 15, 2026
216ba40
fix: update gRPC status mapping for error code -32601 to NOT_FOUND
guglielmo-san Jan 15, 2026
0034194
fix: update error handling to return UNKNOWN status for unmapped A2AE…
guglielmo-san Jan 15, 2026
4d0594a
Merge branch 'main' into guglielmoc/ts-proto-for-grpc
guglielmo-san Jan 15, 2026
fde3641
fix: add TypeScript definitions for server/grpc in package.json exports
guglielmo-san Jan 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
wip
  • Loading branch information
guglielmo-san committed Dec 16, 2025
commit 8f549aead86b3ca27f5ae5f4311b0a3d7ea63f16
18 changes: 5 additions & 13 deletions src/grpc/utils/proto_type_converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,6 @@ import {
TaskStatus,
TaskStatusUpdateEvent,
} from '../a2a.js';
import { Struct } from '../google/protobuf/struct.js';
import { ServerError, InvalidParamsError } from '../../server/errors.js';

// Regexp patterns for matching
const _TASK_NAME_MATCH = /tasks\/([^/]+)/;
const _TASK_PUSH_CONFIG_NAME_MATCH = /tasks\/([^/]+)\/pushNotificationConfigs\/([^/]+)/;


/**
* Converts proto types to internal types.
*/
Expand All @@ -59,12 +51,12 @@ export class FromProto {
return {
kind: 'message',
messageId: message.messageId,
parts: message.parts.map(p => this.part(p)),
parts: message.parts.map(p => this.parts(p)),
contextId: message.contextId || null,
taskId: message.taskId || null,
role: this.role(message.role),
role: message.role === Role.ROLE_AGENT ? "agent" : "user",
metadata: message.metadata,
extensions: message.extensions.length > 0 ? messages.extensions : null,
extensions: message.extensions.length > 0 ? message.extensions : null,
};
}

Expand Down Expand Up @@ -116,9 +108,9 @@ export class FromProto {
throw new Error("SendMessageRequest is missing 'request' field.");
}
return {
configuration: this.messageSendConfiguration(request.configuration),
configuration: request.configuration,
message: this.message(request.request),
metadata: this.metadata(request.metadata),
metadata: request.metadata,
};
}
}
44 changes: 44 additions & 0 deletions src/samples/agents/sample-agent/client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { ServiceError, credentials } from "@grpc/grpc-js";
import { A2AServiceClient, SendMessageRequest, Role, SendMessageResponse} from "../../../grpc/a2a.js";

const client = new A2AServiceClient(
"localhost:8080",
credentials.createInsecure()
);

function sendMessageExample() {
const request: SendMessageRequest = {
tenant: "sample-tenant",
configuration: {
blocking: true,
acceptedOutputModes: ["text"],
pushNotificationConfig: undefined,
},
metadata: {},
request: {
messageId: "msg-1",
parts: [
{
part: { $case: "text", value: "Hello, Agent!" },
metadata: {},
},
],
role: Role.ROLE_USER,
contextId: "context-1",
taskId: undefined,
metadata: {},
extensions: [],
referenceTaskIds: [],
},
};

client.sendMessage(request, (error: ServiceError | null, response: SendMessageResponse) => {
if (error) {
console.error("Error sending message:", error);
} else {
console.log("Received response:", response);
}
});
}

sendMessageExample();
65 changes: 65 additions & 0 deletions src/samples/agents/sample-agent/grpc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import * as grpc from '@grpc/grpc-js';
import { AgentCard, AGENT_CARD_PATH } from '../../../index.js';
import {
InMemoryTaskStore,
TaskStore,
AgentExecutor,
DefaultRequestHandler,
} from '../../../server/index.js';
import { agentCardHandler, jsonRpcHandler, UserBuilder } from '../../../server/express/index.js';
import { SampleAgentExecutor } from './agent_executor.js';
import { A2AServiceService } from '../../../grpc/a2a.js';
import { createGRPCHandler } from '../../../server/transports/grpc/grpc_transport_handler.js';

// --- Server Setup ---

const sampleAgentCard: AgentCard = {
name: 'Sample Agent',
description:
'A sample agent to test the stream functionality and simulate the flow of tasks statuses.',
url: 'http://localhost:41241/',
provider: {
organization: 'A2A Samples',
url: 'https://example.com/a2a-samples', // Added provider URL
},
version: '1.0.0', // Incremented version
protocolVersion: '0.3.0',
capabilities: {
streaming: true, // The new framework supports streaming
pushNotifications: false, // Assuming not implemented for this agent yet
stateTransitionHistory: true, // Agent uses history
},
defaultInputModes: ['text'],
defaultOutputModes: ['text', 'task-status'], // task-status is a common output mode
skills: [
{
id: 'sample_agent',
name: 'Sample Agent',
description: 'Simulate the general flow of a streaming agent.',
tags: ['sample'],
examples: ['hi', 'hello world', 'how are you', 'goodbye'],
inputModes: ['text'], // Explicitly defining for skill
outputModes: ['text', 'task-status'], // Explicitly defining for skill
},
],
supportsAuthenticatedExtendedCard: false,
};

async function main() {
// 1. Create TaskStore
const taskStore: TaskStore = new InMemoryTaskStore();

// 2. Create AgentExecutor
const agentExecutor: AgentExecutor = new SampleAgentExecutor();

// 3. Create DefaultRequestHandler
const requestHandler = new DefaultRequestHandler(sampleAgentCard, taskStore, agentExecutor);

const server = new grpc.Server();
server.addService(A2AServiceService, createGRPCHandler(requestHandler));
server.bindAsync("localhost:8080", grpc.ServerCredentials.createInsecure(), () => {
console.log("Server running at http://localhost:8080");
});
}

main().catch(console.error);
Loading