@pixelbyte-software/pixcode 1.35.1 → 1.35.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/LICENSE +718 -718
- package/README.de.md +248 -248
- package/README.ja.md +240 -240
- package/README.ko.md +240 -240
- package/README.md +303 -303
- package/README.ru.md +248 -248
- package/README.tr.md +250 -250
- package/README.zh-CN.md +240 -240
- package/dist/api-docs.html +548 -548
- package/dist/assets/{index-CBdsvGSR.js → index-D1-AIL_5.js} +1 -1
- package/dist/clear-cache.html +85 -85
- package/dist/convert-icons.md +52 -52
- package/dist/favicon.svg +8 -8
- package/dist/generate-icons.js +48 -48
- package/dist/icons/codex-white.svg +3 -3
- package/dist/icons/codex.svg +3 -3
- package/dist/icons/cursor-white.svg +11 -11
- package/dist/icons/icon-128x128.svg +9 -9
- package/dist/icons/icon-144x144.svg +9 -9
- package/dist/icons/icon-152x152.svg +9 -9
- package/dist/icons/icon-192x192.svg +9 -9
- package/dist/icons/icon-384x384.svg +9 -9
- package/dist/icons/icon-512x512.svg +9 -9
- package/dist/icons/icon-72x72.svg +9 -9
- package/dist/icons/icon-96x96.svg +9 -9
- package/dist/icons/icon-template.svg +9 -9
- package/dist/icons/qwen-logo.svg +14 -14
- package/dist/index.html +58 -58
- package/dist/logo.svg +12 -12
- package/dist/manifest.json +60 -60
- package/dist/openapi.yaml +1693 -1693
- package/dist/sw.js +124 -124
- package/dist-server/server/cli.js +96 -96
- package/dist-server/server/daemon/manager.js +33 -33
- package/dist-server/server/daemon-manager.js +64 -64
- package/dist-server/server/routes/commands.js +25 -25
- package/dist-server/server/routes/git.js +17 -17
- package/dist-server/server/routes/taskmaster.js +419 -419
- package/package.json +180 -180
- package/scripts/fix-node-pty.js +67 -67
- package/scripts/smoke/a2a-roundtrip.mjs +167 -167
- package/scripts/smoke/orchestration-api.mjs +172 -172
- package/scripts/smoke/orchestration-live-run.mjs +176 -176
- package/server/claude-sdk.js +898 -898
- package/server/cli.js +935 -935
- package/server/constants/config.js +4 -4
- package/server/cursor-cli.js +342 -342
- package/server/daemon/manager.js +564 -564
- package/server/daemon-manager.js +959 -959
- package/server/database/db.js +794 -794
- package/server/database/json-store.js +197 -197
- package/server/gemini-cli.js +535 -535
- package/server/gemini-response-handler.js +79 -79
- package/server/index.js +3135 -3135
- package/server/load-env.js +34 -34
- package/server/middleware/auth.js +173 -173
- package/server/modules/orchestration/a2a/adapter-registry.ts +108 -108
- package/server/modules/orchestration/a2a/adapters/abstract-a2a.adapter.ts +55 -55
- package/server/modules/orchestration/a2a/adapters/claude-code.adapter.ts +284 -284
- package/server/modules/orchestration/a2a/adapters/codex.adapter.ts +244 -244
- package/server/modules/orchestration/a2a/adapters/cursor.adapter.ts +249 -249
- package/server/modules/orchestration/a2a/adapters/gemini.adapter.ts +248 -248
- package/server/modules/orchestration/a2a/adapters/opencode.adapter.ts +248 -248
- package/server/modules/orchestration/a2a/adapters/qwen.adapter.ts +248 -248
- package/server/modules/orchestration/a2a/routes.ts +577 -577
- package/server/modules/orchestration/a2a/task-store.ts +178 -178
- package/server/modules/orchestration/a2a/types.ts +125 -125
- package/server/modules/orchestration/a2a/validator.ts +113 -113
- package/server/modules/orchestration/index.ts +66 -66
- package/server/modules/orchestration/preview/port-watcher.ts +112 -112
- package/server/modules/orchestration/preview/preview-proxy.ts +60 -60
- package/server/modules/orchestration/preview/types.ts +19 -19
- package/server/modules/orchestration/tasks/orchestration-task-store.ts +45 -45
- package/server/modules/orchestration/tasks/orchestration-task.routes.ts +73 -73
- package/server/modules/orchestration/tasks/orchestration-task.service.ts +145 -145
- package/server/modules/orchestration/tasks/orchestration-task.types.ts +29 -29
- package/server/modules/orchestration/workflows/built-in-workflows.ts +127 -127
- package/server/modules/orchestration/workflows/workflow-runner.ts +1206 -1206
- package/server/modules/orchestration/workflows/workflow-store.ts +97 -97
- package/server/modules/orchestration/workflows/workflow.routes.ts +169 -169
- package/server/modules/orchestration/workflows/workflow.types.ts +70 -70
- package/server/modules/orchestration/workflows/workspace-target.ts +120 -120
- package/server/modules/orchestration/workspace/docker-workspace.ts +135 -135
- package/server/modules/orchestration/workspace/path-safety.ts +55 -55
- package/server/modules/orchestration/workspace/types.ts +52 -52
- package/server/modules/orchestration/workspace/workspace-manager.ts +97 -97
- package/server/modules/orchestration/workspace/worktree-workspace.ts +125 -125
- package/server/modules/providers/index.ts +2 -2
- package/server/modules/providers/list/claude/claude-auth.provider.ts +145 -145
- package/server/modules/providers/list/claude/claude-mcp.provider.ts +135 -135
- package/server/modules/providers/list/claude/claude-sessions.provider.ts +306 -306
- package/server/modules/providers/list/claude/claude.provider.ts +15 -15
- package/server/modules/providers/list/codex/codex-auth.provider.ts +115 -115
- package/server/modules/providers/list/codex/codex-mcp.provider.ts +135 -135
- package/server/modules/providers/list/codex/codex-sessions.provider.ts +319 -319
- package/server/modules/providers/list/codex/codex.provider.ts +15 -15
- package/server/modules/providers/list/cursor/cursor-auth.provider.ts +143 -143
- package/server/modules/providers/list/cursor/cursor-mcp.provider.ts +108 -108
- package/server/modules/providers/list/cursor/cursor-sessions.provider.ts +421 -421
- package/server/modules/providers/list/cursor/cursor.provider.ts +15 -15
- package/server/modules/providers/list/gemini/gemini-auth.provider.ts +163 -163
- package/server/modules/providers/list/gemini/gemini-mcp.provider.ts +110 -110
- package/server/modules/providers/list/gemini/gemini-sessions.provider.ts +227 -227
- package/server/modules/providers/list/gemini/gemini.provider.ts +15 -15
- package/server/modules/providers/list/opencode/opencode-auth.provider.ts +130 -130
- package/server/modules/providers/list/opencode/opencode-mcp.provider.ts +126 -126
- package/server/modules/providers/list/opencode/opencode-sessions.provider.ts +232 -232
- package/server/modules/providers/list/opencode/opencode.provider.ts +29 -29
- package/server/modules/providers/list/qwen/qwen-auth.provider.ts +145 -145
- package/server/modules/providers/list/qwen/qwen-mcp.provider.ts +114 -114
- package/server/modules/providers/list/qwen/qwen-sessions.provider.ts +265 -265
- package/server/modules/providers/list/qwen/qwen.provider.ts +21 -21
- package/server/modules/providers/provider.registry.ts +40 -40
- package/server/modules/providers/provider.routes.ts +819 -819
- package/server/modules/providers/services/mcp.service.ts +86 -86
- package/server/modules/providers/services/provider-auth.service.ts +26 -26
- package/server/modules/providers/services/sessions.service.ts +45 -45
- package/server/modules/providers/shared/base/abstract.provider.ts +20 -20
- package/server/modules/providers/shared/mcp/mcp.provider.ts +151 -151
- package/server/modules/providers/shared/provider-configs.ts +142 -142
- package/server/modules/providers/tests/mcp.test.ts +293 -293
- package/server/openai-codex.js +462 -462
- package/server/opencode-cli.js +459 -459
- package/server/opencode-response-handler.js +107 -107
- package/server/projects.js +3105 -3105
- package/server/qwen-code-cli.js +395 -395
- package/server/qwen-response-handler.js +73 -73
- package/server/routes/agent.js +1365 -1365
- package/server/routes/auth.js +138 -138
- package/server/routes/codex.js +19 -19
- package/server/routes/commands.js +554 -554
- package/server/routes/cursor.js +52 -52
- package/server/routes/gemini.js +24 -24
- package/server/routes/git.js +1488 -1488
- package/server/routes/mcp-utils.js +31 -31
- package/server/routes/messages.js +61 -61
- package/server/routes/network.js +120 -120
- package/server/routes/plugins.js +318 -318
- package/server/routes/projects.js +915 -915
- package/server/routes/qwen.js +27 -27
- package/server/routes/settings.js +286 -286
- package/server/routes/taskmaster.js +1496 -1496
- package/server/routes/telegram.js +125 -125
- package/server/routes/user.js +123 -123
- package/server/services/external-access.js +171 -171
- package/server/services/install-jobs.js +571 -571
- package/server/services/notification-orchestrator.js +242 -242
- package/server/services/provider-credentials.js +189 -189
- package/server/services/provider-models.js +381 -381
- package/server/services/telegram/bot.js +279 -279
- package/server/services/telegram/telegram-http-client.js +130 -130
- package/server/services/telegram/translations.js +170 -170
- package/server/services/vapid-keys.js +36 -36
- package/server/sessionManager.js +225 -225
- package/server/shared/interfaces.ts +54 -54
- package/server/shared/types.ts +172 -172
- package/server/shared/utils.ts +193 -193
- package/server/tsconfig.json +36 -36
- package/server/utils/colors.js +21 -21
- package/server/utils/commandParser.js +303 -303
- package/server/utils/frontmatter.js +18 -18
- package/server/utils/gitConfig.js +34 -34
- package/server/utils/mcp-detector.js +147 -147
- package/server/utils/plugin-loader.js +457 -457
- package/server/utils/plugin-process-manager.js +184 -184
- package/server/utils/port-access.js +209 -209
- package/server/utils/runtime-paths.js +37 -37
- package/server/utils/taskmaster-websocket.js +128 -128
- package/server/utils/url-detection.js +71 -71
- package/server/vite-daemon.js +78 -78
- package/shared/modelConstants.js +162 -162
- package/shared/networkHosts.js +22 -22
|
@@ -1,130 +1,130 @@
|
|
|
1
|
-
import { EventEmitter } from 'node:events';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Minimal Telegram Bot API client.
|
|
5
|
-
*
|
|
6
|
-
* Replaces `node-telegram-bot-api` which pulled in the deprecated
|
|
7
|
-
* `request` / `har-validator` / `uuid@3` chain (~30 transitive packages,
|
|
8
|
-
* npm install warnings on every fresh box). The Bot API itself is just
|
|
9
|
-
* HTTP, and we only use two endpoints (getUpdates polling + sendMessage),
|
|
10
|
-
* so 100 lines of fetch is all that's needed. Exposes the same surface
|
|
11
|
-
* the bot.js consumer relied on: `getMe()`, `sendMessage()`, `on('message'|'polling_error')`,
|
|
12
|
-
* `stopPolling()`.
|
|
13
|
-
*
|
|
14
|
-
* No third-party deps — uses Node 22's built-in `fetch`.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
const API_BASE = 'https://api.telegram.org/bot';
|
|
18
|
-
|
|
19
|
-
class TelegramApiError extends Error {
|
|
20
|
-
constructor(method, body, httpStatus) {
|
|
21
|
-
const description = body?.description || `HTTP ${httpStatus}`;
|
|
22
|
-
super(`Telegram ${method} failed: ${description}`);
|
|
23
|
-
this.name = 'TelegramApiError';
|
|
24
|
-
this.method = method;
|
|
25
|
-
this.httpStatus = httpStatus;
|
|
26
|
-
// Mirror the shape node-telegram-bot-api exposed so upstream error
|
|
27
|
-
// handling (401/409 checks in bot.js) keeps working unchanged.
|
|
28
|
-
this.response = { statusCode: httpStatus, body };
|
|
29
|
-
this.code = body?.error_code || httpStatus;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Call a Bot API method by name. Returns the `result` field on success,
|
|
35
|
-
* throws a TelegramApiError otherwise.
|
|
36
|
-
*/
|
|
37
|
-
async function callApi(token, method, params, { signal } = {}) {
|
|
38
|
-
const url = `${API_BASE}${token}/${method}`;
|
|
39
|
-
const res = await fetch(url, {
|
|
40
|
-
method: 'POST',
|
|
41
|
-
headers: { 'Content-Type': 'application/json' },
|
|
42
|
-
body: JSON.stringify(params || {}),
|
|
43
|
-
signal,
|
|
44
|
-
});
|
|
45
|
-
let body;
|
|
46
|
-
try { body = await res.json(); } catch { body = null; }
|
|
47
|
-
if (!res.ok || !body?.ok) {
|
|
48
|
-
throw new TelegramApiError(method, body, res.status);
|
|
49
|
-
}
|
|
50
|
-
return body.result;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export class TelegramHttpBot extends EventEmitter {
|
|
54
|
-
constructor(token, { polling = true, pollTimeoutSec = 30 } = {}) {
|
|
55
|
-
super();
|
|
56
|
-
if (!token) throw new Error('TelegramHttpBot: token is required');
|
|
57
|
-
this._token = token;
|
|
58
|
-
this._pollTimeoutSec = pollTimeoutSec;
|
|
59
|
-
this._offset = 0;
|
|
60
|
-
this._polling = false;
|
|
61
|
-
this._abortController = null;
|
|
62
|
-
if (polling) this._startPolling();
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// ---------- Public API (mirrors node-telegram-bot-api surface) ----------
|
|
66
|
-
|
|
67
|
-
async getMe() {
|
|
68
|
-
return callApi(this._token, 'getMe', {});
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
async sendMessage(chatId, text, extra = {}) {
|
|
72
|
-
return callApi(this._token, 'sendMessage', {
|
|
73
|
-
chat_id: chatId,
|
|
74
|
-
text,
|
|
75
|
-
...extra,
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
async stopPolling(_opts = {}) {
|
|
80
|
-
this._polling = false;
|
|
81
|
-
try { this._abortController?.abort(); } catch { /* ignore */ }
|
|
82
|
-
this._abortController = null;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// ---------- Polling loop ----------
|
|
86
|
-
|
|
87
|
-
async _startPolling() {
|
|
88
|
-
this._polling = true;
|
|
89
|
-
// Kick off a non-awaited loop. Each iteration long-polls getUpdates for
|
|
90
|
-
// up to pollTimeoutSec, then loops immediately. We deliberately serialize
|
|
91
|
-
// (no concurrent long-polls) because Telegram rejects that with 409.
|
|
92
|
-
(async () => {
|
|
93
|
-
while (this._polling) {
|
|
94
|
-
this._abortController = new AbortController();
|
|
95
|
-
try {
|
|
96
|
-
const updates = await callApi(
|
|
97
|
-
this._token,
|
|
98
|
-
'getUpdates',
|
|
99
|
-
{
|
|
100
|
-
offset: this._offset,
|
|
101
|
-
timeout: this._pollTimeoutSec,
|
|
102
|
-
allowed_updates: ['message'],
|
|
103
|
-
},
|
|
104
|
-
{ signal: this._abortController.signal },
|
|
105
|
-
);
|
|
106
|
-
for (const update of updates) {
|
|
107
|
-
if (typeof update.update_id === 'number') {
|
|
108
|
-
this._offset = Math.max(this._offset, update.update_id + 1);
|
|
109
|
-
}
|
|
110
|
-
if (update.message) {
|
|
111
|
-
try { this.emit('message', update.message); } catch (err) {
|
|
112
|
-
// Don't let a listener exception break the poll loop.
|
|
113
|
-
this.emit('polling_error', err);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
} catch (err) {
|
|
118
|
-
// AbortError is the expected path when stopPolling() is called.
|
|
119
|
-
if (err?.name === 'AbortError' || !this._polling) break;
|
|
120
|
-
this.emit('polling_error', err);
|
|
121
|
-
// Back off before retrying — rapid retries on 401/409 would
|
|
122
|
-
// otherwise spin at 100% CPU. Upstream consumer's polling_error
|
|
123
|
-
// handler may also call stopBot() on 401/409 which flips _polling
|
|
124
|
-
// off and breaks the loop on the next tick.
|
|
125
|
-
await new Promise((r) => setTimeout(r, 2000));
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
})();
|
|
129
|
-
}
|
|
130
|
-
}
|
|
1
|
+
import { EventEmitter } from 'node:events';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Minimal Telegram Bot API client.
|
|
5
|
+
*
|
|
6
|
+
* Replaces `node-telegram-bot-api` which pulled in the deprecated
|
|
7
|
+
* `request` / `har-validator` / `uuid@3` chain (~30 transitive packages,
|
|
8
|
+
* npm install warnings on every fresh box). The Bot API itself is just
|
|
9
|
+
* HTTP, and we only use two endpoints (getUpdates polling + sendMessage),
|
|
10
|
+
* so 100 lines of fetch is all that's needed. Exposes the same surface
|
|
11
|
+
* the bot.js consumer relied on: `getMe()`, `sendMessage()`, `on('message'|'polling_error')`,
|
|
12
|
+
* `stopPolling()`.
|
|
13
|
+
*
|
|
14
|
+
* No third-party deps — uses Node 22's built-in `fetch`.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const API_BASE = 'https://api.telegram.org/bot';
|
|
18
|
+
|
|
19
|
+
class TelegramApiError extends Error {
|
|
20
|
+
constructor(method, body, httpStatus) {
|
|
21
|
+
const description = body?.description || `HTTP ${httpStatus}`;
|
|
22
|
+
super(`Telegram ${method} failed: ${description}`);
|
|
23
|
+
this.name = 'TelegramApiError';
|
|
24
|
+
this.method = method;
|
|
25
|
+
this.httpStatus = httpStatus;
|
|
26
|
+
// Mirror the shape node-telegram-bot-api exposed so upstream error
|
|
27
|
+
// handling (401/409 checks in bot.js) keeps working unchanged.
|
|
28
|
+
this.response = { statusCode: httpStatus, body };
|
|
29
|
+
this.code = body?.error_code || httpStatus;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Call a Bot API method by name. Returns the `result` field on success,
|
|
35
|
+
* throws a TelegramApiError otherwise.
|
|
36
|
+
*/
|
|
37
|
+
async function callApi(token, method, params, { signal } = {}) {
|
|
38
|
+
const url = `${API_BASE}${token}/${method}`;
|
|
39
|
+
const res = await fetch(url, {
|
|
40
|
+
method: 'POST',
|
|
41
|
+
headers: { 'Content-Type': 'application/json' },
|
|
42
|
+
body: JSON.stringify(params || {}),
|
|
43
|
+
signal,
|
|
44
|
+
});
|
|
45
|
+
let body;
|
|
46
|
+
try { body = await res.json(); } catch { body = null; }
|
|
47
|
+
if (!res.ok || !body?.ok) {
|
|
48
|
+
throw new TelegramApiError(method, body, res.status);
|
|
49
|
+
}
|
|
50
|
+
return body.result;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export class TelegramHttpBot extends EventEmitter {
|
|
54
|
+
constructor(token, { polling = true, pollTimeoutSec = 30 } = {}) {
|
|
55
|
+
super();
|
|
56
|
+
if (!token) throw new Error('TelegramHttpBot: token is required');
|
|
57
|
+
this._token = token;
|
|
58
|
+
this._pollTimeoutSec = pollTimeoutSec;
|
|
59
|
+
this._offset = 0;
|
|
60
|
+
this._polling = false;
|
|
61
|
+
this._abortController = null;
|
|
62
|
+
if (polling) this._startPolling();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// ---------- Public API (mirrors node-telegram-bot-api surface) ----------
|
|
66
|
+
|
|
67
|
+
async getMe() {
|
|
68
|
+
return callApi(this._token, 'getMe', {});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
async sendMessage(chatId, text, extra = {}) {
|
|
72
|
+
return callApi(this._token, 'sendMessage', {
|
|
73
|
+
chat_id: chatId,
|
|
74
|
+
text,
|
|
75
|
+
...extra,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
async stopPolling(_opts = {}) {
|
|
80
|
+
this._polling = false;
|
|
81
|
+
try { this._abortController?.abort(); } catch { /* ignore */ }
|
|
82
|
+
this._abortController = null;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// ---------- Polling loop ----------
|
|
86
|
+
|
|
87
|
+
async _startPolling() {
|
|
88
|
+
this._polling = true;
|
|
89
|
+
// Kick off a non-awaited loop. Each iteration long-polls getUpdates for
|
|
90
|
+
// up to pollTimeoutSec, then loops immediately. We deliberately serialize
|
|
91
|
+
// (no concurrent long-polls) because Telegram rejects that with 409.
|
|
92
|
+
(async () => {
|
|
93
|
+
while (this._polling) {
|
|
94
|
+
this._abortController = new AbortController();
|
|
95
|
+
try {
|
|
96
|
+
const updates = await callApi(
|
|
97
|
+
this._token,
|
|
98
|
+
'getUpdates',
|
|
99
|
+
{
|
|
100
|
+
offset: this._offset,
|
|
101
|
+
timeout: this._pollTimeoutSec,
|
|
102
|
+
allowed_updates: ['message'],
|
|
103
|
+
},
|
|
104
|
+
{ signal: this._abortController.signal },
|
|
105
|
+
);
|
|
106
|
+
for (const update of updates) {
|
|
107
|
+
if (typeof update.update_id === 'number') {
|
|
108
|
+
this._offset = Math.max(this._offset, update.update_id + 1);
|
|
109
|
+
}
|
|
110
|
+
if (update.message) {
|
|
111
|
+
try { this.emit('message', update.message); } catch (err) {
|
|
112
|
+
// Don't let a listener exception break the poll loop.
|
|
113
|
+
this.emit('polling_error', err);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
} catch (err) {
|
|
118
|
+
// AbortError is the expected path when stopPolling() is called.
|
|
119
|
+
if (err?.name === 'AbortError' || !this._polling) break;
|
|
120
|
+
this.emit('polling_error', err);
|
|
121
|
+
// Back off before retrying — rapid retries on 401/409 would
|
|
122
|
+
// otherwise spin at 100% CPU. Upstream consumer's polling_error
|
|
123
|
+
// handler may also call stopBot() on 401/409 which flips _polling
|
|
124
|
+
// off and breaks the loop on the next tick.
|
|
125
|
+
await new Promise((r) => setTimeout(r, 2000));
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
})();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -1,170 +1,170 @@
|
|
|
1
|
-
// Translations for bot-originated replies. These are strictly server-side —
|
|
2
|
-
// the frontend has its own i18n system in src/i18n. When the user changes the
|
|
3
|
-
// app language, we persist it on the telegram_links row and the bot consults
|
|
4
|
-
// this map via `t(lang, key, vars)`.
|
|
5
|
-
//
|
|
6
|
-
// Keep keys flat; nested lookups are overkill for the small number of strings
|
|
7
|
-
// the bot actually emits. English is the source of truth; missing keys in
|
|
8
|
-
// other locales silently fall back to English.
|
|
9
|
-
|
|
10
|
-
const EN = {
|
|
11
|
-
'welcome.needsCode': '👋 Hi! Please send me your 6-digit pairing code to link this chat with your Pixcode account.',
|
|
12
|
-
'welcome.alreadyPaired': '👋 You are already paired. I will forward your messages to your most recent session.',
|
|
13
|
-
'pairing.invalidFormat': 'Please send only the 6-digit code (digits only).',
|
|
14
|
-
'pairing.notFound': 'That code is invalid or has already been used. Please generate a new one in Pixcode and try again.',
|
|
15
|
-
'pairing.expired': 'That code has expired. Please generate a new one in Pixcode.',
|
|
16
|
-
'pairing.success': '✅ Linked successfully! You will now receive notifications for completed tasks. Send me a message any time to prompt your most recent session.',
|
|
17
|
-
'pairing.stillNeeded': 'Please send your 6-digit pairing code first. Open Pixcode → Settings → Telegram to get one.',
|
|
18
|
-
'bridge.queued': '📨 Message forwarded to your latest session. I will reply when the agent responds.',
|
|
19
|
-
'bridge.disabled': 'Message bridge is disabled. Enable it in Pixcode → Settings → Telegram.',
|
|
20
|
-
'notification.taskDone': '✅ {{title}} — task completed.',
|
|
21
|
-
'notification.taskFailed': '⚠️ {{title}} — task failed: {{error}}',
|
|
22
|
-
'notification.actionRequired': '❗ {{title}} — action required.',
|
|
23
|
-
'unpaired.notice': 'This chat has been unlinked from Pixcode. Send your 6-digit code to link again.',
|
|
24
|
-
'error.generic': 'Something went wrong. Please try again.',
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const TR = {
|
|
28
|
-
'welcome.needsCode': '👋 Merhaba! Bu sohbeti Pixcode hesabınla eşlemek için 6 haneli kodunu gönder.',
|
|
29
|
-
'welcome.alreadyPaired': '👋 Zaten eşleşmişsin. Mesajlarını en son oturumuna ileteceğim.',
|
|
30
|
-
'pairing.invalidFormat': 'Lütfen sadece 6 haneli kodu gönder (yalnız rakam).',
|
|
31
|
-
'pairing.notFound': 'Bu kod geçersiz veya daha önce kullanılmış. Pixcode\'dan yeni bir tane oluştur.',
|
|
32
|
-
'pairing.expired': 'Bu kodun süresi doldu. Pixcode\'dan yeni bir tane oluştur.',
|
|
33
|
-
'pairing.success': '✅ Eşleşme başarılı! Bundan sonra tamamlanan görev bildirimlerini buradan alırsın. İstediğin zaman mesaj yazarak son oturumuna prompt gönderebilirsin.',
|
|
34
|
-
'pairing.stillNeeded': 'Önce 6 haneli eşleşme kodunu gönder. Pixcode → Ayarlar → Telegram\'dan alabilirsin.',
|
|
35
|
-
'bridge.queued': '📨 Mesaj son oturumuna iletildi. Ajan cevap verince sana yazacağım.',
|
|
36
|
-
'bridge.disabled': 'Mesaj köprüsü kapalı. Pixcode → Ayarlar → Telegram\'dan açabilirsin.',
|
|
37
|
-
'notification.taskDone': '✅ {{title}} — görev tamamlandı.',
|
|
38
|
-
'notification.taskFailed': '⚠️ {{title}} — görev başarısız: {{error}}',
|
|
39
|
-
'notification.actionRequired': '❗ {{title}} — işlem gerekli.',
|
|
40
|
-
'unpaired.notice': 'Bu sohbetin Pixcode ile bağlantısı kesildi. Tekrar eşleşmek için 6 haneli kodunu gönder.',
|
|
41
|
-
'error.generic': 'Bir şeyler ters gitti. Lütfen tekrar dene.',
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const DE = {
|
|
45
|
-
'welcome.needsCode': '👋 Hallo! Bitte sende mir deinen 6-stelligen Pairing-Code, um diesen Chat mit deinem Pixcode-Konto zu verknüpfen.',
|
|
46
|
-
'welcome.alreadyPaired': '👋 Du bist bereits verknüpft. Ich leite deine Nachrichten an deine letzte Sitzung weiter.',
|
|
47
|
-
'pairing.invalidFormat': 'Bitte sende nur den 6-stelligen Code (nur Ziffern).',
|
|
48
|
-
'pairing.notFound': 'Dieser Code ist ungültig oder wurde bereits verwendet. Erzeuge in Pixcode einen neuen.',
|
|
49
|
-
'pairing.expired': 'Der Code ist abgelaufen. Erzeuge in Pixcode einen neuen.',
|
|
50
|
-
'pairing.success': '✅ Erfolgreich verknüpft! Du bekommst jetzt Benachrichtigungen zu abgeschlossenen Aufgaben und kannst jederzeit Nachrichten an deine letzte Sitzung senden.',
|
|
51
|
-
'pairing.stillNeeded': 'Bitte sende zuerst deinen 6-stelligen Pairing-Code aus Pixcode → Einstellungen → Telegram.',
|
|
52
|
-
'bridge.queued': '📨 Nachricht an deine letzte Sitzung weitergeleitet. Ich antworte, sobald der Agent antwortet.',
|
|
53
|
-
'bridge.disabled': 'Die Nachrichtenbrücke ist deaktiviert. Aktiviere sie in Pixcode → Einstellungen → Telegram.',
|
|
54
|
-
'notification.taskDone': '✅ {{title}} — Aufgabe abgeschlossen.',
|
|
55
|
-
'notification.taskFailed': '⚠️ {{title}} — Aufgabe fehlgeschlagen: {{error}}',
|
|
56
|
-
'notification.actionRequired': '❗ {{title}} — Aktion erforderlich.',
|
|
57
|
-
'unpaired.notice': 'Dieser Chat wurde von Pixcode getrennt. Sende deinen 6-stelligen Code, um ihn erneut zu verknüpfen.',
|
|
58
|
-
'error.generic': 'Etwas ist schiefgelaufen. Bitte versuche es erneut.',
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const IT = {
|
|
62
|
-
'welcome.needsCode': '👋 Ciao! Inviami il tuo codice di abbinamento di 6 cifre per collegare questa chat al tuo account Pixcode.',
|
|
63
|
-
'welcome.alreadyPaired': '👋 Sei già collegato. Inoltrerò i tuoi messaggi alla tua ultima sessione.',
|
|
64
|
-
'pairing.invalidFormat': 'Invia solo il codice di 6 cifre (solo numeri).',
|
|
65
|
-
'pairing.notFound': 'Codice non valido o già utilizzato. Generane uno nuovo in Pixcode.',
|
|
66
|
-
'pairing.expired': 'Codice scaduto. Generane uno nuovo in Pixcode.',
|
|
67
|
-
'pairing.success': '✅ Collegato con successo! Riceverai le notifiche delle attività completate e potrai inviare messaggi alla tua ultima sessione.',
|
|
68
|
-
'pairing.stillNeeded': 'Invia prima il tuo codice di 6 cifre da Pixcode → Impostazioni → Telegram.',
|
|
69
|
-
'bridge.queued': '📨 Messaggio inoltrato alla tua ultima sessione. Risponderò quando l\'agente risponde.',
|
|
70
|
-
'bridge.disabled': 'Il bridge dei messaggi è disabilitato. Attivalo in Pixcode → Impostazioni → Telegram.',
|
|
71
|
-
'notification.taskDone': '✅ {{title}} — attività completata.',
|
|
72
|
-
'notification.taskFailed': '⚠️ {{title}} — attività fallita: {{error}}',
|
|
73
|
-
'notification.actionRequired': '❗ {{title}} — azione richiesta.',
|
|
74
|
-
'unpaired.notice': 'Questa chat è stata scollegata da Pixcode. Invia il tuo codice per ricollegarla.',
|
|
75
|
-
'error.generic': 'Qualcosa è andato storto. Riprova.',
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
const JA = {
|
|
79
|
-
'welcome.needsCode': '👋 こんにちは!このチャットをPixcodeアカウントにリンクするため、6桁のペアリングコードを送信してください。',
|
|
80
|
-
'welcome.alreadyPaired': '👋 既にリンク済みです。メッセージは最新のセッションに転送されます。',
|
|
81
|
-
'pairing.invalidFormat': '6桁の数字のみを送信してください。',
|
|
82
|
-
'pairing.notFound': 'コードが無効か既に使用されています。Pixcodeで新しいコードを生成してください。',
|
|
83
|
-
'pairing.expired': 'コードの有効期限が切れました。Pixcodeで新しいコードを生成してください。',
|
|
84
|
-
'pairing.success': '✅ リンクに成功しました!完了通知を受け取り、最新セッションへメッセージを送信できます。',
|
|
85
|
-
'pairing.stillNeeded': 'まず6桁のペアリングコードを送信してください。Pixcode → 設定 → Telegramで取得できます。',
|
|
86
|
-
'bridge.queued': '📨 メッセージを最新セッションに転送しました。エージェントの応答時にお知らせします。',
|
|
87
|
-
'bridge.disabled': 'メッセージブリッジは無効です。Pixcode → 設定 → Telegramで有効化してください。',
|
|
88
|
-
'notification.taskDone': '✅ {{title}} — タスク完了。',
|
|
89
|
-
'notification.taskFailed': '⚠️ {{title}} — タスク失敗: {{error}}',
|
|
90
|
-
'notification.actionRequired': '❗ {{title}} — 操作が必要。',
|
|
91
|
-
'unpaired.notice': 'このチャットはPixcodeから解除されました。6桁のコードで再リンクしてください。',
|
|
92
|
-
'error.generic': 'エラーが発生しました。もう一度お試しください。',
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
const KO = {
|
|
96
|
-
'welcome.needsCode': '👋 안녕하세요! Pixcode 계정과 이 채팅을 연결하려면 6자리 페어링 코드를 보내주세요.',
|
|
97
|
-
'welcome.alreadyPaired': '👋 이미 연결되어 있습니다. 메시지를 최근 세션으로 전달합니다.',
|
|
98
|
-
'pairing.invalidFormat': '숫자 6자리만 보내주세요.',
|
|
99
|
-
'pairing.notFound': '코드가 유효하지 않거나 이미 사용되었습니다. Pixcode에서 새 코드를 생성하세요.',
|
|
100
|
-
'pairing.expired': '코드가 만료되었습니다. Pixcode에서 새 코드를 생성하세요.',
|
|
101
|
-
'pairing.success': '✅ 연결 성공! 완료 알림을 받고, 최근 세션에 메시지를 보낼 수 있습니다.',
|
|
102
|
-
'pairing.stillNeeded': '먼저 6자리 페어링 코드를 보내주세요. Pixcode → 설정 → Telegram에서 얻을 수 있습니다.',
|
|
103
|
-
'bridge.queued': '📨 메시지를 최근 세션에 전달했습니다. 에이전트가 응답하면 알려드릴게요.',
|
|
104
|
-
'bridge.disabled': '메시지 브리지가 비활성화되어 있습니다. Pixcode → 설정 → Telegram에서 활성화하세요.',
|
|
105
|
-
'notification.taskDone': '✅ {{title}} — 작업 완료.',
|
|
106
|
-
'notification.taskFailed': '⚠️ {{title}} — 작업 실패: {{error}}',
|
|
107
|
-
'notification.actionRequired': '❗ {{title}} — 조치 필요.',
|
|
108
|
-
'unpaired.notice': '이 채팅은 Pixcode에서 연결 해제되었습니다. 6자리 코드로 다시 연결하세요.',
|
|
109
|
-
'error.generic': '문제가 발생했습니다. 다시 시도해주세요.',
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
const RU = {
|
|
113
|
-
'welcome.needsCode': '👋 Привет! Отправь мне 6-значный код сопряжения, чтобы связать этот чат с твоим аккаунтом Pixcode.',
|
|
114
|
-
'welcome.alreadyPaired': '👋 Ты уже связан. Я буду пересылать твои сообщения в последнюю сессию.',
|
|
115
|
-
'pairing.invalidFormat': 'Отправь только 6-значный код (только цифры).',
|
|
116
|
-
'pairing.notFound': 'Код недействителен или уже использован. Создай новый в Pixcode.',
|
|
117
|
-
'pairing.expired': 'Код истёк. Создай новый в Pixcode.',
|
|
118
|
-
'pairing.success': '✅ Связано! Теперь ты будешь получать уведомления о завершённых задачах и сможешь отправлять сообщения в последнюю сессию.',
|
|
119
|
-
'pairing.stillNeeded': 'Сначала отправь 6-значный код из Pixcode → Настройки → Telegram.',
|
|
120
|
-
'bridge.queued': '📨 Сообщение переслано в последнюю сессию. Отвечу, когда агент ответит.',
|
|
121
|
-
'bridge.disabled': 'Мост сообщений отключён. Включи его в Pixcode → Настройки → Telegram.',
|
|
122
|
-
'notification.taskDone': '✅ {{title}} — задача выполнена.',
|
|
123
|
-
'notification.taskFailed': '⚠️ {{title}} — задача провалена: {{error}}',
|
|
124
|
-
'notification.actionRequired': '❗ {{title}} — требуется действие.',
|
|
125
|
-
'unpaired.notice': 'Этот чат отвязан от Pixcode. Отправь 6-значный код, чтобы связать снова.',
|
|
126
|
-
'error.generic': 'Что-то пошло не так. Попробуй ещё раз.',
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
const ZH = {
|
|
130
|
-
'welcome.needsCode': '👋 你好!请发送 6 位配对码,将此聊天链接到你的 Pixcode 账户。',
|
|
131
|
-
'welcome.alreadyPaired': '👋 你已经链接。我会把消息转发到你最近的会话。',
|
|
132
|
-
'pairing.invalidFormat': '请只发送 6 位数字代码。',
|
|
133
|
-
'pairing.notFound': '代码无效或已使用。请在 Pixcode 中生成新代码。',
|
|
134
|
-
'pairing.expired': '代码已过期。请在 Pixcode 中生成新代码。',
|
|
135
|
-
'pairing.success': '✅ 链接成功!你将收到任务完成通知,并可以向最近的会话发送消息。',
|
|
136
|
-
'pairing.stillNeeded': '请先发送 6 位配对码。在 Pixcode → 设置 → Telegram 中获取。',
|
|
137
|
-
'bridge.queued': '📨 消息已转发到最近的会话。智能体回复时我会通知你。',
|
|
138
|
-
'bridge.disabled': '消息桥已禁用。在 Pixcode → 设置 → Telegram 中启用。',
|
|
139
|
-
'notification.taskDone': '✅ {{title}} — 任务完成。',
|
|
140
|
-
'notification.taskFailed': '⚠️ {{title}} — 任务失败:{{error}}',
|
|
141
|
-
'notification.actionRequired': '❗ {{title}} — 需要操作。',
|
|
142
|
-
'unpaired.notice': '此聊天已从 Pixcode 取消链接。发送 6 位代码即可重新链接。',
|
|
143
|
-
'error.generic': '出了点问题,请重试。',
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
const LOCALES = {
|
|
147
|
-
en: EN,
|
|
148
|
-
tr: TR,
|
|
149
|
-
de: DE,
|
|
150
|
-
it: IT,
|
|
151
|
-
ja: JA,
|
|
152
|
-
ko: KO,
|
|
153
|
-
ru: RU,
|
|
154
|
-
'zh-CN': ZH,
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
const interpolate = (template, vars) => {
|
|
158
|
-
if (!vars) return template;
|
|
159
|
-
return template.replace(/\{\{(\w+)\}\}/g, (match, name) => {
|
|
160
|
-
return Object.prototype.hasOwnProperty.call(vars, name) ? String(vars[name]) : match;
|
|
161
|
-
});
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
export const t = (language, key, vars) => {
|
|
165
|
-
const locale = LOCALES[language] || LOCALES.en;
|
|
166
|
-
const raw = locale[key] || LOCALES.en[key] || key;
|
|
167
|
-
return interpolate(raw, vars);
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
export const SUPPORTED_LANGUAGES = Object.keys(LOCALES);
|
|
1
|
+
// Translations for bot-originated replies. These are strictly server-side —
|
|
2
|
+
// the frontend has its own i18n system in src/i18n. When the user changes the
|
|
3
|
+
// app language, we persist it on the telegram_links row and the bot consults
|
|
4
|
+
// this map via `t(lang, key, vars)`.
|
|
5
|
+
//
|
|
6
|
+
// Keep keys flat; nested lookups are overkill for the small number of strings
|
|
7
|
+
// the bot actually emits. English is the source of truth; missing keys in
|
|
8
|
+
// other locales silently fall back to English.
|
|
9
|
+
|
|
10
|
+
const EN = {
|
|
11
|
+
'welcome.needsCode': '👋 Hi! Please send me your 6-digit pairing code to link this chat with your Pixcode account.',
|
|
12
|
+
'welcome.alreadyPaired': '👋 You are already paired. I will forward your messages to your most recent session.',
|
|
13
|
+
'pairing.invalidFormat': 'Please send only the 6-digit code (digits only).',
|
|
14
|
+
'pairing.notFound': 'That code is invalid or has already been used. Please generate a new one in Pixcode and try again.',
|
|
15
|
+
'pairing.expired': 'That code has expired. Please generate a new one in Pixcode.',
|
|
16
|
+
'pairing.success': '✅ Linked successfully! You will now receive notifications for completed tasks. Send me a message any time to prompt your most recent session.',
|
|
17
|
+
'pairing.stillNeeded': 'Please send your 6-digit pairing code first. Open Pixcode → Settings → Telegram to get one.',
|
|
18
|
+
'bridge.queued': '📨 Message forwarded to your latest session. I will reply when the agent responds.',
|
|
19
|
+
'bridge.disabled': 'Message bridge is disabled. Enable it in Pixcode → Settings → Telegram.',
|
|
20
|
+
'notification.taskDone': '✅ {{title}} — task completed.',
|
|
21
|
+
'notification.taskFailed': '⚠️ {{title}} — task failed: {{error}}',
|
|
22
|
+
'notification.actionRequired': '❗ {{title}} — action required.',
|
|
23
|
+
'unpaired.notice': 'This chat has been unlinked from Pixcode. Send your 6-digit code to link again.',
|
|
24
|
+
'error.generic': 'Something went wrong. Please try again.',
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const TR = {
|
|
28
|
+
'welcome.needsCode': '👋 Merhaba! Bu sohbeti Pixcode hesabınla eşlemek için 6 haneli kodunu gönder.',
|
|
29
|
+
'welcome.alreadyPaired': '👋 Zaten eşleşmişsin. Mesajlarını en son oturumuna ileteceğim.',
|
|
30
|
+
'pairing.invalidFormat': 'Lütfen sadece 6 haneli kodu gönder (yalnız rakam).',
|
|
31
|
+
'pairing.notFound': 'Bu kod geçersiz veya daha önce kullanılmış. Pixcode\'dan yeni bir tane oluştur.',
|
|
32
|
+
'pairing.expired': 'Bu kodun süresi doldu. Pixcode\'dan yeni bir tane oluştur.',
|
|
33
|
+
'pairing.success': '✅ Eşleşme başarılı! Bundan sonra tamamlanan görev bildirimlerini buradan alırsın. İstediğin zaman mesaj yazarak son oturumuna prompt gönderebilirsin.',
|
|
34
|
+
'pairing.stillNeeded': 'Önce 6 haneli eşleşme kodunu gönder. Pixcode → Ayarlar → Telegram\'dan alabilirsin.',
|
|
35
|
+
'bridge.queued': '📨 Mesaj son oturumuna iletildi. Ajan cevap verince sana yazacağım.',
|
|
36
|
+
'bridge.disabled': 'Mesaj köprüsü kapalı. Pixcode → Ayarlar → Telegram\'dan açabilirsin.',
|
|
37
|
+
'notification.taskDone': '✅ {{title}} — görev tamamlandı.',
|
|
38
|
+
'notification.taskFailed': '⚠️ {{title}} — görev başarısız: {{error}}',
|
|
39
|
+
'notification.actionRequired': '❗ {{title}} — işlem gerekli.',
|
|
40
|
+
'unpaired.notice': 'Bu sohbetin Pixcode ile bağlantısı kesildi. Tekrar eşleşmek için 6 haneli kodunu gönder.',
|
|
41
|
+
'error.generic': 'Bir şeyler ters gitti. Lütfen tekrar dene.',
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const DE = {
|
|
45
|
+
'welcome.needsCode': '👋 Hallo! Bitte sende mir deinen 6-stelligen Pairing-Code, um diesen Chat mit deinem Pixcode-Konto zu verknüpfen.',
|
|
46
|
+
'welcome.alreadyPaired': '👋 Du bist bereits verknüpft. Ich leite deine Nachrichten an deine letzte Sitzung weiter.',
|
|
47
|
+
'pairing.invalidFormat': 'Bitte sende nur den 6-stelligen Code (nur Ziffern).',
|
|
48
|
+
'pairing.notFound': 'Dieser Code ist ungültig oder wurde bereits verwendet. Erzeuge in Pixcode einen neuen.',
|
|
49
|
+
'pairing.expired': 'Der Code ist abgelaufen. Erzeuge in Pixcode einen neuen.',
|
|
50
|
+
'pairing.success': '✅ Erfolgreich verknüpft! Du bekommst jetzt Benachrichtigungen zu abgeschlossenen Aufgaben und kannst jederzeit Nachrichten an deine letzte Sitzung senden.',
|
|
51
|
+
'pairing.stillNeeded': 'Bitte sende zuerst deinen 6-stelligen Pairing-Code aus Pixcode → Einstellungen → Telegram.',
|
|
52
|
+
'bridge.queued': '📨 Nachricht an deine letzte Sitzung weitergeleitet. Ich antworte, sobald der Agent antwortet.',
|
|
53
|
+
'bridge.disabled': 'Die Nachrichtenbrücke ist deaktiviert. Aktiviere sie in Pixcode → Einstellungen → Telegram.',
|
|
54
|
+
'notification.taskDone': '✅ {{title}} — Aufgabe abgeschlossen.',
|
|
55
|
+
'notification.taskFailed': '⚠️ {{title}} — Aufgabe fehlgeschlagen: {{error}}',
|
|
56
|
+
'notification.actionRequired': '❗ {{title}} — Aktion erforderlich.',
|
|
57
|
+
'unpaired.notice': 'Dieser Chat wurde von Pixcode getrennt. Sende deinen 6-stelligen Code, um ihn erneut zu verknüpfen.',
|
|
58
|
+
'error.generic': 'Etwas ist schiefgelaufen. Bitte versuche es erneut.',
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const IT = {
|
|
62
|
+
'welcome.needsCode': '👋 Ciao! Inviami il tuo codice di abbinamento di 6 cifre per collegare questa chat al tuo account Pixcode.',
|
|
63
|
+
'welcome.alreadyPaired': '👋 Sei già collegato. Inoltrerò i tuoi messaggi alla tua ultima sessione.',
|
|
64
|
+
'pairing.invalidFormat': 'Invia solo il codice di 6 cifre (solo numeri).',
|
|
65
|
+
'pairing.notFound': 'Codice non valido o già utilizzato. Generane uno nuovo in Pixcode.',
|
|
66
|
+
'pairing.expired': 'Codice scaduto. Generane uno nuovo in Pixcode.',
|
|
67
|
+
'pairing.success': '✅ Collegato con successo! Riceverai le notifiche delle attività completate e potrai inviare messaggi alla tua ultima sessione.',
|
|
68
|
+
'pairing.stillNeeded': 'Invia prima il tuo codice di 6 cifre da Pixcode → Impostazioni → Telegram.',
|
|
69
|
+
'bridge.queued': '📨 Messaggio inoltrato alla tua ultima sessione. Risponderò quando l\'agente risponde.',
|
|
70
|
+
'bridge.disabled': 'Il bridge dei messaggi è disabilitato. Attivalo in Pixcode → Impostazioni → Telegram.',
|
|
71
|
+
'notification.taskDone': '✅ {{title}} — attività completata.',
|
|
72
|
+
'notification.taskFailed': '⚠️ {{title}} — attività fallita: {{error}}',
|
|
73
|
+
'notification.actionRequired': '❗ {{title}} — azione richiesta.',
|
|
74
|
+
'unpaired.notice': 'Questa chat è stata scollegata da Pixcode. Invia il tuo codice per ricollegarla.',
|
|
75
|
+
'error.generic': 'Qualcosa è andato storto. Riprova.',
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const JA = {
|
|
79
|
+
'welcome.needsCode': '👋 こんにちは!このチャットをPixcodeアカウントにリンクするため、6桁のペアリングコードを送信してください。',
|
|
80
|
+
'welcome.alreadyPaired': '👋 既にリンク済みです。メッセージは最新のセッションに転送されます。',
|
|
81
|
+
'pairing.invalidFormat': '6桁の数字のみを送信してください。',
|
|
82
|
+
'pairing.notFound': 'コードが無効か既に使用されています。Pixcodeで新しいコードを生成してください。',
|
|
83
|
+
'pairing.expired': 'コードの有効期限が切れました。Pixcodeで新しいコードを生成してください。',
|
|
84
|
+
'pairing.success': '✅ リンクに成功しました!完了通知を受け取り、最新セッションへメッセージを送信できます。',
|
|
85
|
+
'pairing.stillNeeded': 'まず6桁のペアリングコードを送信してください。Pixcode → 設定 → Telegramで取得できます。',
|
|
86
|
+
'bridge.queued': '📨 メッセージを最新セッションに転送しました。エージェントの応答時にお知らせします。',
|
|
87
|
+
'bridge.disabled': 'メッセージブリッジは無効です。Pixcode → 設定 → Telegramで有効化してください。',
|
|
88
|
+
'notification.taskDone': '✅ {{title}} — タスク完了。',
|
|
89
|
+
'notification.taskFailed': '⚠️ {{title}} — タスク失敗: {{error}}',
|
|
90
|
+
'notification.actionRequired': '❗ {{title}} — 操作が必要。',
|
|
91
|
+
'unpaired.notice': 'このチャットはPixcodeから解除されました。6桁のコードで再リンクしてください。',
|
|
92
|
+
'error.generic': 'エラーが発生しました。もう一度お試しください。',
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const KO = {
|
|
96
|
+
'welcome.needsCode': '👋 안녕하세요! Pixcode 계정과 이 채팅을 연결하려면 6자리 페어링 코드를 보내주세요.',
|
|
97
|
+
'welcome.alreadyPaired': '👋 이미 연결되어 있습니다. 메시지를 최근 세션으로 전달합니다.',
|
|
98
|
+
'pairing.invalidFormat': '숫자 6자리만 보내주세요.',
|
|
99
|
+
'pairing.notFound': '코드가 유효하지 않거나 이미 사용되었습니다. Pixcode에서 새 코드를 생성하세요.',
|
|
100
|
+
'pairing.expired': '코드가 만료되었습니다. Pixcode에서 새 코드를 생성하세요.',
|
|
101
|
+
'pairing.success': '✅ 연결 성공! 완료 알림을 받고, 최근 세션에 메시지를 보낼 수 있습니다.',
|
|
102
|
+
'pairing.stillNeeded': '먼저 6자리 페어링 코드를 보내주세요. Pixcode → 설정 → Telegram에서 얻을 수 있습니다.',
|
|
103
|
+
'bridge.queued': '📨 메시지를 최근 세션에 전달했습니다. 에이전트가 응답하면 알려드릴게요.',
|
|
104
|
+
'bridge.disabled': '메시지 브리지가 비활성화되어 있습니다. Pixcode → 설정 → Telegram에서 활성화하세요.',
|
|
105
|
+
'notification.taskDone': '✅ {{title}} — 작업 완료.',
|
|
106
|
+
'notification.taskFailed': '⚠️ {{title}} — 작업 실패: {{error}}',
|
|
107
|
+
'notification.actionRequired': '❗ {{title}} — 조치 필요.',
|
|
108
|
+
'unpaired.notice': '이 채팅은 Pixcode에서 연결 해제되었습니다. 6자리 코드로 다시 연결하세요.',
|
|
109
|
+
'error.generic': '문제가 발생했습니다. 다시 시도해주세요.',
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const RU = {
|
|
113
|
+
'welcome.needsCode': '👋 Привет! Отправь мне 6-значный код сопряжения, чтобы связать этот чат с твоим аккаунтом Pixcode.',
|
|
114
|
+
'welcome.alreadyPaired': '👋 Ты уже связан. Я буду пересылать твои сообщения в последнюю сессию.',
|
|
115
|
+
'pairing.invalidFormat': 'Отправь только 6-значный код (только цифры).',
|
|
116
|
+
'pairing.notFound': 'Код недействителен или уже использован. Создай новый в Pixcode.',
|
|
117
|
+
'pairing.expired': 'Код истёк. Создай новый в Pixcode.',
|
|
118
|
+
'pairing.success': '✅ Связано! Теперь ты будешь получать уведомления о завершённых задачах и сможешь отправлять сообщения в последнюю сессию.',
|
|
119
|
+
'pairing.stillNeeded': 'Сначала отправь 6-значный код из Pixcode → Настройки → Telegram.',
|
|
120
|
+
'bridge.queued': '📨 Сообщение переслано в последнюю сессию. Отвечу, когда агент ответит.',
|
|
121
|
+
'bridge.disabled': 'Мост сообщений отключён. Включи его в Pixcode → Настройки → Telegram.',
|
|
122
|
+
'notification.taskDone': '✅ {{title}} — задача выполнена.',
|
|
123
|
+
'notification.taskFailed': '⚠️ {{title}} — задача провалена: {{error}}',
|
|
124
|
+
'notification.actionRequired': '❗ {{title}} — требуется действие.',
|
|
125
|
+
'unpaired.notice': 'Этот чат отвязан от Pixcode. Отправь 6-значный код, чтобы связать снова.',
|
|
126
|
+
'error.generic': 'Что-то пошло не так. Попробуй ещё раз.',
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const ZH = {
|
|
130
|
+
'welcome.needsCode': '👋 你好!请发送 6 位配对码,将此聊天链接到你的 Pixcode 账户。',
|
|
131
|
+
'welcome.alreadyPaired': '👋 你已经链接。我会把消息转发到你最近的会话。',
|
|
132
|
+
'pairing.invalidFormat': '请只发送 6 位数字代码。',
|
|
133
|
+
'pairing.notFound': '代码无效或已使用。请在 Pixcode 中生成新代码。',
|
|
134
|
+
'pairing.expired': '代码已过期。请在 Pixcode 中生成新代码。',
|
|
135
|
+
'pairing.success': '✅ 链接成功!你将收到任务完成通知,并可以向最近的会话发送消息。',
|
|
136
|
+
'pairing.stillNeeded': '请先发送 6 位配对码。在 Pixcode → 设置 → Telegram 中获取。',
|
|
137
|
+
'bridge.queued': '📨 消息已转发到最近的会话。智能体回复时我会通知你。',
|
|
138
|
+
'bridge.disabled': '消息桥已禁用。在 Pixcode → 设置 → Telegram 中启用。',
|
|
139
|
+
'notification.taskDone': '✅ {{title}} — 任务完成。',
|
|
140
|
+
'notification.taskFailed': '⚠️ {{title}} — 任务失败:{{error}}',
|
|
141
|
+
'notification.actionRequired': '❗ {{title}} — 需要操作。',
|
|
142
|
+
'unpaired.notice': '此聊天已从 Pixcode 取消链接。发送 6 位代码即可重新链接。',
|
|
143
|
+
'error.generic': '出了点问题,请重试。',
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
const LOCALES = {
|
|
147
|
+
en: EN,
|
|
148
|
+
tr: TR,
|
|
149
|
+
de: DE,
|
|
150
|
+
it: IT,
|
|
151
|
+
ja: JA,
|
|
152
|
+
ko: KO,
|
|
153
|
+
ru: RU,
|
|
154
|
+
'zh-CN': ZH,
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
const interpolate = (template, vars) => {
|
|
158
|
+
if (!vars) return template;
|
|
159
|
+
return template.replace(/\{\{(\w+)\}\}/g, (match, name) => {
|
|
160
|
+
return Object.prototype.hasOwnProperty.call(vars, name) ? String(vars[name]) : match;
|
|
161
|
+
});
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export const t = (language, key, vars) => {
|
|
165
|
+
const locale = LOCALES[language] || LOCALES.en;
|
|
166
|
+
const raw = locale[key] || LOCALES.en[key] || key;
|
|
167
|
+
return interpolate(raw, vars);
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
export const SUPPORTED_LANGUAGES = Object.keys(LOCALES);
|