@radaros/transport 0.3.14 → 0.3.15

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 CHANGED
@@ -29,8 +29,9 @@ app.listen(3000);
29
29
 
30
30
  ## Features
31
31
 
32
- - **Express Router** — REST API with streaming support
33
- - **Socket.IO Gateway** — Real-time WebSocket communication
32
+ - **Auto-Discovery** — Reads from the global `Registry` at request time; agents created after server start are immediately available
33
+ - **Express Router** — REST API with streaming support and list endpoints (`GET /agents`, `/teams`, `/workflows`, `/tools`)
34
+ - **Socket.IO Gateway** — Real-time WebSocket communication with dynamic agent/team lookup and tool discovery
34
35
  - **A2A Server** — Agent-to-Agent protocol support
35
36
  - **CORS & Rate Limiting** — Built-in security middleware
36
37
  - **Swagger** — Auto-generated API documentation
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Agent, A2AAgentCard, Registry, Servable, Team, Workflow, EventBus, VoiceAgent } from '@radaros/core';
1
+ import { Agent, A2AAgentCard, Registry, Servable, Team, Workflow, ToolDef, Toolkit, EventBus, VoiceAgent } from '@radaros/core';
2
2
 
3
3
  interface A2AServerOptions {
4
4
  agents: Record<string, Agent>;
@@ -104,6 +104,10 @@ interface RouterOptions {
104
104
  windowMs?: number;
105
105
  max?: number;
106
106
  } | boolean;
107
+ /** Named tool library exposed via GET /tools. Tools from toolkits are auto-collected. */
108
+ toolLibrary?: Record<string, ToolDef>;
109
+ /** Toolkit instances whose tools are exposed via GET /tools. Merged with toolLibrary. */
110
+ toolkits?: Toolkit[];
107
111
  }
108
112
 
109
113
  declare function createAgentRouter(opts: RouterOptions): any;
@@ -218,6 +222,10 @@ interface GatewayOptions {
218
222
  authMiddleware?: (socket: any, next: (err?: Error) => void) => void;
219
223
  /** Max requests per minute per socket. Default: 60 */
220
224
  maxRequestsPerMinute?: number;
225
+ /** Named tool library exposed via tools.list event. */
226
+ toolLibrary?: Record<string, ToolDef>;
227
+ /** Toolkit instances whose tools are exposed via tools.list. Merged with toolLibrary. */
228
+ toolkits?: Toolkit[];
221
229
  }
222
230
 
223
231
  declare function createAgentGateway(opts: GatewayOptions): void;
package/dist/index.js CHANGED
@@ -431,7 +431,7 @@ function requestLogger(options) {
431
431
 
432
432
  // src/express/router-factory.ts
433
433
  import { createRequire as createRequire4 } from "module";
434
- import { classifyServables, registry as globalRegistry } from "@radaros/core";
434
+ import { classifyServables, collectToolkitTools, describeToolLibrary, registry as globalRegistry } from "@radaros/core";
435
435
 
436
436
  // src/express/swagger.ts
437
437
  import { createRequire as createRequire3 } from "module";
@@ -1287,6 +1287,22 @@ function createAgentRouter(opts) {
1287
1287
  res.json(reg.list());
1288
1288
  });
1289
1289
  }
1290
+ const fromToolkits = opts.toolkits ? collectToolkitTools(opts.toolkits) : {};
1291
+ const mergedTools = { ...fromToolkits, ...opts.toolLibrary ?? {} };
1292
+ if (Object.keys(mergedTools).length > 0) {
1293
+ router.get("/tools", (_req, res) => {
1294
+ res.json(describeToolLibrary(mergedTools));
1295
+ });
1296
+ router.get("/tools/:name", (req, res) => {
1297
+ const tool = mergedTools[req.params.name];
1298
+ if (!tool) return res.status(404).json({ error: `Tool "${req.params.name}" not found` });
1299
+ res.json({
1300
+ name: tool.name,
1301
+ description: tool.description,
1302
+ parameters: Object.keys(tool.parameters.shape ?? {})
1303
+ });
1304
+ });
1305
+ }
1290
1306
  return router;
1291
1307
  }
1292
1308
 
@@ -1404,7 +1420,7 @@ function createBrowserGateway(opts) {
1404
1420
  }
1405
1421
 
1406
1422
  // src/socketio/gateway.ts
1407
- import { classifyServables as classifyServables2, registry as globalRegistry2 } from "@radaros/core";
1423
+ import { classifyServables as classifyServables2, collectToolkitTools as collectToolkitTools2, describeToolLibrary as describeToolLibrary2, registry as globalRegistry2 } from "@radaros/core";
1408
1424
  function createSocketRateLimiter(maxPerMinute = 60) {
1409
1425
  return () => {
1410
1426
  let count = 0;
@@ -1482,6 +1498,54 @@ function createAgentGateway(opts) {
1482
1498
  socket.emit("agent.error", { error: error.message });
1483
1499
  }
1484
1500
  });
1501
+ socket.on("agents.list", (_data, ack) => {
1502
+ if (reg) {
1503
+ ack?.(reg.describeAgents());
1504
+ } else {
1505
+ const names = Object.keys(opts.agents ?? {});
1506
+ ack?.(names.map((n) => ({ name: n })));
1507
+ }
1508
+ });
1509
+ socket.on("teams.list", (_data, ack) => {
1510
+ if (reg) {
1511
+ ack?.(reg.describeTeams());
1512
+ } else {
1513
+ const names = Object.keys(opts.teams ?? {});
1514
+ ack?.(names.map((n) => ({ name: n })));
1515
+ }
1516
+ });
1517
+ socket.on("workflows.list", (_data, ack) => {
1518
+ if (reg) {
1519
+ ack?.(reg.describeWorkflows());
1520
+ } else {
1521
+ ack?.([]);
1522
+ }
1523
+ });
1524
+ socket.on("registry.list", (_data, ack) => {
1525
+ if (reg) {
1526
+ ack?.(reg.list());
1527
+ } else {
1528
+ ack?.({
1529
+ agents: Object.keys(opts.agents ?? {}),
1530
+ teams: Object.keys(opts.teams ?? {}),
1531
+ workflows: []
1532
+ });
1533
+ }
1534
+ });
1535
+ const fromToolkits = opts.toolkits ? collectToolkitTools2(opts.toolkits) : {};
1536
+ const mergedTools = { ...fromToolkits, ...opts.toolLibrary ?? {} };
1537
+ socket.on("tools.list", (_data, ack) => {
1538
+ ack?.(describeToolLibrary2(mergedTools));
1539
+ });
1540
+ socket.on("tools.get", (data, ack) => {
1541
+ const tool = mergedTools[data?.name];
1542
+ if (!tool) return ack?.({ error: `Tool "${data?.name}" not found` });
1543
+ ack?.({
1544
+ name: tool.name,
1545
+ description: tool.description,
1546
+ parameters: Object.keys(tool.parameters.shape ?? {})
1547
+ });
1548
+ });
1485
1549
  socket.on("disconnect", () => {
1486
1550
  });
1487
1551
  socket.on("team.run", async (data) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@radaros/transport",
3
- "version": "0.3.14",
3
+ "version": "0.3.15",
4
4
  "description": "HTTP and WebSocket transport layer for RadarOS agents",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -39,7 +39,7 @@
39
39
  "typescript": "^5.6.0"
40
40
  },
41
41
  "peerDependencies": {
42
- "@radaros/core": "^0.3.14",
42
+ "@radaros/core": "^0.3.15",
43
43
  "@types/express": "^4.0.0 || ^5.0.0",
44
44
  "express": "^4.0.0 || ^5.0.0",
45
45
  "multer": ">=2.0.0",