@alis-build/a2a-history 1.0.492 → 1.0.504
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +134 -0
- package/alis/a2a/extension/history/v1/history_grpc_pb.d.ts +39 -38
- package/alis/a2a/extension/history/v1/history_grpc_pb.js +132 -121
- package/alis/a2a/extension/history/v1/history_grpc_web_pb.d.ts +48 -46
- package/alis/a2a/extension/history/v1/history_grpc_web_pb.js +168 -169
- package/alis/a2a/extension/history/v1/history_pb.d.ts +144 -144
- package/alis/a2a/extension/history/v1/history_pb.js +423 -425
- package/package.json +1 -1
- package/transport/jsonrpc/client.ts +212 -0
- package/transport/jsonrpc/index.ts +17 -0
- package/transport/jsonrpc/types.ts +61 -0
package/README.md
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# a2a-history
|
|
2
|
+
|
|
3
|
+
TypeScript/JavaScript client and protobuf definitions for the **A2A History API** — an extension for managing agent-to-agent (A2A) conversation histories and their events.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This package provides:
|
|
8
|
+
|
|
9
|
+
- **Generated protobuf types** (`alis/a2a/extension/history/v1/`) — Message classes and `AsObject` types for history resources, events, and requests/responses
|
|
10
|
+
- **JSON-RPC transport** (`transport/jsonrpc/`) — HTTP JSON-RPC 2.0 client for calling the A2A history service
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pnpm add @alis-build/a2a-history
|
|
16
|
+
# or
|
|
17
|
+
npm install @alis-build/a2a-history
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Peer dependencies
|
|
21
|
+
|
|
22
|
+
- `google-protobuf` — protobuf runtime
|
|
23
|
+
- `grpc-web` / `@grpc/grpc-js` — gRPC support (if using gRPC transport)
|
|
24
|
+
- `@alis-build/google-common-protos` — shared Google API protos
|
|
25
|
+
|
|
26
|
+
## Import paths
|
|
27
|
+
|
|
28
|
+
- JSON-RPC client: `@alis-build/a2a-history/transport/jsonrpc` (or `@alis-build/a2a-history/dist/transport/jsonrpc` if built)
|
|
29
|
+
- Protobuf types: `@alis-build/a2a-history/alis/a2a/extension/history/v1/history_pb`
|
|
30
|
+
|
|
31
|
+
## Quick start
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
import {
|
|
35
|
+
A2AHistoryClient,
|
|
36
|
+
JsonRpcProtocolError,
|
|
37
|
+
JsonRpcTransportError,
|
|
38
|
+
} from "@alis-build/a2a-history/transport/jsonrpc";
|
|
39
|
+
|
|
40
|
+
const client = new A2AHistoryClient({
|
|
41
|
+
baseUrl: "https://api.example.com",
|
|
42
|
+
// Optional: bearer token when not behind auth gateway
|
|
43
|
+
getToken: async () => (await getAuthToken()).accessToken,
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// Fetch a single history by resource name
|
|
47
|
+
const history = await client.getHistory({ name: "histories/abc123" });
|
|
48
|
+
|
|
49
|
+
// List histories with pagination
|
|
50
|
+
const { historiesList, nextPageToken } = await client.listHistories({
|
|
51
|
+
parent: "agents/xyz",
|
|
52
|
+
pageSize: 20,
|
|
53
|
+
pageToken: "",
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// List events within a history
|
|
57
|
+
const { eventsList } = await client.listEvents({
|
|
58
|
+
parent: "histories/abc123",
|
|
59
|
+
pageSize: 50,
|
|
60
|
+
});
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## JSON-RPC client
|
|
64
|
+
|
|
65
|
+
### Configuration
|
|
66
|
+
|
|
67
|
+
| Option | Type | Required | Description |
|
|
68
|
+
|-------------|----------------------------------|----------|-----------------------------------------------------------------------------|
|
|
69
|
+
| `baseUrl` | `string` | Yes | Base URL of the A2A history service (e.g. `https://api.example.com`). No trailing slash. |
|
|
70
|
+
| `getToken` | `() => string \| Promise<string>` | No | Bearer token provider. Use when calling the service directly (not via auth gateway). Can be async for token refresh. |
|
|
71
|
+
|
|
72
|
+
### API methods
|
|
73
|
+
|
|
74
|
+
| Method | JSON-RPC method | Description |
|
|
75
|
+
|------------------|---------------------------|------------------------------------------------------|
|
|
76
|
+
| `getHistory` | `history/get` | Get a single history by resource name |
|
|
77
|
+
| `listHistories` | `history/list` | List histories with optional filtering & pagination |
|
|
78
|
+
| `listEvents` | `history/events/list` | List events within a history with pagination |
|
|
79
|
+
|
|
80
|
+
### Error handling
|
|
81
|
+
|
|
82
|
+
Two error types can be thrown:
|
|
83
|
+
|
|
84
|
+
- **`JsonRpcTransportError`** — Network failure, non-2xx HTTP response, or invalid JSON in the response. Has optional `status` for HTTP status code (e.g. 401, 500).
|
|
85
|
+
- **`JsonRpcProtocolError`** — Server returned a JSON-RPC error object (e.g. method not found, invalid params). Has `code` and `data` for application-level handling.
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
try {
|
|
89
|
+
const history = await client.getHistory({ name: "histories/123" });
|
|
90
|
+
} catch (err) {
|
|
91
|
+
if (err instanceof JsonRpcTransportError) {
|
|
92
|
+
console.error("HTTP/network:", err.message, err.status);
|
|
93
|
+
} else if (err instanceof JsonRpcProtocolError) {
|
|
94
|
+
console.error("RPC error:", err.code, err.message, err.data);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Endpoint
|
|
100
|
+
|
|
101
|
+
All requests are sent as HTTP POST to:
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
{baseUrl}/extensions/a2ahistory
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Protobuf types
|
|
108
|
+
|
|
109
|
+
The generated protobuf definitions live under `alis/a2a/extension/history/v1/` and include:
|
|
110
|
+
|
|
111
|
+
- **Resources:** `A2AHistory`, `Thread`, `ThreadEvent`
|
|
112
|
+
- **Requests/responses:** `GetA2AHistoryRequest`, `ListA2AHistoriesRequest`, `ListEventsRequest`, etc.
|
|
113
|
+
|
|
114
|
+
Use `.AsObject` types for plain JSON-like objects returned by the JSON-RPC client.
|
|
115
|
+
|
|
116
|
+
## Project structure
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
a2a-history-ts/
|
|
120
|
+
├── alis/a2a/extension/history/v1/ # Generated protobuf code
|
|
121
|
+
│ ├── history_pb.js / .d.ts # Message types
|
|
122
|
+
│ ├── history_grpc_pb.js / .d.ts # gRPC Node
|
|
123
|
+
│ └── history_grpc_web_pb.js / .d.ts # gRPC-Web
|
|
124
|
+
├── transport/jsonrpc/ # JSON-RPC transport
|
|
125
|
+
│ ├── client.ts # A2AHistoryClient
|
|
126
|
+
│ ├── types.ts # JsonRpc* types, config
|
|
127
|
+
│ └── index.ts # Public exports
|
|
128
|
+
├── package.json
|
|
129
|
+
└── README.md
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## License
|
|
133
|
+
|
|
134
|
+
Internal Alis Build package.
|
|
@@ -4,44 +4,45 @@
|
|
|
4
4
|
// file: alis/a2a/extension/history/v1/history.proto
|
|
5
5
|
|
|
6
6
|
import * as alis_a2a_extension_history_v1_history_pb from "../../../../../alis/a2a/extension/history/v1/history_pb";
|
|
7
|
-
import * as google_iam_v1_policy_pb from "
|
|
8
|
-
import * as google_iam_v1_iam_policy_pb from "
|
|
9
|
-
import * as alis_open_iam_v1_iam_pb from "
|
|
10
|
-
import * as
|
|
7
|
+
import * as google_iam_v1_policy_pb from "../../../../../google/iam/v1/policy_pb";
|
|
8
|
+
import * as google_iam_v1_iam_policy_pb from "../../../../../google/iam/v1/iam_policy_pb";
|
|
9
|
+
import * as alis_open_iam_v1_iam_pb from "../../../../../alis/open/iam/v1/iam_pb";
|
|
10
|
+
import * as google_protobuf_empty_pb from "google-protobuf/google/protobuf/empty_pb";
|
|
11
|
+
import * as grpc from "grpc";
|
|
11
12
|
|
|
12
|
-
interface
|
|
13
|
+
interface IThreadServiceService extends grpc.ServiceDefinition<grpc.UntypedServiceImplementation> {
|
|
13
14
|
getIamPolicy: grpc.MethodDefinition<google_iam_v1_iam_policy_pb.GetIamPolicyRequest, google_iam_v1_policy_pb.Policy>;
|
|
14
15
|
setIamPolicy: grpc.MethodDefinition<google_iam_v1_iam_policy_pb.SetIamPolicyRequest, google_iam_v1_policy_pb.Policy>;
|
|
15
16
|
testIamPermissions: grpc.MethodDefinition<google_iam_v1_iam_policy_pb.TestIamPermissionsRequest, google_iam_v1_iam_policy_pb.TestIamPermissionsResponse>;
|
|
16
17
|
batchTestIamPermissions: grpc.MethodDefinition<alis_open_iam_v1_iam_pb.BatchTestIamPermissionsRequest, alis_open_iam_v1_iam_pb.BatchTestIamPermissionsResponse>;
|
|
17
18
|
addIamBindings: grpc.MethodDefinition<alis_open_iam_v1_iam_pb.AddIamBindingsRequest, google_iam_v1_policy_pb.Policy>;
|
|
18
19
|
removeIamBindings: grpc.MethodDefinition<alis_open_iam_v1_iam_pb.RemoveIamBindingsRequest, google_iam_v1_policy_pb.Policy>;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
listThreads: grpc.MethodDefinition<alis_a2a_extension_history_v1_history_pb.ListThreadsRequest, alis_a2a_extension_history_v1_history_pb.ListThreadsResponse>;
|
|
21
|
+
getThread: grpc.MethodDefinition<alis_a2a_extension_history_v1_history_pb.GetThreadRequest, alis_a2a_extension_history_v1_history_pb.Thread>;
|
|
22
|
+
deleteThread: grpc.MethodDefinition<alis_a2a_extension_history_v1_history_pb.DeleteThreadRequest, google_protobuf_empty_pb.Empty>;
|
|
23
|
+
appendThreadEvent: grpc.MethodDefinition<alis_a2a_extension_history_v1_history_pb.AppendThreadEventRequest, alis_a2a_extension_history_v1_history_pb.AppendThreadEventResponse>;
|
|
24
|
+
listThreadEvents: grpc.MethodDefinition<alis_a2a_extension_history_v1_history_pb.ListThreadEventsRequest, alis_a2a_extension_history_v1_history_pb.ListThreadEventsResponse>;
|
|
25
|
+
streamThreadEvents: grpc.MethodDefinition<alis_a2a_extension_history_v1_history_pb.StreamThreadEventsRequest, alis_a2a_extension_history_v1_history_pb.ThreadEvent>;
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
export const
|
|
28
|
+
export const ThreadServiceService: IThreadServiceService;
|
|
28
29
|
|
|
29
|
-
export interface
|
|
30
|
+
export interface IThreadServiceServer extends grpc.UntypedServiceImplementation {
|
|
30
31
|
getIamPolicy: grpc.handleUnaryCall<google_iam_v1_iam_policy_pb.GetIamPolicyRequest, google_iam_v1_policy_pb.Policy>;
|
|
31
32
|
setIamPolicy: grpc.handleUnaryCall<google_iam_v1_iam_policy_pb.SetIamPolicyRequest, google_iam_v1_policy_pb.Policy>;
|
|
32
33
|
testIamPermissions: grpc.handleUnaryCall<google_iam_v1_iam_policy_pb.TestIamPermissionsRequest, google_iam_v1_iam_policy_pb.TestIamPermissionsResponse>;
|
|
33
34
|
batchTestIamPermissions: grpc.handleUnaryCall<alis_open_iam_v1_iam_pb.BatchTestIamPermissionsRequest, alis_open_iam_v1_iam_pb.BatchTestIamPermissionsResponse>;
|
|
34
35
|
addIamBindings: grpc.handleUnaryCall<alis_open_iam_v1_iam_pb.AddIamBindingsRequest, google_iam_v1_policy_pb.Policy>;
|
|
35
36
|
removeIamBindings: grpc.handleUnaryCall<alis_open_iam_v1_iam_pb.RemoveIamBindingsRequest, google_iam_v1_policy_pb.Policy>;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
listThreads: grpc.handleUnaryCall<alis_a2a_extension_history_v1_history_pb.ListThreadsRequest, alis_a2a_extension_history_v1_history_pb.ListThreadsResponse>;
|
|
38
|
+
getThread: grpc.handleUnaryCall<alis_a2a_extension_history_v1_history_pb.GetThreadRequest, alis_a2a_extension_history_v1_history_pb.Thread>;
|
|
39
|
+
deleteThread: grpc.handleUnaryCall<alis_a2a_extension_history_v1_history_pb.DeleteThreadRequest, google_protobuf_empty_pb.Empty>;
|
|
40
|
+
appendThreadEvent: grpc.handleUnaryCall<alis_a2a_extension_history_v1_history_pb.AppendThreadEventRequest, alis_a2a_extension_history_v1_history_pb.AppendThreadEventResponse>;
|
|
41
|
+
listThreadEvents: grpc.handleUnaryCall<alis_a2a_extension_history_v1_history_pb.ListThreadEventsRequest, alis_a2a_extension_history_v1_history_pb.ListThreadEventsResponse>;
|
|
42
|
+
streamThreadEvents: grpc.handleServerStreamingCall<alis_a2a_extension_history_v1_history_pb.StreamThreadEventsRequest, alis_a2a_extension_history_v1_history_pb.ThreadEvent>;
|
|
42
43
|
}
|
|
43
44
|
|
|
44
|
-
export class
|
|
45
|
+
export class ThreadServiceClient extends grpc.Client {
|
|
45
46
|
constructor(address: string, credentials: grpc.ChannelCredentials, options?: object);
|
|
46
47
|
getIamPolicy(argument: google_iam_v1_iam_policy_pb.GetIamPolicyRequest, callback: grpc.requestCallback<google_iam_v1_policy_pb.Policy>): grpc.ClientUnaryCall;
|
|
47
48
|
getIamPolicy(argument: google_iam_v1_iam_policy_pb.GetIamPolicyRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<google_iam_v1_policy_pb.Policy>): grpc.ClientUnaryCall;
|
|
@@ -61,21 +62,21 @@ export class A2AHistoryServiceClient extends grpc.Client {
|
|
|
61
62
|
removeIamBindings(argument: alis_open_iam_v1_iam_pb.RemoveIamBindingsRequest, callback: grpc.requestCallback<google_iam_v1_policy_pb.Policy>): grpc.ClientUnaryCall;
|
|
62
63
|
removeIamBindings(argument: alis_open_iam_v1_iam_pb.RemoveIamBindingsRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<google_iam_v1_policy_pb.Policy>): grpc.ClientUnaryCall;
|
|
63
64
|
removeIamBindings(argument: alis_open_iam_v1_iam_pb.RemoveIamBindingsRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<google_iam_v1_policy_pb.Policy>): grpc.ClientUnaryCall;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
65
|
+
listThreads(argument: alis_a2a_extension_history_v1_history_pb.ListThreadsRequest, callback: grpc.requestCallback<alis_a2a_extension_history_v1_history_pb.ListThreadsResponse>): grpc.ClientUnaryCall;
|
|
66
|
+
listThreads(argument: alis_a2a_extension_history_v1_history_pb.ListThreadsRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<alis_a2a_extension_history_v1_history_pb.ListThreadsResponse>): grpc.ClientUnaryCall;
|
|
67
|
+
listThreads(argument: alis_a2a_extension_history_v1_history_pb.ListThreadsRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<alis_a2a_extension_history_v1_history_pb.ListThreadsResponse>): grpc.ClientUnaryCall;
|
|
68
|
+
getThread(argument: alis_a2a_extension_history_v1_history_pb.GetThreadRequest, callback: grpc.requestCallback<alis_a2a_extension_history_v1_history_pb.Thread>): grpc.ClientUnaryCall;
|
|
69
|
+
getThread(argument: alis_a2a_extension_history_v1_history_pb.GetThreadRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<alis_a2a_extension_history_v1_history_pb.Thread>): grpc.ClientUnaryCall;
|
|
70
|
+
getThread(argument: alis_a2a_extension_history_v1_history_pb.GetThreadRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<alis_a2a_extension_history_v1_history_pb.Thread>): grpc.ClientUnaryCall;
|
|
71
|
+
deleteThread(argument: alis_a2a_extension_history_v1_history_pb.DeleteThreadRequest, callback: grpc.requestCallback<google_protobuf_empty_pb.Empty>): grpc.ClientUnaryCall;
|
|
72
|
+
deleteThread(argument: alis_a2a_extension_history_v1_history_pb.DeleteThreadRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<google_protobuf_empty_pb.Empty>): grpc.ClientUnaryCall;
|
|
73
|
+
deleteThread(argument: alis_a2a_extension_history_v1_history_pb.DeleteThreadRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<google_protobuf_empty_pb.Empty>): grpc.ClientUnaryCall;
|
|
74
|
+
appendThreadEvent(argument: alis_a2a_extension_history_v1_history_pb.AppendThreadEventRequest, callback: grpc.requestCallback<alis_a2a_extension_history_v1_history_pb.AppendThreadEventResponse>): grpc.ClientUnaryCall;
|
|
75
|
+
appendThreadEvent(argument: alis_a2a_extension_history_v1_history_pb.AppendThreadEventRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<alis_a2a_extension_history_v1_history_pb.AppendThreadEventResponse>): grpc.ClientUnaryCall;
|
|
76
|
+
appendThreadEvent(argument: alis_a2a_extension_history_v1_history_pb.AppendThreadEventRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<alis_a2a_extension_history_v1_history_pb.AppendThreadEventResponse>): grpc.ClientUnaryCall;
|
|
77
|
+
listThreadEvents(argument: alis_a2a_extension_history_v1_history_pb.ListThreadEventsRequest, callback: grpc.requestCallback<alis_a2a_extension_history_v1_history_pb.ListThreadEventsResponse>): grpc.ClientUnaryCall;
|
|
78
|
+
listThreadEvents(argument: alis_a2a_extension_history_v1_history_pb.ListThreadEventsRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<alis_a2a_extension_history_v1_history_pb.ListThreadEventsResponse>): grpc.ClientUnaryCall;
|
|
79
|
+
listThreadEvents(argument: alis_a2a_extension_history_v1_history_pb.ListThreadEventsRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<alis_a2a_extension_history_v1_history_pb.ListThreadEventsResponse>): grpc.ClientUnaryCall;
|
|
80
|
+
streamThreadEvents(argument: alis_a2a_extension_history_v1_history_pb.StreamThreadEventsRequest, metadataOrOptions?: grpc.Metadata | grpc.CallOptions | null): grpc.ClientReadableStream<alis_a2a_extension_history_v1_history_pb.ThreadEvent>;
|
|
81
|
+
streamThreadEvents(argument: alis_a2a_extension_history_v1_history_pb.StreamThreadEventsRequest, metadata?: grpc.Metadata | null, options?: grpc.CallOptions | null): grpc.ClientReadableStream<alis_a2a_extension_history_v1_history_pb.ThreadEvent>;
|
|
82
|
+
}
|