@cogitator-ai/a2a 0.7.8 → 0.8.0
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 +173 -151
- package/dist/adapters/express.d.ts +5 -0
- package/dist/adapters/express.d.ts.map +1 -1
- package/dist/adapters/express.js +53 -30
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/fastify.d.ts +5 -0
- package/dist/adapters/fastify.d.ts.map +1 -1
- package/dist/adapters/fastify.js +51 -35
- package/dist/adapters/fastify.js.map +1 -1
- package/dist/adapters/hono.d.ts +5 -0
- package/dist/adapters/hono.d.ts.map +1 -1
- package/dist/adapters/hono.js +41 -49
- package/dist/adapters/hono.js.map +1 -1
- package/dist/adapters/koa.d.ts +5 -0
- package/dist/adapters/koa.d.ts.map +1 -1
- package/dist/adapters/koa.js +39 -32
- package/dist/adapters/koa.js.map +1 -1
- package/dist/adapters/next.d.ts +13 -2
- package/dist/adapters/next.d.ts.map +1 -1
- package/dist/adapters/next.js +75 -51
- package/dist/adapters/next.js.map +1 -1
- package/dist/adapters/shared.d.ts +43 -10
- package/dist/adapters/shared.d.ts.map +1 -1
- package/dist/adapters/shared.js +156 -23
- package/dist/adapters/shared.js.map +1 -1
- package/dist/agent-card.d.ts +22 -7
- package/dist/agent-card.d.ts.map +1 -1
- package/dist/agent-card.js +71 -34
- package/dist/agent-card.js.map +1 -1
- package/dist/approvals.d.ts +46 -0
- package/dist/approvals.d.ts.map +1 -0
- package/dist/approvals.js +105 -0
- package/dist/approvals.js.map +1 -0
- package/dist/client.d.ts +59 -17
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +237 -142
- package/dist/client.js.map +1 -1
- package/dist/errors.d.ts +24 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +90 -19
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +11 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -5
- package/dist/index.js.map +1 -1
- package/dist/ownership.d.ts +7 -1
- package/dist/ownership.d.ts.map +1 -1
- package/dist/ownership.js +24 -3
- package/dist/ownership.js.map +1 -1
- package/dist/protocol.d.ts +70 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/protocol.js +187 -0
- package/dist/protocol.js.map +1 -0
- package/dist/push-notifications.d.ts +5 -2
- package/dist/push-notifications.d.ts.map +1 -1
- package/dist/push-notifications.js +33 -23
- package/dist/push-notifications.js.map +1 -1
- package/dist/redis-task-store.js +3 -3
- package/dist/redis-task-store.js.map +1 -1
- package/dist/server.d.ts +75 -12
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +324 -270
- package/dist/server.js.map +1 -1
- package/dist/task-manager.d.ts +57 -11
- package/dist/task-manager.d.ts.map +1 -1
- package/dist/task-manager.js +264 -116
- package/dist/task-manager.js.map +1 -1
- package/dist/task-store.js +4 -4
- package/dist/task-store.js.map +1 -1
- package/dist/types.d.ts +226 -85
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +10 -3
- package/dist/types.js.map +1 -1
- package/dist/url.d.ts +7 -0
- package/dist/url.d.ts.map +1 -0
- package/dist/url.js +12 -0
- package/dist/url.js.map +1 -0
- package/package.json +19 -9
- package/dist/adapters/sse-error-event.d.ts +0 -3
- package/dist/adapters/sse-error-event.d.ts.map +0 -1
- package/dist/adapters/sse-error-event.js +0 -12
- package/dist/adapters/sse-error-event.js.map +0 -1
package/dist/types.d.ts
CHANGED
|
@@ -1,116 +1,220 @@
|
|
|
1
|
-
import type { Agent } from '@cogitator-ai/types';
|
|
2
|
-
|
|
1
|
+
import type { Agent, ToolApprovalDecision, ToolApprovalRequest } from '@cogitator-ai/types';
|
|
2
|
+
/** The A2A protocol version this package speaks, as Agent Cards declare it. */
|
|
3
|
+
export declare const A2A_PROTOCOL_VERSION = "0.3.0";
|
|
4
|
+
/** Where an A2A server publishes its Agent Card (A2A v0.3, section 5.3). */
|
|
5
|
+
export declare const AGENT_CARD_PATH = "/.well-known/agent-card.json";
|
|
6
|
+
/** Where A2A servers before protocol v0.3 published their Agent Card. */
|
|
7
|
+
export declare const LEGACY_AGENT_CARD_PATH = "/.well-known/agent.json";
|
|
8
|
+
export type TaskState = 'submitted' | 'working' | 'input-required' | 'completed' | 'canceled' | 'failed' | 'rejected' | 'auth-required' | 'unknown';
|
|
3
9
|
export declare const TERMINAL_STATES: readonly ["completed", "failed", "canceled", "rejected"];
|
|
4
10
|
export declare function isTerminalState(state: TaskState): boolean;
|
|
5
11
|
/**
|
|
6
|
-
* States after which
|
|
7
|
-
* `
|
|
12
|
+
* States after which an interaction waits on the client: terminal states plus `input-required`
|
|
13
|
+
* and `auth-required`. The status update that reaches one of them is the `final` event of a
|
|
14
|
+
* stream.
|
|
8
15
|
*/
|
|
9
16
|
export declare function isStreamFinalState(state: TaskState): boolean;
|
|
10
17
|
export interface TextPart {
|
|
11
|
-
|
|
18
|
+
kind: 'text';
|
|
12
19
|
text: string;
|
|
20
|
+
metadata?: Record<string, unknown>;
|
|
13
21
|
}
|
|
14
|
-
export interface
|
|
15
|
-
type: 'file';
|
|
22
|
+
export interface FileWithUri {
|
|
16
23
|
uri: string;
|
|
17
|
-
mimeType
|
|
18
|
-
size?: number;
|
|
24
|
+
mimeType?: string;
|
|
19
25
|
name?: string;
|
|
20
26
|
}
|
|
27
|
+
export interface FileWithBytes {
|
|
28
|
+
/** The file content, base64-encoded */
|
|
29
|
+
bytes: string;
|
|
30
|
+
mimeType?: string;
|
|
31
|
+
name?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface FilePart {
|
|
34
|
+
kind: 'file';
|
|
35
|
+
file: FileWithUri | FileWithBytes;
|
|
36
|
+
metadata?: Record<string, unknown>;
|
|
37
|
+
}
|
|
21
38
|
export interface DataPart {
|
|
22
|
-
|
|
23
|
-
mimeType: string;
|
|
39
|
+
kind: 'data';
|
|
24
40
|
data: Record<string, unknown>;
|
|
41
|
+
metadata?: Record<string, unknown>;
|
|
25
42
|
}
|
|
26
43
|
export type Part = TextPart | FilePart | DataPart;
|
|
27
44
|
export interface A2AMessage {
|
|
45
|
+
kind: 'message';
|
|
46
|
+
messageId: string;
|
|
28
47
|
role: 'user' | 'agent';
|
|
29
48
|
parts: Part[];
|
|
30
49
|
taskId?: string;
|
|
31
50
|
contextId?: string;
|
|
32
51
|
referenceTaskIds?: string[];
|
|
52
|
+
extensions?: string[];
|
|
53
|
+
metadata?: Record<string, unknown>;
|
|
33
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* A message as the client composes it: `kind` and `messageId` are filled in when left out.
|
|
57
|
+
*/
|
|
58
|
+
export type A2AMessageInput = Omit<A2AMessage, 'kind' | 'messageId'> & Partial<Pick<A2AMessage, 'kind' | 'messageId'>>;
|
|
34
59
|
export interface Artifact {
|
|
35
|
-
|
|
60
|
+
artifactId: string;
|
|
61
|
+
name?: string;
|
|
62
|
+
description?: string;
|
|
36
63
|
parts: Part[];
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
export interface A2AErrorDetail {
|
|
40
|
-
code: number;
|
|
41
|
-
message: string;
|
|
42
|
-
data?: unknown;
|
|
64
|
+
extensions?: string[];
|
|
65
|
+
metadata?: Record<string, unknown>;
|
|
43
66
|
}
|
|
44
67
|
export interface TaskStatus {
|
|
45
68
|
state: TaskState;
|
|
46
|
-
|
|
47
|
-
message?:
|
|
48
|
-
|
|
69
|
+
/** An agent message about the state, e.g. the question of `input-required` or the error of `failed` */
|
|
70
|
+
message?: A2AMessage;
|
|
71
|
+
/** ISO 8601 time of the change */
|
|
72
|
+
timestamp?: string;
|
|
49
73
|
}
|
|
50
74
|
export interface A2ATask {
|
|
75
|
+
kind: 'task';
|
|
51
76
|
id: string;
|
|
52
77
|
contextId: string;
|
|
53
78
|
status: TaskStatus;
|
|
54
|
-
history
|
|
55
|
-
artifacts
|
|
79
|
+
history?: A2AMessage[];
|
|
80
|
+
artifacts?: Artifact[];
|
|
56
81
|
metadata?: Record<string, unknown>;
|
|
57
82
|
}
|
|
58
83
|
export interface AgentProvider {
|
|
59
|
-
|
|
60
|
-
url
|
|
61
|
-
|
|
84
|
+
organization: string;
|
|
85
|
+
url: string;
|
|
86
|
+
}
|
|
87
|
+
export interface AgentExtension {
|
|
88
|
+
uri: string;
|
|
89
|
+
description?: string;
|
|
90
|
+
required?: boolean;
|
|
91
|
+
params?: Record<string, unknown>;
|
|
62
92
|
}
|
|
63
93
|
export interface A2ACapabilities {
|
|
64
|
-
streaming
|
|
65
|
-
pushNotifications
|
|
66
|
-
|
|
94
|
+
streaming?: boolean;
|
|
95
|
+
pushNotifications?: boolean;
|
|
96
|
+
stateTransitionHistory?: boolean;
|
|
97
|
+
extensions?: AgentExtension[];
|
|
67
98
|
}
|
|
68
99
|
export interface AgentSkill {
|
|
69
100
|
id: string;
|
|
70
101
|
name: string;
|
|
71
|
-
description
|
|
72
|
-
|
|
73
|
-
outputModes: string[];
|
|
102
|
+
description: string;
|
|
103
|
+
tags: string[];
|
|
74
104
|
examples?: string[];
|
|
105
|
+
inputModes?: string[];
|
|
106
|
+
outputModes?: string[];
|
|
107
|
+
security?: Record<string, string[]>[];
|
|
108
|
+
}
|
|
109
|
+
export interface OAuthFlow {
|
|
110
|
+
authorizationUrl?: string;
|
|
111
|
+
tokenUrl?: string;
|
|
112
|
+
refreshUrl?: string;
|
|
113
|
+
scopes: Record<string, string>;
|
|
75
114
|
}
|
|
76
115
|
export type SecurityScheme = {
|
|
77
116
|
type: 'apiKey';
|
|
78
|
-
|
|
79
|
-
|
|
117
|
+
in: 'header' | 'query' | 'cookie';
|
|
118
|
+
name: string;
|
|
119
|
+
description?: string;
|
|
80
120
|
} | {
|
|
81
121
|
type: 'http';
|
|
82
|
-
scheme:
|
|
122
|
+
scheme: string;
|
|
123
|
+
bearerFormat?: string;
|
|
124
|
+
description?: string;
|
|
83
125
|
} | {
|
|
84
126
|
type: 'oauth2';
|
|
85
|
-
flows: Record<
|
|
127
|
+
flows: Partial<Record<'authorizationCode' | 'clientCredentials' | 'implicit' | 'password', OAuthFlow>>;
|
|
128
|
+
oauth2MetadataUrl?: string;
|
|
129
|
+
description?: string;
|
|
86
130
|
} | {
|
|
87
131
|
type: 'openIdConnect';
|
|
88
|
-
|
|
132
|
+
openIdConnectUrl: string;
|
|
133
|
+
description?: string;
|
|
134
|
+
} | {
|
|
135
|
+
type: 'mutualTLS';
|
|
136
|
+
description?: string;
|
|
89
137
|
};
|
|
138
|
+
export type TransportProtocol = 'JSONRPC' | 'GRPC' | 'HTTP+JSON';
|
|
139
|
+
export interface AgentInterface {
|
|
140
|
+
transport: TransportProtocol | (string & {});
|
|
141
|
+
url: string;
|
|
142
|
+
}
|
|
143
|
+
/** A JWS signature of an Agent Card (RFC 7515, detached payload). */
|
|
144
|
+
export interface AgentCardSignature {
|
|
145
|
+
/** The protected JWS header, base64url-encoded JSON */
|
|
146
|
+
protected: string;
|
|
147
|
+
/** The signature, base64url-encoded */
|
|
148
|
+
signature: string;
|
|
149
|
+
header?: Record<string, unknown>;
|
|
150
|
+
}
|
|
90
151
|
export interface AgentCard {
|
|
152
|
+
protocolVersion: string;
|
|
91
153
|
name: string;
|
|
92
|
-
description
|
|
154
|
+
description: string;
|
|
155
|
+
/** The endpoint of `preferredTransport` */
|
|
93
156
|
url: string;
|
|
157
|
+
preferredTransport?: TransportProtocol | (string & {});
|
|
158
|
+
additionalInterfaces?: AgentInterface[];
|
|
94
159
|
version: string;
|
|
95
160
|
provider?: AgentProvider;
|
|
161
|
+
iconUrl?: string;
|
|
162
|
+
documentationUrl?: string;
|
|
96
163
|
capabilities: A2ACapabilities;
|
|
97
|
-
skills: AgentSkill[];
|
|
98
|
-
defaultInputModes: string[];
|
|
99
|
-
defaultOutputModes: string[];
|
|
100
164
|
securitySchemes?: Record<string, SecurityScheme>;
|
|
101
165
|
security?: Record<string, string[]>[];
|
|
166
|
+
defaultInputModes: string[];
|
|
167
|
+
defaultOutputModes: string[];
|
|
168
|
+
skills: AgentSkill[];
|
|
169
|
+
supportsAuthenticatedExtendedCard?: boolean;
|
|
170
|
+
signatures?: AgentCardSignature[];
|
|
171
|
+
}
|
|
172
|
+
/** The card `agent/getAuthenticatedExtendedCard` returns: an Agent Card with more detail. */
|
|
173
|
+
export type ExtendedAgentCard = AgentCard;
|
|
174
|
+
export interface PushNotificationAuthenticationInfo {
|
|
175
|
+
/** Schemes the webhook accepts, e.g. `Bearer` or `Basic` */
|
|
176
|
+
schemes: string[];
|
|
177
|
+
/** Credentials for the first supported scheme: a bearer token or base64 `user:password` */
|
|
178
|
+
credentials?: string;
|
|
179
|
+
}
|
|
180
|
+
export interface PushNotificationConfig {
|
|
181
|
+
/** The webhook the server POSTs the task to on every status change */
|
|
182
|
+
url: string;
|
|
183
|
+
id?: string;
|
|
184
|
+
/** Sent back in the `X-A2A-Notification-Token` header so the webhook can check the sender */
|
|
185
|
+
token?: string;
|
|
186
|
+
authentication?: PushNotificationAuthenticationInfo;
|
|
102
187
|
}
|
|
103
|
-
export interface
|
|
104
|
-
|
|
188
|
+
export interface TaskPushNotificationConfig {
|
|
189
|
+
taskId: string;
|
|
190
|
+
pushNotificationConfig: PushNotificationConfig;
|
|
191
|
+
}
|
|
192
|
+
export interface MessageSendConfiguration {
|
|
193
|
+
/** Only return artifacts with a part of one of these MIME types */
|
|
105
194
|
acceptedOutputModes?: string[];
|
|
106
195
|
/** Trim the returned task history to the last N messages (0 = no history) */
|
|
107
196
|
historyLength?: number;
|
|
108
|
-
/** Wait for the task to finish (default: true). When false the task is returned while still
|
|
197
|
+
/** Wait for the task to finish (default: true). When false the task is returned while still running. */
|
|
109
198
|
blocking?: boolean;
|
|
110
|
-
/** Maximum agent run time in ms */
|
|
111
|
-
timeout?: number;
|
|
112
199
|
/** Register a push notification webhook before the task starts executing */
|
|
113
200
|
pushNotificationConfig?: PushNotificationConfig;
|
|
201
|
+
/**
|
|
202
|
+
* Cogitator extension: a shorter run time limit for this task, in ms. The server never lets it
|
|
203
|
+
* exceed the agent's own timeout or `maxRunTimeoutMs`.
|
|
204
|
+
*/
|
|
205
|
+
timeout?: number;
|
|
206
|
+
}
|
|
207
|
+
/** @deprecated Renamed to `MessageSendConfiguration`, its name in the A2A specification */
|
|
208
|
+
export type SendMessageConfiguration = MessageSendConfiguration;
|
|
209
|
+
export interface MessageSendParams {
|
|
210
|
+
message: A2AMessage;
|
|
211
|
+
configuration?: MessageSendConfiguration;
|
|
212
|
+
metadata?: Record<string, unknown>;
|
|
213
|
+
/**
|
|
214
|
+
* Cogitator extension: the agent to address on a server hosting several, when the request goes
|
|
215
|
+
* to the shared endpoint. Each agent also has its own endpoint, named in its Agent Card.
|
|
216
|
+
*/
|
|
217
|
+
agentName?: string;
|
|
114
218
|
}
|
|
115
219
|
export interface TaskFilter {
|
|
116
220
|
contextId?: string;
|
|
@@ -132,28 +236,39 @@ export interface TaskStore {
|
|
|
132
236
|
delete(taskId: string): Promise<void>;
|
|
133
237
|
}
|
|
134
238
|
export interface TaskStatusUpdateEvent {
|
|
135
|
-
|
|
239
|
+
kind: 'status-update';
|
|
136
240
|
taskId: string;
|
|
241
|
+
contextId: string;
|
|
137
242
|
status: TaskStatus;
|
|
138
|
-
|
|
243
|
+
/** True on the last event of the interaction: the stream ends after it */
|
|
244
|
+
final: boolean;
|
|
245
|
+
metadata?: Record<string, unknown>;
|
|
139
246
|
}
|
|
140
247
|
export interface TaskArtifactUpdateEvent {
|
|
141
|
-
|
|
248
|
+
kind: 'artifact-update';
|
|
142
249
|
taskId: string;
|
|
250
|
+
contextId: string;
|
|
143
251
|
artifact: Artifact;
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
token: string;
|
|
150
|
-
timestamp: string;
|
|
252
|
+
/** The parts extend the artifact with the same id sent before instead of replacing it */
|
|
253
|
+
append?: boolean;
|
|
254
|
+
/** The artifact is complete */
|
|
255
|
+
lastChunk?: boolean;
|
|
256
|
+
metadata?: Record<string, unknown>;
|
|
151
257
|
}
|
|
152
|
-
|
|
258
|
+
/** What a `message/stream` or `tasks/resubscribe` stream carries in each event. */
|
|
259
|
+
export type A2AStreamEvent = A2ATask | A2AMessage | TaskStatusUpdateEvent | TaskArtifactUpdateEvent;
|
|
260
|
+
/** What `message/send` returns: the task, or a direct reply message. */
|
|
261
|
+
export type SendMessageResult = A2ATask | A2AMessage;
|
|
153
262
|
export interface AgentRunResult {
|
|
154
263
|
output: string;
|
|
155
264
|
structured?: unknown;
|
|
156
265
|
requiresInput?: boolean;
|
|
266
|
+
/**
|
|
267
|
+
* `paused` when tool calls wait for approval: the task goes to `input-required` with the calls
|
|
268
|
+
* in a tool approval request data part, and the decisions resume the run
|
|
269
|
+
*/
|
|
270
|
+
status?: 'completed' | 'paused';
|
|
271
|
+
pendingApprovals?: readonly ToolApprovalRequest[];
|
|
157
272
|
runId: string;
|
|
158
273
|
agentId: string;
|
|
159
274
|
threadId: string;
|
|
@@ -181,6 +296,19 @@ export interface CogitatorLike {
|
|
|
181
296
|
/** The caller the run acts for, so thread and memory access is scoped to them */
|
|
182
297
|
userId?: string;
|
|
183
298
|
}): Promise<AgentRunResult>;
|
|
299
|
+
/**
|
|
300
|
+
* Continue the run a thread paused for tool approvals, with the client's decisions. Without
|
|
301
|
+
* it a task waiting for approvals fails when the client answers
|
|
302
|
+
*/
|
|
303
|
+
resume?(agent: unknown, threadId: string, options: {
|
|
304
|
+
decisions?: Record<string, ToolApprovalDecision>;
|
|
305
|
+
defaultDecision?: ToolApprovalDecision;
|
|
306
|
+
signal?: AbortSignal;
|
|
307
|
+
stream?: boolean;
|
|
308
|
+
onToken?: (token: string) => void;
|
|
309
|
+
timeout?: number;
|
|
310
|
+
userId?: string;
|
|
311
|
+
}): Promise<AgentRunResult>;
|
|
184
312
|
}
|
|
185
313
|
/** Who an authenticated A2A request comes from. */
|
|
186
314
|
export interface A2ACaller {
|
|
@@ -202,29 +330,47 @@ export interface A2AServerConfig {
|
|
|
202
330
|
cogitator: CogitatorLike;
|
|
203
331
|
/**
|
|
204
332
|
* Path of the JSON-RPC endpoint the framework adapters serve, relative to
|
|
205
|
-
* where they are mounted (default: '/a2a'). Must start with '/'.
|
|
333
|
+
* where they are mounted (default: '/a2a'). Must start with '/'. Each agent
|
|
334
|
+
* also gets its own endpoint at `<basePath>/<agent name>`.
|
|
206
335
|
*/
|
|
207
336
|
basePath?: string;
|
|
208
337
|
taskStore?: TaskStore;
|
|
209
|
-
/**
|
|
338
|
+
/**
|
|
339
|
+
* Absolute URL of the JSON-RPC endpoint the Agent Cards advertise. Without it the framework
|
|
340
|
+
* adapters derive it from the request that fetches the card. Set it when the server runs behind
|
|
341
|
+
* a proxy that changes the host or the path. Other agents than the first are advertised at
|
|
342
|
+
* `<cardUrl>/<agent name>`.
|
|
343
|
+
*/
|
|
210
344
|
cardUrl?: string;
|
|
345
|
+
/** The version of the agents the cards advertise (default: '1.0.0') */
|
|
346
|
+
agentVersion?: string;
|
|
347
|
+
/** The organization the cards name as provider */
|
|
348
|
+
provider?: AgentProvider;
|
|
211
349
|
auth?: A2AAuthConfig;
|
|
212
350
|
pushNotificationStore?: PushNotificationStore;
|
|
351
|
+
/**
|
|
352
|
+
* Signs every Agent Card with a JWS (HMAC SHA-256, `HS256`) in its `signatures`, which a client
|
|
353
|
+
* holding the shared secret checks with `verifyAgentCardSignature`
|
|
354
|
+
*/
|
|
213
355
|
cardSigning?: {
|
|
214
|
-
algorithm?: 'hmac-sha256';
|
|
356
|
+
algorithm?: 'HS256' | 'hmac-sha256';
|
|
215
357
|
secret: string;
|
|
216
358
|
};
|
|
217
|
-
extendedCardGenerator?: (agentName: string) =>
|
|
359
|
+
extendedCardGenerator?: (agentName: string) => AgentCard;
|
|
218
360
|
allowPrivateUrls?: boolean;
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
361
|
+
/**
|
|
362
|
+
* How often the framework adapters write an SSE comment on a streaming response
|
|
363
|
+
* while the run is silent, in milliseconds, so a proxy (nginx closes after 60 s) or the
|
|
364
|
+
* runtime (Bun after 10 s) does not cut a run that waits on a slow tool. Default: 5000.
|
|
365
|
+
* `0` turns heartbeats off.
|
|
366
|
+
*/
|
|
367
|
+
sseHeartbeatMs?: number;
|
|
368
|
+
/**
|
|
369
|
+
* The longest run, in ms, a client may ask for with `configuration.timeout` for an agent
|
|
370
|
+
* without its own `timeout` (default: 120000, the Cogitator run default). A client can only
|
|
371
|
+
* shorten a run: its timeout is capped by the agent's `timeout`, or by this value.
|
|
372
|
+
*/
|
|
373
|
+
maxRunTimeoutMs?: number;
|
|
228
374
|
}
|
|
229
375
|
export interface PushNotificationStore {
|
|
230
376
|
create(taskId: string, config: PushNotificationConfig): Promise<PushNotificationConfig>;
|
|
@@ -232,27 +378,22 @@ export interface PushNotificationStore {
|
|
|
232
378
|
list(taskId: string): Promise<PushNotificationConfig[]>;
|
|
233
379
|
delete(taskId: string, configId: string): Promise<void>;
|
|
234
380
|
}
|
|
235
|
-
export interface ExtendedAgentCard extends AgentCard {
|
|
236
|
-
extendedSkills?: AgentSkill[];
|
|
237
|
-
rateLimit?: {
|
|
238
|
-
requestsPerMinute: number;
|
|
239
|
-
};
|
|
240
|
-
pricing?: {
|
|
241
|
-
model: string;
|
|
242
|
-
details?: string;
|
|
243
|
-
};
|
|
244
|
-
metadata?: Record<string, unknown>;
|
|
245
|
-
}
|
|
246
381
|
export interface A2AClientConfig {
|
|
247
382
|
headers?: Record<string, string>;
|
|
248
383
|
timeout?: number;
|
|
384
|
+
/**
|
|
385
|
+
* Path of the Agent Card relative to the base URL (default: '/.well-known/agent-card.json',
|
|
386
|
+
* falling back to the pre-v0.3 '/.well-known/agent.json')
|
|
387
|
+
*/
|
|
249
388
|
agentCardPath?: string;
|
|
389
|
+
/**
|
|
390
|
+
* Path of the JSON-RPC endpoint relative to the base URL. Without it the client sends requests
|
|
391
|
+
* to the `url` the Agent Card names, as the A2A specification requires.
|
|
392
|
+
*/
|
|
250
393
|
rpcPath?: string;
|
|
251
394
|
/**
|
|
252
|
-
* The agent to talk to on a server that hosts several: the name it is
|
|
253
|
-
*
|
|
254
|
-
* `message/stream` and `agent/extendedCard`; `agentCard()` returns the card
|
|
255
|
-
* of that name. Without it the server answers with its first agent.
|
|
395
|
+
* The agent to talk to on a Cogitator server that hosts several: the name it is registered
|
|
396
|
+
* under in the server's `agents`. The client then uses that agent's own card and endpoint.
|
|
256
397
|
*/
|
|
257
398
|
agentName?: string;
|
|
258
399
|
}
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE5F,+EAA+E;AAC/E,eAAO,MAAM,oBAAoB,UAAU,CAAC;AAE5C,4EAA4E;AAC5E,eAAO,MAAM,eAAe,iCAAiC,CAAC;AAE9D,yEAAyE;AACzE,eAAO,MAAM,sBAAsB,4BAA4B,CAAC;AAEhE,MAAM,MAAM,SAAS,GACjB,WAAW,GACX,SAAS,GACT,gBAAgB,GAChB,WAAW,GACX,UAAU,GACV,QAAQ,GACR,UAAU,GACV,eAAe,GACf,SAAS,CAAC;AAEd,eAAO,MAAM,eAAe,0DAA2D,CAAC;AAExF,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAEzD;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAE5D;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,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;IACH,WAAW,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,OAAO,GAAG,aAAa,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACtE,qBAAqB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,SAAS,CAAC;IACzD,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;IACxF,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC,CAAC;IAC9E,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,EAAE,CAAC,CAAC;IACxD,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACzD;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
package/dist/types.js
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
|
+
/** The A2A protocol version this package speaks, as Agent Cards declare it. */
|
|
2
|
+
export const A2A_PROTOCOL_VERSION = '0.3.0';
|
|
3
|
+
/** Where an A2A server publishes its Agent Card (A2A v0.3, section 5.3). */
|
|
4
|
+
export const AGENT_CARD_PATH = '/.well-known/agent-card.json';
|
|
5
|
+
/** Where A2A servers before protocol v0.3 published their Agent Card. */
|
|
6
|
+
export const LEGACY_AGENT_CARD_PATH = '/.well-known/agent.json';
|
|
1
7
|
export const TERMINAL_STATES = ['completed', 'failed', 'canceled', 'rejected'];
|
|
2
8
|
export function isTerminalState(state) {
|
|
3
9
|
return TERMINAL_STATES.includes(state);
|
|
4
10
|
}
|
|
5
11
|
/**
|
|
6
|
-
* States after which
|
|
7
|
-
* `
|
|
12
|
+
* States after which an interaction waits on the client: terminal states plus `input-required`
|
|
13
|
+
* and `auth-required`. The status update that reaches one of them is the `final` event of a
|
|
14
|
+
* stream.
|
|
8
15
|
*/
|
|
9
16
|
export function isStreamFinalState(state) {
|
|
10
|
-
return state === 'input-required' || isTerminalState(state);
|
|
17
|
+
return state === 'input-required' || state === 'auth-required' || isTerminalState(state);
|
|
11
18
|
}
|
|
12
19
|
//# sourceMappingURL=types.js.map
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,+EAA+E;AAC/E,MAAM,CAAC,MAAM,oBAAoB,GAAG,OAAO,CAAC;AAE5C,4EAA4E;AAC5E,MAAM,CAAC,MAAM,eAAe,GAAG,8BAA8B,CAAC;AAE9D,yEAAyE;AACzE,MAAM,CAAC,MAAM,sBAAsB,GAAG,yBAAyB,CAAC;AAahE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,CAAU,CAAC;AAExF,MAAM,UAAU,eAAe,CAAC,KAAgB;IAC9C,OAAQ,eAAqC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAgB;IACjD,OAAO,KAAK,KAAK,gBAAgB,IAAI,KAAK,KAAK,eAAe,IAAI,eAAe,CAAC,KAAK,CAAC,CAAC;AAC3F,CAAC"}
|
package/dist/url.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `value` without the slashes it ends with. A loop rather than `replace(/\/+$/, '')`: that
|
|
3
|
+
* pattern backtracks in quadratic time over a long run of slashes followed by anything else,
|
|
4
|
+
* and base paths and URLs come from configuration and requests.
|
|
5
|
+
*/
|
|
6
|
+
export declare function trimTrailingSlashes(value: string): string;
|
|
7
|
+
//# sourceMappingURL=url.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../src/url.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIzD"}
|
package/dist/url.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `value` without the slashes it ends with. A loop rather than `replace(/\/+$/, '')`: that
|
|
3
|
+
* pattern backtracks in quadratic time over a long run of slashes followed by anything else,
|
|
4
|
+
* and base paths and URLs come from configuration and requests.
|
|
5
|
+
*/
|
|
6
|
+
export function trimTrailingSlashes(value) {
|
|
7
|
+
let end = value.length;
|
|
8
|
+
while (end > 0 && value.charCodeAt(end - 1) === 47)
|
|
9
|
+
end--;
|
|
10
|
+
return value.slice(0, end);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=url.js.map
|
package/dist/url.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url.js","sourceRoot":"","sources":["../src/url.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAa;IAC/C,IAAI,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC;IACvB,OAAO,GAAG,GAAG,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,GAAG,CAAC,CAAC,KAAK,EAAE;QAAE,GAAG,EAAE,CAAC;IAC1D,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAC7B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cogitator-ai/a2a",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "A2A (Agent-to-Agent) Protocol v0.3 implementation for Cogitator",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cogitator",
|
|
@@ -19,27 +19,33 @@
|
|
|
19
19
|
"exports": {
|
|
20
20
|
".": {
|
|
21
21
|
"types": "./dist/index.d.ts",
|
|
22
|
-
"import": "./dist/index.js"
|
|
22
|
+
"import": "./dist/index.js",
|
|
23
|
+
"default": "./dist/index.js"
|
|
23
24
|
},
|
|
24
25
|
"./express": {
|
|
25
26
|
"types": "./dist/adapters/express.d.ts",
|
|
26
|
-
"import": "./dist/adapters/express.js"
|
|
27
|
+
"import": "./dist/adapters/express.js",
|
|
28
|
+
"default": "./dist/adapters/express.js"
|
|
27
29
|
},
|
|
28
30
|
"./hono": {
|
|
29
31
|
"types": "./dist/adapters/hono.d.ts",
|
|
30
|
-
"import": "./dist/adapters/hono.js"
|
|
32
|
+
"import": "./dist/adapters/hono.js",
|
|
33
|
+
"default": "./dist/adapters/hono.js"
|
|
31
34
|
},
|
|
32
35
|
"./fastify": {
|
|
33
36
|
"types": "./dist/adapters/fastify.d.ts",
|
|
34
|
-
"import": "./dist/adapters/fastify.js"
|
|
37
|
+
"import": "./dist/adapters/fastify.js",
|
|
38
|
+
"default": "./dist/adapters/fastify.js"
|
|
35
39
|
},
|
|
36
40
|
"./koa": {
|
|
37
41
|
"types": "./dist/adapters/koa.d.ts",
|
|
38
|
-
"import": "./dist/adapters/koa.js"
|
|
42
|
+
"import": "./dist/adapters/koa.js",
|
|
43
|
+
"default": "./dist/adapters/koa.js"
|
|
39
44
|
},
|
|
40
45
|
"./next": {
|
|
41
46
|
"types": "./dist/adapters/next.d.ts",
|
|
42
|
-
"import": "./dist/adapters/next.js"
|
|
47
|
+
"import": "./dist/adapters/next.js",
|
|
48
|
+
"default": "./dist/adapters/next.js"
|
|
43
49
|
}
|
|
44
50
|
},
|
|
45
51
|
"files": [
|
|
@@ -47,18 +53,22 @@
|
|
|
47
53
|
"README.md"
|
|
48
54
|
],
|
|
49
55
|
"dependencies": {
|
|
50
|
-
"@cogitator-ai/
|
|
56
|
+
"@cogitator-ai/server-shared": "0.5.0",
|
|
57
|
+
"@cogitator-ai/types": "0.36.0",
|
|
51
58
|
"zod": "^4.6.5"
|
|
52
59
|
},
|
|
53
60
|
"devDependencies": {
|
|
61
|
+
"@a2a-js/sdk": "0.3.14",
|
|
62
|
+
"@cogitator-ai/core": "0.34.0",
|
|
54
63
|
"@types/express": "^5.0.6",
|
|
55
64
|
"@types/koa": "^3.0.3",
|
|
56
65
|
"@types/node": "^22.20.4",
|
|
66
|
+
"ajv": "^8.18.0",
|
|
57
67
|
"typescript": "^6.0.3",
|
|
58
68
|
"vitest": "^5.0.3"
|
|
59
69
|
},
|
|
60
70
|
"peerDependencies": {
|
|
61
|
-
"@cogitator-ai/core": ">=0.
|
|
71
|
+
"@cogitator-ai/core": ">=0.34.0",
|
|
62
72
|
"express": ">=4.18.0",
|
|
63
73
|
"fastify": ">=4.0.0",
|
|
64
74
|
"hono": ">=4.0.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sse-error-event.d.ts","sourceRoot":"","sources":["../../src/adapters/sse-error-event.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,cAAc,CASjE"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { clientErrorMessage } from '../errors.js';
|
|
2
|
-
export function buildSseErrorEvent(error) {
|
|
3
|
-
const message = clientErrorMessage(error, 'A2A stream failed');
|
|
4
|
-
const timestamp = new Date().toISOString();
|
|
5
|
-
return {
|
|
6
|
-
type: 'status-update',
|
|
7
|
-
taskId: '',
|
|
8
|
-
status: { state: 'failed', timestamp, message },
|
|
9
|
-
timestamp,
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=sse-error-event.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sse-error-event.js","sourceRoot":"","sources":["../../src/adapters/sse-error-event.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,MAAM,OAAO,GAAG,kBAAkB,CAAC,KAAK,EAAE,mBAAmB,CAAC,CAAC;IAC/D,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC3C,OAAO;QACL,IAAI,EAAE,eAAe;QACrB,MAAM,EAAE,EAAE;QACV,MAAM,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE;QAC/C,SAAS;KACV,CAAC;AACJ,CAAC"}
|