teleton 0.7.0 → 0.7.2

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/cli/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  TelegramUserClient,
3
3
  main
4
- } from "../chunk-OGIG552S.js";
4
+ } from "../chunk-VSMUAU5X.js";
5
5
  import "../chunk-UDD7FYOU.js";
6
6
  import "../chunk-EHEV7FJ7.js";
7
7
  import "../chunk-U7FQYCBQ.js";
@@ -14,7 +14,7 @@ import {
14
14
  readRawConfig,
15
15
  setNestedValue,
16
16
  writeRawConfig
17
- } from "../chunk-TCD4NZDA.js";
17
+ } from "../chunk-JHKWHGBM.js";
18
18
  import {
19
19
  ConfigSchema,
20
20
  DealsConfigSchema,
@@ -38,9 +38,9 @@ import {
38
38
  validateApiKeyFormat
39
39
  } from "../chunk-LRCPA7SC.js";
40
40
  import "../chunk-OCLG5GKI.js";
41
- import "../chunk-N3F7E7DR.js";
42
- import "../chunk-FNV5FF35.js";
41
+ import "../chunk-RBU6JXD3.js";
43
42
  import "../chunk-UCN6TI25.js";
43
+ import "../chunk-FNV5FF35.js";
44
44
  import "../chunk-XBKSS6DM.js";
45
45
  import {
46
46
  TELEGRAM_MAX_MESSAGE_LENGTH
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  TeletonApp,
3
3
  main
4
- } from "./chunk-OGIG552S.js";
4
+ } from "./chunk-VSMUAU5X.js";
5
5
  import "./chunk-UDD7FYOU.js";
6
6
  import "./chunk-EHEV7FJ7.js";
7
7
  import "./chunk-U7FQYCBQ.js";
8
- import "./chunk-TCD4NZDA.js";
8
+ import "./chunk-JHKWHGBM.js";
9
9
  import "./chunk-NERLQY2H.js";
10
10
  import "./chunk-QUAPFI2N.js";
11
11
  import "./chunk-TSKJCWQQ.js";
@@ -13,9 +13,9 @@ import "./chunk-XBE4JB7C.js";
13
13
  import "./chunk-ND2X5FWB.js";
14
14
  import "./chunk-LRCPA7SC.js";
15
15
  import "./chunk-OCLG5GKI.js";
16
- import "./chunk-N3F7E7DR.js";
17
- import "./chunk-FNV5FF35.js";
16
+ import "./chunk-RBU6JXD3.js";
18
17
  import "./chunk-UCN6TI25.js";
18
+ import "./chunk-FNV5FF35.js";
19
19
  import "./chunk-XBKSS6DM.js";
20
20
  import "./chunk-RO62LO6Z.js";
21
21
  import "./chunk-VAUJSSD3.js";
@@ -16,7 +16,8 @@ import {
16
16
  initializeMemory,
17
17
  runMigrations,
18
18
  setSchemaVersion
19
- } from "./chunk-N3F7E7DR.js";
19
+ } from "./chunk-RBU6JXD3.js";
20
+ import "./chunk-UCN6TI25.js";
20
21
  import {
21
22
  AnthropicEmbeddingProvider,
22
23
  CachedEmbeddingProvider,
@@ -27,7 +28,6 @@ import {
27
28
  hashText,
28
29
  serializeEmbedding
29
30
  } from "./chunk-FNV5FF35.js";
30
- import "./chunk-UCN6TI25.js";
31
31
  import "./chunk-XBKSS6DM.js";
32
32
  import "./chunk-RO62LO6Z.js";
33
33
  import "./chunk-VAUJSSD3.js";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  getDatabase
3
- } from "./chunk-N3F7E7DR.js";
4
- import "./chunk-FNV5FF35.js";
3
+ } from "./chunk-RBU6JXD3.js";
5
4
  import "./chunk-UCN6TI25.js";
5
+ import "./chunk-FNV5FF35.js";
6
6
  import "./chunk-XBKSS6DM.js";
7
7
  import "./chunk-RO62LO6Z.js";
8
8
  import "./chunk-VAUJSSD3.js";
@@ -16,7 +16,7 @@ import {
16
16
  validateWritePath,
17
17
  writePluginSecret,
18
18
  writeRawConfig
19
- } from "./chunk-TCD4NZDA.js";
19
+ } from "./chunk-JHKWHGBM.js";
20
20
  import "./chunk-NERLQY2H.js";
21
21
  import "./chunk-QUAPFI2N.js";
22
22
  import "./chunk-TSKJCWQQ.js";
@@ -47,6 +47,7 @@ import "./chunk-QGM4M3NI.js";
47
47
  import { Hono as Hono12 } from "hono";
48
48
  import { serve } from "@hono/node-server";
49
49
  import { cors } from "hono/cors";
50
+ import { streamSSE as streamSSE2 } from "hono/streaming";
50
51
  import { bodyLimit } from "hono/body-limit";
51
52
  import { setCookie, getCookie, deleteCookie } from "hono/cookie";
52
53
  import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
@@ -608,11 +609,8 @@ import { Hono as Hono6 } from "hono";
608
609
  function createPluginsRoutes(deps) {
609
610
  const app = new Hono6();
610
611
  app.get("/", (c) => {
611
- const response = {
612
- success: true,
613
- data: deps.plugins
614
- };
615
- return c.json(response);
612
+ const data = deps.marketplace ? deps.marketplace.modules.filter((m) => deps.toolRegistry.isPluginModule(m.name)).map((m) => ({ name: m.name, version: m.version ?? "0.0.0" })) : deps.plugins;
613
+ return c.json({ success: true, data });
616
614
  });
617
615
  return app;
618
616
  }
@@ -624,9 +622,10 @@ var SAFE_ARG_RE = /^[a-zA-Z0-9._\/:=@-]+$/;
624
622
  function createMcpRoutes(deps) {
625
623
  const app = new Hono7();
626
624
  app.get("/", (c) => {
625
+ const servers = typeof deps.mcpServers === "function" ? deps.mcpServers() : deps.mcpServers;
627
626
  const response = {
628
627
  success: true,
629
- data: deps.mcpServers
628
+ data: servers
630
629
  };
631
630
  return c.json(response);
632
631
  });
@@ -1805,6 +1804,96 @@ var WebUIServer = class {
1805
1804
  this.app.route("/api/tasks", createTasksRoutes(this.deps));
1806
1805
  this.app.route("/api/config", createConfigRoutes(this.deps));
1807
1806
  this.app.route("/api/marketplace", createMarketplaceRoutes(this.deps));
1807
+ this.app.post("/api/agent/start", async (c) => {
1808
+ const lifecycle = this.deps.lifecycle;
1809
+ if (!lifecycle) {
1810
+ return c.json({ error: "Agent lifecycle not available" }, 503);
1811
+ }
1812
+ const state = lifecycle.getState();
1813
+ if (state === "running") {
1814
+ return c.json({ state: "running" }, 409);
1815
+ }
1816
+ if (state === "stopping") {
1817
+ return c.json({ error: "Agent is currently stopping, please wait" }, 409);
1818
+ }
1819
+ lifecycle.start().catch((err) => {
1820
+ log2.error({ err }, "Agent start failed");
1821
+ });
1822
+ return c.json({ state: "starting" });
1823
+ });
1824
+ this.app.post("/api/agent/stop", async (c) => {
1825
+ const lifecycle = this.deps.lifecycle;
1826
+ if (!lifecycle) {
1827
+ return c.json({ error: "Agent lifecycle not available" }, 503);
1828
+ }
1829
+ const state = lifecycle.getState();
1830
+ if (state === "stopped") {
1831
+ return c.json({ state: "stopped" }, 409);
1832
+ }
1833
+ if (state === "starting") {
1834
+ return c.json({ error: "Agent is currently starting, please wait" }, 409);
1835
+ }
1836
+ lifecycle.stop().catch((err) => {
1837
+ log2.error({ err }, "Agent stop failed");
1838
+ });
1839
+ return c.json({ state: "stopping" });
1840
+ });
1841
+ this.app.get("/api/agent/status", (c) => {
1842
+ const lifecycle = this.deps.lifecycle;
1843
+ if (!lifecycle) {
1844
+ return c.json({ error: "Agent lifecycle not available" }, 503);
1845
+ }
1846
+ return c.json({
1847
+ state: lifecycle.getState(),
1848
+ uptime: lifecycle.getUptime(),
1849
+ error: lifecycle.getError() ?? null
1850
+ });
1851
+ });
1852
+ this.app.get("/api/agent/events", (c) => {
1853
+ const lifecycle = this.deps.lifecycle;
1854
+ if (!lifecycle) {
1855
+ return c.json({ error: "Agent lifecycle not available" }, 503);
1856
+ }
1857
+ return streamSSE2(c, async (stream) => {
1858
+ let aborted = false;
1859
+ stream.onAbort(() => {
1860
+ aborted = true;
1861
+ });
1862
+ const now = Date.now();
1863
+ await stream.writeSSE({
1864
+ event: "status",
1865
+ id: String(now),
1866
+ data: JSON.stringify({
1867
+ state: lifecycle.getState(),
1868
+ error: lifecycle.getError() ?? null,
1869
+ timestamp: now
1870
+ }),
1871
+ retry: 3e3
1872
+ });
1873
+ const onStateChange = (event) => {
1874
+ if (aborted) return;
1875
+ stream.writeSSE({
1876
+ event: "status",
1877
+ id: String(event.timestamp),
1878
+ data: JSON.stringify({
1879
+ state: event.state,
1880
+ error: event.error ?? null,
1881
+ timestamp: event.timestamp
1882
+ })
1883
+ });
1884
+ };
1885
+ lifecycle.on("stateChange", onStateChange);
1886
+ while (!aborted) {
1887
+ await stream.sleep(3e4);
1888
+ if (aborted) break;
1889
+ await stream.writeSSE({
1890
+ event: "ping",
1891
+ data: ""
1892
+ });
1893
+ }
1894
+ lifecycle.off("stateChange", onStateChange);
1895
+ });
1896
+ });
1808
1897
  const webDist = findWebDist();
1809
1898
  if (webDist) {
1810
1899
  const indexHtml = readFileSync3(join4(webDist, "index.html"), "utf-8");