@axiom-lattice/protocols 2.1.39 → 2.1.40

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.
@@ -0,0 +1,184 @@
1
+ /**
2
+ * A2AProtocol - Google Agent-to-Agent Protocol type definitions
3
+ *
4
+ * Based on the A2A open protocol spec for AI agent interoperability.
5
+ * @see https://github.com/google/A2A
6
+ */
7
+
8
+ // ─── Agent Card ───────────────────────────────────────────────────────────
9
+
10
+ export interface A2ASkill {
11
+ id: string;
12
+ name: string;
13
+ description: string;
14
+ tags: string[];
15
+ examples: string[];
16
+ }
17
+
18
+ export interface A2ACapabilities {
19
+ streaming: boolean;
20
+ pushNotifications: boolean;
21
+ stateTransitionHistory: boolean;
22
+ }
23
+
24
+ export interface A2AProvider {
25
+ organization: string;
26
+ url?: string;
27
+ }
28
+
29
+ export interface AgentCard {
30
+ name: string;
31
+ description: string;
32
+ url: string;
33
+ provider: A2AProvider;
34
+ version: string;
35
+ documentationUrl?: string;
36
+ capabilities: A2ACapabilities;
37
+ defaultInputModes: string[];
38
+ defaultOutputModes: string[];
39
+ skills: A2ASkill[];
40
+ }
41
+
42
+ // ─── Artifact / Part ──────────────────────────────────────────────────────
43
+
44
+ export interface A2ATextPart {
45
+ type: "text";
46
+ text: string;
47
+ }
48
+
49
+ export interface A2AFilePart {
50
+ type: "file";
51
+ file: {
52
+ name: string;
53
+ mimeType: string;
54
+ bytes?: string;
55
+ uri?: string;
56
+ };
57
+ }
58
+
59
+ export interface A2ADataPart {
60
+ type: "data";
61
+ data: Record<string, unknown>;
62
+ }
63
+
64
+ export type A2APart = A2ATextPart | A2AFilePart | A2ADataPart;
65
+
66
+ // ─── Message ──────────────────────────────────────────────────────────────
67
+
68
+ export interface A2AMessage {
69
+ role: "user" | "agent";
70
+ parts: A2APart[];
71
+ metadata?: Record<string, unknown>;
72
+ }
73
+
74
+ // ─── Task ─────────────────────────────────────────────────────────────────
75
+
76
+ export type A2ATaskState =
77
+ | "working"
78
+ | "input-required"
79
+ | "completed"
80
+ | "failed"
81
+ | "canceled"
82
+ | "rejected";
83
+
84
+ export interface A2ATaskStatus {
85
+ state: A2ATaskState;
86
+ message?: A2AMessage;
87
+ timestamp: string;
88
+ }
89
+
90
+ export interface A2AArtifact {
91
+ name?: string;
92
+ description?: string;
93
+ parts: A2APart[];
94
+ metadata?: Record<string, unknown>;
95
+ }
96
+
97
+ export interface A2ATask {
98
+ id: string;
99
+ sessionId?: string;
100
+ status: A2ATaskStatus;
101
+ artifacts: A2AArtifact[];
102
+ history?: A2AMessage[];
103
+ metadata?: Record<string, unknown>;
104
+ }
105
+
106
+ // ─── Request / Response ───────────────────────────────────────────────────
107
+
108
+ export interface A2ATaskSendRequest {
109
+ id?: string;
110
+ sessionId?: string;
111
+ message: A2AMessage;
112
+ pushNotification?: A2APushNotification;
113
+ historyLength?: number;
114
+ metadata?: Record<string, unknown>;
115
+ }
116
+
117
+ export interface A2APushNotification {
118
+ url: string;
119
+ token?: string;
120
+ }
121
+
122
+ export interface A2ATaskUpdatePayload {
123
+ id: string;
124
+ sessionId?: string;
125
+ status: A2ATaskStatus;
126
+ final?: boolean;
127
+ metadata?: Record<string, unknown>;
128
+ }
129
+
130
+ export interface A2ATaskArtifactUpdatePayload {
131
+ id: string;
132
+ sessionId?: string;
133
+ artifact: A2AArtifact;
134
+ final?: boolean;
135
+ metadata?: Record<string, unknown>;
136
+ }
137
+
138
+ // ─── SSE Events ───────────────────────────────────────────────────────────
139
+
140
+ export type A2ASSEEvent =
141
+ | { event: "task"; data: A2ATaskUpdatePayload }
142
+ | { event: "status-update"; data: A2ATaskUpdatePayload }
143
+ | { event: "artifact-update"; data: A2ATaskArtifactUpdatePayload }
144
+ | { event: "error"; data: { code: string; message: string } };
145
+
146
+ // ─── Config ───────────────────────────────────────────────────────────────
147
+
148
+ export interface A2AConfig {
149
+ agentName: string;
150
+ agentDescription: string;
151
+ agentUrl: string;
152
+ organization: string;
153
+ version?: string;
154
+ capabilities?: Partial<A2ACapabilities>;
155
+ defaultInputModes?: string[];
156
+ defaultOutputModes?: string[];
157
+ skills?: A2ASkill[];
158
+ apiKeyMap: Map<string, A2AApiKeyEntry>;
159
+ }
160
+
161
+ export interface A2AApiKeyEntry {
162
+ key: string;
163
+ tenantId?: string;
164
+ projectId?: string;
165
+ workspaceId?: string;
166
+ }
167
+
168
+ export const A2A_DEFAULT_CAPABILITIES: A2ACapabilities = {
169
+ streaming: true,
170
+ pushNotifications: false,
171
+ stateTransitionHistory: false,
172
+ };
173
+
174
+ export const A2A_DEFAULT_INPUT_MODES = ["text", "text/plain"];
175
+ export const A2A_DEFAULT_OUTPUT_MODES = ["text", "text/plain", "text/markdown"];
176
+
177
+ export interface A2AAuthContext {
178
+ authenticated: boolean;
179
+ apiKey?: string;
180
+ tenantId?: string;
181
+ projectId?: string;
182
+ workspaceId?: string;
183
+ source?: "bearer" | "x-api-key";
184
+ }
@@ -16,6 +16,8 @@ export enum AgentType {
16
16
  DEEP_AGENT = "deep_agent",
17
17
  TEAM = "team",
18
18
  PROCESSING = "processing",
19
+ /** Remote A2A agent — delegates to an external A2A-compatible server */
20
+ A2A_REMOTE = "a2a_remote",
19
21
  }
20
22
 
21
23
  /**
@@ -204,6 +206,44 @@ export function isTeamAgentConfig(
204
206
  return config.type === AgentType.TEAM;
205
207
  }
206
208
 
209
+ // ─── A2A_REMOTE Agent ──────────────────────────────────────────────────────
210
+
211
+ /**
212
+ * A2A_REMOTE agent configuration — delegates to an external A2A server.
213
+ *
214
+ * This agent type wraps a remote A2A endpoint so orchestrators can treat
215
+ * external agents the same as local LangGraph agents.
216
+ */
217
+ export interface A2ARemoteAgentConfig extends BaseAgentConfig {
218
+ type: AgentType.A2A_REMOTE;
219
+ /**
220
+ * URL of the remote agent's agent card (e.g. http://host:3000/.well-known/agent-card.json).
221
+ * The builder fetches this card to discover the JSON-RPC endpoint.
222
+ */
223
+ agentCardUrl: string;
224
+ /**
225
+ * Optional API key sent as Bearer token or X-API-Key header.
226
+ */
227
+ apiKey?: string;
228
+ /**
229
+ * HTTP timeout in milliseconds (default: 300_000 = 5 min).
230
+ */
231
+ timeout?: number;
232
+ /**
233
+ * Optional tool keys (not used by the builder, but included for type compatibility).
234
+ */
235
+ tools?: string[];
236
+ }
237
+
238
+ /**
239
+ * Type guard to check if config is A2ARemoteAgentConfig
240
+ */
241
+ export function isA2ARemoteAgentConfig(
242
+ config: AgentConfig
243
+ ): config is A2ARemoteAgentConfig {
244
+ return config.type === AgentType.A2A_REMOTE;
245
+ }
246
+
207
247
  /**
208
248
  * Agent configuration union type
209
249
  * Different agent types have different configuration options
@@ -213,6 +253,7 @@ export type AgentConfig =
213
253
  | DeepAgentConfig
214
254
  | TeamAgentConfig
215
255
  | ProcessingAgentConfig
256
+ | A2ARemoteAgentConfig
216
257
 
217
258
  /**
218
259
  * Agent configuration with tools property
@@ -222,6 +263,7 @@ export type AgentConfigWithTools =
222
263
  | DeepAgentConfig
223
264
  | TeamAgentConfig
224
265
  | ProcessingAgentConfig
266
+ | A2ARemoteAgentConfig
225
267
 
226
268
  /**
227
269
  * Type guard to check if config has tools property
@@ -59,6 +59,8 @@ export interface Project {
59
59
  workspaceId: string;
60
60
  name: string;
61
61
  description?: string;
62
+ /** Application-specific configuration stored as JSON */
63
+ config?: Record<string, unknown>;
62
64
  createdAt: Date;
63
65
  updatedAt: Date;
64
66
  }
@@ -69,14 +71,22 @@ export interface Project {
69
71
  export interface CreateProjectRequest {
70
72
  name: string;
71
73
  description?: string;
74
+ /** Application-specific configuration stored as JSON (optional) */
75
+ config?: Record<string, unknown>;
72
76
  }
73
77
 
74
78
  /**
75
79
  * Update project request type
80
+ *
81
+ * @remarks
82
+ * - The `config` field uses **replace** semantics: if provided, it completely
83
+ * overwrites the existing config. To preserve the current config, omit this field.
76
84
  */
77
85
  export interface UpdateProjectRequest {
78
86
  name?: string;
79
87
  description?: string;
88
+ /** Application-specific configuration stored as JSON (replaces existing if provided) */
89
+ config?: Record<string, unknown>;
80
90
  }
81
91
 
82
92
  /**
package/src/index.ts CHANGED
@@ -34,6 +34,8 @@ export * from "./BindingProtocol";
34
34
  export * from "./EvalStoreProtocol";
35
35
 
36
36
  export * from "./ChannelAdapterProtocol";
37
+ export * from "./A2AProtocol";
38
+ export * from "./A2AApiKeyStoreProtocol";
37
39
 
38
40
  // 导出通用类型
39
41
  export * from "./types";