@radaros/transport 0.3.29 → 0.3.31

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.cjs CHANGED
@@ -1607,6 +1607,35 @@ function createAgentRouter(opts) {
1607
1607
  res.json(reg.list());
1608
1608
  });
1609
1609
  }
1610
+ if (opts.scheduler) {
1611
+ const queue = opts.scheduler;
1612
+ router.get("/schedules", async (_req, res) => {
1613
+ try {
1614
+ const schedules = await queue.listSchedules();
1615
+ res.json(schedules);
1616
+ } catch (err) {
1617
+ res.status(500).json({ error: err.message });
1618
+ }
1619
+ });
1620
+ router.post("/schedules", async (req, res) => {
1621
+ try {
1622
+ const { id, cron, timezone, agent, workflow } = req.body;
1623
+ if (!id || !cron) return res.status(400).json({ error: "id and cron are required" });
1624
+ const result = await queue.schedule({ id, cron, timezone, agent, workflow });
1625
+ res.status(201).json(result);
1626
+ } catch (err) {
1627
+ res.status(400).json({ error: err.message });
1628
+ }
1629
+ });
1630
+ router.delete("/schedules/:id", async (req, res) => {
1631
+ try {
1632
+ await queue.unschedule(req.params.id);
1633
+ res.json({ status: "unscheduled", id: req.params.id });
1634
+ } catch (err) {
1635
+ res.status(404).json({ error: err.message });
1636
+ }
1637
+ });
1638
+ }
1610
1639
  if (opts.admin) {
1611
1640
  const adminOpts = typeof opts.admin === "object" ? opts.admin : {};
1612
1641
  const { router: adminRouter } = createAdminRouter({
package/dist/index.d.cts CHANGED
@@ -201,6 +201,11 @@ interface RouterOptions {
201
201
  mcpManager?: MCPManager;
202
202
  middleware?: any[];
203
203
  };
204
+ /**
205
+ * Enable schedule management routes under `/schedules`.
206
+ * Pass an AgentQueue instance from `@radaros/queue`.
207
+ */
208
+ scheduler?: any;
204
209
  }
205
210
 
206
211
  declare function createAgentRouter(opts: RouterOptions): any;
package/dist/index.d.ts CHANGED
@@ -201,6 +201,11 @@ interface RouterOptions {
201
201
  mcpManager?: MCPManager;
202
202
  middleware?: any[];
203
203
  };
204
+ /**
205
+ * Enable schedule management routes under `/schedules`.
206
+ * Pass an AgentQueue instance from `@radaros/queue`.
207
+ */
208
+ scheduler?: any;
204
209
  }
205
210
 
206
211
  declare function createAgentRouter(opts: RouterOptions): any;
package/dist/index.js CHANGED
@@ -1564,6 +1564,35 @@ function createAgentRouter(opts) {
1564
1564
  res.json(reg.list());
1565
1565
  });
1566
1566
  }
1567
+ if (opts.scheduler) {
1568
+ const queue = opts.scheduler;
1569
+ router.get("/schedules", async (_req, res) => {
1570
+ try {
1571
+ const schedules = await queue.listSchedules();
1572
+ res.json(schedules);
1573
+ } catch (err) {
1574
+ res.status(500).json({ error: err.message });
1575
+ }
1576
+ });
1577
+ router.post("/schedules", async (req, res) => {
1578
+ try {
1579
+ const { id, cron, timezone, agent, workflow } = req.body;
1580
+ if (!id || !cron) return res.status(400).json({ error: "id and cron are required" });
1581
+ const result = await queue.schedule({ id, cron, timezone, agent, workflow });
1582
+ res.status(201).json(result);
1583
+ } catch (err) {
1584
+ res.status(400).json({ error: err.message });
1585
+ }
1586
+ });
1587
+ router.delete("/schedules/:id", async (req, res) => {
1588
+ try {
1589
+ await queue.unschedule(req.params.id);
1590
+ res.json({ status: "unscheduled", id: req.params.id });
1591
+ } catch (err) {
1592
+ res.status(404).json({ error: err.message });
1593
+ }
1594
+ });
1595
+ }
1567
1596
  if (opts.admin) {
1568
1597
  const adminOpts = typeof opts.admin === "object" ? opts.admin : {};
1569
1598
  const { router: adminRouter } = createAdminRouter({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@radaros/transport",
3
- "version": "0.3.29",
3
+ "version": "0.3.31",
4
4
  "description": "HTTP and WebSocket transport layer for RadarOS agents",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -42,7 +42,7 @@
42
42
  "typescript": "^5.6.0"
43
43
  },
44
44
  "peerDependencies": {
45
- "@radaros/core": "^0.3.29",
45
+ "@radaros/core": "^0.3.31",
46
46
  "@types/express": "^4.0.0 || ^5.0.0",
47
47
  "express": "^4.0.0 || ^5.0.0",
48
48
  "multer": ">=2.0.0",