teleton 0.8.3 → 0.8.4

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.
@@ -6,13 +6,7 @@ import {
6
6
  getWalletBalance,
7
7
  invalidateTonClientCache,
8
8
  loadWallet
9
- } from "./chunk-FUNF6H4W.js";
10
- import {
11
- expandPath
12
- } from "./chunk-AEHTQI3H.js";
13
- import {
14
- ConfigSchema
15
- } from "./chunk-AERHOXGC.js";
9
+ } from "./chunk-JROBTXWY.js";
16
10
  import {
17
11
  getOrCreateSession,
18
12
  getSession,
@@ -81,8 +75,7 @@ import {
81
75
  loadContextFromTranscript
82
76
  } from "./chunk-LVTKJQ7O.js";
83
77
  import {
84
- getProviderMetadata,
85
- getSupportedProviders
78
+ getProviderMetadata
86
79
  } from "./chunk-6OOHHJ4N.js";
87
80
  import {
88
81
  fetchWithTimeout
@@ -8779,7 +8772,7 @@ function createTelegramSocialSDK(bridge, log12) {
8779
8772
  const client = getClient2();
8780
8773
  const { Api: Api4, helpers } = await import("telegram");
8781
8774
  const { CustomFile } = await import("telegram/client/uploads.js");
8782
- const { readFileSync: readFileSync7, statSync: statSync2 } = await import("fs");
8775
+ const { readFileSync: readFileSync6, statSync: statSync2 } = await import("fs");
8783
8776
  const { basename: basename2 } = await import("path");
8784
8777
  const { resolve: resolve2, normalize: normalize2 } = await import("path");
8785
8778
  const { homedir: homedir2 } = await import("os");
@@ -8804,7 +8797,7 @@ function createTelegramSocialSDK(bridge, log12) {
8804
8797
  }
8805
8798
  const fileName = basename2(filePath);
8806
8799
  const fileSize = statSync2(filePath).size;
8807
- const fileBuffer = readFileSync7(filePath);
8800
+ const fileBuffer = readFileSync6(filePath);
8808
8801
  const isVideo = filePath.toLowerCase().match(/\.(mp4|mov|avi|webm|mkv|m4v)$/);
8809
8802
  const customFile = new CustomFile(fileName, fileSize, filePath, fileBuffer);
8810
8803
  const uploadedFile = await client.uploadFile({
@@ -9776,658 +9769,14 @@ async function loadEnhancedPlugins(config, loadedModuleNames, sdkDeps, db) {
9776
9769
  return { modules, hookRegistry };
9777
9770
  }
9778
9771
 
9779
- // src/config/configurable-keys.ts
9780
- import { readFileSync as readFileSync5, writeFileSync as writeFileSync2, existsSync as existsSync6 } from "fs";
9781
- import { parse, stringify } from "yaml";
9782
- var noValidation = () => void 0;
9783
- var identity = (v) => v;
9784
- var nonEmpty = (v) => v.length > 0 ? void 0 : "Must not be empty";
9785
- function numberInRange(min, max) {
9786
- return (v) => {
9787
- const n2 = Number(v);
9788
- if (isNaN(n2)) return "Must be a number";
9789
- if (n2 < min || n2 > max) return `Must be between ${min} and ${max}`;
9790
- return void 0;
9791
- };
9792
- }
9793
- function enumValidator(options) {
9794
- return (v) => options.includes(v) ? void 0 : `Must be one of: ${options.join(", ")}`;
9795
- }
9796
- function positiveInteger(v) {
9797
- const n2 = Number(v);
9798
- if (!Number.isInteger(n2) || n2 <= 0) return "Must be a positive integer";
9799
- return void 0;
9800
- }
9801
- function validateUrl(v) {
9802
- if (v === "") return void 0;
9803
- if (v.startsWith("http://") || v.startsWith("https://")) return void 0;
9804
- return "Must be empty or start with http:// or https://";
9805
- }
9806
- var CONFIGURABLE_KEYS = {
9807
- // ─── API Keys ──────────────────────────────────────────────────────
9808
- "agent.api_key": {
9809
- type: "string",
9810
- category: "API Keys",
9811
- label: "LLM API Key",
9812
- description: "LLM provider API key",
9813
- sensitive: true,
9814
- hotReload: "instant",
9815
- validate: (v) => v.length >= 10 ? void 0 : "Must be at least 10 characters",
9816
- mask: (v) => v.slice(0, 8) + "****",
9817
- parse: identity
9818
- },
9819
- tavily_api_key: {
9820
- type: "string",
9821
- category: "API Keys",
9822
- label: "Tavily API Key",
9823
- description: "Tavily API key for web search",
9824
- sensitive: true,
9825
- hotReload: "instant",
9826
- validate: (v) => v.startsWith("tvly-") ? void 0 : "Must start with 'tvly-'",
9827
- mask: (v) => v.slice(0, 9) + "****",
9828
- parse: identity
9829
- },
9830
- tonapi_key: {
9831
- type: "string",
9832
- category: "API Keys",
9833
- label: "TonAPI Key",
9834
- description: "TonAPI key for higher rate limits",
9835
- sensitive: true,
9836
- hotReload: "instant",
9837
- validate: (v) => v.length >= 10 ? void 0 : "Must be at least 10 characters",
9838
- mask: (v) => v.slice(0, 10) + "****",
9839
- parse: identity
9840
- },
9841
- toncenter_api_key: {
9842
- type: "string",
9843
- category: "API Keys",
9844
- label: "TonCenter API Key",
9845
- description: "TonCenter API key for dedicated RPC endpoint (free at toncenter.com)",
9846
- sensitive: true,
9847
- hotReload: "instant",
9848
- validate: (v) => v.length >= 10 ? void 0 : "Must be at least 10 characters",
9849
- mask: (v) => v.slice(0, 10) + "****",
9850
- parse: identity
9851
- },
9852
- "telegram.bot_token": {
9853
- type: "string",
9854
- category: "API Keys",
9855
- label: "Bot Token",
9856
- description: "Bot token from @BotFather",
9857
- sensitive: true,
9858
- hotReload: "instant",
9859
- validate: (v) => v.includes(":") ? void 0 : "Must contain ':' (e.g., 123456:ABC...)",
9860
- mask: (v) => v.split(":")[0] + ":****",
9861
- parse: identity
9862
- },
9863
- // ─── Agent ─────────────────────────────────────────────────────────
9864
- "agent.provider": {
9865
- type: "enum",
9866
- category: "Agent",
9867
- label: "Provider",
9868
- description: "LLM provider",
9869
- sensitive: false,
9870
- hotReload: "instant",
9871
- options: getSupportedProviders().map((p2) => p2.id),
9872
- validate: enumValidator(getSupportedProviders().map((p2) => p2.id)),
9873
- mask: identity,
9874
- parse: identity
9875
- },
9876
- "agent.model": {
9877
- type: "string",
9878
- category: "Agent",
9879
- label: "Model",
9880
- description: "Main LLM model ID",
9881
- sensitive: false,
9882
- hotReload: "instant",
9883
- validate: nonEmpty,
9884
- mask: identity,
9885
- parse: identity
9886
- },
9887
- "agent.utility_model": {
9888
- type: "string",
9889
- category: "Agent",
9890
- label: "Utility Model",
9891
- description: "Cheap model for summarization (auto-detected if empty)",
9892
- sensitive: false,
9893
- hotReload: "instant",
9894
- validate: noValidation,
9895
- mask: identity,
9896
- parse: identity
9897
- },
9898
- "agent.temperature": {
9899
- type: "number",
9900
- category: "Agent",
9901
- label: "Temperature",
9902
- description: "Response creativity (0.0 = deterministic, 2.0 = max)",
9903
- sensitive: false,
9904
- hotReload: "instant",
9905
- validate: numberInRange(0, 2),
9906
- mask: identity,
9907
- parse: (v) => Number(v)
9908
- },
9909
- "agent.max_tokens": {
9910
- type: "number",
9911
- category: "Agent",
9912
- label: "Max Tokens",
9913
- description: "Maximum response length in tokens",
9914
- sensitive: false,
9915
- hotReload: "instant",
9916
- validate: numberInRange(256, 128e3),
9917
- mask: identity,
9918
- parse: (v) => Number(v)
9919
- },
9920
- "agent.max_agentic_iterations": {
9921
- type: "number",
9922
- category: "Agent",
9923
- label: "Max Iterations",
9924
- description: "Max tool-call loop iterations per message",
9925
- sensitive: false,
9926
- hotReload: "instant",
9927
- validate: numberInRange(1, 20),
9928
- mask: identity,
9929
- parse: (v) => Number(v)
9930
- },
9931
- "agent.base_url": {
9932
- type: "string",
9933
- category: "Agent",
9934
- label: "API Base URL",
9935
- description: "Base URL for local LLM server (requires restart)",
9936
- sensitive: false,
9937
- hotReload: "restart",
9938
- validate: validateUrl,
9939
- mask: identity,
9940
- parse: identity
9941
- },
9942
- "cocoon.port": {
9943
- type: "number",
9944
- category: "Agent",
9945
- label: "Cocoon Port",
9946
- description: "Cocoon proxy port (requires restart)",
9947
- sensitive: false,
9948
- hotReload: "restart",
9949
- validate: numberInRange(1, 65535),
9950
- mask: identity,
9951
- parse: (v) => Number(v)
9952
- },
9953
- // ─── Session ───────────────────────────────────────────────────
9954
- "agent.session_reset_policy.daily_reset_enabled": {
9955
- type: "boolean",
9956
- category: "Session",
9957
- label: "Daily Reset",
9958
- description: "Enable daily session reset at specified hour",
9959
- sensitive: false,
9960
- hotReload: "instant",
9961
- validate: enumValidator(["true", "false"]),
9962
- mask: identity,
9963
- parse: (v) => v === "true"
9964
- },
9965
- "agent.session_reset_policy.daily_reset_hour": {
9966
- type: "number",
9967
- category: "Session",
9968
- label: "Reset Hour",
9969
- description: "Hour (0-23 UTC) for daily session reset",
9970
- sensitive: false,
9971
- hotReload: "instant",
9972
- validate: numberInRange(0, 23),
9973
- mask: identity,
9974
- parse: (v) => Number(v)
9975
- },
9976
- "agent.session_reset_policy.idle_expiry_enabled": {
9977
- type: "boolean",
9978
- category: "Session",
9979
- label: "Idle Expiry",
9980
- description: "Enable automatic session expiry after idle period",
9981
- sensitive: false,
9982
- hotReload: "instant",
9983
- validate: enumValidator(["true", "false"]),
9984
- mask: identity,
9985
- parse: (v) => v === "true"
9986
- },
9987
- "agent.session_reset_policy.idle_expiry_minutes": {
9988
- type: "number",
9989
- category: "Session",
9990
- label: "Idle Minutes",
9991
- description: "Idle minutes before session expires (minimum 1)",
9992
- sensitive: false,
9993
- hotReload: "instant",
9994
- validate: numberInRange(1, Number.MAX_SAFE_INTEGER),
9995
- mask: identity,
9996
- parse: (v) => Number(v)
9997
- },
9998
- // ─── Telegram ──────────────────────────────────────────────────────
9999
- "telegram.bot_username": {
10000
- type: "string",
10001
- category: "Telegram",
10002
- label: "Bot Username",
10003
- description: "Bot username without @",
10004
- sensitive: false,
10005
- hotReload: "instant",
10006
- validate: (v) => v.length >= 3 ? void 0 : "Must be at least 3 characters",
10007
- mask: identity,
10008
- parse: identity
10009
- },
10010
- "telegram.dm_policy": {
10011
- type: "enum",
10012
- category: "Telegram",
10013
- label: "DM Policy",
10014
- description: "Who can message the bot in private",
10015
- sensitive: false,
10016
- hotReload: "instant",
10017
- options: ["admin-only", "allowlist", "open", "disabled"],
10018
- optionLabels: {
10019
- "admin-only": "Admin Only",
10020
- allowlist: "Allow Users",
10021
- open: "Open",
10022
- disabled: "Disabled"
10023
- },
10024
- validate: enumValidator(["open", "allowlist", "admin-only", "disabled"]),
10025
- mask: identity,
10026
- parse: identity
10027
- },
10028
- "telegram.group_policy": {
10029
- type: "enum",
10030
- category: "Telegram",
10031
- label: "Group Policy",
10032
- description: "Which groups the bot can respond in",
10033
- sensitive: false,
10034
- hotReload: "instant",
10035
- options: ["open", "allowlist", "admin-only", "disabled"],
10036
- optionLabels: {
10037
- open: "Open",
10038
- allowlist: "Allow Groups",
10039
- "admin-only": "Admin Only",
10040
- disabled: "Disabled"
10041
- },
10042
- validate: enumValidator(["open", "allowlist", "admin-only", "disabled"]),
10043
- mask: identity,
10044
- parse: identity
10045
- },
10046
- "telegram.require_mention": {
10047
- type: "boolean",
10048
- category: "Telegram",
10049
- label: "Require Mention",
10050
- description: "Require @mention in groups to respond",
10051
- sensitive: false,
10052
- hotReload: "instant",
10053
- validate: enumValidator(["true", "false"]),
10054
- mask: identity,
10055
- parse: (v) => v === "true"
10056
- },
10057
- "telegram.owner_name": {
10058
- type: "string",
10059
- category: "Telegram",
10060
- label: "Owner Name",
10061
- description: "Owner's first name (used in system prompt)",
10062
- sensitive: false,
10063
- hotReload: "instant",
10064
- validate: noValidation,
10065
- mask: identity,
10066
- parse: identity
10067
- },
10068
- "telegram.owner_username": {
10069
- type: "string",
10070
- category: "Telegram",
10071
- label: "Owner Username",
10072
- description: "Owner's Telegram username (without @)",
10073
- sensitive: false,
10074
- hotReload: "instant",
10075
- validate: noValidation,
10076
- mask: identity,
10077
- parse: identity
10078
- },
10079
- "telegram.debounce_ms": {
10080
- type: "number",
10081
- category: "Telegram",
10082
- label: "Debounce (ms)",
10083
- description: "Group message debounce delay in ms (0 = disabled)",
10084
- sensitive: false,
10085
- hotReload: "instant",
10086
- validate: numberInRange(0, 1e4),
10087
- mask: identity,
10088
- parse: (v) => Number(v)
10089
- },
10090
- "telegram.agent_channel": {
10091
- type: "string",
10092
- category: "Telegram",
10093
- label: "Agent Channel",
10094
- description: "Channel username for auto-publishing",
10095
- sensitive: false,
10096
- hotReload: "instant",
10097
- validate: noValidation,
10098
- mask: identity,
10099
- parse: identity
10100
- },
10101
- "telegram.typing_simulation": {
10102
- type: "boolean",
10103
- category: "Telegram",
10104
- label: "Typing Simulation",
10105
- description: "Simulate typing indicator before sending replies",
10106
- sensitive: false,
10107
- hotReload: "instant",
10108
- validate: enumValidator(["true", "false"]),
10109
- mask: identity,
10110
- parse: (v) => v === "true"
10111
- },
10112
- "telegram.owner_id": {
10113
- type: "number",
10114
- category: "Telegram",
10115
- label: "Admin ID",
10116
- description: "Primary admin Telegram user ID (auto-added to Admin IDs)",
10117
- sensitive: false,
10118
- hotReload: "instant",
10119
- validate: positiveInteger,
10120
- mask: identity,
10121
- parse: (v) => Number(v)
10122
- },
10123
- "telegram.max_message_length": {
10124
- type: "number",
10125
- category: "Telegram",
10126
- label: "Max Message Length",
10127
- description: "Maximum message length in characters",
10128
- sensitive: false,
10129
- hotReload: "instant",
10130
- validate: numberInRange(1, 32768),
10131
- mask: identity,
10132
- parse: (v) => Number(v)
10133
- },
10134
- "telegram.rate_limit_messages_per_second": {
10135
- type: "number",
10136
- category: "Telegram",
10137
- label: "Rate Limit \u2014 Messages/sec",
10138
- description: "Rate limit: messages per second (requires restart)",
10139
- sensitive: false,
10140
- hotReload: "restart",
10141
- validate: numberInRange(0.1, 10),
10142
- mask: identity,
10143
- parse: (v) => Number(v)
10144
- },
10145
- "telegram.rate_limit_groups_per_minute": {
10146
- type: "number",
10147
- category: "Telegram",
10148
- label: "Rate Limit \u2014 Groups/min",
10149
- description: "Rate limit: groups per minute (requires restart)",
10150
- sensitive: false,
10151
- hotReload: "restart",
10152
- validate: numberInRange(1, 60),
10153
- mask: identity,
10154
- parse: (v) => Number(v)
10155
- },
10156
- "telegram.admin_ids": {
10157
- type: "array",
10158
- itemType: "number",
10159
- category: "Telegram",
10160
- label: "Admin IDs",
10161
- description: "Admin user IDs with elevated access",
10162
- sensitive: false,
10163
- hotReload: "instant",
10164
- validate: positiveInteger,
10165
- mask: identity,
10166
- parse: (v) => Number(v)
10167
- },
10168
- "telegram.allow_from": {
10169
- type: "array",
10170
- itemType: "number",
10171
- category: "Telegram",
10172
- label: "Allowed Users",
10173
- description: "User IDs allowed for DM access",
10174
- sensitive: false,
10175
- hotReload: "instant",
10176
- validate: positiveInteger,
10177
- mask: identity,
10178
- parse: (v) => Number(v)
10179
- },
10180
- "telegram.group_allow_from": {
10181
- type: "array",
10182
- itemType: "number",
10183
- category: "Telegram",
10184
- label: "Allowed Groups",
10185
- description: "Group IDs allowed for group access",
10186
- sensitive: false,
10187
- hotReload: "instant",
10188
- validate: positiveInteger,
10189
- mask: identity,
10190
- parse: (v) => Number(v)
10191
- },
10192
- // ─── Embedding ─────────────────────────────────────────────────────
10193
- "embedding.provider": {
10194
- type: "enum",
10195
- category: "Embedding",
10196
- label: "Embedding Provider",
10197
- description: "Embedding provider for RAG",
10198
- sensitive: false,
10199
- hotReload: "instant",
10200
- options: ["local", "anthropic", "none"],
10201
- validate: enumValidator(["local", "anthropic", "none"]),
10202
- mask: identity,
10203
- parse: identity
10204
- },
10205
- "embedding.model": {
10206
- type: "string",
10207
- category: "Embedding",
10208
- label: "Embedding Model",
10209
- description: "Embedding model ID (requires restart)",
10210
- sensitive: false,
10211
- hotReload: "restart",
10212
- validate: noValidation,
10213
- mask: identity,
10214
- parse: identity
10215
- },
10216
- // ─── WebUI ─────────────────────────────────────────────────────────
10217
- "webui.port": {
10218
- type: "number",
10219
- category: "WebUI",
10220
- label: "WebUI Port",
10221
- description: "HTTP server port (requires restart)",
10222
- sensitive: false,
10223
- hotReload: "restart",
10224
- validate: numberInRange(1024, 65535),
10225
- mask: identity,
10226
- parse: (v) => Number(v)
10227
- },
10228
- "webui.log_requests": {
10229
- type: "boolean",
10230
- category: "WebUI",
10231
- label: "Log HTTP Requests",
10232
- description: "Log all HTTP requests to console",
10233
- sensitive: false,
10234
- hotReload: "instant",
10235
- validate: enumValidator(["true", "false"]),
10236
- mask: identity,
10237
- parse: (v) => v === "true"
10238
- },
10239
- // ─── Deals ─────────────────────────────────────────────────────────
10240
- "deals.enabled": {
10241
- type: "boolean",
10242
- category: "Deals",
10243
- label: "Deals Enabled",
10244
- description: "Enable the deals/escrow module",
10245
- sensitive: false,
10246
- hotReload: "instant",
10247
- validate: enumValidator(["true", "false"]),
10248
- mask: identity,
10249
- parse: (v) => v === "true"
10250
- },
10251
- "deals.expiry_seconds": {
10252
- type: "number",
10253
- category: "Deals",
10254
- label: "Deal Expiry",
10255
- description: "Deal expiry timeout in seconds",
10256
- sensitive: false,
10257
- hotReload: "instant",
10258
- validate: numberInRange(10, 3600),
10259
- mask: identity,
10260
- parse: (v) => Number(v)
10261
- },
10262
- "deals.buy_max_floor_percent": {
10263
- type: "number",
10264
- category: "Deals",
10265
- label: "Buy Max Floor %",
10266
- description: "Maximum floor % for buy deals",
10267
- sensitive: false,
10268
- hotReload: "instant",
10269
- validate: numberInRange(1, 100),
10270
- mask: identity,
10271
- parse: (v) => Number(v)
10272
- },
10273
- "deals.sell_min_floor_percent": {
10274
- type: "number",
10275
- category: "Deals",
10276
- label: "Sell Min Floor %",
10277
- description: "Minimum floor % for sell deals",
10278
- sensitive: false,
10279
- hotReload: "instant",
10280
- validate: numberInRange(100, 500),
10281
- mask: identity,
10282
- parse: (v) => Number(v)
10283
- },
10284
- // ─── TON Proxy ────────────────────────────────────────────────────
10285
- "ton_proxy.enabled": {
10286
- type: "boolean",
10287
- category: "TON Proxy",
10288
- label: "TON Proxy Enabled",
10289
- description: "Enable Tonutils-Proxy for .ton site access (auto-downloads binary on first run)",
10290
- sensitive: false,
10291
- hotReload: "instant",
10292
- validate: enumValidator(["true", "false"]),
10293
- mask: identity,
10294
- parse: (v) => v === "true"
10295
- },
10296
- "ton_proxy.port": {
10297
- type: "number",
10298
- category: "TON Proxy",
10299
- label: "Proxy Port",
10300
- description: "HTTP proxy port for .ton sites (default: 8080)",
10301
- sensitive: false,
10302
- hotReload: "restart",
10303
- validate: numberInRange(1, 65535),
10304
- mask: identity,
10305
- parse: (v) => Number(v)
10306
- },
10307
- "ton_proxy.binary_path": {
10308
- type: "string",
10309
- category: "TON Proxy",
10310
- label: "Binary Path",
10311
- description: "Custom path to tonutils-proxy-cli (leave empty for auto-download)",
10312
- sensitive: false,
10313
- hotReload: "restart",
10314
- validate: noValidation,
10315
- mask: identity,
10316
- parse: identity
10317
- },
10318
- // ─── Capabilities ──────────────────────────────────────────────────
10319
- "capabilities.exec.mode": {
10320
- type: "enum",
10321
- category: "Coding Agent",
10322
- label: "Exec Mode",
10323
- description: "System execution: off (disabled) or yolo (full system access)",
10324
- sensitive: false,
10325
- hotReload: "restart",
10326
- options: ["off", "yolo"],
10327
- optionLabels: { off: "Disabled", yolo: "YOLO" },
10328
- validate: enumValidator(["off", "yolo"]),
10329
- mask: identity,
10330
- parse: identity
10331
- },
10332
- "capabilities.exec.scope": {
10333
- type: "enum",
10334
- category: "Coding Agent",
10335
- label: "Exec Scope",
10336
- description: "Who can trigger exec tools",
10337
- sensitive: false,
10338
- hotReload: "restart",
10339
- options: ["admin-only", "allowlist", "all"],
10340
- optionLabels: { "admin-only": "Admin Only", allowlist: "Allowlist", all: "Everyone" },
10341
- validate: enumValidator(["admin-only", "allowlist", "all"]),
10342
- mask: identity,
10343
- parse: identity
10344
- },
10345
- // ─── Developer ─────────────────────────────────────────────────────
10346
- "dev.hot_reload": {
10347
- type: "boolean",
10348
- category: "Developer",
10349
- label: "Hot Reload",
10350
- description: "Watch ~/.teleton/plugins/ for live changes",
10351
- sensitive: false,
10352
- hotReload: "instant",
10353
- validate: enumValidator(["true", "false"]),
10354
- mask: identity,
10355
- parse: (v) => v === "true"
10356
- }
10357
- };
10358
- var FORBIDDEN_SEGMENTS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
10359
- function assertSafePath(parts) {
10360
- if (parts.some((p2) => FORBIDDEN_SEGMENTS.has(p2))) {
10361
- throw new Error("Invalid config path: forbidden segment");
10362
- }
10363
- }
10364
- function getNestedValue(obj, path) {
10365
- const parts = path.split(".");
10366
- assertSafePath(parts);
10367
- let current = obj;
10368
- for (const part of parts) {
10369
- if (current == null || typeof current !== "object") return void 0;
10370
- current = current[part];
10371
- }
10372
- return current;
10373
- }
10374
- function setNestedValue(obj, path, value) {
10375
- const parts = path.split(".");
10376
- assertSafePath(parts);
10377
- let current = obj;
10378
- for (let i = 0; i < parts.length - 1; i++) {
10379
- if (current[parts[i]] == null || typeof current[parts[i]] !== "object") {
10380
- current[parts[i]] = {};
10381
- }
10382
- current = current[parts[i]];
10383
- }
10384
- current[parts[parts.length - 1]] = value;
10385
- }
10386
- function deleteNestedValue(obj, path) {
10387
- const parts = path.split(".");
10388
- assertSafePath(parts);
10389
- let current = obj;
10390
- for (let i = 0; i < parts.length - 1; i++) {
10391
- if (current == null || typeof current !== "object") return;
10392
- current = current[parts[i]];
10393
- }
10394
- if (current != null && typeof current === "object") {
10395
- delete current[parts[parts.length - 1]];
10396
- }
10397
- }
10398
- function readRawConfig(configPath) {
10399
- const fullPath = expandPath(configPath);
10400
- if (!existsSync6(fullPath)) {
10401
- throw new Error(`Config file not found: ${fullPath}
10402
- Run 'teleton setup' to create one.`);
10403
- }
10404
- const raw = parse(readFileSync5(fullPath, "utf-8"));
10405
- if (!raw || typeof raw !== "object") {
10406
- throw new Error(`Invalid config file: ${fullPath}`);
10407
- }
10408
- return raw;
10409
- }
10410
- function writeRawConfig(raw, configPath) {
10411
- const clone = { ...raw };
10412
- delete clone.market;
10413
- const result = ConfigSchema.safeParse(clone);
10414
- if (!result.success) {
10415
- throw new Error(`Refusing to save invalid config: ${result.error.message}`);
10416
- }
10417
- raw.meta = raw.meta ?? {};
10418
- raw.meta.last_modified_at = (/* @__PURE__ */ new Date()).toISOString();
10419
- const fullPath = expandPath(configPath);
10420
- writeFileSync2(fullPath, stringify(raw), { encoding: "utf-8", mode: 384 });
10421
- }
10422
-
10423
9772
  // src/ton-proxy/manager.ts
10424
9773
  import { spawn, execSync } from "child_process";
10425
9774
  import {
10426
- existsSync as existsSync7,
9775
+ existsSync as existsSync6,
10427
9776
  chmodSync,
10428
9777
  createWriteStream,
10429
- readFileSync as readFileSync6,
10430
- writeFileSync as writeFileSync3,
9778
+ readFileSync as readFileSync5,
9779
+ writeFileSync as writeFileSync2,
10431
9780
  unlinkSync
10432
9781
  } from "fs";
10433
9782
  import { mkdir } from "fs/promises";
@@ -10456,7 +9805,7 @@ var TonProxyManager = class {
10456
9805
  }
10457
9806
  /** Check if the binary exists on disk */
10458
9807
  isInstalled() {
10459
- return existsSync7(this.getBinaryPath());
9808
+ return existsSync6(this.getBinaryPath());
10460
9809
  }
10461
9810
  /** Whether the proxy process is currently running */
10462
9811
  isRunning() {
@@ -10493,9 +9842,9 @@ var TonProxyManager = class {
10493
9842
  }
10494
9843
  /** Kill any orphan proxy process from a previous session */
10495
9844
  killOrphan() {
10496
- if (existsSync7(PID_FILE)) {
9845
+ if (existsSync6(PID_FILE)) {
10497
9846
  try {
10498
- const pid = parseInt(readFileSync6(PID_FILE, "utf-8").trim(), 10);
9847
+ const pid = parseInt(readFileSync5(PID_FILE, "utf-8").trim(), 10);
10499
9848
  if (pid && !isNaN(pid)) {
10500
9849
  try {
10501
9850
  process.kill(pid, 0);
@@ -10529,7 +9878,7 @@ var TonProxyManager = class {
10529
9878
  /** Write PID to file for orphan detection */
10530
9879
  writePidFile(pid) {
10531
9880
  try {
10532
- writeFileSync3(PID_FILE, String(pid), { mode: 384 });
9881
+ writeFileSync2(PID_FILE, String(pid), { mode: 384 });
10533
9882
  } catch {
10534
9883
  log10.warn("Failed to write TON Proxy PID file");
10535
9884
  }
@@ -10537,7 +9886,7 @@ var TonProxyManager = class {
10537
9886
  /** Remove PID file */
10538
9887
  removePidFile() {
10539
9888
  try {
10540
- if (existsSync7(PID_FILE)) unlinkSync(PID_FILE);
9889
+ if (existsSync6(PID_FILE)) unlinkSync(PID_FILE);
10541
9890
  } catch {
10542
9891
  }
10543
9892
  }
@@ -10632,7 +9981,7 @@ var TonProxyManager = class {
10632
9981
  await this.stop();
10633
9982
  }
10634
9983
  const binaryPath = this.getBinaryPath();
10635
- if (existsSync7(binaryPath)) {
9984
+ if (existsSync6(binaryPath)) {
10636
9985
  const { unlink } = await import("fs/promises");
10637
9986
  await unlink(binaryPath);
10638
9987
  log10.info(`TON Proxy binary removed: ${binaryPath}`);
@@ -10851,12 +10200,6 @@ export {
10851
10200
  adaptPlugin,
10852
10201
  ensurePluginDeps,
10853
10202
  loadEnhancedPlugins,
10854
- CONFIGURABLE_KEYS,
10855
- getNestedValue,
10856
- setNestedValue,
10857
- deleteNestedValue,
10858
- readRawConfig,
10859
- writeRawConfig,
10860
10203
  TonProxyManager,
10861
10204
  getTonProxyManager,
10862
10205
  setTonProxyManager,