@f2a/network 0.1.2 → 0.2.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.
Files changed (226) hide show
  1. package/README.md +278 -63
  2. package/dist/cli/commands.d.ts.map +1 -1
  3. package/dist/cli/commands.js +29 -2
  4. package/dist/cli/commands.js.map +1 -1
  5. package/dist/cli/config.d.ts +176 -0
  6. package/dist/cli/config.d.ts.map +1 -0
  7. package/dist/cli/config.js +386 -0
  8. package/dist/cli/config.js.map +1 -0
  9. package/dist/cli/daemon.d.ts +54 -0
  10. package/dist/cli/daemon.d.ts.map +1 -0
  11. package/dist/cli/daemon.js +572 -0
  12. package/dist/cli/daemon.js.map +1 -0
  13. package/dist/cli/index.js +90 -16
  14. package/dist/cli/index.js.map +1 -1
  15. package/dist/cli/init.d.ts +13 -0
  16. package/dist/cli/init.d.ts.map +1 -0
  17. package/dist/cli/init.js +352 -0
  18. package/dist/cli/init.js.map +1 -0
  19. package/dist/core/e2ee-crypto.d.ts +127 -1
  20. package/dist/core/e2ee-crypto.d.ts.map +1 -1
  21. package/dist/core/e2ee-crypto.js +446 -12
  22. package/dist/core/e2ee-crypto.js.map +1 -1
  23. package/dist/core/f2a.d.ts +2 -1
  24. package/dist/core/f2a.d.ts.map +1 -1
  25. package/dist/core/f2a.js +6 -2
  26. package/dist/core/f2a.js.map +1 -1
  27. package/dist/core/identity/encrypted-key-store.d.ts +19 -0
  28. package/dist/core/identity/encrypted-key-store.d.ts.map +1 -0
  29. package/dist/core/identity/encrypted-key-store.js +72 -0
  30. package/dist/core/identity/encrypted-key-store.js.map +1 -0
  31. package/dist/core/identity/identity-manager.d.ts +133 -0
  32. package/dist/core/identity/identity-manager.d.ts.map +1 -0
  33. package/dist/core/identity/identity-manager.js +454 -0
  34. package/dist/core/identity/identity-manager.js.map +1 -0
  35. package/dist/core/identity/index.d.ts +8 -0
  36. package/dist/core/identity/index.d.ts.map +1 -0
  37. package/dist/core/identity/index.js +7 -0
  38. package/dist/core/identity/index.js.map +1 -0
  39. package/dist/core/identity/types.d.ts +70 -0
  40. package/dist/core/identity/types.d.ts.map +1 -0
  41. package/dist/core/identity/types.js +17 -0
  42. package/dist/core/identity/types.js.map +1 -0
  43. package/dist/core/p2p-network.d.ts +26 -0
  44. package/dist/core/p2p-network.d.ts.map +1 -1
  45. package/dist/core/p2p-network.js +434 -105
  46. package/dist/core/p2p-network.js.map +1 -1
  47. package/dist/core/reputation-security.d.ts +15 -0
  48. package/dist/core/reputation-security.d.ts.map +1 -1
  49. package/dist/core/reputation-security.js +73 -3
  50. package/dist/core/reputation-security.js.map +1 -1
  51. package/dist/core/reputation.d.ts +129 -4
  52. package/dist/core/reputation.d.ts.map +1 -1
  53. package/dist/core/reputation.js +294 -1
  54. package/dist/core/reputation.js.map +1 -1
  55. package/dist/core/review-committee.d.ts +2 -2
  56. package/dist/core/review-committee.d.ts.map +1 -1
  57. package/dist/core/review-committee.js +17 -0
  58. package/dist/core/review-committee.js.map +1 -1
  59. package/dist/daemon/control-server.d.ts.map +1 -1
  60. package/dist/daemon/control-server.js +44 -1
  61. package/dist/daemon/control-server.js.map +1 -1
  62. package/dist/daemon/webhook.d.ts +3 -0
  63. package/dist/daemon/webhook.d.ts.map +1 -1
  64. package/dist/daemon/webhook.js +318 -6
  65. package/dist/daemon/webhook.js.map +1 -1
  66. package/dist/index.d.ts +3 -3
  67. package/dist/index.d.ts.map +1 -1
  68. package/dist/index.js +7 -3
  69. package/dist/index.js.map +1 -1
  70. package/dist/types/index.d.ts +4 -0
  71. package/dist/types/index.d.ts.map +1 -1
  72. package/dist/types/index.js.map +1 -1
  73. package/dist/types/result.d.ts +1 -1
  74. package/dist/types/result.d.ts.map +1 -1
  75. package/dist/types/result.js.map +1 -1
  76. package/dist/utils/crypto-utils.d.ts +17 -0
  77. package/dist/utils/crypto-utils.d.ts.map +1 -0
  78. package/dist/utils/crypto-utils.js +28 -0
  79. package/dist/utils/crypto-utils.js.map +1 -0
  80. package/dist/utils/logger.d.ts +1 -0
  81. package/dist/utils/logger.d.ts.map +1 -1
  82. package/dist/utils/logger.js +9 -3
  83. package/dist/utils/logger.js.map +1 -1
  84. package/dist/utils/rate-limiter.d.ts.map +1 -1
  85. package/dist/utils/rate-limiter.js +3 -1
  86. package/dist/utils/rate-limiter.js.map +1 -1
  87. package/dist/utils/signature.d.ts +47 -1
  88. package/dist/utils/signature.d.ts.map +1 -1
  89. package/dist/utils/signature.js +166 -11
  90. package/dist/utils/signature.js.map +1 -1
  91. package/package.json +9 -1
  92. package/.github/workflows/ci.yml +0 -113
  93. package/.github/workflows/publish.yml +0 -60
  94. package/MONOREPO.md +0 -58
  95. package/SKILL.md +0 -137
  96. package/dist/adapters/openclaw.d.ts +0 -103
  97. package/dist/adapters/openclaw.d.ts.map +0 -1
  98. package/dist/adapters/openclaw.js +0 -297
  99. package/dist/adapters/openclaw.js.map +0 -1
  100. package/dist/core/connection-manager.d.ts +0 -80
  101. package/dist/core/connection-manager.d.ts.map +0 -1
  102. package/dist/core/connection-manager.js +0 -235
  103. package/dist/core/connection-manager.js.map +0 -1
  104. package/dist/core/connection-manager.test.d.ts +0 -2
  105. package/dist/core/connection-manager.test.d.ts.map +0 -1
  106. package/dist/core/connection-manager.test.js +0 -52
  107. package/dist/core/connection-manager.test.js.map +0 -1
  108. package/dist/core/identity.d.ts +0 -47
  109. package/dist/core/identity.d.ts.map +0 -1
  110. package/dist/core/identity.js +0 -130
  111. package/dist/core/identity.js.map +0 -1
  112. package/dist/core/identity.test.d.ts +0 -2
  113. package/dist/core/identity.test.d.ts.map +0 -1
  114. package/dist/core/identity.test.js +0 -43
  115. package/dist/core/identity.test.js.map +0 -1
  116. package/dist/core/serverless.d.ts +0 -155
  117. package/dist/core/serverless.d.ts.map +0 -1
  118. package/dist/core/serverless.js +0 -615
  119. package/dist/core/serverless.js.map +0 -1
  120. package/dist/daemon/webhook.test.d.ts +0 -2
  121. package/dist/daemon/webhook.test.d.ts.map +0 -1
  122. package/dist/daemon/webhook.test.js +0 -24
  123. package/dist/daemon/webhook.test.js.map +0 -1
  124. package/dist/protocol/messages.d.ts +0 -739
  125. package/dist/protocol/messages.d.ts.map +0 -1
  126. package/dist/protocol/messages.js +0 -188
  127. package/dist/protocol/messages.js.map +0 -1
  128. package/dist/protocol/messages.test.d.ts +0 -2
  129. package/dist/protocol/messages.test.d.ts.map +0 -1
  130. package/dist/protocol/messages.test.js +0 -55
  131. package/dist/protocol/messages.test.js.map +0 -1
  132. package/docs/F2A-PROTOCOL.md +0 -61
  133. package/docs/MOBILE_BOOTSTRAP_DESIGN.md +0 -126
  134. package/docs/a2a-lessons.md +0 -316
  135. package/docs/middleware-guide.md +0 -448
  136. package/docs/readme-update-checklist.md +0 -90
  137. package/docs/reputation-guide.md +0 -396
  138. package/docs/rfcs/001-reputation-system.md +0 -712
  139. package/docs/security-design.md +0 -247
  140. package/install.sh +0 -231
  141. package/packages/openclaw-adapter/README.md +0 -510
  142. package/packages/openclaw-adapter/openclaw.plugin.json +0 -106
  143. package/packages/openclaw-adapter/package.json +0 -40
  144. package/packages/openclaw-adapter/src/announcement-queue.test.ts +0 -449
  145. package/packages/openclaw-adapter/src/announcement-queue.ts +0 -403
  146. package/packages/openclaw-adapter/src/capability-detector.test.ts +0 -99
  147. package/packages/openclaw-adapter/src/capability-detector.ts +0 -183
  148. package/packages/openclaw-adapter/src/claim-handlers.test.ts +0 -974
  149. package/packages/openclaw-adapter/src/claim-handlers.ts +0 -482
  150. package/packages/openclaw-adapter/src/connector.business.test.ts +0 -583
  151. package/packages/openclaw-adapter/src/connector.ts +0 -795
  152. package/packages/openclaw-adapter/src/index.test.ts +0 -82
  153. package/packages/openclaw-adapter/src/index.ts +0 -18
  154. package/packages/openclaw-adapter/src/integration.e2e.test.ts +0 -829
  155. package/packages/openclaw-adapter/src/logger.ts +0 -51
  156. package/packages/openclaw-adapter/src/network-client.test.ts +0 -266
  157. package/packages/openclaw-adapter/src/network-client.ts +0 -251
  158. package/packages/openclaw-adapter/src/network-recovery.test.ts +0 -465
  159. package/packages/openclaw-adapter/src/node-manager.test.ts +0 -136
  160. package/packages/openclaw-adapter/src/node-manager.ts +0 -429
  161. package/packages/openclaw-adapter/src/plugin.test.ts +0 -439
  162. package/packages/openclaw-adapter/src/plugin.ts +0 -104
  163. package/packages/openclaw-adapter/src/reputation.test.ts +0 -221
  164. package/packages/openclaw-adapter/src/reputation.ts +0 -368
  165. package/packages/openclaw-adapter/src/task-guard.test.ts +0 -502
  166. package/packages/openclaw-adapter/src/task-guard.ts +0 -860
  167. package/packages/openclaw-adapter/src/task-queue.concurrency.test.ts +0 -462
  168. package/packages/openclaw-adapter/src/task-queue.edge-cases.test.ts +0 -284
  169. package/packages/openclaw-adapter/src/task-queue.persistence.test.ts +0 -408
  170. package/packages/openclaw-adapter/src/task-queue.ts +0 -668
  171. package/packages/openclaw-adapter/src/tool-handlers.test.ts +0 -906
  172. package/packages/openclaw-adapter/src/tool-handlers.ts +0 -574
  173. package/packages/openclaw-adapter/src/types.ts +0 -361
  174. package/packages/openclaw-adapter/src/webhook-pusher.test.ts +0 -188
  175. package/packages/openclaw-adapter/src/webhook-pusher.ts +0 -220
  176. package/packages/openclaw-adapter/src/webhook-server.test.ts +0 -580
  177. package/packages/openclaw-adapter/src/webhook-server.ts +0 -202
  178. package/packages/openclaw-adapter/tsconfig.json +0 -20
  179. package/src/cli/commands.test.ts +0 -157
  180. package/src/cli/commands.ts +0 -129
  181. package/src/cli/index.test.ts +0 -77
  182. package/src/cli/index.ts +0 -234
  183. package/src/core/autonomous-economy.test.ts +0 -291
  184. package/src/core/autonomous-economy.ts +0 -428
  185. package/src/core/e2ee-crypto.test.ts +0 -125
  186. package/src/core/e2ee-crypto.ts +0 -246
  187. package/src/core/f2a.test.ts +0 -269
  188. package/src/core/f2a.ts +0 -618
  189. package/src/core/p2p-network.test.ts +0 -199
  190. package/src/core/p2p-network.ts +0 -1432
  191. package/src/core/reputation-security.test.ts +0 -403
  192. package/src/core/reputation-security.ts +0 -562
  193. package/src/core/reputation.test.ts +0 -260
  194. package/src/core/reputation.ts +0 -576
  195. package/src/core/review-committee.test.ts +0 -380
  196. package/src/core/review-committee.ts +0 -401
  197. package/src/core/token-manager.test.ts +0 -133
  198. package/src/core/token-manager.ts +0 -140
  199. package/src/daemon/control-server.test.ts +0 -216
  200. package/src/daemon/control-server.ts +0 -292
  201. package/src/daemon/index.test.ts +0 -85
  202. package/src/daemon/index.ts +0 -89
  203. package/src/daemon/main.ts +0 -44
  204. package/src/daemon/start.ts +0 -29
  205. package/src/daemon/webhook.test.ts +0 -68
  206. package/src/daemon/webhook.ts +0 -105
  207. package/src/index.test.ts +0 -436
  208. package/src/index.ts +0 -72
  209. package/src/types/index.test.ts +0 -87
  210. package/src/types/index.ts +0 -341
  211. package/src/types/result.ts +0 -68
  212. package/src/utils/benchmark.ts +0 -237
  213. package/src/utils/logger.ts +0 -331
  214. package/src/utils/middleware.ts +0 -229
  215. package/src/utils/rate-limiter.ts +0 -207
  216. package/src/utils/signature.ts +0 -136
  217. package/src/utils/validation.ts +0 -186
  218. package/tests/docker/Dockerfile.node +0 -23
  219. package/tests/docker/Dockerfile.runner +0 -18
  220. package/tests/docker/docker-compose.test.yml +0 -73
  221. package/tests/integration/message-passing.test.ts +0 -109
  222. package/tests/integration/multi-node.test.ts +0 -92
  223. package/tests/integration/p2p-connection.test.ts +0 -83
  224. package/tests/integration/test-config.ts +0 -32
  225. package/tsconfig.json +0 -21
  226. package/vitest.config.ts +0 -26
@@ -1,739 +0,0 @@
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