@f2a/network 0.1.2

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.
Files changed (234) hide show
  1. package/.github/workflows/ci.yml +113 -0
  2. package/.github/workflows/publish.yml +60 -0
  3. package/LICENSE +21 -0
  4. package/MONOREPO.md +58 -0
  5. package/README.md +280 -0
  6. package/SKILL.md +137 -0
  7. package/dist/adapters/openclaw.d.ts +103 -0
  8. package/dist/adapters/openclaw.d.ts.map +1 -0
  9. package/dist/adapters/openclaw.js +297 -0
  10. package/dist/adapters/openclaw.js.map +1 -0
  11. package/dist/cli/commands.d.ts +17 -0
  12. package/dist/cli/commands.d.ts.map +1 -0
  13. package/dist/cli/commands.js +107 -0
  14. package/dist/cli/commands.js.map +1 -0
  15. package/dist/cli/index.d.ts +6 -0
  16. package/dist/cli/index.d.ts.map +1 -0
  17. package/dist/cli/index.js +203 -0
  18. package/dist/cli/index.js.map +1 -0
  19. package/dist/core/autonomous-economy.d.ts +136 -0
  20. package/dist/core/autonomous-economy.d.ts.map +1 -0
  21. package/dist/core/autonomous-economy.js +255 -0
  22. package/dist/core/autonomous-economy.js.map +1 -0
  23. package/dist/core/connection-manager.d.ts +80 -0
  24. package/dist/core/connection-manager.d.ts.map +1 -0
  25. package/dist/core/connection-manager.js +235 -0
  26. package/dist/core/connection-manager.js.map +1 -0
  27. package/dist/core/connection-manager.test.d.ts +2 -0
  28. package/dist/core/connection-manager.test.d.ts.map +1 -0
  29. package/dist/core/connection-manager.test.js +52 -0
  30. package/dist/core/connection-manager.test.js.map +1 -0
  31. package/dist/core/e2ee-crypto.d.ts +90 -0
  32. package/dist/core/e2ee-crypto.d.ts.map +1 -0
  33. package/dist/core/e2ee-crypto.js +190 -0
  34. package/dist/core/e2ee-crypto.js.map +1 -0
  35. package/dist/core/f2a.d.ts +126 -0
  36. package/dist/core/f2a.d.ts.map +1 -0
  37. package/dist/core/f2a.js +425 -0
  38. package/dist/core/f2a.js.map +1 -0
  39. package/dist/core/identity.d.ts +47 -0
  40. package/dist/core/identity.d.ts.map +1 -0
  41. package/dist/core/identity.js +130 -0
  42. package/dist/core/identity.js.map +1 -0
  43. package/dist/core/identity.test.d.ts +2 -0
  44. package/dist/core/identity.test.d.ts.map +1 -0
  45. package/dist/core/identity.test.js +43 -0
  46. package/dist/core/identity.test.js.map +1 -0
  47. package/dist/core/p2p-network.d.ts +242 -0
  48. package/dist/core/p2p-network.d.ts.map +1 -0
  49. package/dist/core/p2p-network.js +1182 -0
  50. package/dist/core/p2p-network.js.map +1 -0
  51. package/dist/core/reputation-security.d.ts +168 -0
  52. package/dist/core/reputation-security.d.ts.map +1 -0
  53. package/dist/core/reputation-security.js +369 -0
  54. package/dist/core/reputation-security.js.map +1 -0
  55. package/dist/core/reputation.d.ts +179 -0
  56. package/dist/core/reputation.d.ts.map +1 -0
  57. package/dist/core/reputation.js +472 -0
  58. package/dist/core/reputation.js.map +1 -0
  59. package/dist/core/review-committee.d.ts +130 -0
  60. package/dist/core/review-committee.d.ts.map +1 -0
  61. package/dist/core/review-committee.js +251 -0
  62. package/dist/core/review-committee.js.map +1 -0
  63. package/dist/core/serverless.d.ts +155 -0
  64. package/dist/core/serverless.d.ts.map +1 -0
  65. package/dist/core/serverless.js +615 -0
  66. package/dist/core/serverless.js.map +1 -0
  67. package/dist/core/token-manager.d.ts +42 -0
  68. package/dist/core/token-manager.d.ts.map +1 -0
  69. package/dist/core/token-manager.js +122 -0
  70. package/dist/core/token-manager.js.map +1 -0
  71. package/dist/daemon/control-server.d.ts +55 -0
  72. package/dist/daemon/control-server.d.ts.map +1 -0
  73. package/dist/daemon/control-server.js +262 -0
  74. package/dist/daemon/control-server.js.map +1 -0
  75. package/dist/daemon/index.d.ts +35 -0
  76. package/dist/daemon/index.d.ts.map +1 -0
  77. package/dist/daemon/index.js +69 -0
  78. package/dist/daemon/index.js.map +1 -0
  79. package/dist/daemon/main.d.ts +6 -0
  80. package/dist/daemon/main.d.ts.map +1 -0
  81. package/dist/daemon/main.js +38 -0
  82. package/dist/daemon/main.js.map +1 -0
  83. package/dist/daemon/start.d.ts +6 -0
  84. package/dist/daemon/start.d.ts.map +1 -0
  85. package/dist/daemon/start.js +25 -0
  86. package/dist/daemon/start.js.map +1 -0
  87. package/dist/daemon/webhook.d.ts +30 -0
  88. package/dist/daemon/webhook.d.ts.map +1 -0
  89. package/dist/daemon/webhook.js +86 -0
  90. package/dist/daemon/webhook.js.map +1 -0
  91. package/dist/daemon/webhook.test.d.ts +2 -0
  92. package/dist/daemon/webhook.test.d.ts.map +1 -0
  93. package/dist/daemon/webhook.test.js +24 -0
  94. package/dist/daemon/webhook.test.js.map +1 -0
  95. package/dist/index.d.ts +24 -0
  96. package/dist/index.d.ts.map +1 -0
  97. package/dist/index.js +25 -0
  98. package/dist/index.js.map +1 -0
  99. package/dist/protocol/messages.d.ts +739 -0
  100. package/dist/protocol/messages.d.ts.map +1 -0
  101. package/dist/protocol/messages.js +188 -0
  102. package/dist/protocol/messages.js.map +1 -0
  103. package/dist/protocol/messages.test.d.ts +2 -0
  104. package/dist/protocol/messages.test.d.ts.map +1 -0
  105. package/dist/protocol/messages.test.js +55 -0
  106. package/dist/protocol/messages.test.js.map +1 -0
  107. package/dist/types/index.d.ts +247 -0
  108. package/dist/types/index.d.ts.map +1 -0
  109. package/dist/types/index.js +10 -0
  110. package/dist/types/index.js.map +1 -0
  111. package/dist/types/result.d.ts +28 -0
  112. package/dist/types/result.d.ts.map +1 -0
  113. package/dist/types/result.js +16 -0
  114. package/dist/types/result.js.map +1 -0
  115. package/dist/utils/benchmark.d.ts +67 -0
  116. package/dist/utils/benchmark.d.ts.map +1 -0
  117. package/dist/utils/benchmark.js +179 -0
  118. package/dist/utils/benchmark.js.map +1 -0
  119. package/dist/utils/logger.d.ts +105 -0
  120. package/dist/utils/logger.d.ts.map +1 -0
  121. package/dist/utils/logger.js +275 -0
  122. package/dist/utils/logger.js.map +1 -0
  123. package/dist/utils/middleware.d.ts +85 -0
  124. package/dist/utils/middleware.d.ts.map +1 -0
  125. package/dist/utils/middleware.js +173 -0
  126. package/dist/utils/middleware.js.map +1 -0
  127. package/dist/utils/rate-limiter.d.ts +71 -0
  128. package/dist/utils/rate-limiter.d.ts.map +1 -0
  129. package/dist/utils/rate-limiter.js +160 -0
  130. package/dist/utils/rate-limiter.js.map +1 -0
  131. package/dist/utils/signature.d.ts +57 -0
  132. package/dist/utils/signature.d.ts.map +1 -0
  133. package/dist/utils/signature.js +102 -0
  134. package/dist/utils/signature.js.map +1 -0
  135. package/dist/utils/validation.d.ts +504 -0
  136. package/dist/utils/validation.d.ts.map +1 -0
  137. package/dist/utils/validation.js +159 -0
  138. package/dist/utils/validation.js.map +1 -0
  139. package/docs/F2A-PROTOCOL.md +61 -0
  140. package/docs/MOBILE_BOOTSTRAP_DESIGN.md +126 -0
  141. package/docs/a2a-lessons.md +316 -0
  142. package/docs/middleware-guide.md +448 -0
  143. package/docs/readme-update-checklist.md +90 -0
  144. package/docs/reputation-guide.md +396 -0
  145. package/docs/rfcs/001-reputation-system.md +712 -0
  146. package/docs/security-design.md +247 -0
  147. package/install.sh +231 -0
  148. package/package.json +64 -0
  149. package/packages/openclaw-adapter/README.md +510 -0
  150. package/packages/openclaw-adapter/openclaw.plugin.json +106 -0
  151. package/packages/openclaw-adapter/package.json +40 -0
  152. package/packages/openclaw-adapter/src/announcement-queue.test.ts +449 -0
  153. package/packages/openclaw-adapter/src/announcement-queue.ts +403 -0
  154. package/packages/openclaw-adapter/src/capability-detector.test.ts +99 -0
  155. package/packages/openclaw-adapter/src/capability-detector.ts +183 -0
  156. package/packages/openclaw-adapter/src/claim-handlers.test.ts +974 -0
  157. package/packages/openclaw-adapter/src/claim-handlers.ts +482 -0
  158. package/packages/openclaw-adapter/src/connector.business.test.ts +583 -0
  159. package/packages/openclaw-adapter/src/connector.ts +795 -0
  160. package/packages/openclaw-adapter/src/index.test.ts +82 -0
  161. package/packages/openclaw-adapter/src/index.ts +18 -0
  162. package/packages/openclaw-adapter/src/integration.e2e.test.ts +829 -0
  163. package/packages/openclaw-adapter/src/logger.ts +51 -0
  164. package/packages/openclaw-adapter/src/network-client.test.ts +266 -0
  165. package/packages/openclaw-adapter/src/network-client.ts +251 -0
  166. package/packages/openclaw-adapter/src/network-recovery.test.ts +465 -0
  167. package/packages/openclaw-adapter/src/node-manager.test.ts +136 -0
  168. package/packages/openclaw-adapter/src/node-manager.ts +429 -0
  169. package/packages/openclaw-adapter/src/plugin.test.ts +439 -0
  170. package/packages/openclaw-adapter/src/plugin.ts +104 -0
  171. package/packages/openclaw-adapter/src/reputation.test.ts +221 -0
  172. package/packages/openclaw-adapter/src/reputation.ts +368 -0
  173. package/packages/openclaw-adapter/src/task-guard.test.ts +502 -0
  174. package/packages/openclaw-adapter/src/task-guard.ts +860 -0
  175. package/packages/openclaw-adapter/src/task-queue.concurrency.test.ts +462 -0
  176. package/packages/openclaw-adapter/src/task-queue.edge-cases.test.ts +284 -0
  177. package/packages/openclaw-adapter/src/task-queue.persistence.test.ts +408 -0
  178. package/packages/openclaw-adapter/src/task-queue.ts +668 -0
  179. package/packages/openclaw-adapter/src/tool-handlers.test.ts +906 -0
  180. package/packages/openclaw-adapter/src/tool-handlers.ts +574 -0
  181. package/packages/openclaw-adapter/src/types.ts +361 -0
  182. package/packages/openclaw-adapter/src/webhook-pusher.test.ts +188 -0
  183. package/packages/openclaw-adapter/src/webhook-pusher.ts +220 -0
  184. package/packages/openclaw-adapter/src/webhook-server.test.ts +580 -0
  185. package/packages/openclaw-adapter/src/webhook-server.ts +202 -0
  186. package/packages/openclaw-adapter/tsconfig.json +20 -0
  187. package/src/cli/commands.test.ts +157 -0
  188. package/src/cli/commands.ts +129 -0
  189. package/src/cli/index.test.ts +77 -0
  190. package/src/cli/index.ts +234 -0
  191. package/src/core/autonomous-economy.test.ts +291 -0
  192. package/src/core/autonomous-economy.ts +428 -0
  193. package/src/core/e2ee-crypto.test.ts +125 -0
  194. package/src/core/e2ee-crypto.ts +246 -0
  195. package/src/core/f2a.test.ts +269 -0
  196. package/src/core/f2a.ts +618 -0
  197. package/src/core/p2p-network.test.ts +199 -0
  198. package/src/core/p2p-network.ts +1432 -0
  199. package/src/core/reputation-security.test.ts +403 -0
  200. package/src/core/reputation-security.ts +562 -0
  201. package/src/core/reputation.test.ts +260 -0
  202. package/src/core/reputation.ts +576 -0
  203. package/src/core/review-committee.test.ts +380 -0
  204. package/src/core/review-committee.ts +401 -0
  205. package/src/core/token-manager.test.ts +133 -0
  206. package/src/core/token-manager.ts +140 -0
  207. package/src/daemon/control-server.test.ts +216 -0
  208. package/src/daemon/control-server.ts +292 -0
  209. package/src/daemon/index.test.ts +85 -0
  210. package/src/daemon/index.ts +89 -0
  211. package/src/daemon/main.ts +44 -0
  212. package/src/daemon/start.ts +29 -0
  213. package/src/daemon/webhook.test.ts +68 -0
  214. package/src/daemon/webhook.ts +105 -0
  215. package/src/index.test.ts +436 -0
  216. package/src/index.ts +72 -0
  217. package/src/types/index.test.ts +87 -0
  218. package/src/types/index.ts +341 -0
  219. package/src/types/result.ts +68 -0
  220. package/src/utils/benchmark.ts +237 -0
  221. package/src/utils/logger.ts +331 -0
  222. package/src/utils/middleware.ts +229 -0
  223. package/src/utils/rate-limiter.ts +207 -0
  224. package/src/utils/signature.ts +136 -0
  225. package/src/utils/validation.ts +186 -0
  226. package/tests/docker/Dockerfile.node +23 -0
  227. package/tests/docker/Dockerfile.runner +18 -0
  228. package/tests/docker/docker-compose.test.yml +73 -0
  229. package/tests/integration/message-passing.test.ts +109 -0
  230. package/tests/integration/multi-node.test.ts +92 -0
  231. package/tests/integration/p2p-connection.test.ts +83 -0
  232. package/tests/integration/test-config.ts +32 -0
  233. package/tsconfig.json +21 -0
  234. package/vitest.config.ts +26 -0
@@ -0,0 +1,739 @@
1
+ /**
2
+ * 协议消息定义和验证
3
+ * 使用 Zod 进行运行时类型验证
4
+ */
5
+ import { z } from 'zod';
6
+ export declare const MessageTypeSchema: z.ZodEnum<["identity_challenge", "identity_response", "connection_pending", "confirmation_result", "message", "message_ack", "skill_query", "skill_response", "skill_invoke", "skill_result", "group_message", "group_invite", "key_exchange", "webrtc_offer", "webrtc_answer", "webrtc_ice"]>;
7
+ export declare const BaseMessageSchema: z.ZodObject<{
8
+ type: z.ZodEnum<["identity_challenge", "identity_response", "connection_pending", "confirmation_result", "message", "message_ack", "skill_query", "skill_response", "skill_invoke", "skill_result", "group_message", "group_invite", "key_exchange", "webrtc_offer", "webrtc_answer", "webrtc_ice"]>;
9
+ id: z.ZodOptional<z.ZodString>;
10
+ timestamp: z.ZodNumber;
11
+ }, "strip", z.ZodTypeAny, {
12
+ type: "message" | "identity_challenge" | "identity_response" | "connection_pending" | "confirmation_result" | "message_ack" | "skill_query" | "skill_response" | "skill_invoke" | "skill_result" | "group_message" | "group_invite" | "key_exchange" | "webrtc_offer" | "webrtc_answer" | "webrtc_ice";
13
+ timestamp: number;
14
+ id?: string | undefined;
15
+ }, {
16
+ type: "message" | "identity_challenge" | "identity_response" | "connection_pending" | "confirmation_result" | "message_ack" | "skill_query" | "skill_response" | "skill_invoke" | "skill_result" | "group_message" | "group_invite" | "key_exchange" | "webrtc_offer" | "webrtc_answer" | "webrtc_ice";
17
+ timestamp: number;
18
+ id?: string | undefined;
19
+ }>;
20
+ export declare const IdentityChallengeSchema: z.ZodObject<{
21
+ id: z.ZodOptional<z.ZodString>;
22
+ } & {
23
+ type: z.ZodLiteral<"identity_challenge">;
24
+ agentId: z.ZodString;
25
+ publicKey: z.ZodString;
26
+ challenge: z.ZodString;
27
+ timestamp: z.ZodNumber;
28
+ }, "strip", z.ZodTypeAny, {
29
+ type: "identity_challenge";
30
+ agentId: string;
31
+ timestamp: number;
32
+ publicKey: string;
33
+ challenge: string;
34
+ id?: string | undefined;
35
+ }, {
36
+ type: "identity_challenge";
37
+ agentId: string;
38
+ timestamp: number;
39
+ publicKey: string;
40
+ challenge: string;
41
+ id?: string | undefined;
42
+ }>;
43
+ export declare const IdentityResponseSchema: z.ZodObject<{
44
+ id: z.ZodOptional<z.ZodString>;
45
+ timestamp: z.ZodNumber;
46
+ } & {
47
+ type: z.ZodLiteral<"identity_response">;
48
+ agentId: z.ZodString;
49
+ publicKey: z.ZodString;
50
+ signature: z.ZodString;
51
+ }, "strip", z.ZodTypeAny, {
52
+ type: "identity_response";
53
+ agentId: string;
54
+ timestamp: number;
55
+ publicKey: string;
56
+ signature: string;
57
+ id?: string | undefined;
58
+ }, {
59
+ type: "identity_response";
60
+ agentId: string;
61
+ timestamp: number;
62
+ publicKey: string;
63
+ signature: string;
64
+ id?: string | undefined;
65
+ }>;
66
+ export declare const ConnectionPendingSchema: z.ZodObject<{
67
+ id: z.ZodOptional<z.ZodString>;
68
+ timestamp: z.ZodNumber;
69
+ } & {
70
+ type: z.ZodLiteral<"connection_pending">;
71
+ confirmationId: z.ZodString;
72
+ message: z.ZodString;
73
+ timeout: z.ZodNumber;
74
+ }, "strip", z.ZodTypeAny, {
75
+ timeout: number;
76
+ message: string;
77
+ type: "connection_pending";
78
+ timestamp: number;
79
+ confirmationId: string;
80
+ id?: string | undefined;
81
+ }, {
82
+ timeout: number;
83
+ message: string;
84
+ type: "connection_pending";
85
+ timestamp: number;
86
+ confirmationId: string;
87
+ id?: string | undefined;
88
+ }>;
89
+ export declare const ConfirmationResultSchema: z.ZodObject<{
90
+ id: z.ZodOptional<z.ZodString>;
91
+ timestamp: z.ZodNumber;
92
+ } & {
93
+ type: z.ZodLiteral<"confirmation_result">;
94
+ confirmationId: z.ZodString;
95
+ accepted: z.ZodBoolean;
96
+ reason: z.ZodOptional<z.ZodString>;
97
+ }, "strip", z.ZodTypeAny, {
98
+ type: "confirmation_result";
99
+ timestamp: number;
100
+ confirmationId: string;
101
+ accepted: boolean;
102
+ id?: string | undefined;
103
+ reason?: string | undefined;
104
+ }, {
105
+ type: "confirmation_result";
106
+ timestamp: number;
107
+ confirmationId: string;
108
+ accepted: boolean;
109
+ id?: string | undefined;
110
+ reason?: string | undefined;
111
+ }>;
112
+ export declare const TextMessageSchema: z.ZodObject<{} & {
113
+ type: z.ZodLiteral<"message">;
114
+ id: z.ZodString;
115
+ from: z.ZodString;
116
+ to: z.ZodString;
117
+ content: z.ZodString;
118
+ timestamp: z.ZodNumber;
119
+ }, "strip", z.ZodTypeAny, {
120
+ content: string;
121
+ id: string;
122
+ to: string;
123
+ type: "message";
124
+ timestamp: number;
125
+ from: string;
126
+ }, {
127
+ content: string;
128
+ id: string;
129
+ to: string;
130
+ type: "message";
131
+ timestamp: number;
132
+ from: string;
133
+ }>;
134
+ export declare const MessageAckSchema: z.ZodObject<{
135
+ id: z.ZodOptional<z.ZodString>;
136
+ timestamp: z.ZodNumber;
137
+ } & {
138
+ type: z.ZodLiteral<"message_ack">;
139
+ messageId: z.ZodString;
140
+ }, "strip", z.ZodTypeAny, {
141
+ type: "message_ack";
142
+ timestamp: number;
143
+ messageId: string;
144
+ id?: string | undefined;
145
+ }, {
146
+ type: "message_ack";
147
+ timestamp: number;
148
+ messageId: string;
149
+ id?: string | undefined;
150
+ }>;
151
+ export declare const SkillQuerySchema: z.ZodObject<{
152
+ id: z.ZodOptional<z.ZodString>;
153
+ timestamp: z.ZodNumber;
154
+ } & {
155
+ type: z.ZodLiteral<"skill_query">;
156
+ requestId: z.ZodString;
157
+ }, "strip", z.ZodTypeAny, {
158
+ type: "skill_query";
159
+ timestamp: number;
160
+ requestId: string;
161
+ id?: string | undefined;
162
+ }, {
163
+ type: "skill_query";
164
+ timestamp: number;
165
+ requestId: string;
166
+ id?: string | undefined;
167
+ }>;
168
+ export declare const SkillResponseSchema: z.ZodObject<{
169
+ id: z.ZodOptional<z.ZodString>;
170
+ timestamp: z.ZodNumber;
171
+ } & {
172
+ type: z.ZodLiteral<"skill_response">;
173
+ requestId: z.ZodString;
174
+ skills: z.ZodArray<z.ZodObject<{
175
+ name: z.ZodString;
176
+ description: z.ZodString;
177
+ parameters: z.ZodRecord<z.ZodString, z.ZodAny>;
178
+ }, "strip", z.ZodTypeAny, {
179
+ description: string;
180
+ name: string;
181
+ parameters: Record<string, any>;
182
+ }, {
183
+ description: string;
184
+ name: string;
185
+ parameters: Record<string, any>;
186
+ }>, "many">;
187
+ }, "strip", z.ZodTypeAny, {
188
+ type: "skill_response";
189
+ timestamp: number;
190
+ requestId: string;
191
+ skills: {
192
+ description: string;
193
+ name: string;
194
+ parameters: Record<string, any>;
195
+ }[];
196
+ id?: string | undefined;
197
+ }, {
198
+ type: "skill_response";
199
+ timestamp: number;
200
+ requestId: string;
201
+ skills: {
202
+ description: string;
203
+ name: string;
204
+ parameters: Record<string, any>;
205
+ }[];
206
+ id?: string | undefined;
207
+ }>;
208
+ export declare const SkillInvokeSchema: z.ZodObject<{
209
+ id: z.ZodOptional<z.ZodString>;
210
+ timestamp: z.ZodNumber;
211
+ } & {
212
+ type: z.ZodLiteral<"skill_invoke">;
213
+ requestId: z.ZodString;
214
+ skill: z.ZodString;
215
+ parameters: z.ZodRecord<z.ZodString, z.ZodAny>;
216
+ }, "strip", z.ZodTypeAny, {
217
+ type: "skill_invoke";
218
+ timestamp: number;
219
+ requestId: string;
220
+ parameters: Record<string, any>;
221
+ skill: string;
222
+ id?: string | undefined;
223
+ }, {
224
+ type: "skill_invoke";
225
+ timestamp: number;
226
+ requestId: string;
227
+ parameters: Record<string, any>;
228
+ skill: string;
229
+ id?: string | undefined;
230
+ }>;
231
+ export declare const SkillResultSchema: z.ZodObject<{
232
+ id: z.ZodOptional<z.ZodString>;
233
+ timestamp: z.ZodNumber;
234
+ } & {
235
+ type: z.ZodLiteral<"skill_result">;
236
+ requestId: z.ZodString;
237
+ status: z.ZodEnum<["success", "error"]>;
238
+ result: z.ZodOptional<z.ZodAny>;
239
+ error: z.ZodOptional<z.ZodString>;
240
+ }, "strip", z.ZodTypeAny, {
241
+ status: "success" | "error";
242
+ type: "skill_result";
243
+ timestamp: number;
244
+ requestId: string;
245
+ error?: string | undefined;
246
+ result?: any;
247
+ id?: string | undefined;
248
+ }, {
249
+ status: "success" | "error";
250
+ type: "skill_result";
251
+ timestamp: number;
252
+ requestId: string;
253
+ error?: string | undefined;
254
+ result?: any;
255
+ id?: string | undefined;
256
+ }>;
257
+ export declare const GroupMessageSchema: z.ZodObject<{
258
+ id: z.ZodOptional<z.ZodString>;
259
+ timestamp: z.ZodNumber;
260
+ } & {
261
+ type: z.ZodLiteral<"group_message">;
262
+ groupId: z.ZodString;
263
+ groupName: z.ZodString;
264
+ from: z.ZodString;
265
+ content: z.ZodString;
266
+ }, "strip", z.ZodTypeAny, {
267
+ content: string;
268
+ type: "group_message";
269
+ timestamp: number;
270
+ from: string;
271
+ groupId: string;
272
+ groupName: string;
273
+ id?: string | undefined;
274
+ }, {
275
+ content: string;
276
+ type: "group_message";
277
+ timestamp: number;
278
+ from: string;
279
+ groupId: string;
280
+ groupName: string;
281
+ id?: string | undefined;
282
+ }>;
283
+ export declare const GroupInviteSchema: z.ZodObject<{
284
+ id: z.ZodOptional<z.ZodString>;
285
+ timestamp: z.ZodNumber;
286
+ } & {
287
+ type: z.ZodLiteral<"group_invite">;
288
+ groupId: z.ZodString;
289
+ groupName: z.ZodString;
290
+ inviter: z.ZodString;
291
+ }, "strip", z.ZodTypeAny, {
292
+ type: "group_invite";
293
+ timestamp: number;
294
+ groupId: string;
295
+ groupName: string;
296
+ inviter: string;
297
+ id?: string | undefined;
298
+ }, {
299
+ type: "group_invite";
300
+ timestamp: number;
301
+ groupId: string;
302
+ groupName: string;
303
+ inviter: string;
304
+ id?: string | undefined;
305
+ }>;
306
+ export declare const WebRTCOfferSchema: z.ZodObject<{
307
+ id: z.ZodOptional<z.ZodString>;
308
+ timestamp: z.ZodNumber;
309
+ } & {
310
+ type: z.ZodLiteral<"webrtc_offer">;
311
+ offer: z.ZodAny;
312
+ }, "strip", z.ZodTypeAny, {
313
+ type: "webrtc_offer";
314
+ timestamp: number;
315
+ id?: string | undefined;
316
+ offer?: any;
317
+ }, {
318
+ type: "webrtc_offer";
319
+ timestamp: number;
320
+ id?: string | undefined;
321
+ offer?: any;
322
+ }>;
323
+ export declare const WebRTCAnswerSchema: z.ZodObject<{
324
+ id: z.ZodOptional<z.ZodString>;
325
+ timestamp: z.ZodNumber;
326
+ } & {
327
+ type: z.ZodLiteral<"webrtc_answer">;
328
+ answer: z.ZodAny;
329
+ }, "strip", z.ZodTypeAny, {
330
+ type: "webrtc_answer";
331
+ timestamp: number;
332
+ id?: string | undefined;
333
+ answer?: any;
334
+ }, {
335
+ type: "webrtc_answer";
336
+ timestamp: number;
337
+ id?: string | undefined;
338
+ answer?: any;
339
+ }>;
340
+ export declare const WebRTCIceSchema: z.ZodObject<{
341
+ id: z.ZodOptional<z.ZodString>;
342
+ timestamp: z.ZodNumber;
343
+ } & {
344
+ type: z.ZodLiteral<"webrtc_ice">;
345
+ candidate: z.ZodAny;
346
+ }, "strip", z.ZodTypeAny, {
347
+ type: "webrtc_ice";
348
+ timestamp: number;
349
+ id?: string | undefined;
350
+ candidate?: any;
351
+ }, {
352
+ type: "webrtc_ice";
353
+ timestamp: number;
354
+ id?: string | undefined;
355
+ candidate?: any;
356
+ }>;
357
+ export declare const KeyExchangeSchema: z.ZodObject<{
358
+ id: z.ZodOptional<z.ZodString>;
359
+ timestamp: z.ZodNumber;
360
+ } & {
361
+ type: z.ZodLiteral<"key_exchange">;
362
+ publicKey: z.ZodString;
363
+ }, "strip", z.ZodTypeAny, {
364
+ type: "key_exchange";
365
+ timestamp: number;
366
+ publicKey: string;
367
+ id?: string | undefined;
368
+ }, {
369
+ type: "key_exchange";
370
+ timestamp: number;
371
+ publicKey: string;
372
+ id?: string | undefined;
373
+ }>;
374
+ export declare const F2AMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
375
+ id: z.ZodOptional<z.ZodString>;
376
+ } & {
377
+ type: z.ZodLiteral<"identity_challenge">;
378
+ agentId: z.ZodString;
379
+ publicKey: z.ZodString;
380
+ challenge: z.ZodString;
381
+ timestamp: z.ZodNumber;
382
+ }, "strip", z.ZodTypeAny, {
383
+ type: "identity_challenge";
384
+ agentId: string;
385
+ timestamp: number;
386
+ publicKey: string;
387
+ challenge: string;
388
+ id?: string | undefined;
389
+ }, {
390
+ type: "identity_challenge";
391
+ agentId: string;
392
+ timestamp: number;
393
+ publicKey: string;
394
+ challenge: string;
395
+ id?: string | undefined;
396
+ }>, z.ZodObject<{
397
+ id: z.ZodOptional<z.ZodString>;
398
+ timestamp: z.ZodNumber;
399
+ } & {
400
+ type: z.ZodLiteral<"identity_response">;
401
+ agentId: z.ZodString;
402
+ publicKey: z.ZodString;
403
+ signature: z.ZodString;
404
+ }, "strip", z.ZodTypeAny, {
405
+ type: "identity_response";
406
+ agentId: string;
407
+ timestamp: number;
408
+ publicKey: string;
409
+ signature: string;
410
+ id?: string | undefined;
411
+ }, {
412
+ type: "identity_response";
413
+ agentId: string;
414
+ timestamp: number;
415
+ publicKey: string;
416
+ signature: string;
417
+ id?: string | undefined;
418
+ }>, z.ZodObject<{
419
+ id: z.ZodOptional<z.ZodString>;
420
+ timestamp: z.ZodNumber;
421
+ } & {
422
+ type: z.ZodLiteral<"connection_pending">;
423
+ confirmationId: z.ZodString;
424
+ message: z.ZodString;
425
+ timeout: z.ZodNumber;
426
+ }, "strip", z.ZodTypeAny, {
427
+ timeout: number;
428
+ message: string;
429
+ type: "connection_pending";
430
+ timestamp: number;
431
+ confirmationId: string;
432
+ id?: string | undefined;
433
+ }, {
434
+ timeout: number;
435
+ message: string;
436
+ type: "connection_pending";
437
+ timestamp: number;
438
+ confirmationId: string;
439
+ id?: string | undefined;
440
+ }>, z.ZodObject<{
441
+ id: z.ZodOptional<z.ZodString>;
442
+ timestamp: z.ZodNumber;
443
+ } & {
444
+ type: z.ZodLiteral<"confirmation_result">;
445
+ confirmationId: z.ZodString;
446
+ accepted: z.ZodBoolean;
447
+ reason: z.ZodOptional<z.ZodString>;
448
+ }, "strip", z.ZodTypeAny, {
449
+ type: "confirmation_result";
450
+ timestamp: number;
451
+ confirmationId: string;
452
+ accepted: boolean;
453
+ id?: string | undefined;
454
+ reason?: string | undefined;
455
+ }, {
456
+ type: "confirmation_result";
457
+ timestamp: number;
458
+ confirmationId: string;
459
+ accepted: boolean;
460
+ id?: string | undefined;
461
+ reason?: string | undefined;
462
+ }>, z.ZodObject<{} & {
463
+ type: z.ZodLiteral<"message">;
464
+ id: z.ZodString;
465
+ from: z.ZodString;
466
+ to: z.ZodString;
467
+ content: z.ZodString;
468
+ timestamp: z.ZodNumber;
469
+ }, "strip", z.ZodTypeAny, {
470
+ content: string;
471
+ id: string;
472
+ to: string;
473
+ type: "message";
474
+ timestamp: number;
475
+ from: string;
476
+ }, {
477
+ content: string;
478
+ id: string;
479
+ to: string;
480
+ type: "message";
481
+ timestamp: number;
482
+ from: string;
483
+ }>, z.ZodObject<{
484
+ id: z.ZodOptional<z.ZodString>;
485
+ timestamp: z.ZodNumber;
486
+ } & {
487
+ type: z.ZodLiteral<"message_ack">;
488
+ messageId: z.ZodString;
489
+ }, "strip", z.ZodTypeAny, {
490
+ type: "message_ack";
491
+ timestamp: number;
492
+ messageId: string;
493
+ id?: string | undefined;
494
+ }, {
495
+ type: "message_ack";
496
+ timestamp: number;
497
+ messageId: string;
498
+ id?: string | undefined;
499
+ }>, z.ZodObject<{
500
+ id: z.ZodOptional<z.ZodString>;
501
+ timestamp: z.ZodNumber;
502
+ } & {
503
+ type: z.ZodLiteral<"skill_query">;
504
+ requestId: z.ZodString;
505
+ }, "strip", z.ZodTypeAny, {
506
+ type: "skill_query";
507
+ timestamp: number;
508
+ requestId: string;
509
+ id?: string | undefined;
510
+ }, {
511
+ type: "skill_query";
512
+ timestamp: number;
513
+ requestId: string;
514
+ id?: string | undefined;
515
+ }>, z.ZodObject<{
516
+ id: z.ZodOptional<z.ZodString>;
517
+ timestamp: z.ZodNumber;
518
+ } & {
519
+ type: z.ZodLiteral<"skill_response">;
520
+ requestId: z.ZodString;
521
+ skills: z.ZodArray<z.ZodObject<{
522
+ name: z.ZodString;
523
+ description: z.ZodString;
524
+ parameters: z.ZodRecord<z.ZodString, z.ZodAny>;
525
+ }, "strip", z.ZodTypeAny, {
526
+ description: string;
527
+ name: string;
528
+ parameters: Record<string, any>;
529
+ }, {
530
+ description: string;
531
+ name: string;
532
+ parameters: Record<string, any>;
533
+ }>, "many">;
534
+ }, "strip", z.ZodTypeAny, {
535
+ type: "skill_response";
536
+ timestamp: number;
537
+ requestId: string;
538
+ skills: {
539
+ description: string;
540
+ name: string;
541
+ parameters: Record<string, any>;
542
+ }[];
543
+ id?: string | undefined;
544
+ }, {
545
+ type: "skill_response";
546
+ timestamp: number;
547
+ requestId: string;
548
+ skills: {
549
+ description: string;
550
+ name: string;
551
+ parameters: Record<string, any>;
552
+ }[];
553
+ id?: string | undefined;
554
+ }>, z.ZodObject<{
555
+ id: z.ZodOptional<z.ZodString>;
556
+ timestamp: z.ZodNumber;
557
+ } & {
558
+ type: z.ZodLiteral<"skill_invoke">;
559
+ requestId: z.ZodString;
560
+ skill: z.ZodString;
561
+ parameters: z.ZodRecord<z.ZodString, z.ZodAny>;
562
+ }, "strip", z.ZodTypeAny, {
563
+ type: "skill_invoke";
564
+ timestamp: number;
565
+ requestId: string;
566
+ parameters: Record<string, any>;
567
+ skill: string;
568
+ id?: string | undefined;
569
+ }, {
570
+ type: "skill_invoke";
571
+ timestamp: number;
572
+ requestId: string;
573
+ parameters: Record<string, any>;
574
+ skill: string;
575
+ id?: string | undefined;
576
+ }>, z.ZodObject<{
577
+ id: z.ZodOptional<z.ZodString>;
578
+ timestamp: z.ZodNumber;
579
+ } & {
580
+ type: z.ZodLiteral<"skill_result">;
581
+ requestId: z.ZodString;
582
+ status: z.ZodEnum<["success", "error"]>;
583
+ result: z.ZodOptional<z.ZodAny>;
584
+ error: z.ZodOptional<z.ZodString>;
585
+ }, "strip", z.ZodTypeAny, {
586
+ status: "success" | "error";
587
+ type: "skill_result";
588
+ timestamp: number;
589
+ requestId: string;
590
+ error?: string | undefined;
591
+ result?: any;
592
+ id?: string | undefined;
593
+ }, {
594
+ status: "success" | "error";
595
+ type: "skill_result";
596
+ timestamp: number;
597
+ requestId: string;
598
+ error?: string | undefined;
599
+ result?: any;
600
+ id?: string | undefined;
601
+ }>, z.ZodObject<{
602
+ id: z.ZodOptional<z.ZodString>;
603
+ timestamp: z.ZodNumber;
604
+ } & {
605
+ type: z.ZodLiteral<"group_message">;
606
+ groupId: z.ZodString;
607
+ groupName: z.ZodString;
608
+ from: z.ZodString;
609
+ content: z.ZodString;
610
+ }, "strip", z.ZodTypeAny, {
611
+ content: string;
612
+ type: "group_message";
613
+ timestamp: number;
614
+ from: string;
615
+ groupId: string;
616
+ groupName: string;
617
+ id?: string | undefined;
618
+ }, {
619
+ content: string;
620
+ type: "group_message";
621
+ timestamp: number;
622
+ from: string;
623
+ groupId: string;
624
+ groupName: string;
625
+ id?: string | undefined;
626
+ }>, z.ZodObject<{
627
+ id: z.ZodOptional<z.ZodString>;
628
+ timestamp: z.ZodNumber;
629
+ } & {
630
+ type: z.ZodLiteral<"group_invite">;
631
+ groupId: z.ZodString;
632
+ groupName: z.ZodString;
633
+ inviter: z.ZodString;
634
+ }, "strip", z.ZodTypeAny, {
635
+ type: "group_invite";
636
+ timestamp: number;
637
+ groupId: string;
638
+ groupName: string;
639
+ inviter: string;
640
+ id?: string | undefined;
641
+ }, {
642
+ type: "group_invite";
643
+ timestamp: number;
644
+ groupId: string;
645
+ groupName: string;
646
+ inviter: string;
647
+ id?: string | undefined;
648
+ }>, z.ZodObject<{
649
+ id: z.ZodOptional<z.ZodString>;
650
+ timestamp: z.ZodNumber;
651
+ } & {
652
+ type: z.ZodLiteral<"webrtc_offer">;
653
+ offer: z.ZodAny;
654
+ }, "strip", z.ZodTypeAny, {
655
+ type: "webrtc_offer";
656
+ timestamp: number;
657
+ id?: string | undefined;
658
+ offer?: any;
659
+ }, {
660
+ type: "webrtc_offer";
661
+ timestamp: number;
662
+ id?: string | undefined;
663
+ offer?: any;
664
+ }>, z.ZodObject<{
665
+ id: z.ZodOptional<z.ZodString>;
666
+ timestamp: z.ZodNumber;
667
+ } & {
668
+ type: z.ZodLiteral<"webrtc_answer">;
669
+ answer: z.ZodAny;
670
+ }, "strip", z.ZodTypeAny, {
671
+ type: "webrtc_answer";
672
+ timestamp: number;
673
+ id?: string | undefined;
674
+ answer?: any;
675
+ }, {
676
+ type: "webrtc_answer";
677
+ timestamp: number;
678
+ id?: string | undefined;
679
+ answer?: any;
680
+ }>, z.ZodObject<{
681
+ id: z.ZodOptional<z.ZodString>;
682
+ timestamp: z.ZodNumber;
683
+ } & {
684
+ type: z.ZodLiteral<"webrtc_ice">;
685
+ candidate: z.ZodAny;
686
+ }, "strip", z.ZodTypeAny, {
687
+ type: "webrtc_ice";
688
+ timestamp: number;
689
+ id?: string | undefined;
690
+ candidate?: any;
691
+ }, {
692
+ type: "webrtc_ice";
693
+ timestamp: number;
694
+ id?: string | undefined;
695
+ candidate?: any;
696
+ }>, z.ZodObject<{
697
+ id: z.ZodOptional<z.ZodString>;
698
+ timestamp: z.ZodNumber;
699
+ } & {
700
+ type: z.ZodLiteral<"key_exchange">;
701
+ publicKey: z.ZodString;
702
+ }, "strip", z.ZodTypeAny, {
703
+ type: "key_exchange";
704
+ timestamp: number;
705
+ publicKey: string;
706
+ id?: string | undefined;
707
+ }, {
708
+ type: "key_exchange";
709
+ timestamp: number;
710
+ publicKey: string;
711
+ id?: string | undefined;
712
+ }>]>;
713
+ export type IdentityChallengeMessage = z.infer<typeof IdentityChallengeSchema>;
714
+ export type IdentityResponseMessage = z.infer<typeof IdentityResponseSchema>;
715
+ export type ConnectionPendingMessage = z.infer<typeof ConnectionPendingSchema>;
716
+ export type ConfirmationResultMessage = z.infer<typeof ConfirmationResultSchema>;
717
+ export type TextMessage = z.infer<typeof TextMessageSchema>;
718
+ export type MessageAck = z.infer<typeof MessageAckSchema>;
719
+ export type SkillQueryMessage = z.infer<typeof SkillQuerySchema>;
720
+ export type SkillResponseMessage = z.infer<typeof SkillResponseSchema>;
721
+ export type SkillInvokeMessage = z.infer<typeof SkillInvokeSchema>;
722
+ export type SkillResultMessage = z.infer<typeof SkillResultSchema>;
723
+ export type GroupMessage = z.infer<typeof GroupMessageSchema>;
724
+ export type GroupInviteMessage = z.infer<typeof GroupInviteSchema>;
725
+ export type WebRTCOfferMessage = z.infer<typeof WebRTCOfferSchema>;
726
+ export type WebRTCAnswerMessage = z.infer<typeof WebRTCAnswerSchema>;
727
+ export type WebRTCIceMessage = z.infer<typeof WebRTCIceSchema>;
728
+ export type KeyExchangeMessage = z.infer<typeof KeyExchangeSchema>;
729
+ export type F2AMessage = z.infer<typeof F2AMessageSchema>;
730
+ export declare function validateMessage(data: unknown): {
731
+ success: true;
732
+ data: F2AMessage;
733
+ } | {
734
+ success: false;
735
+ error: string;
736
+ };
737
+ export declare function createMessageId(): string;
738
+ export declare function createTimestamp(): number;
739
+ //# sourceMappingURL=messages.d.ts.map