@flow-a2a/shared 0.1.2 → 0.1.3
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 +40 -0
- package/dist/a2a-types.d.ts +288 -0
- package/dist/a2a-types.js +59 -0
- package/dist/a2a-types.js.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +1 -130
- package/dist/types.js +1 -1
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# @flow-a2a/shared
|
|
2
|
+
|
|
3
|
+
Shared type package for the flow-a2a protocol stack.
|
|
4
|
+
|
|
5
|
+
Used by [`@flow-a2a/plugin`](https://www.npmjs.com/package/@flow-a2a/plugin) and the Lattice API center to guarantee that wire-format types stay in sync. See the [flow-a2a README](https://github.com/FlowGPT/lattice/tree/main/packages/flow-a2a) for the full stack overview.
|
|
6
|
+
|
|
7
|
+
## Contents
|
|
8
|
+
|
|
9
|
+
- **`types.ts`** — WebSocket message types (`ClientMessage` / `ServerMessage`), lobster identity, Feishu mention shape
|
|
10
|
+
- **`pricing.ts`** — per-1M-token pricing for mainstream models (Claude / GPT / DeepSeek / Gemini, etc.), consumed by the cost tracker
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
npm install @flow-a2a/shared
|
|
16
|
+
# or
|
|
17
|
+
bun add @flow-a2a/shared
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import type { ClientMessage, ServerMessage, LobsterIdentity } from '@flow-a2a/shared'
|
|
24
|
+
import { getPricing } from '@flow-a2a/shared'
|
|
25
|
+
|
|
26
|
+
const pricing = getPricing('claude-opus-4-6')
|
|
27
|
+
// { input: 15, output: 75, cacheRead: 0, cacheWrite: 0 } per 1M tokens
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Versioning
|
|
31
|
+
|
|
32
|
+
**The protocol is the contract between plugin and center.** Whenever you change `types.ts`:
|
|
33
|
+
|
|
34
|
+
1. Bump `shared/` — patch for backward-compatible fields, minor/major for breaking changes
|
|
35
|
+
2. Update `plugin/` and `apps/api/src/center/` implementations
|
|
36
|
+
3. Release `shared` and `plugin` together
|
|
37
|
+
|
|
38
|
+
## License
|
|
39
|
+
|
|
40
|
+
MIT
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lattice A2A Protocol · v1 · Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Source of truth: .claude/a2a-protocol.md + .claude/a2a-spec.md
|
|
5
|
+
*
|
|
6
|
+
* All WS frames = JSON-RPC 2.0 Notification:
|
|
7
|
+
* { jsonrpc: "2.0", method: <frame-name>, params: {...} }
|
|
8
|
+
*
|
|
9
|
+
* `params.taskId` correlates multi-frame exchanges (not JSON-RPC id/result).
|
|
10
|
+
*/
|
|
11
|
+
export interface JsonRpcNotification<M extends string = string, P = unknown> {
|
|
12
|
+
jsonrpc: "2.0";
|
|
13
|
+
method: M;
|
|
14
|
+
params: P;
|
|
15
|
+
}
|
|
16
|
+
export type TaskState = "submitted" | "working" | "input-required" | "auth-required" | "completed" | "failed" | "canceled" | "rejected";
|
|
17
|
+
export declare const TERMINAL_STATES: ReadonlySet<TaskState>;
|
|
18
|
+
/** Legal state transitions (a2a-spec.md §2.7 / a2a-protocol.md §4.3). */
|
|
19
|
+
export declare const LEGAL_STATE_TRANSITIONS: ReadonlyMap<TaskState, ReadonlySet<TaskState>>;
|
|
20
|
+
export declare function isTerminal(state: TaskState): boolean;
|
|
21
|
+
export declare function isLegalTransition(from: TaskState, to: TaskState): boolean;
|
|
22
|
+
export interface TextPart {
|
|
23
|
+
kind: "text";
|
|
24
|
+
text: string;
|
|
25
|
+
metadata?: Record<string, unknown>;
|
|
26
|
+
}
|
|
27
|
+
export interface FilePart {
|
|
28
|
+
kind: "file";
|
|
29
|
+
file: {
|
|
30
|
+
uri: string;
|
|
31
|
+
mimeType?: string;
|
|
32
|
+
name?: string;
|
|
33
|
+
};
|
|
34
|
+
metadata?: Record<string, unknown>;
|
|
35
|
+
}
|
|
36
|
+
export interface DataPart {
|
|
37
|
+
kind: "data";
|
|
38
|
+
data: unknown;
|
|
39
|
+
metadata?: Record<string, unknown>;
|
|
40
|
+
}
|
|
41
|
+
/** Lattice extension: reference an artifact produced by another task in the same context. */
|
|
42
|
+
export interface ArtifactRefPart {
|
|
43
|
+
kind: "artifact-ref";
|
|
44
|
+
contextId: string;
|
|
45
|
+
taskId: string;
|
|
46
|
+
artifactId: string;
|
|
47
|
+
metadata?: Record<string, unknown>;
|
|
48
|
+
}
|
|
49
|
+
export type Part = TextPart | FilePart | DataPart | ArtifactRefPart;
|
|
50
|
+
export interface Message {
|
|
51
|
+
kind: "message";
|
|
52
|
+
messageId: string;
|
|
53
|
+
role: "user" | "agent";
|
|
54
|
+
parts: Part[];
|
|
55
|
+
metadata?: Record<string, unknown>;
|
|
56
|
+
}
|
|
57
|
+
export interface Artifact {
|
|
58
|
+
artifactId: string;
|
|
59
|
+
name: string;
|
|
60
|
+
description?: string;
|
|
61
|
+
parts: Part[];
|
|
62
|
+
metadata?: Record<string, unknown>;
|
|
63
|
+
}
|
|
64
|
+
export interface TaskStatus {
|
|
65
|
+
state: TaskState;
|
|
66
|
+
message?: Message;
|
|
67
|
+
/** Optional structured error payload — populated when `state` is `failed` /
|
|
68
|
+
* `rejected` / `canceled` with a reason. Mirrors `a2a.error` params code+message. */
|
|
69
|
+
error?: {
|
|
70
|
+
code: number;
|
|
71
|
+
message: string;
|
|
72
|
+
};
|
|
73
|
+
timestamp: string;
|
|
74
|
+
}
|
|
75
|
+
export interface TaskMetadata {
|
|
76
|
+
"lattice.fromAgent"?: string;
|
|
77
|
+
"lattice.toAgent"?: string;
|
|
78
|
+
"lattice.skillId"?: string;
|
|
79
|
+
"lattice.parentTaskId"?: string | null;
|
|
80
|
+
"lattice.rootTaskId"?: string;
|
|
81
|
+
"lattice.triggeredBy"?: "agent" | "user" | "system";
|
|
82
|
+
"lattice.triggeredByUserId"?: string;
|
|
83
|
+
"lattice.costUsd"?: number;
|
|
84
|
+
"lattice.durationMs"?: number;
|
|
85
|
+
[k: string]: unknown;
|
|
86
|
+
}
|
|
87
|
+
export interface Task {
|
|
88
|
+
id: string;
|
|
89
|
+
contextId: string;
|
|
90
|
+
kind: "task";
|
|
91
|
+
status: TaskStatus;
|
|
92
|
+
artifacts: Artifact[];
|
|
93
|
+
history?: Message[];
|
|
94
|
+
metadata: TaskMetadata;
|
|
95
|
+
}
|
|
96
|
+
export interface Context {
|
|
97
|
+
id: string;
|
|
98
|
+
title?: string;
|
|
99
|
+
rootTaskId: string;
|
|
100
|
+
createdByAgent: string;
|
|
101
|
+
triggeredByUserId?: string | null;
|
|
102
|
+
createdAt: string;
|
|
103
|
+
closedAt?: string | null;
|
|
104
|
+
memberAgents: string[];
|
|
105
|
+
}
|
|
106
|
+
export interface SkillDef {
|
|
107
|
+
id: string;
|
|
108
|
+
name: string;
|
|
109
|
+
description: string;
|
|
110
|
+
tags?: string[];
|
|
111
|
+
examples?: string[];
|
|
112
|
+
}
|
|
113
|
+
export interface AgentCardCapabilities {
|
|
114
|
+
streaming: boolean;
|
|
115
|
+
stateTransitionHistory?: boolean;
|
|
116
|
+
}
|
|
117
|
+
/** Lattice overlay — written by center, never by agent. */
|
|
118
|
+
export interface AgentCardLatticeOverlay {
|
|
119
|
+
team?: string;
|
|
120
|
+
owner?: string;
|
|
121
|
+
lifecycle?: "active" | "retired";
|
|
122
|
+
rateLimit?: {
|
|
123
|
+
rps?: number;
|
|
124
|
+
concurrency?: number;
|
|
125
|
+
};
|
|
126
|
+
costHintUsd?: number;
|
|
127
|
+
}
|
|
128
|
+
export interface AgentCard {
|
|
129
|
+
name: string;
|
|
130
|
+
description: string;
|
|
131
|
+
version: string;
|
|
132
|
+
url?: string;
|
|
133
|
+
capabilities: AgentCardCapabilities;
|
|
134
|
+
defaultInputModes: string[];
|
|
135
|
+
defaultOutputModes: string[];
|
|
136
|
+
skills: SkillDef[];
|
|
137
|
+
lattice?: AgentCardLatticeOverlay;
|
|
138
|
+
}
|
|
139
|
+
export interface DirectoryAgentEntry {
|
|
140
|
+
agentId: string;
|
|
141
|
+
online: boolean;
|
|
142
|
+
lifecycle: "active" | "retired";
|
|
143
|
+
skills: string[];
|
|
144
|
+
}
|
|
145
|
+
export interface DirectorySnapshot {
|
|
146
|
+
version: number;
|
|
147
|
+
agents: DirectoryAgentEntry[];
|
|
148
|
+
}
|
|
149
|
+
export interface RegisterParams {
|
|
150
|
+
agentId: string;
|
|
151
|
+
token?: string;
|
|
152
|
+
meta?: {
|
|
153
|
+
agentId?: string;
|
|
154
|
+
instanceId?: string;
|
|
155
|
+
[k: string]: unknown;
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
export type RegisterFrame = JsonRpcNotification<"register", RegisterParams>;
|
|
159
|
+
export interface RegisteredParams {
|
|
160
|
+
sessionId: string;
|
|
161
|
+
directorySnapshot: DirectorySnapshot;
|
|
162
|
+
}
|
|
163
|
+
export type RegisteredFrame = JsonRpcNotification<"registered", RegisteredParams>;
|
|
164
|
+
export interface PingParams {
|
|
165
|
+
ts: number;
|
|
166
|
+
}
|
|
167
|
+
export type PingFrame = JsonRpcNotification<"ping", PingParams>;
|
|
168
|
+
export interface PongParams {
|
|
169
|
+
ts: number;
|
|
170
|
+
}
|
|
171
|
+
export type PongFrame = JsonRpcNotification<"pong", PongParams>;
|
|
172
|
+
export interface A2ACallParams {
|
|
173
|
+
taskId: string;
|
|
174
|
+
to: string;
|
|
175
|
+
message: Message;
|
|
176
|
+
parentTaskId?: string | null;
|
|
177
|
+
contextId?: string | null;
|
|
178
|
+
skillId?: string;
|
|
179
|
+
metadata?: Record<string, unknown>;
|
|
180
|
+
ts: number;
|
|
181
|
+
}
|
|
182
|
+
export type A2ACallFrame = JsonRpcNotification<"a2a.call", A2ACallParams>;
|
|
183
|
+
export interface A2ACallAckParams {
|
|
184
|
+
taskId: string;
|
|
185
|
+
to: string;
|
|
186
|
+
status: "accepted" | "rejected";
|
|
187
|
+
reason?: string;
|
|
188
|
+
ts: number;
|
|
189
|
+
}
|
|
190
|
+
export type A2ACallAckFrame = JsonRpcNotification<"a2a.call.ack", A2ACallAckParams>;
|
|
191
|
+
export interface A2AProgressParams {
|
|
192
|
+
taskId: string;
|
|
193
|
+
to: string;
|
|
194
|
+
message: Message;
|
|
195
|
+
ts: number;
|
|
196
|
+
}
|
|
197
|
+
export type A2AProgressFrame = JsonRpcNotification<"a2a.progress", A2AProgressParams>;
|
|
198
|
+
export interface A2AResultParams {
|
|
199
|
+
taskId: string;
|
|
200
|
+
to: string;
|
|
201
|
+
status: TaskStatus;
|
|
202
|
+
artifacts?: Artifact[];
|
|
203
|
+
metadata?: Record<string, unknown>;
|
|
204
|
+
ts: number;
|
|
205
|
+
}
|
|
206
|
+
export type A2AResultFrame = JsonRpcNotification<"a2a.result", A2AResultParams>;
|
|
207
|
+
export interface A2ACancelParams {
|
|
208
|
+
taskId: string;
|
|
209
|
+
to: string;
|
|
210
|
+
reason?: string;
|
|
211
|
+
ts: number;
|
|
212
|
+
}
|
|
213
|
+
export type A2ACancelFrame = JsonRpcNotification<"a2a.cancel", A2ACancelParams>;
|
|
214
|
+
export interface A2AErrorParams {
|
|
215
|
+
taskId?: string;
|
|
216
|
+
code: number;
|
|
217
|
+
message: string;
|
|
218
|
+
data?: Record<string, unknown>;
|
|
219
|
+
ts: number;
|
|
220
|
+
}
|
|
221
|
+
export type A2AErrorFrame = JsonRpcNotification<"a2a.error", A2AErrorParams>;
|
|
222
|
+
export interface A2ASkillUpdatedParams {
|
|
223
|
+
agentId: string;
|
|
224
|
+
online: boolean;
|
|
225
|
+
lifecycle: "active" | "retired";
|
|
226
|
+
diff: {
|
|
227
|
+
added: string[];
|
|
228
|
+
removed: string[];
|
|
229
|
+
changed: string[];
|
|
230
|
+
};
|
|
231
|
+
directoryVersion: number;
|
|
232
|
+
ts: number;
|
|
233
|
+
}
|
|
234
|
+
export type A2ASkillUpdatedFrame = JsonRpcNotification<"a2a.skill.updated", A2ASkillUpdatedParams>;
|
|
235
|
+
export interface A2AAgentRetiredParams {
|
|
236
|
+
agentId: string;
|
|
237
|
+
directoryVersion: number;
|
|
238
|
+
ts: number;
|
|
239
|
+
}
|
|
240
|
+
export type A2AAgentRetiredFrame = JsonRpcNotification<"a2a.agent.retired", A2AAgentRetiredParams>;
|
|
241
|
+
export interface A2AEdgeRevokedParams {
|
|
242
|
+
fromAgent: string;
|
|
243
|
+
toAgent: string;
|
|
244
|
+
directoryVersion: number;
|
|
245
|
+
ts: number;
|
|
246
|
+
}
|
|
247
|
+
export type A2AEdgeRevokedFrame = JsonRpcNotification<"a2a.edge.revoked", A2AEdgeRevokedParams>;
|
|
248
|
+
export type ContextEventKind = "task.created" | "task.progress" | "task.completed" | "task.failed" | "task.canceled" | "context.closed";
|
|
249
|
+
export interface A2AContextEventParams {
|
|
250
|
+
contextId: string;
|
|
251
|
+
taskId: string;
|
|
252
|
+
ownerAgent: string;
|
|
253
|
+
kind: ContextEventKind;
|
|
254
|
+
summaryText?: string;
|
|
255
|
+
artifactsAdded?: Array<{
|
|
256
|
+
artifactId: string;
|
|
257
|
+
name: string;
|
|
258
|
+
mimeType?: string;
|
|
259
|
+
}>;
|
|
260
|
+
ts: number;
|
|
261
|
+
}
|
|
262
|
+
export type A2AContextEventFrame = JsonRpcNotification<"a2a.context.event", A2AContextEventParams>;
|
|
263
|
+
export interface A2APolicyUpdatedParams {
|
|
264
|
+
policyVersion: number;
|
|
265
|
+
ts: number;
|
|
266
|
+
}
|
|
267
|
+
export type A2APolicyUpdatedFrame = JsonRpcNotification<"a2a.policy.updated", A2APolicyUpdatedParams>;
|
|
268
|
+
export type A2AFrameMethod = "a2a.call" | "a2a.call.ack" | "a2a.progress" | "a2a.result" | "a2a.cancel" | "a2a.error" | "a2a.skill.updated" | "a2a.agent.retired" | "a2a.edge.revoked" | "a2a.context.event" | "a2a.policy.updated";
|
|
269
|
+
export type A2AFrame = A2ACallFrame | A2ACallAckFrame | A2AProgressFrame | A2AResultFrame | A2ACancelFrame | A2AErrorFrame | A2ASkillUpdatedFrame | A2AAgentRetiredFrame | A2AEdgeRevokedFrame | A2AContextEventFrame | A2APolicyUpdatedFrame;
|
|
270
|
+
export type HandshakeFrame = RegisterFrame | RegisteredFrame | PingFrame | PongFrame;
|
|
271
|
+
export type AnyFrame = HandshakeFrame | A2AFrame;
|
|
272
|
+
export declare const A2A_ERROR: {
|
|
273
|
+
readonly UNAUTHORIZED: -32000;
|
|
274
|
+
readonly FORBIDDEN: -32001;
|
|
275
|
+
readonly AGENT_UNAVAILABLE: -32002;
|
|
276
|
+
readonly AGENT_RETIRED: -32003;
|
|
277
|
+
readonly TOKEN_CARD_MISSING: -32004;
|
|
278
|
+
readonly RATE_LIMITED: -32005;
|
|
279
|
+
readonly CALL_TIMEOUT: -32006;
|
|
280
|
+
readonly INVALID_STATE: -32007;
|
|
281
|
+
readonly INVALID_PARENT: -32008;
|
|
282
|
+
readonly INVALID_CONTEXT: -32009;
|
|
283
|
+
readonly CONTEXT_ACCESS_DENIED: -32010;
|
|
284
|
+
readonly INVALID_FRAME: -32602;
|
|
285
|
+
};
|
|
286
|
+
export type A2AErrorCode = (typeof A2A_ERROR)[keyof typeof A2A_ERROR];
|
|
287
|
+
export declare function isJsonRpcFrame(x: unknown): x is JsonRpcNotification;
|
|
288
|
+
export declare function isA2AMethod(method: string): method is A2AFrameMethod;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lattice A2A Protocol · v1 · Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Source of truth: .claude/a2a-protocol.md + .claude/a2a-spec.md
|
|
5
|
+
*
|
|
6
|
+
* All WS frames = JSON-RPC 2.0 Notification:
|
|
7
|
+
* { jsonrpc: "2.0", method: <frame-name>, params: {...} }
|
|
8
|
+
*
|
|
9
|
+
* `params.taskId` correlates multi-frame exchanges (not JSON-RPC id/result).
|
|
10
|
+
*/
|
|
11
|
+
export const TERMINAL_STATES = new Set([
|
|
12
|
+
"completed",
|
|
13
|
+
"failed",
|
|
14
|
+
"canceled",
|
|
15
|
+
"rejected",
|
|
16
|
+
]);
|
|
17
|
+
/** Legal state transitions (a2a-spec.md §2.7 / a2a-protocol.md §4.3). */
|
|
18
|
+
export const LEGAL_STATE_TRANSITIONS = new Map([
|
|
19
|
+
["submitted", new Set(["working", "failed", "rejected", "canceled"])],
|
|
20
|
+
["working", new Set(["completed", "failed", "canceled", "input-required", "auth-required"])],
|
|
21
|
+
["input-required", new Set(["working", "canceled", "failed"])],
|
|
22
|
+
["auth-required", new Set(["working", "canceled", "failed"])],
|
|
23
|
+
["completed", new Set()],
|
|
24
|
+
["failed", new Set()],
|
|
25
|
+
["canceled", new Set()],
|
|
26
|
+
["rejected", new Set()],
|
|
27
|
+
]);
|
|
28
|
+
export function isTerminal(state) {
|
|
29
|
+
return TERMINAL_STATES.has(state);
|
|
30
|
+
}
|
|
31
|
+
export function isLegalTransition(from, to) {
|
|
32
|
+
return LEGAL_STATE_TRANSITIONS.get(from)?.has(to) ?? false;
|
|
33
|
+
}
|
|
34
|
+
// ─── Error Codes (a2a-protocol.md §7 / a2a-spec.md §2.6) ────────────────────
|
|
35
|
+
export const A2A_ERROR = {
|
|
36
|
+
UNAUTHORIZED: -32000,
|
|
37
|
+
FORBIDDEN: -32001, // aka NO_EDGE / ROLE_VIOLATION / SKILL_NOT_ALLOWED
|
|
38
|
+
AGENT_UNAVAILABLE: -32002,
|
|
39
|
+
AGENT_RETIRED: -32003,
|
|
40
|
+
TOKEN_CARD_MISSING: -32004, // also: TASK_NOT_FOUND (REST)
|
|
41
|
+
RATE_LIMITED: -32005, // aka ACCEPT_TIMEOUT when data.reason="accept_timeout"
|
|
42
|
+
CALL_TIMEOUT: -32006,
|
|
43
|
+
INVALID_STATE: -32007,
|
|
44
|
+
INVALID_PARENT: -32008,
|
|
45
|
+
INVALID_CONTEXT: -32009,
|
|
46
|
+
CONTEXT_ACCESS_DENIED: -32010,
|
|
47
|
+
INVALID_FRAME: -32602,
|
|
48
|
+
};
|
|
49
|
+
// ─── Convenience type guards ────────────────────────────────────────────────
|
|
50
|
+
export function isJsonRpcFrame(x) {
|
|
51
|
+
return typeof x === "object" && x !== null
|
|
52
|
+
&& x.jsonrpc === "2.0"
|
|
53
|
+
&& typeof x.method === "string"
|
|
54
|
+
&& typeof x.params === "object";
|
|
55
|
+
}
|
|
56
|
+
export function isA2AMethod(method) {
|
|
57
|
+
return method.startsWith("a2a.");
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=a2a-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"a2a-types.js","sourceRoot":"","sources":["../src/a2a-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAsBH,MAAM,CAAC,MAAM,eAAe,GAA2B,IAAI,GAAG,CAAY;IACxE,WAAW;IACX,QAAQ;IACR,UAAU;IACV,UAAU;CACX,CAAC,CAAC;AAEH,yEAAyE;AACzE,MAAM,CAAC,MAAM,uBAAuB,GAAmD,IAAI,GAAG,CAAC;IAC7F,CAAC,WAAW,EAAE,IAAI,GAAG,CAAY,CAAC,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;IAChF,CAAC,SAAS,EAAE,IAAI,GAAG,CAAY,CAAC,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,gBAAgB,EAAE,eAAe,CAAC,CAAC,CAAC;IACvG,CAAC,gBAAgB,EAAE,IAAI,GAAG,CAAY,CAAC,SAAS,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;IACzE,CAAC,eAAe,EAAE,IAAI,GAAG,CAAY,CAAC,SAAS,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;IACxE,CAAC,WAAW,EAAE,IAAI,GAAG,EAAa,CAAC;IACnC,CAAC,QAAQ,EAAE,IAAI,GAAG,EAAa,CAAC;IAChC,CAAC,UAAU,EAAE,IAAI,GAAG,EAAa,CAAC;IAClC,CAAC,UAAU,EAAE,IAAI,GAAG,EAAa,CAAC;CACnC,CAAC,CAAC;AAEH,MAAM,UAAU,UAAU,CAAC,KAAgB;IACzC,OAAO,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,IAAe,EAAE,EAAa;IAC9D,OAAO,uBAAuB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,IAAI,KAAK,CAAC;AAC7D,CAAC;AAsUD,+EAA+E;AAE/E,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,YAAY,EAAW,CAAC,KAAK;IAC7B,SAAS,EAAc,CAAC,KAAK,EAAE,mDAAmD;IAClF,iBAAiB,EAAM,CAAC,KAAK;IAC7B,aAAa,EAAU,CAAC,KAAK;IAC7B,kBAAkB,EAAK,CAAC,KAAK,EAAE,8BAA8B;IAC7D,YAAY,EAAW,CAAC,KAAK,EAAE,uDAAuD;IACtF,YAAY,EAAW,CAAC,KAAK;IAC7B,aAAa,EAAU,CAAC,KAAK;IAC7B,cAAc,EAAS,CAAC,KAAK;IAC7B,eAAe,EAAQ,CAAC,KAAK;IAC7B,qBAAqB,EAAE,CAAC,KAAK;IAC7B,aAAa,EAAU,CAAC,KAAK;CACrB,CAAC;AAIX,+EAA+E;AAE/E,MAAM,UAAU,cAAc,CAAC,CAAU;IACvC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI;WACpC,CAAS,CAAC,OAAO,KAAK,KAAK;WAC5B,OAAQ,CAAS,CAAC,MAAM,KAAK,QAAQ;WACrC,OAAQ,CAAS,CAAC,MAAM,KAAK,QAAQ,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,MAAc;IACxC,OAAO,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;AACnC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
export type {
|
|
1
|
+
export type { TelemetryRecord, TriggerUserInfo, Recommendation, } from "./types.js";
|
|
2
2
|
export { MODEL_PRICING, MODEL_ALIASES, computeCost, type ModelPrice, type CostSource, type CostResult, } from "./pricing.js";
|
|
3
|
+
export { TERMINAL_STATES, LEGAL_STATE_TRANSITIONS, isTerminal, isLegalTransition, A2A_ERROR, isJsonRpcFrame, isA2AMethod, } from "./a2a-types.js";
|
|
4
|
+
export type { JsonRpcNotification, TaskState, TextPart, FilePart, DataPart, ArtifactRefPart, Part, Message, Artifact, TaskStatus, TaskMetadata, Task, Context, SkillDef, AgentCardCapabilities, AgentCardLatticeOverlay, AgentCard, DirectoryAgentEntry, DirectorySnapshot, RegisterParams, RegisterFrame, RegisteredParams, RegisteredFrame, PingParams, PingFrame, PongParams, PongFrame, HandshakeFrame, A2ACallParams, A2ACallFrame, A2ACallAckParams, A2ACallAckFrame, A2AProgressParams, A2AProgressFrame, A2AResultParams, A2AResultFrame, A2ACancelParams, A2ACancelFrame, A2AErrorParams, A2AErrorFrame, A2ASkillUpdatedParams, A2ASkillUpdatedFrame, A2AAgentRetiredParams, A2AAgentRetiredFrame, A2AEdgeRevokedParams, A2AEdgeRevokedFrame, ContextEventKind, A2AContextEventParams, A2AContextEventFrame, A2APolicyUpdatedParams, A2APolicyUpdatedFrame, A2AFrameMethod, A2AFrame, AnyFrame, A2AErrorCode, } from "./a2a-types.js";
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export { MODEL_PRICING, MODEL_ALIASES, computeCost, } from "./pricing.js";
|
|
2
|
+
// ─── A2A Protocol v1 ────────────────────────────────────────────────────────
|
|
3
|
+
export { TERMINAL_STATES, LEGAL_STATE_TRANSITIONS, isTerminal, isLegalTransition, A2A_ERROR, isJsonRpcFrame, isA2AMethod, } from "./a2a-types.js";
|
|
2
4
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,aAAa,EACb,aAAa,EACb,WAAW,GAIZ,MAAM,cAAc,CAAC;AAEtB,+EAA+E;AAE/E,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,UAAU,EACV,iBAAiB,EACjB,SAAS,EACT,cAAc,EACd,WAAW,GACZ,MAAM,gBAAgB,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,108 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Flow-A2A — Shared Protocol Types
|
|
3
3
|
*
|
|
4
|
-
* Extends reef's protocol with telemetry message types.
|
|
5
4
|
* Used by plugin (client), center (server), and shared tooling.
|
|
5
|
+
* All WS communication uses JSON-RPC 2.0 framing (see a2a-types.ts).
|
|
6
6
|
*/
|
|
7
|
-
export interface LobsterIdentity {
|
|
8
|
-
lobsterId: string;
|
|
9
|
-
name: string;
|
|
10
|
-
botOpenId?: string;
|
|
11
|
-
groups?: string[];
|
|
12
|
-
meta?: Record<string, unknown>;
|
|
13
|
-
}
|
|
14
|
-
export interface LobsterInfo {
|
|
15
|
-
id: string;
|
|
16
|
-
name: string;
|
|
17
|
-
botOpenId?: string;
|
|
18
|
-
groups: string[];
|
|
19
|
-
connectedAt: number;
|
|
20
|
-
meta?: Record<string, unknown>;
|
|
21
|
-
}
|
|
22
|
-
export interface MentionTarget {
|
|
23
|
-
name: string;
|
|
24
|
-
openId?: string;
|
|
25
|
-
}
|
|
26
|
-
export type ClientMessage = ({
|
|
27
|
-
type: "register";
|
|
28
|
-
token?: string;
|
|
29
|
-
} & LobsterIdentity) | {
|
|
30
|
-
type: "lobby";
|
|
31
|
-
text: string;
|
|
32
|
-
} | {
|
|
33
|
-
type: "dm";
|
|
34
|
-
to: string;
|
|
35
|
-
text: string;
|
|
36
|
-
} | {
|
|
37
|
-
type: "feishu";
|
|
38
|
-
chatId: string;
|
|
39
|
-
text: string;
|
|
40
|
-
messageId?: string;
|
|
41
|
-
threadId?: string;
|
|
42
|
-
mentions?: MentionTarget[];
|
|
43
|
-
} | {
|
|
44
|
-
type: "history";
|
|
45
|
-
} | {
|
|
46
|
-
type: "ping";
|
|
47
|
-
} | {
|
|
48
|
-
type: "who";
|
|
49
|
-
} | {
|
|
50
|
-
type: "telemetry";
|
|
51
|
-
batch: TelemetryRecord[];
|
|
52
|
-
};
|
|
53
|
-
export type ServerMessage = {
|
|
54
|
-
type: "registered";
|
|
55
|
-
lobsterId: string;
|
|
56
|
-
lobsters: LobsterInfo[];
|
|
57
|
-
} | {
|
|
58
|
-
type: "lobby";
|
|
59
|
-
from: string;
|
|
60
|
-
fromName: string;
|
|
61
|
-
text: string;
|
|
62
|
-
ts: number;
|
|
63
|
-
} | {
|
|
64
|
-
type: "dm";
|
|
65
|
-
from: string;
|
|
66
|
-
fromName: string;
|
|
67
|
-
text: string;
|
|
68
|
-
ts: number;
|
|
69
|
-
echo?: boolean;
|
|
70
|
-
} | {
|
|
71
|
-
type: "feishu";
|
|
72
|
-
from: string;
|
|
73
|
-
fromName: string;
|
|
74
|
-
fromBotOpenId: string;
|
|
75
|
-
chatId: string;
|
|
76
|
-
text: string;
|
|
77
|
-
messageId: string;
|
|
78
|
-
threadId?: string;
|
|
79
|
-
ts: number;
|
|
80
|
-
} | {
|
|
81
|
-
type: "join";
|
|
82
|
-
lobsterId: string;
|
|
83
|
-
name: string;
|
|
84
|
-
ts: number;
|
|
85
|
-
} | {
|
|
86
|
-
type: "leave";
|
|
87
|
-
lobsterId: string;
|
|
88
|
-
name: string;
|
|
89
|
-
ts: number;
|
|
90
|
-
} | {
|
|
91
|
-
type: "history";
|
|
92
|
-
messages: ServerMessage[];
|
|
93
|
-
} | {
|
|
94
|
-
type: "who";
|
|
95
|
-
lobsters: LobsterInfo[];
|
|
96
|
-
} | {
|
|
97
|
-
type: "pong";
|
|
98
|
-
} | {
|
|
99
|
-
type: "error";
|
|
100
|
-
message: string;
|
|
101
|
-
} | {
|
|
102
|
-
type: "telemetry_ack";
|
|
103
|
-
accepted: number;
|
|
104
|
-
errors?: string[];
|
|
105
|
-
};
|
|
106
7
|
export interface TelemetryRecord {
|
|
107
8
|
kind: "llm" | "tool";
|
|
108
9
|
ts: number;
|
|
@@ -145,33 +46,3 @@ export interface Recommendation {
|
|
|
145
46
|
estimatedSavingsUsd: number | null;
|
|
146
47
|
confidence: "high" | "medium" | "low";
|
|
147
48
|
}
|
|
148
|
-
export interface LobbyAdapter {
|
|
149
|
-
onLobbyMessage?(msg: {
|
|
150
|
-
from: string;
|
|
151
|
-
fromName: string;
|
|
152
|
-
text: string;
|
|
153
|
-
ts: number;
|
|
154
|
-
}): void;
|
|
155
|
-
onDirectMessage?(msg: {
|
|
156
|
-
from: string;
|
|
157
|
-
fromName: string;
|
|
158
|
-
text: string;
|
|
159
|
-
ts: number;
|
|
160
|
-
}): void;
|
|
161
|
-
onFeishuRelay?(msg: {
|
|
162
|
-
from: string;
|
|
163
|
-
fromName: string;
|
|
164
|
-
fromBotOpenId: string;
|
|
165
|
-
chatId: string;
|
|
166
|
-
text: string;
|
|
167
|
-
messageId: string;
|
|
168
|
-
threadId?: string;
|
|
169
|
-
ts: number;
|
|
170
|
-
}): void;
|
|
171
|
-
onPresence?(msg: {
|
|
172
|
-
type: "join" | "leave";
|
|
173
|
-
lobsterId: string;
|
|
174
|
-
name: string;
|
|
175
|
-
}): void;
|
|
176
|
-
onHistory?(messages: ServerMessage[]): void;
|
|
177
|
-
}
|
package/dist/types.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Flow-A2A — Shared Protocol Types
|
|
3
3
|
*
|
|
4
|
-
* Extends reef's protocol with telemetry message types.
|
|
5
4
|
* Used by plugin (client), center (server), and shared tooling.
|
|
5
|
+
* All WS communication uses JSON-RPC 2.0 framing (see a2a-types.ts).
|
|
6
6
|
*/
|
|
7
7
|
export {};
|
|
8
8
|
//# sourceMappingURL=types.js.map
|