@radaros/transport 0.3.7 → 0.3.9
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 +99 -39
- package/dist/index.js +1239 -1145
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,38 @@
|
|
|
1
|
-
import { Agent, Team, Workflow,
|
|
1
|
+
import { Agent, A2AAgentCard, Team, Workflow, EventBus, VoiceAgent } from '@radaros/core';
|
|
2
|
+
|
|
3
|
+
interface A2AServerOptions {
|
|
4
|
+
agents: Record<string, Agent>;
|
|
5
|
+
basePath?: string;
|
|
6
|
+
provider?: {
|
|
7
|
+
organization: string;
|
|
8
|
+
url?: string;
|
|
9
|
+
};
|
|
10
|
+
version?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Mount an A2A-compliant server on an Express app.
|
|
15
|
+
*
|
|
16
|
+
* - Serves `/.well-known/agent.json` with the Agent Card
|
|
17
|
+
* - Handles JSON-RPC 2.0 requests at the basePath for message/send, message/stream, tasks/get, tasks/cancel
|
|
18
|
+
*/
|
|
19
|
+
declare function createA2AServer(app: any, opts: A2AServerOptions): void;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Generate an A2A Agent Card from a RadarOS Agent.
|
|
23
|
+
* The card is served at /.well-known/agent.json per the A2A spec.
|
|
24
|
+
*/
|
|
25
|
+
declare function generateAgentCard(agent: Agent, serverUrl: string, provider?: {
|
|
26
|
+
organization: string;
|
|
27
|
+
url?: string;
|
|
28
|
+
}, version?: string): A2AAgentCard;
|
|
29
|
+
/**
|
|
30
|
+
* Generate a combined Agent Card that lists multiple agents as skills.
|
|
31
|
+
*/
|
|
32
|
+
declare function generateMultiAgentCard(agents: Record<string, Agent>, serverUrl: string, provider?: {
|
|
33
|
+
organization: string;
|
|
34
|
+
url?: string;
|
|
35
|
+
}, version?: string): A2AAgentCard;
|
|
2
36
|
|
|
3
37
|
interface FileUploadOptions {
|
|
4
38
|
maxFileSize?: number;
|
|
@@ -8,6 +42,9 @@ interface FileUploadOptions {
|
|
|
8
42
|
declare function createFileUploadMiddleware(opts?: FileUploadOptions): any;
|
|
9
43
|
declare function buildMultiModalInput(body: any, files?: any[]): string | any[];
|
|
10
44
|
|
|
45
|
+
declare function errorHandler(): (err: any, _req: any, res: any, _next: any) => void;
|
|
46
|
+
declare function requestLogger(): (req: any, _res: any, next: any) => void;
|
|
47
|
+
|
|
11
48
|
interface SwaggerOptions {
|
|
12
49
|
/** Enable Swagger UI at /docs. Default: false */
|
|
13
50
|
enabled?: boolean;
|
|
@@ -42,9 +79,6 @@ interface RouterOptions {
|
|
|
42
79
|
|
|
43
80
|
declare function createAgentRouter(opts: RouterOptions): any;
|
|
44
81
|
|
|
45
|
-
declare function errorHandler(): (err: any, _req: any, res: any, _next: any) => void;
|
|
46
|
-
declare function requestLogger(): (req: any, _res: any, next: any) => void;
|
|
47
|
-
|
|
48
82
|
interface OpenAPISpec {
|
|
49
83
|
openapi: string;
|
|
50
84
|
info: {
|
|
@@ -69,6 +103,66 @@ interface OpenAPISpec {
|
|
|
69
103
|
}
|
|
70
104
|
declare function generateOpenAPISpec(routerOpts: RouterOptions, swaggerOpts?: SwaggerOptions): OpenAPISpec;
|
|
71
105
|
|
|
106
|
+
/**
|
|
107
|
+
* Minimal interface for a BrowserAgent — avoids a hard dependency on @radaros/browser.
|
|
108
|
+
* Any object that matches this shape (e.g. a real BrowserAgent) works.
|
|
109
|
+
*/
|
|
110
|
+
interface BrowserAgentLike {
|
|
111
|
+
name: string;
|
|
112
|
+
eventBus: EventBus;
|
|
113
|
+
run(task: string, opts?: {
|
|
114
|
+
startUrl?: string;
|
|
115
|
+
apiKey?: string;
|
|
116
|
+
sessionId?: string;
|
|
117
|
+
}): Promise<{
|
|
118
|
+
result: string;
|
|
119
|
+
success: boolean;
|
|
120
|
+
finalUrl: string;
|
|
121
|
+
durationMs: number;
|
|
122
|
+
videoPath?: string;
|
|
123
|
+
steps: Array<{
|
|
124
|
+
index: number;
|
|
125
|
+
action: unknown;
|
|
126
|
+
screenshot: Buffer;
|
|
127
|
+
pageUrl: string;
|
|
128
|
+
pageTitle: string;
|
|
129
|
+
dom?: string;
|
|
130
|
+
}>;
|
|
131
|
+
}>;
|
|
132
|
+
}
|
|
133
|
+
interface BrowserGatewayOptions {
|
|
134
|
+
/** Named BrowserAgent instances. Clients select one via agentName. */
|
|
135
|
+
agents: Record<string, BrowserAgentLike>;
|
|
136
|
+
/** Socket.IO server instance */
|
|
137
|
+
io: any;
|
|
138
|
+
/** Socket.IO namespace. Default: "/radaros-browser" */
|
|
139
|
+
namespace?: string;
|
|
140
|
+
/** Optional auth middleware applied to the namespace */
|
|
141
|
+
authMiddleware?: (socket: any, next: (err?: Error) => void) => void;
|
|
142
|
+
/**
|
|
143
|
+
* Stream screenshots to the client in real-time.
|
|
144
|
+
* Default: true. Disable for bandwidth-constrained clients.
|
|
145
|
+
*/
|
|
146
|
+
streamScreenshots?: boolean;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Create a Socket.IO gateway that streams BrowserAgent execution in real-time.
|
|
150
|
+
*
|
|
151
|
+
* ## Client → Server events
|
|
152
|
+
* - `browser.start` — kick off a browser task
|
|
153
|
+
* - `browser.stop` — cancel a running task
|
|
154
|
+
*
|
|
155
|
+
* ## Server → Client events
|
|
156
|
+
* - `browser.started` — task accepted
|
|
157
|
+
* - `browser.screenshot` — live screenshot (base64 PNG)
|
|
158
|
+
* - `browser.action` — action about to execute
|
|
159
|
+
* - `browser.step` — full step with screenshot + DOM
|
|
160
|
+
* - `browser.done` — task finished (result, success, duration, video)
|
|
161
|
+
* - `browser.error` — error occurred
|
|
162
|
+
* - `browser.stopped` — task was cancelled
|
|
163
|
+
*/
|
|
164
|
+
declare function createBrowserGateway(opts: BrowserGatewayOptions): void;
|
|
165
|
+
|
|
72
166
|
interface GatewayOptions {
|
|
73
167
|
agents?: Record<string, Agent>;
|
|
74
168
|
teams?: Record<string, Team>;
|
|
@@ -87,38 +181,4 @@ interface VoiceGatewayOptions {
|
|
|
87
181
|
}
|
|
88
182
|
declare function createVoiceGateway(opts: VoiceGatewayOptions): void;
|
|
89
183
|
|
|
90
|
-
|
|
91
|
-
agents: Record<string, Agent>;
|
|
92
|
-
basePath?: string;
|
|
93
|
-
provider?: {
|
|
94
|
-
organization: string;
|
|
95
|
-
url?: string;
|
|
96
|
-
};
|
|
97
|
-
version?: string;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Mount an A2A-compliant server on an Express app.
|
|
102
|
-
*
|
|
103
|
-
* - Serves `/.well-known/agent.json` with the Agent Card
|
|
104
|
-
* - Handles JSON-RPC 2.0 requests at the basePath for message/send, message/stream, tasks/get, tasks/cancel
|
|
105
|
-
*/
|
|
106
|
-
declare function createA2AServer(app: any, opts: A2AServerOptions): void;
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Generate an A2A Agent Card from a RadarOS Agent.
|
|
110
|
-
* The card is served at /.well-known/agent.json per the A2A spec.
|
|
111
|
-
*/
|
|
112
|
-
declare function generateAgentCard(agent: Agent, serverUrl: string, provider?: {
|
|
113
|
-
organization: string;
|
|
114
|
-
url?: string;
|
|
115
|
-
}, version?: string): A2AAgentCard;
|
|
116
|
-
/**
|
|
117
|
-
* Generate a combined Agent Card that lists multiple agents as skills.
|
|
118
|
-
*/
|
|
119
|
-
declare function generateMultiAgentCard(agents: Record<string, Agent>, serverUrl: string, provider?: {
|
|
120
|
-
organization: string;
|
|
121
|
-
url?: string;
|
|
122
|
-
}, version?: string): A2AAgentCard;
|
|
123
|
-
|
|
124
|
-
export { type A2AServerOptions, type FileUploadOptions, type GatewayOptions, type RouterOptions, type SwaggerOptions, type VoiceGatewayOptions, buildMultiModalInput, createA2AServer, createAgentGateway, createAgentRouter, createFileUploadMiddleware, createVoiceGateway, errorHandler, generateAgentCard, generateMultiAgentCard, generateOpenAPISpec, requestLogger };
|
|
184
|
+
export { type A2AServerOptions, type BrowserGatewayOptions, type FileUploadOptions, type GatewayOptions, type RouterOptions, type SwaggerOptions, type VoiceGatewayOptions, buildMultiModalInput, createA2AServer, createAgentGateway, createAgentRouter, createBrowserGateway, createFileUploadMiddleware, createVoiceGateway, errorHandler, generateAgentCard, generateMultiAgentCard, generateOpenAPISpec, requestLogger };
|