volute 0.8.3 → 0.9.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.
- package/dist/{agent-YORVRB6I.js → agent-MB3OTRRK.js} +8 -8
- package/dist/api-client-YPKOZP2O.js +10 -0
- package/dist/{channel-RDGHBFSI.js → channel-G5D4VBXY.js} +67 -82
- package/dist/chunk-4RQBJWQX.js +17 -0
- package/dist/{chunk-23L3MKEV.js → chunk-STOEJOJO.js} +18 -4
- package/dist/cli.js +11 -11
- package/dist/{connector-ZP6MEFF4.js → connector-PK7D5GTN.js} +38 -21
- package/dist/{daemon-client-54J3EIZD.js → daemon-client-P44NU3KU.js} +1 -1
- package/dist/{daemon-restart-IMNCBWFV.js → daemon-restart-EKDXXHKH.js} +1 -1
- package/dist/daemon.js +252 -56
- package/dist/{delete-45TGQC4N.js → delete-WKQKE3FT.js} +7 -4
- package/dist/{env-KMNYGVZ2.js → env-HZMZSWWD.js} +85 -36
- package/dist/{history-PXJVYLVY.js → history-SH25BAA5.js} +13 -10
- package/dist/logs-V54B6QSG.js +77 -0
- package/dist/{package-2S7APQBC.js → package-WPX6LCYE.js} +1 -1
- package/dist/{restart-KVH3TK5N.js → restart-CCYM3MEC.js} +10 -4
- package/dist/{schedule-HCUCBNQI.js → schedule-XGBUF7NU.js} +26 -10
- package/dist/{send-BNC2S5BY.js → send-TFZ62XPZ.js} +37 -29
- package/dist/{start-QU73YTJW.js → start-6YRS6FF6.js} +7 -2
- package/dist/{status-Q6ZQJXNI.js → status-SIMKH3ZE.js} +8 -3
- package/dist/{stop-N7U5N6A7.js → stop-UQSNF4CG.js} +7 -2
- package/dist/{up-RZJMSVQS.js → up-J7AHQHIM.js} +1 -1
- package/dist/{upgrade-CZF6PN7Y.js → upgrade-BRNMSQBX.js} +13 -4
- package/dist/{variant-RKXPN5DH.js → variant-AQRAN6FR.js} +32 -15
- package/package.json +1 -1
- package/dist/logs-TZB3MTLZ.js +0 -37
- /package/dist/{chunk-6RDCTVQK.js → chunk-AWHQZDB4.js} +0 -0
package/dist/daemon.js
CHANGED
|
@@ -13,7 +13,19 @@ import {
|
|
|
13
13
|
getCurrentVersion
|
|
14
14
|
} from "./chunk-RT6Y7AR3.js";
|
|
15
15
|
import {
|
|
16
|
-
|
|
16
|
+
readVoluteConfig,
|
|
17
|
+
writeVoluteConfig
|
|
18
|
+
} from "./chunk-NETNFBA5.js";
|
|
19
|
+
import {
|
|
20
|
+
agentEnvPath,
|
|
21
|
+
loadMergedEnv,
|
|
22
|
+
readEnv,
|
|
23
|
+
sharedEnvPath,
|
|
24
|
+
writeEnv
|
|
25
|
+
} from "./chunk-QF22MYDJ.js";
|
|
26
|
+
import {
|
|
27
|
+
CHANNELS,
|
|
28
|
+
getChannelDriver
|
|
17
29
|
} from "./chunk-LIPPXNIE.js";
|
|
18
30
|
import {
|
|
19
31
|
agentMessages,
|
|
@@ -34,13 +46,6 @@ import {
|
|
|
34
46
|
users,
|
|
35
47
|
verifyUser
|
|
36
48
|
} from "./chunk-ECPQXRLB.js";
|
|
37
|
-
import {
|
|
38
|
-
readVoluteConfig,
|
|
39
|
-
writeVoluteConfig
|
|
40
|
-
} from "./chunk-NETNFBA5.js";
|
|
41
|
-
import {
|
|
42
|
-
loadMergedEnv
|
|
43
|
-
} from "./chunk-QF22MYDJ.js";
|
|
44
49
|
import {
|
|
45
50
|
slugify,
|
|
46
51
|
writeChannelEntry
|
|
@@ -847,7 +852,7 @@ var log = {
|
|
|
847
852
|
var logger_default = log;
|
|
848
853
|
|
|
849
854
|
// src/web/app.ts
|
|
850
|
-
import { Hono as
|
|
855
|
+
import { Hono as Hono16 } from "hono";
|
|
851
856
|
import { bodyLimit } from "hono/body-limit";
|
|
852
857
|
import { csrf } from "hono/csrf";
|
|
853
858
|
import { HTTPException } from "hono/http-exception";
|
|
@@ -1376,10 +1381,107 @@ var app2 = new Hono2().post("/register", zValidator("json", credentialsSchema),
|
|
|
1376
1381
|
}).route("/", admin);
|
|
1377
1382
|
var auth_default = app2;
|
|
1378
1383
|
|
|
1379
|
-
// src/web/routes/
|
|
1384
|
+
// src/web/routes/channels.ts
|
|
1380
1385
|
import { Hono as Hono3 } from "hono";
|
|
1386
|
+
function buildEnv(name) {
|
|
1387
|
+
return { ...loadMergedEnv(name), VOLUTE_AGENT: name, VOLUTE_AGENT_DIR: agentDir(name) };
|
|
1388
|
+
}
|
|
1389
|
+
var app3 = new Hono3().post("/:name/channels/send", requireAdmin, async (c) => {
|
|
1390
|
+
const name = c.req.param("name");
|
|
1391
|
+
if (!findAgent(name)) return c.json({ error: "Agent not found" }, 404);
|
|
1392
|
+
const { platform, uri, message } = await c.req.json();
|
|
1393
|
+
const driver = getChannelDriver(platform);
|
|
1394
|
+
if (!driver) return c.json({ error: `No driver for platform: ${platform}` }, 400);
|
|
1395
|
+
const env = buildEnv(name);
|
|
1396
|
+
try {
|
|
1397
|
+
await driver.send(env, uri, message);
|
|
1398
|
+
return c.json({ ok: true });
|
|
1399
|
+
} catch (err) {
|
|
1400
|
+
return c.json({ error: err instanceof Error ? err.message : String(err) }, 500);
|
|
1401
|
+
}
|
|
1402
|
+
}).get("/:name/channels/read", async (c) => {
|
|
1403
|
+
const name = c.req.param("name");
|
|
1404
|
+
if (!findAgent(name)) return c.json({ error: "Agent not found" }, 404);
|
|
1405
|
+
const platform = c.req.query("platform");
|
|
1406
|
+
const uri = c.req.query("uri");
|
|
1407
|
+
const limit = parseInt(c.req.query("limit") ?? "20", 10) || 20;
|
|
1408
|
+
if (!platform || !uri) return c.json({ error: "platform and uri required" }, 400);
|
|
1409
|
+
const driver = getChannelDriver(platform);
|
|
1410
|
+
if (!driver) return c.json({ error: `No driver for platform: ${platform}` }, 400);
|
|
1411
|
+
const env = buildEnv(name);
|
|
1412
|
+
try {
|
|
1413
|
+
const output = await driver.read(env, uri, limit);
|
|
1414
|
+
return c.text(output);
|
|
1415
|
+
} catch (err) {
|
|
1416
|
+
return c.json({ error: err instanceof Error ? err.message : String(err) }, 500);
|
|
1417
|
+
}
|
|
1418
|
+
}).get("/:name/channels/list", async (c) => {
|
|
1419
|
+
const name = c.req.param("name");
|
|
1420
|
+
if (!findAgent(name)) return c.json({ error: "Agent not found" }, 404);
|
|
1421
|
+
const platform = c.req.query("platform");
|
|
1422
|
+
const platforms = platform ? [platform] : Object.keys(CHANNELS);
|
|
1423
|
+
const env = buildEnv(name);
|
|
1424
|
+
const results = {};
|
|
1425
|
+
for (const p of platforms) {
|
|
1426
|
+
const driver = getChannelDriver(p);
|
|
1427
|
+
if (!driver?.listConversations) continue;
|
|
1428
|
+
try {
|
|
1429
|
+
const convs = await driver.listConversations(env);
|
|
1430
|
+
for (const conv of convs) {
|
|
1431
|
+
writeChannelEntry(name, conv.id, {
|
|
1432
|
+
platformId: conv.platformId,
|
|
1433
|
+
platform: p,
|
|
1434
|
+
name: conv.name,
|
|
1435
|
+
type: conv.type
|
|
1436
|
+
});
|
|
1437
|
+
}
|
|
1438
|
+
results[p] = convs;
|
|
1439
|
+
} catch (err) {
|
|
1440
|
+
results[p] = [{ error: err instanceof Error ? err.message : String(err) }];
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
return c.json(results);
|
|
1444
|
+
}).get("/:name/channels/users", async (c) => {
|
|
1445
|
+
const name = c.req.param("name");
|
|
1446
|
+
if (!findAgent(name)) return c.json({ error: "Agent not found" }, 404);
|
|
1447
|
+
const platform = c.req.query("platform");
|
|
1448
|
+
if (!platform) return c.json({ error: "platform required" }, 400);
|
|
1449
|
+
const driver = getChannelDriver(platform);
|
|
1450
|
+
if (!driver?.listUsers)
|
|
1451
|
+
return c.json({ error: `Platform ${platform} does not support listing users` }, 400);
|
|
1452
|
+
const env = buildEnv(name);
|
|
1453
|
+
try {
|
|
1454
|
+
const users2 = await driver.listUsers(env);
|
|
1455
|
+
return c.json(users2);
|
|
1456
|
+
} catch (err) {
|
|
1457
|
+
return c.json({ error: err instanceof Error ? err.message : String(err) }, 500);
|
|
1458
|
+
}
|
|
1459
|
+
}).post("/:name/channels/create", requireAdmin, async (c) => {
|
|
1460
|
+
const name = c.req.param("name");
|
|
1461
|
+
if (!findAgent(name)) return c.json({ error: "Agent not found" }, 404);
|
|
1462
|
+
const {
|
|
1463
|
+
platform,
|
|
1464
|
+
participants,
|
|
1465
|
+
name: convName
|
|
1466
|
+
} = await c.req.json();
|
|
1467
|
+
const driver = getChannelDriver(platform);
|
|
1468
|
+
if (!driver?.createConversation) {
|
|
1469
|
+
return c.json({ error: `Platform ${platform} does not support creating conversations` }, 400);
|
|
1470
|
+
}
|
|
1471
|
+
const env = buildEnv(name);
|
|
1472
|
+
try {
|
|
1473
|
+
const slug = await driver.createConversation(env, participants, convName);
|
|
1474
|
+
return c.json({ slug });
|
|
1475
|
+
} catch (err) {
|
|
1476
|
+
return c.json({ error: err instanceof Error ? err.message : String(err) }, 500);
|
|
1477
|
+
}
|
|
1478
|
+
});
|
|
1479
|
+
var channels_default = app3;
|
|
1480
|
+
|
|
1481
|
+
// src/web/routes/connectors.ts
|
|
1482
|
+
import { Hono as Hono4 } from "hono";
|
|
1381
1483
|
var CONNECTOR_TYPE_RE = /^[a-z][a-z0-9-]*$/;
|
|
1382
|
-
var
|
|
1484
|
+
var app4 = new Hono4().get("/:name/connectors", (c) => {
|
|
1383
1485
|
const name = c.req.param("name");
|
|
1384
1486
|
const entry = findAgent(name);
|
|
1385
1487
|
if (!entry) return c.json({ error: "Agent not found" }, 404);
|
|
@@ -1445,15 +1547,89 @@ var app3 = new Hono3().get("/:name/connectors", (c) => {
|
|
|
1445
1547
|
writeVoluteConfig(dir, config);
|
|
1446
1548
|
return c.json({ ok: true });
|
|
1447
1549
|
});
|
|
1448
|
-
var connectors_default =
|
|
1550
|
+
var connectors_default = app4;
|
|
1551
|
+
|
|
1552
|
+
// src/web/routes/env.ts
|
|
1553
|
+
import { Hono as Hono5 } from "hono";
|
|
1554
|
+
var app5 = new Hono5().get("/:name/env", (c) => {
|
|
1555
|
+
const name = c.req.param("name");
|
|
1556
|
+
if (!findAgent(name)) return c.json({ error: "Agent not found" }, 404);
|
|
1557
|
+
const shared = readEnv(sharedEnvPath());
|
|
1558
|
+
const agent = readEnv(agentEnvPath(name));
|
|
1559
|
+
return c.json({ shared, agent });
|
|
1560
|
+
}).get("/:name/env/:key", (c) => {
|
|
1561
|
+
const name = c.req.param("name");
|
|
1562
|
+
if (!findAgent(name)) return c.json({ error: "Agent not found" }, 404);
|
|
1563
|
+
const key = c.req.param("key");
|
|
1564
|
+
const merged = loadMergedEnv(name);
|
|
1565
|
+
const value = merged[key];
|
|
1566
|
+
if (value === void 0) return c.json({ error: "Key not found" }, 404);
|
|
1567
|
+
return c.json({ value });
|
|
1568
|
+
}).put("/:name/env/:key", requireAdmin, async (c) => {
|
|
1569
|
+
const name = c.req.param("name");
|
|
1570
|
+
if (!findAgent(name)) return c.json({ error: "Agent not found" }, 404);
|
|
1571
|
+
const key = c.req.param("key");
|
|
1572
|
+
let body;
|
|
1573
|
+
try {
|
|
1574
|
+
body = await c.req.json();
|
|
1575
|
+
} catch {
|
|
1576
|
+
return c.json({ error: "Invalid JSON body" }, 400);
|
|
1577
|
+
}
|
|
1578
|
+
if (typeof body.value !== "string") {
|
|
1579
|
+
return c.json({ error: "Missing required field: value" }, 400);
|
|
1580
|
+
}
|
|
1581
|
+
const path = agentEnvPath(name);
|
|
1582
|
+
const env = readEnv(path);
|
|
1583
|
+
env[key] = body.value;
|
|
1584
|
+
writeEnv(path, env);
|
|
1585
|
+
return c.json({ ok: true });
|
|
1586
|
+
}).delete("/:name/env/:key", requireAdmin, (c) => {
|
|
1587
|
+
const name = c.req.param("name");
|
|
1588
|
+
if (!findAgent(name)) return c.json({ error: "Agent not found" }, 404);
|
|
1589
|
+
const key = c.req.param("key");
|
|
1590
|
+
const path = agentEnvPath(name);
|
|
1591
|
+
const env = readEnv(path);
|
|
1592
|
+
if (!(key in env)) return c.json({ error: "Key not found" }, 404);
|
|
1593
|
+
delete env[key];
|
|
1594
|
+
writeEnv(path, env);
|
|
1595
|
+
return c.json({ ok: true });
|
|
1596
|
+
});
|
|
1597
|
+
var sharedEnvApp = new Hono5().get("/", (c) => {
|
|
1598
|
+
return c.json(readEnv(sharedEnvPath()));
|
|
1599
|
+
}).put("/:key", requireAdmin, async (c) => {
|
|
1600
|
+
const key = c.req.param("key");
|
|
1601
|
+
let body;
|
|
1602
|
+
try {
|
|
1603
|
+
body = await c.req.json();
|
|
1604
|
+
} catch {
|
|
1605
|
+
return c.json({ error: "Invalid JSON body" }, 400);
|
|
1606
|
+
}
|
|
1607
|
+
if (typeof body.value !== "string") {
|
|
1608
|
+
return c.json({ error: "Missing required field: value" }, 400);
|
|
1609
|
+
}
|
|
1610
|
+
const path = sharedEnvPath();
|
|
1611
|
+
const env = readEnv(path);
|
|
1612
|
+
env[key] = body.value;
|
|
1613
|
+
writeEnv(path, env);
|
|
1614
|
+
return c.json({ ok: true });
|
|
1615
|
+
}).delete("/:key", requireAdmin, (c) => {
|
|
1616
|
+
const key = c.req.param("key");
|
|
1617
|
+
const path = sharedEnvPath();
|
|
1618
|
+
const env = readEnv(path);
|
|
1619
|
+
if (!(key in env)) return c.json({ error: "Key not found" }, 404);
|
|
1620
|
+
delete env[key];
|
|
1621
|
+
writeEnv(path, env);
|
|
1622
|
+
return c.json({ ok: true });
|
|
1623
|
+
});
|
|
1624
|
+
var env_default = app5;
|
|
1449
1625
|
|
|
1450
1626
|
// src/web/routes/files.ts
|
|
1451
1627
|
import { existsSync as existsSync5 } from "fs";
|
|
1452
1628
|
import { readdir, readFile } from "fs/promises";
|
|
1453
1629
|
import { resolve as resolve6 } from "path";
|
|
1454
|
-
import { Hono as
|
|
1630
|
+
import { Hono as Hono6 } from "hono";
|
|
1455
1631
|
var ALLOWED_FILES = /* @__PURE__ */ new Set(["SOUL.md", "MEMORY.md", "CLAUDE.md", "VOLUTE.md"]);
|
|
1456
|
-
var
|
|
1632
|
+
var app6 = new Hono6().get("/:name/files", async (c) => {
|
|
1457
1633
|
const name = c.req.param("name");
|
|
1458
1634
|
const entry = findAgent(name);
|
|
1459
1635
|
if (!entry) return c.json({ error: "Agent not found" }, 404);
|
|
@@ -1479,15 +1655,15 @@ var app4 = new Hono4().get("/:name/files", async (c) => {
|
|
|
1479
1655
|
const content = await readFile(filePath, "utf-8");
|
|
1480
1656
|
return c.json({ filename, content });
|
|
1481
1657
|
});
|
|
1482
|
-
var files_default =
|
|
1658
|
+
var files_default = app6;
|
|
1483
1659
|
|
|
1484
1660
|
// src/web/routes/logs.ts
|
|
1485
1661
|
import { spawn as spawn2 } from "child_process";
|
|
1486
1662
|
import { existsSync as existsSync6 } from "fs";
|
|
1487
1663
|
import { resolve as resolve7 } from "path";
|
|
1488
|
-
import { Hono as
|
|
1664
|
+
import { Hono as Hono7 } from "hono";
|
|
1489
1665
|
import { streamSSE } from "hono/streaming";
|
|
1490
|
-
var
|
|
1666
|
+
var app7 = new Hono7().get("/:name/logs", async (c) => {
|
|
1491
1667
|
const name = c.req.param("name");
|
|
1492
1668
|
const entry = findAgent(name);
|
|
1493
1669
|
if (!entry) return c.json({ error: "Agent not found" }, 404);
|
|
@@ -1515,11 +1691,30 @@ var app5 = new Hono5().get("/:name/logs", async (c) => {
|
|
|
1515
1691
|
stream.onAbort(resolve11);
|
|
1516
1692
|
});
|
|
1517
1693
|
});
|
|
1694
|
+
}).get("/:name/logs/tail", async (c) => {
|
|
1695
|
+
const name = c.req.param("name");
|
|
1696
|
+
const entry = findAgent(name);
|
|
1697
|
+
if (!entry) return c.json({ error: "Agent not found" }, 404);
|
|
1698
|
+
const logFile = resolve7(stateDir(name), "logs", "agent.log");
|
|
1699
|
+
if (!existsSync6(logFile)) {
|
|
1700
|
+
return c.json({ error: "No log file found" }, 404);
|
|
1701
|
+
}
|
|
1702
|
+
const nParam = parseInt(c.req.query("n") ?? "50", 10);
|
|
1703
|
+
const n = Number.isFinite(nParam) && nParam > 0 ? Math.min(nParam, 1e4) : 50;
|
|
1704
|
+
const tail = spawn2("tail", ["-n", String(n), logFile]);
|
|
1705
|
+
let output = "";
|
|
1706
|
+
tail.stdout.on("data", (data) => {
|
|
1707
|
+
output += data.toString();
|
|
1708
|
+
});
|
|
1709
|
+
await new Promise((resolve11) => {
|
|
1710
|
+
tail.on("exit", resolve11);
|
|
1711
|
+
});
|
|
1712
|
+
return c.text(output);
|
|
1518
1713
|
});
|
|
1519
|
-
var logs_default =
|
|
1714
|
+
var logs_default = app7;
|
|
1520
1715
|
|
|
1521
1716
|
// src/web/routes/schedules.ts
|
|
1522
|
-
import { Hono as
|
|
1717
|
+
import { Hono as Hono8 } from "hono";
|
|
1523
1718
|
function readSchedules(name) {
|
|
1524
1719
|
return readVoluteConfig(agentDir(name))?.schedules ?? [];
|
|
1525
1720
|
}
|
|
@@ -1530,7 +1725,7 @@ function writeSchedules(name, schedules) {
|
|
|
1530
1725
|
writeVoluteConfig(dir, config);
|
|
1531
1726
|
getScheduler().loadSchedules(name);
|
|
1532
1727
|
}
|
|
1533
|
-
var
|
|
1728
|
+
var app8 = new Hono8().get("/:name/schedules", (c) => {
|
|
1534
1729
|
const name = c.req.param("name");
|
|
1535
1730
|
if (!findAgent(name)) return c.json({ error: "Agent not found" }, 404);
|
|
1536
1731
|
return c.json(readSchedules(name));
|
|
@@ -1598,12 +1793,12 @@ var app6 = new Hono6().get("/:name/schedules", (c) => {
|
|
|
1598
1793
|
return c.json({ error: "Failed to reach agent" }, 502);
|
|
1599
1794
|
}
|
|
1600
1795
|
});
|
|
1601
|
-
var schedules_default =
|
|
1796
|
+
var schedules_default = app8;
|
|
1602
1797
|
|
|
1603
1798
|
// src/web/routes/system.ts
|
|
1604
|
-
import { Hono as
|
|
1799
|
+
import { Hono as Hono9 } from "hono";
|
|
1605
1800
|
import { streamSSE as streamSSE2 } from "hono/streaming";
|
|
1606
|
-
var
|
|
1801
|
+
var app9 = new Hono9().get("/logs", async (c) => {
|
|
1607
1802
|
const user = c.get("user");
|
|
1608
1803
|
if (user.role !== "admin") return c.json({ error: "Forbidden" }, 403);
|
|
1609
1804
|
return streamSSE2(c, async (stream) => {
|
|
@@ -1622,18 +1817,18 @@ var app7 = new Hono7().get("/logs", async (c) => {
|
|
|
1622
1817
|
});
|
|
1623
1818
|
});
|
|
1624
1819
|
});
|
|
1625
|
-
var system_default =
|
|
1820
|
+
var system_default = app9;
|
|
1626
1821
|
|
|
1627
1822
|
// src/web/routes/typing.ts
|
|
1628
1823
|
import { zValidator as zValidator2 } from "@hono/zod-validator";
|
|
1629
|
-
import { Hono as
|
|
1824
|
+
import { Hono as Hono10 } from "hono";
|
|
1630
1825
|
import { z as z2 } from "zod";
|
|
1631
1826
|
var typingSchema = z2.object({
|
|
1632
1827
|
channel: z2.string().min(1),
|
|
1633
1828
|
sender: z2.string().min(1),
|
|
1634
1829
|
active: z2.boolean()
|
|
1635
1830
|
});
|
|
1636
|
-
var
|
|
1831
|
+
var app10 = new Hono10().post("/:name/typing", zValidator2("json", typingSchema), (c) => {
|
|
1637
1832
|
const { channel, sender, active } = c.req.valid("json");
|
|
1638
1833
|
const map = getTypingMap();
|
|
1639
1834
|
if (active) {
|
|
@@ -1650,13 +1845,13 @@ var app8 = new Hono8().post("/:name/typing", zValidator2("json", typingSchema),
|
|
|
1650
1845
|
const map = getTypingMap();
|
|
1651
1846
|
return c.json({ typing: map.get(channel) });
|
|
1652
1847
|
});
|
|
1653
|
-
var typing_default =
|
|
1848
|
+
var typing_default = app10;
|
|
1654
1849
|
|
|
1655
1850
|
// src/web/routes/update.ts
|
|
1656
1851
|
import { spawn as spawn3 } from "child_process";
|
|
1657
|
-
import { Hono as
|
|
1852
|
+
import { Hono as Hono11 } from "hono";
|
|
1658
1853
|
var bin;
|
|
1659
|
-
var
|
|
1854
|
+
var app11 = new Hono11().get("/update", async (c) => {
|
|
1660
1855
|
const result = await checkForUpdate();
|
|
1661
1856
|
return c.json(result);
|
|
1662
1857
|
}).post("/update", requireAdmin, async (c) => {
|
|
@@ -1671,11 +1866,11 @@ var app9 = new Hono9().get("/update", async (c) => {
|
|
|
1671
1866
|
child.unref();
|
|
1672
1867
|
return c.json({ ok: true, message: "Updating..." });
|
|
1673
1868
|
});
|
|
1674
|
-
var update_default =
|
|
1869
|
+
var update_default = app11;
|
|
1675
1870
|
|
|
1676
1871
|
// src/web/routes/variants.ts
|
|
1677
|
-
import { Hono as
|
|
1678
|
-
var
|
|
1872
|
+
import { Hono as Hono12 } from "hono";
|
|
1873
|
+
var app12 = new Hono12().get("/:name/variants", async (c) => {
|
|
1679
1874
|
const name = c.req.param("name");
|
|
1680
1875
|
const entry = findAgent(name);
|
|
1681
1876
|
if (!entry) return c.json({ error: "Agent not found" }, 404);
|
|
@@ -1689,13 +1884,13 @@ var app10 = new Hono10().get("/:name/variants", async (c) => {
|
|
|
1689
1884
|
);
|
|
1690
1885
|
return c.json(results);
|
|
1691
1886
|
});
|
|
1692
|
-
var variants_default =
|
|
1887
|
+
var variants_default = app12;
|
|
1693
1888
|
|
|
1694
1889
|
// src/web/routes/volute/chat.ts
|
|
1695
1890
|
import { readFileSync as readFileSync4 } from "fs";
|
|
1696
1891
|
import { resolve as resolve8 } from "path";
|
|
1697
1892
|
import { zValidator as zValidator3 } from "@hono/zod-validator";
|
|
1698
|
-
import { Hono as
|
|
1893
|
+
import { Hono as Hono13 } from "hono";
|
|
1699
1894
|
import { streamSSE as streamSSE3 } from "hono/streaming";
|
|
1700
1895
|
import { z as z3 } from "zod";
|
|
1701
1896
|
|
|
@@ -1922,7 +2117,7 @@ function daemonFetchInternal(path, body) {
|
|
|
1922
2117
|
if (token) headers.Authorization = `Bearer ${token}`;
|
|
1923
2118
|
return fetch(`${daemonUrl}${path}`, { method: "POST", headers, body });
|
|
1924
2119
|
}
|
|
1925
|
-
var
|
|
2120
|
+
var app13 = new Hono13().post("/:name/chat", zValidator3("json", chatSchema), async (c) => {
|
|
1926
2121
|
const name = c.req.param("name");
|
|
1927
2122
|
const [baseName] = name.split("@", 2);
|
|
1928
2123
|
const entry = findAgent(baseName);
|
|
@@ -2054,18 +2249,18 @@ var app11 = new Hono11().post("/:name/chat", zValidator3("json", chatSchema), as
|
|
|
2054
2249
|
});
|
|
2055
2250
|
});
|
|
2056
2251
|
});
|
|
2057
|
-
var chat_default =
|
|
2252
|
+
var chat_default = app13;
|
|
2058
2253
|
|
|
2059
2254
|
// src/web/routes/volute/conversations.ts
|
|
2060
2255
|
import { zValidator as zValidator4 } from "@hono/zod-validator";
|
|
2061
|
-
import { Hono as
|
|
2256
|
+
import { Hono as Hono14 } from "hono";
|
|
2062
2257
|
import { z as z4 } from "zod";
|
|
2063
2258
|
var createConvSchema = z4.object({
|
|
2064
2259
|
title: z4.string().optional(),
|
|
2065
2260
|
participantIds: z4.array(z4.number()).optional(),
|
|
2066
2261
|
participantNames: z4.array(z4.string()).optional()
|
|
2067
2262
|
});
|
|
2068
|
-
var
|
|
2263
|
+
var app14 = new Hono14().get("/:name/conversations", async (c) => {
|
|
2069
2264
|
const name = c.req.param("name");
|
|
2070
2265
|
const user = c.get("user");
|
|
2071
2266
|
let lookupId = user.id;
|
|
@@ -2150,17 +2345,17 @@ var app12 = new Hono12().get("/:name/conversations", async (c) => {
|
|
|
2150
2345
|
if (!deleted) return c.json({ error: "Conversation not found" }, 404);
|
|
2151
2346
|
return c.json({ ok: true });
|
|
2152
2347
|
});
|
|
2153
|
-
var conversations_default =
|
|
2348
|
+
var conversations_default = app14;
|
|
2154
2349
|
|
|
2155
2350
|
// src/web/routes/volute/user-conversations.ts
|
|
2156
2351
|
import { zValidator as zValidator5 } from "@hono/zod-validator";
|
|
2157
|
-
import { Hono as
|
|
2352
|
+
import { Hono as Hono15 } from "hono";
|
|
2158
2353
|
import { z as z5 } from "zod";
|
|
2159
2354
|
var createSchema = z5.object({
|
|
2160
2355
|
title: z5.string().optional(),
|
|
2161
2356
|
participantNames: z5.array(z5.string()).min(1)
|
|
2162
2357
|
});
|
|
2163
|
-
var
|
|
2358
|
+
var app15 = new Hono15().use("*", authMiddleware).get("/", async (c) => {
|
|
2164
2359
|
const user = c.get("user");
|
|
2165
2360
|
const convs = await listConversationsWithParticipants(user.id);
|
|
2166
2361
|
return c.json(convs);
|
|
@@ -2209,11 +2404,11 @@ var app13 = new Hono13().use("*", authMiddleware).get("/", async (c) => {
|
|
|
2209
2404
|
if (!deleted) return c.json({ error: "Conversation not found" }, 404);
|
|
2210
2405
|
return c.json({ ok: true });
|
|
2211
2406
|
});
|
|
2212
|
-
var user_conversations_default =
|
|
2407
|
+
var user_conversations_default = app15;
|
|
2213
2408
|
|
|
2214
2409
|
// src/web/app.ts
|
|
2215
|
-
var
|
|
2216
|
-
|
|
2410
|
+
var app16 = new Hono16();
|
|
2411
|
+
app16.onError((err, c) => {
|
|
2217
2412
|
if (err instanceof HTTPException) {
|
|
2218
2413
|
return err.getResponse();
|
|
2219
2414
|
}
|
|
@@ -2224,10 +2419,10 @@ app14.onError((err, c) => {
|
|
|
2224
2419
|
});
|
|
2225
2420
|
return c.json({ error: "Internal server error" }, 500);
|
|
2226
2421
|
});
|
|
2227
|
-
|
|
2422
|
+
app16.notFound((c) => {
|
|
2228
2423
|
return c.json({ error: "Not found" }, 404);
|
|
2229
2424
|
});
|
|
2230
|
-
|
|
2425
|
+
app16.use("*", async (c, next) => {
|
|
2231
2426
|
const start = Date.now();
|
|
2232
2427
|
await next();
|
|
2233
2428
|
const duration = Date.now() - start;
|
|
@@ -2238,7 +2433,7 @@ app14.use("*", async (c, next) => {
|
|
|
2238
2433
|
duration
|
|
2239
2434
|
});
|
|
2240
2435
|
});
|
|
2241
|
-
|
|
2436
|
+
app16.get("/api/health", (c) => {
|
|
2242
2437
|
let version = "unknown";
|
|
2243
2438
|
let cached = null;
|
|
2244
2439
|
try {
|
|
@@ -2253,13 +2448,14 @@ app14.get("/api/health", (c) => {
|
|
|
2253
2448
|
...cached?.updateAvailable ? { updateAvailable: true, latest: cached.latest } : {}
|
|
2254
2449
|
});
|
|
2255
2450
|
});
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
var
|
|
2451
|
+
app16.use("/api/*", bodyLimit({ maxSize: 10 * 1024 * 1024 }));
|
|
2452
|
+
app16.use("/api/*", csrf());
|
|
2453
|
+
app16.use("/api/agents/*", authMiddleware);
|
|
2454
|
+
app16.use("/api/conversations/*", authMiddleware);
|
|
2455
|
+
app16.use("/api/system/*", authMiddleware);
|
|
2456
|
+
app16.use("/api/env/*", authMiddleware);
|
|
2457
|
+
var routes = app16.route("/api/auth", auth_default).route("/api/system", system_default).route("/api/system", update_default).route("/api/agents", agents_default).route("/api/agents", chat_default).route("/api/agents", connectors_default).route("/api/agents", schedules_default).route("/api/agents", logs_default).route("/api/agents", typing_default).route("/api/agents", variants_default).route("/api/agents", files_default).route("/api/agents", channels_default).route("/api/agents", env_default).route("/api/agents", conversations_default).route("/api/env", sharedEnvApp).route("/api/conversations", user_conversations_default);
|
|
2458
|
+
var app_default = app16;
|
|
2263
2459
|
|
|
2264
2460
|
// src/web/server.ts
|
|
2265
2461
|
var MIME_TYPES = {
|
|
@@ -2355,10 +2551,10 @@ async function startDaemon(opts) {
|
|
|
2355
2551
|
}
|
|
2356
2552
|
throw err;
|
|
2357
2553
|
}
|
|
2358
|
-
writeFileSync2(DAEMON_PID_PATH, myPid, { mode:
|
|
2554
|
+
writeFileSync2(DAEMON_PID_PATH, myPid, { mode: 420 });
|
|
2359
2555
|
writeFileSync2(DAEMON_JSON_PATH, `${JSON.stringify({ port, hostname, token }, null, 2)}
|
|
2360
2556
|
`, {
|
|
2361
|
-
mode:
|
|
2557
|
+
mode: 420
|
|
2362
2558
|
});
|
|
2363
2559
|
const manager = initAgentManager();
|
|
2364
2560
|
manager.loadCrashAttempts();
|
|
@@ -33,10 +33,13 @@ async function run(args) {
|
|
|
33
33
|
process.exit(1);
|
|
34
34
|
}
|
|
35
35
|
try {
|
|
36
|
-
const {
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
const { getClient, urlOf } = await import("./api-client-YPKOZP2O.js");
|
|
37
|
+
const { daemonFetch } = await import("./daemon-client-P44NU3KU.js");
|
|
38
|
+
const client = getClient();
|
|
39
|
+
const res = await daemonFetch(
|
|
40
|
+
urlOf(client.api.agents[":name"].stop.$url({ param: { name } })),
|
|
41
|
+
{ method: "POST" }
|
|
42
|
+
);
|
|
40
43
|
if (res.ok) {
|
|
41
44
|
console.log(`Stopped ${name}.`);
|
|
42
45
|
}
|