teleton 0.8.2 → 0.8.3
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/bootstrap-DDFVEMYI.js +128 -0
- package/dist/{chunk-XBSCYMKM.js → chunk-2ERTYRHA.js} +6 -6
- package/dist/{chunk-2IZU3REP.js → chunk-33Z47EXI.js} +139 -214
- package/dist/{chunk-HEDJCLA6.js → chunk-35MX4ZUI.js} +2 -122
- package/dist/{chunk-YOSUPUAJ.js → chunk-6OOHHJ4N.js} +1 -174
- package/dist/{chunk-GGXJLMOH.js → chunk-7MWKT67G.js} +295 -416
- package/dist/chunk-AEHTQI3H.js +142 -0
- package/dist/{chunk-7YKSXOQQ.js → chunk-AERHOXGC.js} +78 -320
- package/dist/{chunk-W25Z7CM6.js → chunk-ALKAAG4O.js} +3 -3
- package/dist/chunk-CUE4UZXR.js +129 -0
- package/dist/chunk-FUNF6H4W.js +251 -0
- package/dist/{chunk-VYKW7FMV.js → chunk-GHMXWAXI.js} +1 -1
- package/dist/{chunk-J73TA3UM.js → chunk-LVTKJQ7O.js} +7 -5
- package/dist/chunk-NVKBBTI6.js +128 -0
- package/dist/{chunk-57URFK6M.js → chunk-OIMAE24Q.js} +51 -13
- package/dist/chunk-WTDAICGT.js +175 -0
- package/dist/{chunk-55SKE6YH.js → chunk-XDZDOKIF.js} +1 -1
- package/dist/cli/index.js +42 -22
- package/dist/{client-YOOHI776.js → client-5KD25NOP.js} +4 -3
- package/dist/index.js +15 -10
- package/dist/local-IHKJFQJS.js +9 -0
- package/dist/{memory-Q6EWGK2S.js → memory-QMJRM3XJ.js} +5 -3
- package/dist/{memory-hook-WUXJNVT5.js → memory-hook-VUNWZ3NY.js} +5 -4
- package/dist/{migrate-WFU6COBN.js → migrate-5VBAP52B.js} +3 -2
- package/dist/{server-GYZXKIKU.js → server-JF6FX772.js} +39 -13
- package/dist/{server-YODFBZKG.js → server-N4T7E25M.js} +14 -10
- package/dist/{setup-server-IZBUOJRU.js → setup-server-IX3BFPPH.js} +5 -3
- package/dist/{store-7M4XV6M5.js → store-BY7S6IFN.js} +4 -3
- package/dist/{tool-index-NYH57UWP.js → tool-index-FTERJSZK.js} +2 -1
- package/package.json +1 -1
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AgentLifecycle
|
|
3
|
+
} from "./chunk-NVKBBTI6.js";
|
|
4
|
+
import {
|
|
5
|
+
configExists,
|
|
6
|
+
getDefaultConfigPath
|
|
7
|
+
} from "./chunk-AEHTQI3H.js";
|
|
8
|
+
import {
|
|
9
|
+
ensureWorkspace
|
|
10
|
+
} from "./chunk-AERHOXGC.js";
|
|
11
|
+
import "./chunk-C4NKJT2Z.js";
|
|
12
|
+
import "./chunk-6OOHHJ4N.js";
|
|
13
|
+
import {
|
|
14
|
+
SHUTDOWN_TIMEOUT_MS
|
|
15
|
+
} from "./chunk-R4YSJ4EY.js";
|
|
16
|
+
import "./chunk-EYWNOHMJ.js";
|
|
17
|
+
import {
|
|
18
|
+
createLogger
|
|
19
|
+
} from "./chunk-NQ6FZKCE.js";
|
|
20
|
+
import "./chunk-3RG5ZIWI.js";
|
|
21
|
+
|
|
22
|
+
// src/api/bootstrap.ts
|
|
23
|
+
var log = createLogger("Bootstrap");
|
|
24
|
+
async function startApiOnly(options) {
|
|
25
|
+
await ensureWorkspace({ ensureTemplates: false, silent: false });
|
|
26
|
+
const configPath = options.config ?? getDefaultConfigPath();
|
|
27
|
+
const lifecycle = new AgentLifecycle();
|
|
28
|
+
const deps = {
|
|
29
|
+
agent: null,
|
|
30
|
+
bridge: null,
|
|
31
|
+
memory: null,
|
|
32
|
+
toolRegistry: null,
|
|
33
|
+
plugins: null,
|
|
34
|
+
mcpServers: null,
|
|
35
|
+
config: {
|
|
36
|
+
enabled: false,
|
|
37
|
+
port: 7777,
|
|
38
|
+
host: "127.0.0.1",
|
|
39
|
+
cors_origins: [],
|
|
40
|
+
log_requests: false
|
|
41
|
+
},
|
|
42
|
+
configPath,
|
|
43
|
+
lifecycle,
|
|
44
|
+
marketplace: null,
|
|
45
|
+
userHookEvaluator: null
|
|
46
|
+
};
|
|
47
|
+
const { ApiServer } = await import("./server-JF6FX772.js");
|
|
48
|
+
const apiConfig = {
|
|
49
|
+
enabled: true,
|
|
50
|
+
port: parseInt(options.apiPort || process.env.TELETON_API_PORT || "7778"),
|
|
51
|
+
key_hash: "",
|
|
52
|
+
allowed_ips: []
|
|
53
|
+
};
|
|
54
|
+
const server = new ApiServer(deps, apiConfig);
|
|
55
|
+
let appInstance = null;
|
|
56
|
+
lifecycle.registerCallbacks(
|
|
57
|
+
// startFn — called when POST /v1/agent/start fires
|
|
58
|
+
async () => {
|
|
59
|
+
if (!configExists(configPath)) {
|
|
60
|
+
throw new Error("Configuration not found. Complete setup via /v1/setup endpoints first.");
|
|
61
|
+
}
|
|
62
|
+
const { TeletonApp } = await import("./index.js");
|
|
63
|
+
appInstance = new TeletonApp(configPath);
|
|
64
|
+
await appInstance.startAgentSubsystems();
|
|
65
|
+
server.updateDeps({
|
|
66
|
+
agent: appInstance.getAgent(),
|
|
67
|
+
bridge: appInstance.getBridge(),
|
|
68
|
+
memory: appInstance.getMemory(),
|
|
69
|
+
toolRegistry: appInstance.getToolRegistry(),
|
|
70
|
+
plugins: appInstance.getPlugins(),
|
|
71
|
+
config: appInstance.getWebuiConfig()
|
|
72
|
+
});
|
|
73
|
+
},
|
|
74
|
+
// stopFn — called when POST /v1/agent/stop fires
|
|
75
|
+
async () => {
|
|
76
|
+
if (appInstance) {
|
|
77
|
+
await appInstance.stopAgentSubsystems();
|
|
78
|
+
appInstance = null;
|
|
79
|
+
server.updateDeps({
|
|
80
|
+
agent: null,
|
|
81
|
+
bridge: null,
|
|
82
|
+
memory: null,
|
|
83
|
+
toolRegistry: null,
|
|
84
|
+
plugins: null
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
await server.start();
|
|
90
|
+
if (process.env.TELETON_JSON_CREDENTIALS === "true") {
|
|
91
|
+
const creds = server.getCredentials();
|
|
92
|
+
process.stdout.write(JSON.stringify(creds) + "\n");
|
|
93
|
+
}
|
|
94
|
+
log.info("API-only mode: complete setup via /v1/setup endpoints, then POST /v1/agent/start");
|
|
95
|
+
let shutdownInProgress = false;
|
|
96
|
+
const gracefulShutdown = async () => {
|
|
97
|
+
if (shutdownInProgress) return;
|
|
98
|
+
shutdownInProgress = true;
|
|
99
|
+
const forceExit = setTimeout(() => {
|
|
100
|
+
log.error("Shutdown timed out, forcing exit");
|
|
101
|
+
process.exit(1);
|
|
102
|
+
}, SHUTDOWN_TIMEOUT_MS);
|
|
103
|
+
forceExit.unref();
|
|
104
|
+
try {
|
|
105
|
+
if (lifecycle.getState() === "running") {
|
|
106
|
+
await lifecycle.stop();
|
|
107
|
+
}
|
|
108
|
+
await server.stop();
|
|
109
|
+
} finally {
|
|
110
|
+
clearTimeout(forceExit);
|
|
111
|
+
process.exit(0);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
process.on("SIGINT", gracefulShutdown);
|
|
115
|
+
process.on("SIGTERM", gracefulShutdown);
|
|
116
|
+
process.on("unhandledRejection", (reason) => {
|
|
117
|
+
log.error({ err: reason }, "Unhandled rejection");
|
|
118
|
+
});
|
|
119
|
+
process.on("uncaughtException", (error) => {
|
|
120
|
+
log.error({ err: error }, "Uncaught exception");
|
|
121
|
+
process.exit(1);
|
|
122
|
+
});
|
|
123
|
+
await new Promise(() => {
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
export {
|
|
127
|
+
startApiOnly
|
|
128
|
+
};
|
|
@@ -30,22 +30,22 @@ import {
|
|
|
30
30
|
validateWritePath,
|
|
31
31
|
writePluginSecret,
|
|
32
32
|
writeRawConfig
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-7MWKT67G.js";
|
|
34
34
|
import {
|
|
35
35
|
invalidateEndpointCache,
|
|
36
36
|
invalidateTonClientCache,
|
|
37
37
|
setToncenterApiKey
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-FUNF6H4W.js";
|
|
39
39
|
import {
|
|
40
40
|
getErrorMessage
|
|
41
41
|
} from "./chunk-3UFPFWYP.js";
|
|
42
|
-
import {
|
|
43
|
-
getProviderMetadata,
|
|
44
|
-
validateApiKeyFormat
|
|
45
|
-
} from "./chunk-YOSUPUAJ.js";
|
|
46
42
|
import {
|
|
47
43
|
setTonapiKey
|
|
48
44
|
} from "./chunk-VFA7QMCZ.js";
|
|
45
|
+
import {
|
|
46
|
+
getProviderMetadata,
|
|
47
|
+
validateApiKeyFormat
|
|
48
|
+
} from "./chunk-6OOHHJ4N.js";
|
|
49
49
|
import {
|
|
50
50
|
WORKSPACE_PATHS,
|
|
51
51
|
WORKSPACE_ROOT
|