@flow-a2a/shared 0.1.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/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/pricing.d.ts +17 -0
- package/dist/pricing.js +88 -0
- package/dist/pricing.js.map +1 -0
- package/dist/types.d.ts +168 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/package.json +41 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export type { LobsterIdentity, LobsterInfo, MentionTarget, ClientMessage, ServerMessage, TelemetryRecord, TriggerUserInfo, LobbyAdapter, } from "./types.js";
|
|
2
|
+
export { MODEL_PRICING, MODEL_ALIASES, computeCost, type ModelPrice, type CostSource, type CostResult, } from "./pricing.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,aAAa,EACb,aAAa,EACb,WAAW,GAIZ,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flow-A2A — Model Pricing Table & Cost Calculator
|
|
3
|
+
*
|
|
4
|
+
* Reused from costclaw-telemetry with no modifications.
|
|
5
|
+
*/
|
|
6
|
+
export interface ModelPrice {
|
|
7
|
+
inputPer1M: number;
|
|
8
|
+
outputPer1M: number;
|
|
9
|
+
}
|
|
10
|
+
export declare const MODEL_PRICING: Record<string, ModelPrice>;
|
|
11
|
+
export declare const MODEL_ALIASES: Array<[string, string]>;
|
|
12
|
+
export type CostSource = "telemetry" | "calculated" | "estimated";
|
|
13
|
+
export interface CostResult {
|
|
14
|
+
costUsd: number;
|
|
15
|
+
source: CostSource;
|
|
16
|
+
}
|
|
17
|
+
export declare function computeCost(model: string, inputTokens: number, outputTokens: number, telemetryCostUsd?: number): CostResult;
|
package/dist/pricing.js
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flow-A2A — Model Pricing Table & Cost Calculator
|
|
3
|
+
*
|
|
4
|
+
* Reused from costclaw-telemetry with no modifications.
|
|
5
|
+
*/
|
|
6
|
+
// Prices as of March 2026 — update entries as needed
|
|
7
|
+
export const MODEL_PRICING = {
|
|
8
|
+
// OpenAI
|
|
9
|
+
"gpt-4o": { inputPer1M: 2.50, outputPer1M: 10.00 },
|
|
10
|
+
"gpt-4o-2024-11-20": { inputPer1M: 2.50, outputPer1M: 10.00 },
|
|
11
|
+
"gpt-4o-mini": { inputPer1M: 0.15, outputPer1M: 0.60 },
|
|
12
|
+
"gpt-4o-mini-2024-07-18": { inputPer1M: 0.15, outputPer1M: 0.60 },
|
|
13
|
+
"gpt-4-turbo": { inputPer1M: 10.00, outputPer1M: 30.00 },
|
|
14
|
+
"gpt-4": { inputPer1M: 30.00, outputPer1M: 60.00 },
|
|
15
|
+
"gpt-3.5-turbo": { inputPer1M: 0.50, outputPer1M: 1.50 },
|
|
16
|
+
"o1": { inputPer1M: 15.00, outputPer1M: 60.00 },
|
|
17
|
+
"o1-mini": { inputPer1M: 3.00, outputPer1M: 12.00 },
|
|
18
|
+
"o3": { inputPer1M: 10.00, outputPer1M: 40.00 },
|
|
19
|
+
"o3-mini": { inputPer1M: 1.10, outputPer1M: 4.40 },
|
|
20
|
+
"o4-mini": { inputPer1M: 1.10, outputPer1M: 4.40 },
|
|
21
|
+
// Anthropic Claude
|
|
22
|
+
"claude-3-5-sonnet-20241022": { inputPer1M: 3.00, outputPer1M: 15.00 },
|
|
23
|
+
"claude-3-5-sonnet-20240620": { inputPer1M: 3.00, outputPer1M: 15.00 },
|
|
24
|
+
"claude-3-5-haiku-20241022": { inputPer1M: 0.80, outputPer1M: 4.00 },
|
|
25
|
+
"claude-3-opus-20240229": { inputPer1M: 15.00, outputPer1M: 75.00 },
|
|
26
|
+
"claude-3-sonnet-20240229": { inputPer1M: 3.00, outputPer1M: 15.00 },
|
|
27
|
+
"claude-3-haiku-20240307": { inputPer1M: 0.25, outputPer1M: 1.25 },
|
|
28
|
+
"claude-sonnet-4-6": { inputPer1M: 3.00, outputPer1M: 15.00 },
|
|
29
|
+
"claude-opus-4-6": { inputPer1M: 15.00, outputPer1M: 75.00 },
|
|
30
|
+
"claude-haiku-4-5": { inputPer1M: 0.80, outputPer1M: 4.00 },
|
|
31
|
+
// Google Gemini
|
|
32
|
+
"gemini-2.5-pro": { inputPer1M: 1.25, outputPer1M: 10.00 },
|
|
33
|
+
"gemini-2.5-flash": { inputPer1M: 0.30, outputPer1M: 2.50 },
|
|
34
|
+
"gemini-2.5-flash-lite": { inputPer1M: 0.10, outputPer1M: 0.40 },
|
|
35
|
+
"gemini-2.0-flash": { inputPer1M: 0.10, outputPer1M: 0.40 },
|
|
36
|
+
"gemini-1.5-pro": { inputPer1M: 1.25, outputPer1M: 5.00 },
|
|
37
|
+
"gemini-1.5-flash": { inputPer1M: 0.075, outputPer1M: 0.30 },
|
|
38
|
+
// xAI Grok
|
|
39
|
+
"grok-2": { inputPer1M: 2.00, outputPer1M: 10.00 },
|
|
40
|
+
"grok-2-mini": { inputPer1M: 0.20, outputPer1M: 0.40 },
|
|
41
|
+
"grok-3": { inputPer1M: 3.00, outputPer1M: 15.00 },
|
|
42
|
+
// Meta Llama (via API providers — prices vary, these are common averages)
|
|
43
|
+
"llama-3.1-405b-instruct": { inputPer1M: 3.00, outputPer1M: 3.00 },
|
|
44
|
+
"llama-3.1-70b-instruct": { inputPer1M: 0.52, outputPer1M: 0.75 },
|
|
45
|
+
"llama-3.1-8b-instruct": { inputPer1M: 0.05, outputPer1M: 0.08 },
|
|
46
|
+
"llama-3.3-70b-instruct": { inputPer1M: 0.23, outputPer1M: 0.40 },
|
|
47
|
+
};
|
|
48
|
+
// Canonical aliases for prefix matching (longest match wins)
|
|
49
|
+
export const MODEL_ALIASES = [
|
|
50
|
+
["claude-3-5-sonnet", "claude-3-5-sonnet-20241022"],
|
|
51
|
+
["claude-3-5-haiku", "claude-3-5-haiku-20241022"],
|
|
52
|
+
["claude-3-opus", "claude-3-opus-20240229"],
|
|
53
|
+
["claude-3-sonnet", "claude-3-sonnet-20240229"],
|
|
54
|
+
["claude-3-haiku", "claude-3-haiku-20240307"],
|
|
55
|
+
["gpt-4o-mini", "gpt-4o-mini"],
|
|
56
|
+
["gpt-4o", "gpt-4o"],
|
|
57
|
+
["gr-claude-opus", "claude-opus-4-6"],
|
|
58
|
+
["gr-claude-sonnet", "claude-sonnet-4-6"],
|
|
59
|
+
];
|
|
60
|
+
function resolveModel(raw) {
|
|
61
|
+
const lower = raw.toLowerCase().trim();
|
|
62
|
+
if (MODEL_PRICING[lower])
|
|
63
|
+
return lower;
|
|
64
|
+
for (const [alias, canonical] of MODEL_ALIASES) {
|
|
65
|
+
if (lower.startsWith(alias))
|
|
66
|
+
return canonical;
|
|
67
|
+
}
|
|
68
|
+
const keys = Object.keys(MODEL_PRICING).sort((a, b) => b.length - a.length);
|
|
69
|
+
for (const key of keys) {
|
|
70
|
+
if (lower.startsWith(key) || key.startsWith(lower))
|
|
71
|
+
return key;
|
|
72
|
+
}
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
export function computeCost(model, inputTokens, outputTokens, telemetryCostUsd) {
|
|
76
|
+
if (telemetryCostUsd != null && telemetryCostUsd > 0) {
|
|
77
|
+
return { costUsd: telemetryCostUsd, source: "telemetry" };
|
|
78
|
+
}
|
|
79
|
+
const resolved = resolveModel(model);
|
|
80
|
+
if (!resolved) {
|
|
81
|
+
return { costUsd: 0, source: "estimated" };
|
|
82
|
+
}
|
|
83
|
+
const price = MODEL_PRICING[resolved];
|
|
84
|
+
const costUsd = (inputTokens / 1_000_000) * price.inputPer1M +
|
|
85
|
+
(outputTokens / 1_000_000) * price.outputPer1M;
|
|
86
|
+
return { costUsd, source: "calculated" };
|
|
87
|
+
}
|
|
88
|
+
//# s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AAM,CAAC,CAAC;IAC5E,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC;YAAE,OAAO,GAAG,CAAC;IACjE,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,WAAW,CACzB,KAAa,EACb,WAAmB,EACnB,YAAoB,EACpB,gBAAyB;IAEzB,IAAI,gBAAgB,IAAI,IAAI,IAAI,gBAAgB,GAAG,CAAC,EAAE,CAAC;QACrD,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;IAC5D,CAAC;IAED,MAAM,QAAQ,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IACrC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;IAC7C,CAAC;IAED,MAAM,KAAK,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAC;IACtC,MAAM,OAAO,GACX,CAAC,WAAW,GAAG,SAAS,CAAC,GAAG,KAAK,CAAC,UAAU;QAC5C,CAAC,YAAY,GAAG,SAAS,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC;IAEjD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC;AAC3C,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flow-A2A — Shared Protocol Types
|
|
3
|
+
*
|
|
4
|
+
* Extends reef's protocol with telemetry message types.
|
|
5
|
+
* Used by plugin (client), center (server), and shared tooling.
|
|
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
|
+
export interface TelemetryRecord {
|
|
107
|
+
kind: "llm" | "tool";
|
|
108
|
+
ts: number;
|
|
109
|
+
sessionKey?: string;
|
|
110
|
+
agentId?: string;
|
|
111
|
+
triggerUser?: string;
|
|
112
|
+
triggerUserId?: string;
|
|
113
|
+
triggerSource?: string;
|
|
114
|
+
channel?: string;
|
|
115
|
+
scope?: string;
|
|
116
|
+
conversationId?: string;
|
|
117
|
+
conversationName?: string;
|
|
118
|
+
model?: string;
|
|
119
|
+
inputTokens?: number;
|
|
120
|
+
outputTokens?: number;
|
|
121
|
+
costUsd?: number;
|
|
122
|
+
costSource?: string;
|
|
123
|
+
trigger?: string;
|
|
124
|
+
isSubagent?: boolean;
|
|
125
|
+
toolName?: string;
|
|
126
|
+
success?: boolean;
|
|
127
|
+
durationMs?: number;
|
|
128
|
+
}
|
|
129
|
+
export interface TriggerUserInfo {
|
|
130
|
+
triggerUser: string;
|
|
131
|
+
triggerUserId: string;
|
|
132
|
+
triggerSource: string;
|
|
133
|
+
channel?: string;
|
|
134
|
+
scope?: string;
|
|
135
|
+
conversationId?: string;
|
|
136
|
+
conversationName?: string;
|
|
137
|
+
ts: number;
|
|
138
|
+
}
|
|
139
|
+
export interface LobbyAdapter {
|
|
140
|
+
onLobbyMessage?(msg: {
|
|
141
|
+
from: string;
|
|
142
|
+
fromName: string;
|
|
143
|
+
text: string;
|
|
144
|
+
ts: number;
|
|
145
|
+
}): void;
|
|
146
|
+
onDirectMessage?(msg: {
|
|
147
|
+
from: string;
|
|
148
|
+
fromName: string;
|
|
149
|
+
text: string;
|
|
150
|
+
ts: number;
|
|
151
|
+
}): void;
|
|
152
|
+
onFeishuRelay?(msg: {
|
|
153
|
+
from: string;
|
|
154
|
+
fromName: string;
|
|
155
|
+
fromBotOpenId: string;
|
|
156
|
+
chatId: string;
|
|
157
|
+
text: string;
|
|
158
|
+
messageId: string;
|
|
159
|
+
threadId?: string;
|
|
160
|
+
ts: number;
|
|
161
|
+
}): void;
|
|
162
|
+
onPresence?(msg: {
|
|
163
|
+
type: "join" | "leave";
|
|
164
|
+
lobsterId: string;
|
|
165
|
+
name: string;
|
|
166
|
+
}): void;
|
|
167
|
+
onHistory?(messages: ServerMessage[]): void;
|
|
168
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@flow-a2a/shared",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Shared types, protocol definitions, and pricing logic for Flow-A2A",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/nicepkg/flow-a2a.git",
|
|
21
|
+
"directory": "packages/shared"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://github.com/nicepkg/flow-a2a#readme",
|
|
24
|
+
"keywords": [
|
|
25
|
+
"flow-a2a",
|
|
26
|
+
"a2a",
|
|
27
|
+
"agent-to-agent",
|
|
28
|
+
"llm",
|
|
29
|
+
"cost-tracking",
|
|
30
|
+
"openclaw"
|
|
31
|
+
],
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "tsc"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"typescript": "^5.7.0"
|
|
40
|
+
}
|
|
41
|
+
}
|