limixbot 0.3.25 → 0.3.27
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/assets/{ActivityPanel-CgPkGKZZ.js → ActivityPanel-CZp2xEki.js} +1 -1
- package/dist/assets/{App-lurtH-qI.js → App-D_mkV9W-.js} +119 -119
- package/dist/assets/{AppEventEditor-G_71EWui.js → AppEventEditor-D64c8IWK.js} +1 -1
- package/dist/assets/BotSettingsDialog-DaI2-9_R.js +16 -0
- package/dist/assets/{BrowserPanel-DrKZNyYB.js → BrowserPanel-6q-wWkU_.js} +1 -1
- package/dist/assets/{BrowserProfilesManager-CtiUbbdv.js → BrowserProfilesManager-A9Zp2yg3.js} +1 -1
- package/dist/assets/{CloudAddDialog-D4BX2927.js → CloudAddDialog-C13cTWxt.js} +1 -1
- package/dist/assets/{ComputerFilesPane-RnmlJhlD.js → ComputerFilesPane-DXUwyPuB.js} +1 -1
- package/dist/assets/{ComputerPanel-D8upQSmd.js → ComputerPanel-B9Q6kwf8.js} +2 -2
- package/dist/assets/{DataPanel-MZcku4SL.js → DataPanel-D7ycypEv.js} +1 -1
- package/dist/assets/{DesktopViewer-p7N7cqle.js → DesktopViewer-CRcjWYHe.js} +1 -1
- package/dist/assets/{FilesView-CDbtoPxh.js → FilesView-C9q-oJuG.js} +1 -1
- package/dist/assets/{GrokMoveDialog-BebZb43R.js → GrokMoveDialog-CZv7Fds1.js} +1 -1
- package/dist/assets/{InspectorPanel-BMkRIuTz.js → InspectorPanel-fkCIC4EB.js} +1 -1
- package/dist/assets/{KeyboardShortcutsModal-3XyVcNTZ.js → KeyboardShortcutsModal-CgCp58T_.js} +1 -1
- package/dist/assets/{LiveDesktop-BkRR5lCn.js → LiveDesktop-od0aHHqq.js} +1 -1
- package/dist/assets/{LocalVmWorkspace-9l9iWtAy.js → LocalVmWorkspace-DH05UaVi.js} +1 -1
- package/dist/assets/{MacLocalControl-B45d0l7H.js → MacLocalControl-CEALKyim.js} +1 -1
- package/dist/assets/{MarkdownFilePreview-ChR-f9oD.js → MarkdownFilePreview-DhFsdkOv.js} +1 -1
- package/dist/assets/{MenuMotion-BBaxdyL_.js → MenuMotion-BOUToDZz.js} +1 -1
- package/dist/assets/{NewBotDialog-C_uQRhxy.js → NewBotDialog-Ceqj6MMN.js} +1 -1
- package/dist/assets/{PhoneAppDialog-CDO1xUXD.js → PhoneAppDialog-CUxtDKPl.js} +1 -1
- package/dist/assets/{PlacesRail-iu-rjh5s.js → PlacesRail-dslg5RRJ.js} +1 -1
- package/dist/assets/{PluginsPanel-DlQBRYQB.js → PluginsPanel-CCQmQ2XT.js} +1 -1
- package/dist/assets/{ProIntroduction-RbtTSiR6.js → ProIntroduction-D0A7u7j2.js} +1 -1
- package/dist/assets/{RemoteAgentSettingsPanel-C8r-80J4.js → RemoteAgentSettingsPanel-CMyqxw7K.js} +1 -1
- package/dist/assets/{RoomPanel-BIUTnm5N.js → RoomPanel-DNYnR3YM.js} +1 -1
- package/dist/assets/{RoutinesPage-DROK-336.js → RoutinesPage-BOkrb8H8.js} +2 -2
- package/dist/assets/SettingsModal-ZyPdij7d.js +19 -0
- package/dist/assets/{ShareTeamDialog-CVnQoRVQ.js → ShareTeamDialog-BlrpGRW0.js} +1 -1
- package/dist/assets/{SignedInSites-B-iBIlfL.js → SignedInSites-Deoa-m3S.js} +1 -1
- package/dist/assets/TeamLibraryPanel-jl65sW8p.js +1 -0
- package/dist/assets/{TeamMapPage-kXk9hCNu.js → TeamMapPage-DkQj9J_8.js} +1 -1
- package/dist/assets/{TriggersPage-prZBUP3d.js → TriggersPage-CiEkHUBu.js} +1 -1
- package/dist/assets/{VisibilitySection-DJjvTyLx.js → VisibilitySection-Dd761EPJ.js} +1 -1
- package/dist/assets/{WebhookTrigger-BAFikH71.js → WebhookTrigger-DSdjao1J.js} +1 -1
- package/dist/assets/{WorksOnGrid-DJmfLtP8.js → WorksOnGrid-Bu7gRfv5.js} +1 -1
- package/dist/assets/{abnfDiagram-YUKMZFIV-DUI6uevQ.js → abnfDiagram-YUKMZFIV-UeQ15ljp.js} +1 -1
- package/dist/assets/{activity-DVLFekjx.js → activity-Rykx5lZJ.js} +1 -1
- package/dist/assets/{architectureDiagram-47P4ROYG-CMELW5_4.js → architectureDiagram-47P4ROYG-Cb42ilBV.js} +1 -1
- package/dist/assets/{blockDiagram-E7TT5TSB-C3xD0z1e.js → blockDiagram-E7TT5TSB-BF1yg64q.js} +1 -1
- package/dist/assets/{c4Diagram-CRA5TL53-Cm9X0GEV.js → c4Diagram-CRA5TL53-VaNJpISp.js} +1 -1
- package/dist/assets/{calendar-days-CDvwJ_d4.js → calendar-days-kC634hX1.js} +1 -1
- package/dist/assets/channel-Di74R1Kh.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-LWcbjcjL.js → chunk-2Q5K7J3B-NtXjlfnQ.js} +1 -1
- package/dist/assets/{chunk-5VM5RSS4-B3rNoWeE.js → chunk-5VM5RSS4-CYWCBb40.js} +1 -1
- package/dist/assets/{chunk-7TKQ45FW-FL9R0rHe.js → chunk-7TKQ45FW-CTx1wLnU.js} +1 -1
- package/dist/assets/{chunk-AW2ZBBNX-JRef_4rd.js → chunk-AW2ZBBNX-PDrwpbhk.js} +1 -1
- package/dist/assets/{chunk-FVRAUYC3-C__loQFR.js → chunk-FVRAUYC3-CqIp8Ubp.js} +2 -2
- package/dist/assets/{chunk-HTAEGDNF-Bx74_xmN.js → chunk-HTAEGDNF-yA6riuIr.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-B20vr3uH.js → chunk-JWPE2WC7-DEE_S031.js} +1 -1
- package/dist/assets/{chunk-KQW6MTUR-DfO9J2pt.js → chunk-KQW6MTUR-QybxNtsY.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-BAPGqnqj.js → chunk-XXDRQBXY-BjchQyqU.js} +1 -1
- package/dist/assets/{classDiagram-v2-K4WV4PDN-C3VR3yN8.js → classDiagram-v2-K4WV4PDN-DtOc8Abr.js} +1 -1
- package/dist/assets/{coins-CueFc0mY.js → coins-D0wNJCPg.js} +1 -1
- package/dist/assets/{core-Bw6kaGwe.js → core-8pT2FttX.js} +1 -1
- package/dist/assets/{cose-bilkent-JH36ORCC-19p3m04s.js → cose-bilkent-JH36ORCC-CWHsqn7M.js} +1 -1
- package/dist/assets/{cynefin-EF2NZ3EQ-Tv0tce7B.js → cynefin-EF2NZ3EQ-BqS-D9jN.js} +1 -1
- package/dist/assets/{cynefinDiagram-3GCD6N5R-Iin0JwlW.js → cynefinDiagram-3GCD6N5R-Fc51YETb.js} +1 -1
- package/dist/assets/{dagre-W4DXFKR2-00TRmSmB.js → dagre-W4DXFKR2-So1kz52t.js} +1 -1
- package/dist/assets/{diagram-2UJZ2QOL-DslMBjKt.js → diagram-2UJZ2QOL-DpdA_Lk0.js} +1 -1
- package/dist/assets/{diagram-OVF4WLC6-C3o3f1eL.js → diagram-OVF4WLC6-BqSu7ih2.js} +1 -1
- package/dist/assets/{diagram-PFPMY2P6-RRy9F9wH.js → diagram-PFPMY2P6-BoM6YcIG.js} +1 -1
- package/dist/assets/{diagram-UMYRVEAY-CWfRKtkp.js → diagram-UMYRVEAY-B7wKoLi9.js} +1 -1
- package/dist/assets/{diagram-YEKJPTXX-SlJKvYay.js → diagram-YEKJPTXX-BEXKw540.js} +1 -1
- package/dist/assets/{diagram-ZIFT7M5P-DqzI8_eN.js → diagram-ZIFT7M5P-BAD7sJRi.js} +1 -1
- package/dist/assets/{ebnfDiagram-VR2GEFS7-CDsrBNMu.js → ebnfDiagram-VR2GEFS7-DILoqvy-.js} +1 -1
- package/dist/assets/{elk-IJKZMXRS-iikFqO-X.js → elk-IJKZMXRS-BHW-Cxin.js} +1 -1
- package/dist/assets/{erDiagram-O2IAPWRE-DzFCc0Gp.js → erDiagram-O2IAPWRE-Blp0Wwq0.js} +1 -1
- package/dist/assets/{file-up-BzW-KJx-.js → file-up-CEuHjVBK.js} +1 -1
- package/dist/assets/{flowDiagram-OXPTDLAJ-U5nLRus2.js → flowDiagram-OXPTDLAJ-6SkVmYje.js} +1 -1
- package/dist/assets/{ganttDiagram-R7TSEDQI-h7xqrZ23.js → ganttDiagram-R7TSEDQI-DFDwj8QX.js} +1 -1
- package/dist/assets/{gitGraphDiagram-XJZIOB7I-Bo9ZX2g5.js → gitGraphDiagram-XJZIOB7I-mtJG-sis.js} +1 -1
- package/dist/assets/{import-name-BN_-MYip.js → import-name-C4W1Pfjg.js} +1 -1
- package/dist/assets/{index-BEjJ5c6H.js → index-C-oxoDHn.js} +2 -2
- package/dist/assets/{index-DkDFNBNq.js → index-IrHnIHKE.js} +1 -1
- package/dist/assets/{infoDiagram-5W2HQ5XZ-CAZmFoiz.js → infoDiagram-5W2HQ5XZ-CmyXB17U.js} +1 -1
- package/dist/assets/{ishikawaDiagram-K3B6WC7H-T1M7DtvG.js → ishikawaDiagram-K3B6WC7H-BKFtIESa.js} +1 -1
- package/dist/assets/{journeyDiagram-COXZFDF6-DzO0Gzq9.js → journeyDiagram-COXZFDF6-DuXMREdz.js} +1 -1
- package/dist/assets/{kanban-definition-P3RFRI5V-C0fM1UHu.js → kanban-definition-P3RFRI5V-B9mWvKdh.js} +1 -1
- package/dist/assets/{mcp-servers-C7oRQpN5.js → mcp-servers-sCMeVHO_.js} +1 -1
- package/dist/assets/{mermaid.core-mKZTdBWz.js → mermaid.core-3c-Lql2y.js} +4 -4
- package/dist/assets/{mindmap-definition-LZFPQGKD-DEgoC28p.js → mindmap-definition-LZFPQGKD-BmLt9bkD.js} +1 -1
- package/dist/assets/{minimize-D-CvaOV-.js → minimize-BfKI3Nbu.js} +1 -1
- package/dist/assets/{monitor-DRcE92Rj.js → monitor-C-EBTsrK.js} +1 -1
- package/dist/assets/{new-bot-COj1uEQa.js → new-bot-BEp90nDO.js} +1 -1
- package/dist/assets/{org-library-BIb28h24.js → org-library-CtpOGMPw.js} +1 -1
- package/dist/assets/{package-format-hON5OXLZ.js → package-format-JjOaH2hV.js} +1 -1
- package/dist/assets/{pegDiagram-BGZESJAR-Vatn56u_.js → pegDiagram-BGZESJAR-5w1MTtLg.js} +1 -1
- package/dist/assets/{pieDiagram-CAPJLFHJ-DniOgFo3.js → pieDiagram-CAPJLFHJ-C4etNvsK.js} +1 -1
- package/dist/assets/{quadrantDiagram-GDMTTRAM-BqhAQt5w.js → quadrantDiagram-GDMTTRAM-k4cDUeIN.js} +1 -1
- package/dist/assets/{rail-BWcrFQ2_.js → rail-C6qkoJbO.js} +1 -1
- package/dist/assets/{railroadDiagram-SM67HX2B-CxHs3JOs.js → railroadDiagram-SM67HX2B-B9d0qasL.js} +1 -1
- package/dist/assets/{remote-desktop-panel-9XdtvJrd.js → remote-desktop-panel-D_ANOxbk.js} +1 -1
- package/dist/assets/{requirementDiagram-X7JNWC4A-ChjhMFon.js → requirementDiagram-X7JNWC4A-BlYV4z86.js} +1 -1
- package/dist/assets/{sankeyDiagram-UM26HJRW-B67bYF8E.js → sankeyDiagram-UM26HJRW-DaIVWJEd.js} +1 -1
- package/dist/assets/{sequenceDiagram-ZO4K6R2Y-CTy7B-eu.js → sequenceDiagram-ZO4K6R2Y-CAnXpud0.js} +1 -1
- package/dist/assets/{sizeCapture-INFHLROL-uy6qiY-2.js → sizeCapture-INFHLROL-BIeqIcHi.js} +1 -1
- package/dist/assets/{stateDiagram-v2-TBUQTH76-BvYYPNqL.js → stateDiagram-v2-TBUQTH76-7ql5dn9y.js} +1 -1
- package/dist/assets/{styles-DlOxUga6.js → styles-BRMaHK08.js} +2 -2
- package/dist/assets/{swimlanes-N4OXWK64-CMSAKu-2.js → swimlanes-N4OXWK64-CItt-UlU.js} +1 -1
- package/dist/assets/swimlanesDiagram-K3J5GTZL-DAZsljU6.js +8 -0
- package/dist/assets/{team-share-BbQqJ5O6.js → team-share-2OjfOHsk.js} +1 -1
- package/dist/assets/{timeline-definition-YOQAKGHF-BOK1V5EC.js → timeline-definition-YOQAKGHF-8Xn9QBNo.js} +1 -1
- package/dist/assets/{usecaseDiagram-VIAY4XPW-DEywfSfC.js → usecaseDiagram-VIAY4XPW-B6LxotkO.js} +1 -1
- package/dist/assets/{vennDiagram-BLWOH2XV-DN1iWw97.js → vennDiagram-BLWOH2XV-Ciex0LDC.js} +1 -1
- package/dist/assets/{wardleyDiagram-YMQ3BMBF-BAIfK1We.js → wardleyDiagram-YMQ3BMBF-B_TbpQlN.js} +1 -1
- package/dist/assets/{xychartDiagram-TAQBALBS-BLBD8FaQ.js → xychartDiagram-TAQBALBS-Dz_iIYt1.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/rail.html +4 -4
- package/dist-server/index.js +1676 -1665
- package/dist-server/package.json +1 -1
- package/dist-server/server/index.js +2 -0
- package/dist-server/server/limix-bot-library.js +9 -8
- package/dist-server/server/limix-gateway-sidecar.js +114 -0
- package/dist-server/server/limix-lang.js +2 -0
- package/dist-server/server/limix-owner-lane.js +5 -2
- package/dist-server/server/limix-skill-hub.js +18 -17
- package/dist-server/server/limix-skill-store.js +12 -11
- package/dist-server/server/routes/bot-skills.js +3 -0
- package/dist-server/shared/first-reply-rescue.js +4 -3
- package/package.json +1 -1
- package/dist/assets/BotSettingsDialog-BUvuLu53.js +0 -16
- package/dist/assets/SettingsModal--yYGUYK2.js +0 -15
- package/dist/assets/TeamLibraryPanel-CwVaJVC_.js +0 -1
- package/dist/assets/channel-CsOUN1ZX.js +0 -1
- package/dist/assets/swimlanesDiagram-K3J5GTZL-BaaZdhur.js +0 -8
package/dist-server/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"type":"module","version":"0.3.
|
|
1
|
+
{"type":"module","version":"0.3.27"}
|
|
@@ -512,6 +512,7 @@ import { createBotOrderRoutes } from "./routes/bot-order.js";
|
|
|
512
512
|
import { createBotLifecycleRoutes } from "./routes/bot-lifecycle.js";
|
|
513
513
|
import { createBotSkillsRoutes } from "./routes/bot-skills.js";
|
|
514
514
|
import { startHubAutoSync } from "./limix-skill-hub.js";
|
|
515
|
+
import { startLimixGatewaySidecar } from "./limix-gateway-sidecar.js";
|
|
515
516
|
import { limixBundledFor, limixSelectBundled, limixSkillDefaultsMigration } from "./limix-skill-store.js";
|
|
516
517
|
import { createSkillShareRoutes } from "./routes/skill-share.js";
|
|
517
518
|
import { createTeamContextRoutes } from "./routes/team-context.js";
|
|
@@ -1438,6 +1439,7 @@ const firstEngineRead = holdUntilFirstEngineRead();
|
|
|
1438
1439
|
await registry.load(providerConfigs(), decorateHostedProvider);
|
|
1439
1440
|
const bundledSkills = loadBundledSkills();
|
|
1440
1441
|
limixSkillDefaultsMigration();
|
|
1442
|
+
startLimixGatewaySidecar({ port: PORT, webhookPort: WEBHOOK_PORT });
|
|
1441
1443
|
const availableSkills = () => mergeSkills(bundledSkills, loadUserSkills(join(DATA_DIR, "skills")));
|
|
1442
1444
|
/** Every turn the engine can mount it, whatever its words: they pick only the skill's instructions. A Cloud home or a hosted workspace has no USB port. */
|
|
1443
1445
|
const usbPhoneOffered = (instance, skills) => instance.adapter.capabilities.phoneMcp === true &&
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// template only describes who the bot is: its routines always arrive paused and nothing is connected for the person.
|
|
5
5
|
import { MASCOT_BODY_IDS } from "../shared/mascot-bodies.js";
|
|
6
6
|
import { MAUS_COLOR_NAMES } from "../shared/wire.js";
|
|
7
|
+
import { lxs } from "./limix-lang.js";
|
|
7
8
|
const TEAM_LIBRARY_RAW_ROOT = "https://raw.githubusercontent.com/leomieo/limix-bot-teams/main";
|
|
8
9
|
const LIST_TTL_MS = 10 * 60 * 1000;
|
|
9
10
|
const MAX_CATALOG_BYTES = 256_000;
|
|
@@ -52,11 +53,11 @@ function apps(value, field) {
|
|
|
52
53
|
}
|
|
53
54
|
export function parseBotListing(value) {
|
|
54
55
|
if (!isRecord(value) || value.format !== "openmaus.catalog" || value.version !== 1)
|
|
55
|
-
throw new Error("Danh sách mẫu không đúng định dạng");
|
|
56
|
+
throw new Error(lxs("Danh sách mẫu không đúng định dạng", "The template list has the wrong format"));
|
|
56
57
|
if (value.bots === undefined)
|
|
57
58
|
return [];
|
|
58
59
|
if (!Array.isArray(value.bots) || value.bots.length > 200)
|
|
59
|
-
throw new Error("Danh sách bot mẫu không hợp lệ");
|
|
60
|
+
throw new Error(lxs("Danh sách bot mẫu không hợp lệ", "The template bot list is not valid"));
|
|
60
61
|
const seen = new Set();
|
|
61
62
|
const out = [];
|
|
62
63
|
value.bots.forEach((raw, index) => {
|
|
@@ -83,10 +84,10 @@ export function parseBotListing(value) {
|
|
|
83
84
|
}
|
|
84
85
|
export function parseLibraryBot(value, expectedId) {
|
|
85
86
|
if (!isRecord(value) || value.format !== "limix.bot" || value.version !== 1)
|
|
86
|
-
throw new Error("Tệp bot mẫu không đúng định dạng");
|
|
87
|
+
throw new Error(lxs("Tệp bot mẫu không đúng định dạng", "The template bot file has the wrong format"));
|
|
87
88
|
const id = text(value.id, "id", 64);
|
|
88
89
|
if (id !== expectedId)
|
|
89
|
-
throw new Error("Tệp bot mẫu không khớp với danh sách");
|
|
90
|
+
throw new Error(lxs("Tệp bot mẫu không khớp với danh sách", "The template bot file does not match the list"));
|
|
90
91
|
if (!Array.isArray(value.tryAsking) || value.tryAsking.length === 0 || value.tryAsking.length > 6)
|
|
91
92
|
throw new Error("tryAsking is invalid");
|
|
92
93
|
const bot = {
|
|
@@ -134,15 +135,15 @@ export function parseLibraryBot(value, expectedId) {
|
|
|
134
135
|
async function fetchJson(url, maxBytes) {
|
|
135
136
|
const response = await fetch(url, { headers: { accept: "application/json, text/plain;q=0.9" }, redirect: "error", signal: AbortSignal.timeout(10_000) });
|
|
136
137
|
if (!response.ok)
|
|
137
|
-
throw new Error(`GitHub trả lỗi HTTP ${response.status}`);
|
|
138
|
+
throw new Error(lxs(`GitHub trả lỗi HTTP ${response.status}`, `GitHub returned HTTP ${response.status}`));
|
|
138
139
|
const raw = await response.text();
|
|
139
140
|
if (Buffer.byteLength(raw) > maxBytes)
|
|
140
|
-
throw new Error("Tệp mẫu quá lớn");
|
|
141
|
+
throw new Error(lxs("Tệp mẫu quá lớn", "The template file is too large"));
|
|
141
142
|
try {
|
|
142
143
|
return JSON.parse(raw);
|
|
143
144
|
}
|
|
144
145
|
catch {
|
|
145
|
-
throw new Error("GitHub không trả về JSON hợp lệ");
|
|
146
|
+
throw new Error(lxs("GitHub không trả về JSON hợp lệ", "GitHub did not return valid JSON"));
|
|
146
147
|
}
|
|
147
148
|
}
|
|
148
149
|
let cached = null;
|
|
@@ -175,7 +176,7 @@ export async function handleLimixBotLibrary(method, path) {
|
|
|
175
176
|
return null;
|
|
176
177
|
const id = match[1];
|
|
177
178
|
if (!(await listing()).some((bot) => bot.id === id))
|
|
178
|
-
return { status: 404, body: { error: "Không có bot mẫu này" } };
|
|
179
|
+
return { status: 404, body: { error: lxs("Không có bot mẫu này", "No such template bot") } };
|
|
179
180
|
return { status: 200, body: { bot: parseLibraryBot(await fetchJson(`${TEAM_LIBRARY_RAW_ROOT}/bots/${id}.json?t=${Date.now()}`, MAX_BOT_BYTES), id) } };
|
|
180
181
|
}
|
|
181
182
|
catch (error) {
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
// Limix Bot on a server (Docker image, LIMIX_GATEWAY_SIDECAR=1): the Telegram / Zalo / Discord connector
|
|
2
|
+
// (limix/gateway) runs beside the server, so the bots keep answering while every computer is off. On the desktop the
|
|
3
|
+
// app runs the connector itself (electron/limix-gateway.mjs) and this file does nothing.
|
|
4
|
+
//
|
|
5
|
+
// The connector listens only on 127.0.0.1:8790 inside the machine. Its page is reached through this server at
|
|
6
|
+
// /api/limix/gateway/, behind the server's own sign-in (a paired device or the loopback owner): the server adds the
|
|
7
|
+
// connector's admin token to each call, so the token never has to be typed or shared.
|
|
8
|
+
import { spawn } from "node:child_process";
|
|
9
|
+
import { randomBytes } from "node:crypto";
|
|
10
|
+
import { existsSync, mkdirSync } from "node:fs";
|
|
11
|
+
import { request as httpRequest } from "node:http";
|
|
12
|
+
import { join } from "node:path";
|
|
13
|
+
import { DATA_DIR } from "./config.js";
|
|
14
|
+
import { limixOwnerLaneToken } from "./limix-owner-lane.js";
|
|
15
|
+
const GATEWAY_PORT = Number(process.env.LIMIX_GATEWAY_PORT) || 8790;
|
|
16
|
+
const PREFIX = "/api/limix/gateway";
|
|
17
|
+
const ADMIN = randomBytes(24).toString("base64url");
|
|
18
|
+
let child = null;
|
|
19
|
+
let stopping = false;
|
|
20
|
+
let restarts = 0;
|
|
21
|
+
export const limixGatewaySidecarOn = () => process.env.LIMIX_GATEWAY_SIDECAR === "1";
|
|
22
|
+
function entry() {
|
|
23
|
+
const candidates = [process.env.LIMIX_GATEWAY_ENTRY, "/app/limix-gateway/src/main.mjs", join(process.cwd(), "limix", "gateway", "src", "main.mjs")];
|
|
24
|
+
return candidates.find((candidate) => Boolean(candidate && existsSync(candidate))) ?? null;
|
|
25
|
+
}
|
|
26
|
+
/** Starts the connector once; it is started again (up to 20 times, waiting longer each time) when it stops. */
|
|
27
|
+
export function startLimixGatewaySidecar({ port, webhookPort }) {
|
|
28
|
+
if (!limixGatewaySidecarOn() || child || stopping)
|
|
29
|
+
return;
|
|
30
|
+
const main = entry();
|
|
31
|
+
if (!main) {
|
|
32
|
+
console.log("limix gateway: not in this image");
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const dataDir = join(DATA_DIR, "limix-gateway");
|
|
36
|
+
mkdirSync(dataDir, { recursive: true, mode: 0o700 });
|
|
37
|
+
const owner = limixOwnerLaneToken();
|
|
38
|
+
child = spawn(process.execPath, [main], {
|
|
39
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
40
|
+
env: {
|
|
41
|
+
PATH: process.env.PATH, HOME: process.env.HOME, TZ: process.env.TZ, NODE_ENV: "production",
|
|
42
|
+
LIMIX_DATA_DIR: dataDir, LIMIX_PORT: String(GATEWAY_PORT), LIMIX_NO_BROWSER: "1", LIMIX_ADMIN_TOKEN: ADMIN,
|
|
43
|
+
LIMIX_SERVER_URL: `http://127.0.0.1:${port}`, LIMIX_BOT_API_URL: `http://127.0.0.1:${webhookPort}`,
|
|
44
|
+
...(owner ? { LIMIX_OWNER_LANE_TOKEN: owner } : {}),
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
const note = (chunk) => { const line = String(chunk).trim().split("\n").pop(); if (line)
|
|
48
|
+
console.log(`limix gateway: ${line.slice(0, 200)}`); };
|
|
49
|
+
child.stdout?.on("data", note);
|
|
50
|
+
child.stderr?.on("data", note);
|
|
51
|
+
const started = Date.now();
|
|
52
|
+
child.on("exit", (code) => {
|
|
53
|
+
child = null;
|
|
54
|
+
if (stopping)
|
|
55
|
+
return;
|
|
56
|
+
if (Date.now() - started > 10 * 60_000)
|
|
57
|
+
restarts = 0; // ran a good while: a fresh failure, not a crash loop
|
|
58
|
+
console.log(`limix gateway exited (${code})`);
|
|
59
|
+
if (restarts++ < 20)
|
|
60
|
+
setTimeout(() => startLimixGatewaySidecar({ port, webhookPort }), Math.min(60_000, 2000 * restarts)).unref();
|
|
61
|
+
});
|
|
62
|
+
const stop = () => { stopping = true; try {
|
|
63
|
+
child?.kill();
|
|
64
|
+
}
|
|
65
|
+
catch { /* gone */ } };
|
|
66
|
+
process.once("exit", stop);
|
|
67
|
+
process.once("SIGTERM", stop);
|
|
68
|
+
}
|
|
69
|
+
/** GET|POST /api/limix/gateway/… → the connector. False: not this route (or no sidecar here). */
|
|
70
|
+
export function proxyLimixGateway(req, res, path) {
|
|
71
|
+
if (!limixGatewaySidecarOn() || (path !== PREFIX && !path.startsWith(`${PREFIX}/`)))
|
|
72
|
+
return false;
|
|
73
|
+
if (path === PREFIX) {
|
|
74
|
+
res.writeHead(308, { location: `${PREFIX}/` });
|
|
75
|
+
res.end();
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
const rest = path.slice(PREFIX.length) || "/";
|
|
79
|
+
const send = (status, error) => { res.writeHead(status, { "content-type": "application/json" }); res.end(JSON.stringify({ error })); };
|
|
80
|
+
// The server keeps the connector running; stopping it from its page would only make it start again.
|
|
81
|
+
if (rest === "/api/shutdown") {
|
|
82
|
+
send(403, "On a server the connector always runs. Remove a connection to stop it.");
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
if (!["GET", "POST"].includes(req.method ?? "")) {
|
|
86
|
+
send(405, "method not allowed");
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
const query = new URL(req.url ?? "/", "http://x").search;
|
|
90
|
+
const upstream = httpRequest({
|
|
91
|
+
host: "127.0.0.1", port: GATEWAY_PORT, method: req.method, path: rest + query, timeout: 30_000,
|
|
92
|
+
headers: {
|
|
93
|
+
host: `127.0.0.1:${GATEWAY_PORT}`, "x-limix-admin": ADMIN,
|
|
94
|
+
...(req.headers["content-type"] ? { "content-type": req.headers["content-type"] } : {}),
|
|
95
|
+
...(req.headers["content-length"] ? { "content-length": req.headers["content-length"] } : {}),
|
|
96
|
+
},
|
|
97
|
+
}, (reply) => {
|
|
98
|
+
const headers = {};
|
|
99
|
+
for (const name of ["content-type", "cache-control", "content-security-policy", "x-frame-options"]) {
|
|
100
|
+
const value = reply.headers[name];
|
|
101
|
+
if (value !== undefined)
|
|
102
|
+
headers[name] = value;
|
|
103
|
+
}
|
|
104
|
+
res.writeHead(reply.statusCode ?? 502, headers);
|
|
105
|
+
reply.pipe(res);
|
|
106
|
+
});
|
|
107
|
+
upstream.on("timeout", () => upstream.destroy(new Error("timeout")));
|
|
108
|
+
upstream.on("error", () => { if (!res.headersSent)
|
|
109
|
+
send(502, "The Telegram / Zalo / Discord connector is starting. Reload in a few seconds.");
|
|
110
|
+
else
|
|
111
|
+
res.end(); });
|
|
112
|
+
req.pipe(upstream);
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
// confined guest turn. The connector (limix-gateway) sends X-Limix-Owner only for a sender the owner linked with /link,
|
|
3
3
|
// in a private chat; the secret is made per launch by the desktop app and never reaches an engine (deleted below,
|
|
4
4
|
// before any engine is started). An owner thread stays an owner thread: a guest's call can never continue it.
|
|
5
|
-
import { timingSafeEqual } from "node:crypto";
|
|
5
|
+
import { randomBytes, timingSafeEqual } from "node:crypto";
|
|
6
6
|
import { readFileSync, writeFileSync } from "node:fs";
|
|
7
7
|
import { join } from "node:path";
|
|
8
8
|
import { DATA_DIR } from "./config.js";
|
|
9
|
-
|
|
9
|
+
// On a server the connector is this server's own sidecar (limix-gateway-sidecar.ts): the server makes the secret.
|
|
10
|
+
const TOKEN = process.env.LIMIX_OWNER_LANE_TOKEN?.trim() || (process.env.LIMIX_GATEWAY_SIDECAR === "1" ? randomBytes(32).toString("base64url") : "");
|
|
10
11
|
delete process.env.LIMIX_OWNER_LANE_TOKEN;
|
|
12
|
+
/** The secret, for the sidecar connector only (never for an engine). */
|
|
13
|
+
export const limixOwnerLaneToken = () => (process.env.LIMIX_GATEWAY_SIDECAR === "1" ? TOKEN : "");
|
|
11
14
|
export const LIMIX_OWNER_HEADER = "x-limix-owner";
|
|
12
15
|
export function limixOwnerCall(header) {
|
|
13
16
|
if (!/^[A-Za-z0-9_-]{43}$/.test(TOKEN) || typeof header !== "string")
|
|
@@ -9,6 +9,7 @@ import { isSkillName } from "../shared/skill-md.js";
|
|
|
9
9
|
import { writeFileAtomic } from "./atomic.js";
|
|
10
10
|
import { DATA_DIR } from "./config.js";
|
|
11
11
|
import { installLibrarySkill, readSkillLibraryIndex, retireLibrarySkill, setLibrarySkillReviewState } from "./skill-library.js";
|
|
12
|
+
import { lxs } from "./limix-lang.js";
|
|
12
13
|
export const HUB_REPO = "leomieo/limix-skill-hub";
|
|
13
14
|
const HUB_BRANCH = "main";
|
|
14
15
|
const SYNC_MIN_GAP_MS = 20 * 60 * 60 * 1000;
|
|
@@ -54,11 +55,11 @@ export function syncHub() {
|
|
|
54
55
|
return { changed: false, count: hubCatalog().length };
|
|
55
56
|
}
|
|
56
57
|
if (!response.ok)
|
|
57
|
-
throw new Error(`Hub trả về ${response.status}`);
|
|
58
|
+
throw new Error(lxs(`Hub trả về ${response.status}`, `The hub returned ${response.status}`));
|
|
58
59
|
const text = await response.text();
|
|
59
60
|
const parsed = JSON.parse(text);
|
|
60
61
|
if (!Array.isArray(parsed.skills))
|
|
61
|
-
throw new Error("Danh mục Hub không đúng định dạng");
|
|
62
|
+
throw new Error(lxs("Danh mục Hub không đúng định dạng", "The hub catalog has the wrong format"));
|
|
62
63
|
mkdirSync(hubDir(), { recursive: true, mode: 0o700 });
|
|
63
64
|
writeFileAtomic(catalogFile(), text, { mode: 0o600 });
|
|
64
65
|
saveSettings({ ...settings, etag: response.headers.get("etag"), lastSync: new Date().toISOString(), lastError: null });
|
|
@@ -83,9 +84,9 @@ const isToolFile = (path) => SCRIPT.test(path) || MCP_FILE.test(path);
|
|
|
83
84
|
const sha = (data) => createHash("sha256").update(data).digest("hex");
|
|
84
85
|
export function hubSkillBlocked(entry) {
|
|
85
86
|
if (entry.area === "quarantine" || entry.security_status === "quarantined")
|
|
86
|
-
return "Skill nằm trong khu cách ly vì có mã nguy hiểm.";
|
|
87
|
+
return lxs("Skill nằm trong khu cách ly vì có mã nguy hiểm.", "This skill is quarantined because it contains dangerous code.");
|
|
87
88
|
if (entry.approval_status === "quarantined" || entry.approval_status === "rejected")
|
|
88
|
-
return "Skill bị từ chối.";
|
|
89
|
+
return lxs("Skill bị từ chối.", "This skill was rejected.");
|
|
89
90
|
return null;
|
|
90
91
|
}
|
|
91
92
|
/** installed state of every catalog entry that came from the hub */
|
|
@@ -109,24 +110,24 @@ export function hubSkills() {
|
|
|
109
110
|
// A same-named skill the owner imported by hand is not the hub's: never touched by sync.
|
|
110
111
|
enabled: have?.reviewState === "approved",
|
|
111
112
|
updateAvailable: Boolean(have && have.checksum !== entry.checksum),
|
|
112
|
-
blocked: !have && library[entry.id] ? "Thư viện đã có kỹ năng cùng tên không đến từ Hub." : null,
|
|
113
|
+
blocked: !have && library[entry.id] ? lxs("Thư viện đã có kỹ năng cùng tên không đến từ Hub.", "The library already has a skill with this name that did not come from the hub.") : null,
|
|
113
114
|
risky: hubSkillBlocked(entry),
|
|
114
115
|
};
|
|
115
116
|
});
|
|
116
117
|
}
|
|
117
118
|
export async function installHubSkill(id, options = {}) {
|
|
118
119
|
if (!isSkillName(id))
|
|
119
|
-
return { error: "Tên kỹ năng không hợp lệ" };
|
|
120
|
+
return { error: lxs("Tên kỹ năng không hợp lệ", "Invalid skill name") };
|
|
120
121
|
const entry = hubCatalog().find((e) => e.id === id);
|
|
121
122
|
if (!entry)
|
|
122
|
-
return { error: "Không thấy kỹ năng này trong danh mục Hub. Hãy đồng bộ lại." };
|
|
123
|
+
return { error: lxs("Không thấy kỹ năng này trong danh mục Hub. Hãy đồng bộ lại.", "This skill is not in the hub catalog. Sync again.") };
|
|
123
124
|
const blocked = hubSkillBlocked(entry);
|
|
124
125
|
if (blocked && !options.allowRisky)
|
|
125
126
|
return { error: blocked };
|
|
126
127
|
const installed = installedFromHub().get(id);
|
|
127
128
|
const existing = readSkillLibraryIndex()[id];
|
|
128
129
|
if (existing && !installed)
|
|
129
|
-
return { error: "Thư viện đã có kỹ năng cùng tên không đến từ Hub." };
|
|
130
|
+
return { error: lxs("Thư viện đã có kỹ năng cùng tên không đến từ Hub.", "The library already has a skill with this name that did not come from the hub.") };
|
|
130
131
|
const wanted = Object.keys(entry.file_hashes).filter((path) => path !== "SKILL.md" && (options.allowTools || !isToolFile(path)));
|
|
131
132
|
const skipped = Object.keys(entry.file_hashes).filter((path) => path !== "SKILL.md" && !wanted.includes(path));
|
|
132
133
|
const files = [];
|
|
@@ -134,22 +135,22 @@ export async function installHubSkill(id, options = {}) {
|
|
|
134
135
|
for (const path of ["SKILL.md", ...wanted]) {
|
|
135
136
|
const expected = entry.file_hashes[path];
|
|
136
137
|
if (!expected)
|
|
137
|
-
return { error: `Danh mục thiếu mã kiểm tra cho ${path}` };
|
|
138
|
+
return { error: lxs(`Danh mục thiếu mã kiểm tra cho ${path}`, `The catalog has no checksum for ${path}`) };
|
|
138
139
|
let response;
|
|
139
140
|
try {
|
|
140
141
|
response = await fetchText(rawUrl(`${entry.area === "quarantine" ? "quarantine" : "skills"}/${id}/${path}`));
|
|
141
142
|
}
|
|
142
143
|
catch (cause) {
|
|
143
|
-
return { error: `Không tải được ${path}: ${cause instanceof Error ? cause.message : String(cause)
|
|
144
|
+
return { error: lxs(`Không tải được ${path}: `, `Couldn't download ${path}: `) + (cause instanceof Error ? cause.message : String(cause)) };
|
|
144
145
|
}
|
|
145
146
|
if (!response.ok)
|
|
146
|
-
return { error: `Không tải được ${path} (${response.status})` };
|
|
147
|
+
return { error: lxs(`Không tải được ${path} (${response.status})`, `Couldn't download ${path} (${response.status})`) };
|
|
147
148
|
const bytes = new Uint8Array(await response.arrayBuffer());
|
|
148
149
|
if (bytes.byteLength > FILE_MAX_BYTES)
|
|
149
|
-
return { error: `${path} quá lớn` };
|
|
150
|
+
return { error: lxs(`${path} quá lớn`, `${path} is too large`) };
|
|
150
151
|
// Pinned content: a file the hub no longer serves as catalogued is refused, never installed.
|
|
151
152
|
if (sha(bytes) !== expected)
|
|
152
|
-
return { error: `${path} không khớp mã SHA-256 trong danh mục — đã dừng cài` };
|
|
153
|
+
return { error: lxs(`${path} không khớp mã SHA-256 trong danh mục — đã dừng cài`, `${path} does not match the SHA-256 in the catalog — install stopped`) };
|
|
153
154
|
if (path === "SKILL.md")
|
|
154
155
|
skillMd = new TextDecoder().decode(bytes);
|
|
155
156
|
else
|
|
@@ -160,7 +161,7 @@ export async function installHubSkill(id, options = {}) {
|
|
|
160
161
|
if ("error" in retired)
|
|
161
162
|
return { error: retired.error };
|
|
162
163
|
if ("stale" in retired)
|
|
163
|
-
return { error: "Kỹ năng đã bị sửa tay sau khi cài, không cập nhật đè." };
|
|
164
|
+
return { error: lxs("Kỹ năng đã bị sửa tay sau khi cài, không cập nhật đè.", "This skill was edited by hand after installing, so it is not overwritten.") };
|
|
164
165
|
}
|
|
165
166
|
const result = installLibrarySkill({
|
|
166
167
|
name: id,
|
|
@@ -180,19 +181,19 @@ export async function installHubSkill(id, options = {}) {
|
|
|
180
181
|
}
|
|
181
182
|
export function setHubSkillEnabled(id, enabled) {
|
|
182
183
|
if (!installedFromHub().has(id))
|
|
183
|
-
return { error: "Kỹ năng này chưa cài từ Hub" };
|
|
184
|
+
return { error: lxs("Kỹ năng này chưa cài từ Hub", "This skill was not installed from the hub") };
|
|
184
185
|
const result = setLibrarySkillReviewState(id, enabled ? "approved" : "disabled");
|
|
185
186
|
return "error" in result ? { error: result.error } : { ok: true };
|
|
186
187
|
}
|
|
187
188
|
export function removeHubSkill(id) {
|
|
188
189
|
const installed = installedFromHub().get(id);
|
|
189
190
|
if (!installed)
|
|
190
|
-
return { error: "Kỹ năng này chưa cài từ Hub" };
|
|
191
|
+
return { error: lxs("Kỹ năng này chưa cài từ Hub", "This skill was not installed from the hub") };
|
|
191
192
|
const result = retireLibrarySkill(id, installed.sha256);
|
|
192
193
|
if ("error" in result)
|
|
193
194
|
return { error: result.error };
|
|
194
195
|
if ("stale" in result)
|
|
195
|
-
return { error: "Kỹ năng đã bị sửa tay sau khi cài, không gỡ tự động." };
|
|
196
|
+
return { error: lxs("Kỹ năng đã bị sửa tay sau khi cài, không gỡ tự động.", "This skill was edited by hand after installing, so it is not removed automatically.") };
|
|
196
197
|
return { ok: true }; // the bytes stay in the library archive, so a removal can be undone by hand
|
|
197
198
|
}
|
|
198
199
|
/** Auto Install (off by default): only excellent/recommended, approved, instructions-only skills; max 5 per sync. */
|
|
@@ -16,6 +16,7 @@ import { writeFileAtomic } from "./atomic.js";
|
|
|
16
16
|
import { DATA_DIR } from "./config.js";
|
|
17
17
|
import { importedSkillListings, setImportedSkillEnabled } from "./imported-skills.js";
|
|
18
18
|
import { listLibrarySkills, loadBundledSkills, mergeSkills, readSkillLibraryIndex, selectBundledSkills, setLibrarySkillEveryBot, setLibrarySkillOptOut, setLibrarySkillReviewState, unassignLibrarySkill, } from "./skill-library.js";
|
|
19
|
+
import { lxs } from "./limix-lang.js";
|
|
19
20
|
/** Always on for every bot. "Learning new skills" itself is the skill-authoring feature, on for every bot already. */
|
|
20
21
|
export const LIMIX_CORE_SKILLS = new Set([
|
|
21
22
|
"create-verification-skill", "agent-reach", "windows-computer-automation", "phone-connection", "phone-harness",
|
|
@@ -62,7 +63,7 @@ export function limixSelectBundled(text, capabilities, skills) {
|
|
|
62
63
|
export function limixBundledListings(botId) {
|
|
63
64
|
return limixBundledFor(botId, loadBundledSkills()).map(({ manifest }) => ({
|
|
64
65
|
name: manifest.id, description: manifest.description, enabled: true, editable: false,
|
|
65
|
-
source: LIMIX_CORE_SKILLS.has(manifest.id) ? "Kĩ năng gốc của Limix Bot" : "Kho Kĩ Năng (Skills) · có sẵn",
|
|
66
|
+
source: LIMIX_CORE_SKILLS.has(manifest.id) ? lxs("Kĩ năng gốc của Limix Bot", "Limix Bot core skill") : lxs("Kho Kĩ Năng (Skills) · có sẵn", "Skills Store · built in"),
|
|
66
67
|
sha256: "", importedAt: "", warnings: [], skippedFiles: [], origin: "bundled", core: LIMIX_CORE_SKILLS.has(manifest.id),
|
|
67
68
|
}));
|
|
68
69
|
}
|
|
@@ -72,7 +73,7 @@ export function limixBundledSwitch(botId, name, enabled) {
|
|
|
72
73
|
return null;
|
|
73
74
|
if (LIMIX_CORE_SKILLS.has(name)) {
|
|
74
75
|
return enabled ? { status: 200, body: { skill: limixBundledListings(botId).find((skill) => skill.name === name) } }
|
|
75
|
-
: { status: 409, body: { error: "Kĩ năng gốc của Limix Bot luôn bật cho mọi bot." } };
|
|
76
|
+
: { status: 409, body: { error: lxs("Kĩ năng gốc của Limix Bot luôn bật cho mọi bot.", "Limix Bot core skills are always on for every bot.") } };
|
|
76
77
|
}
|
|
77
78
|
setBundledPick(botId, name, enabled);
|
|
78
79
|
return { status: 200, body: { skill: { ...limixBundledListings(botId).find((skill) => skill.name === name), name, enabled } } };
|
|
@@ -84,7 +85,7 @@ function storeItems(bots, botId) {
|
|
|
84
85
|
const items = new Map();
|
|
85
86
|
for (const { manifest } of loadBundledSkills()) {
|
|
86
87
|
const core = LIMIX_CORE_SKILLS.has(manifest.id);
|
|
87
|
-
items.set(manifest.id, { name: manifest.id, description: manifest.description, kind: "bundled", added: core || picks.has(manifest.id), core, ready: true, warnings: 0, source: "Có sẵn trong Limix Bot" });
|
|
88
|
+
items.set(manifest.id, { name: manifest.id, description: manifest.description, kind: "bundled", added: core || picks.has(manifest.id), core, ready: true, warnings: 0, source: lxs("Có sẵn trong Limix Bot", "Built into Limix Bot") });
|
|
88
89
|
}
|
|
89
90
|
for (const skill of listLibrarySkills()) {
|
|
90
91
|
if (items.has(skill.name))
|
|
@@ -92,13 +93,13 @@ function storeItems(bots, botId) {
|
|
|
92
93
|
const intact = !skill.warnings.some((warning) => warning.includes("enablement is blocked"));
|
|
93
94
|
items.set(skill.name, {
|
|
94
95
|
name: skill.name, description: skill.description, kind: "library", added: assigned.has(skill.name) && skill.enabled, core: false,
|
|
95
|
-
ready: intact, warnings: skill.warnings.length, source: skill.source.startsWith("limix-hub:") ? "Thư viện kĩ năng Limix" : "Đã cài trong Cài đặt",
|
|
96
|
+
ready: intact, warnings: skill.warnings.length, source: skill.source.startsWith("limix-hub:") ? lxs("Thư viện kĩ năng Limix", "Limix skill library") : lxs("Đã cài trong Cài đặt", "Installed in Settings"),
|
|
96
97
|
});
|
|
97
98
|
}
|
|
98
99
|
for (const skill of importedSkillListings(botId, new Set())) {
|
|
99
100
|
if (items.has(skill.name))
|
|
100
101
|
continue;
|
|
101
|
-
items.set(skill.name, { name: skill.name, description: skill.description, kind: "imported", added: skill.enabled, core: false, ready: true, warnings: skill.warnings.length, source: skill.source || "Từ máy tính này" });
|
|
102
|
+
items.set(skill.name, { name: skill.name, description: skill.description, kind: "imported", added: skill.enabled, core: false, ready: true, warnings: skill.warnings.length, source: skill.source || lxs("Từ máy tính này", "From this computer") });
|
|
102
103
|
}
|
|
103
104
|
return [...items.values()].sort((a, b) => Number(b.core) - Number(a.core) || a.name.localeCompare(b.name));
|
|
104
105
|
}
|
|
@@ -106,15 +107,15 @@ function storeItems(bots, botId) {
|
|
|
106
107
|
export function limixStoreSet(bots, botId, name, add, kind) {
|
|
107
108
|
const bot = bots.bot(botId);
|
|
108
109
|
if (!bot)
|
|
109
|
-
return { error: "Không tìm thấy bot." };
|
|
110
|
+
return { error: lxs("Không tìm thấy bot.", "Bot not found.") };
|
|
110
111
|
if (!isSkillName(name))
|
|
111
|
-
return { error: "Tên kĩ năng không hợp lệ." };
|
|
112
|
+
return { error: lxs("Tên kĩ năng không hợp lệ.", "Invalid skill name.") };
|
|
112
113
|
const item = storeItems(bots, botId).find((entry) => entry.name === name && (!kind || entry.kind === kind));
|
|
113
114
|
if (!item)
|
|
114
|
-
return { error: `Kho chưa có kĩ năng "${name}".` };
|
|
115
|
+
return { error: lxs(`Kho chưa có kĩ năng "${name}".`, `The store has no skill "${name}".`) };
|
|
115
116
|
if (item.kind === "bundled") {
|
|
116
117
|
if (item.core)
|
|
117
|
-
return add ? { ok: true } : { error: "Kĩ năng gốc của Limix Bot luôn bật cho mọi bot." };
|
|
118
|
+
return add ? { ok: true } : { error: lxs("Kĩ năng gốc của Limix Bot luôn bật cho mọi bot.", "Limix Bot core skills are always on for every bot.") };
|
|
118
119
|
setBundledPick(botId, name, add);
|
|
119
120
|
return { ok: true };
|
|
120
121
|
}
|
|
@@ -148,14 +149,14 @@ export function handleLimixSkillStore(bots, method, path, body) {
|
|
|
148
149
|
return null;
|
|
149
150
|
const botId = m[1];
|
|
150
151
|
if (!bots.bot(botId))
|
|
151
|
-
return { status: 404, body: { error: "Không tìm thấy bot." } };
|
|
152
|
+
return { status: 404, body: { error: lxs("Không tìm thấy bot.", "Bot not found.") } };
|
|
152
153
|
if (method === "GET")
|
|
153
154
|
return { status: 200, body: { skills: storeItems(bots, botId) } };
|
|
154
155
|
if (method === "POST") {
|
|
155
156
|
const raw = (body && typeof body === "object" ? body : {});
|
|
156
157
|
const kind = raw.kind === "bundled" || raw.kind === "library" || raw.kind === "imported" ? raw.kind : undefined;
|
|
157
158
|
if (typeof raw.name !== "string" || typeof raw.add !== "boolean")
|
|
158
|
-
return { status: 400, body: { error: "Cần tên kĩ năng và add." } };
|
|
159
|
+
return { status: 400, body: { error: lxs("Cần tên kĩ năng và add.", "A skill name and add are required.") } };
|
|
159
160
|
const result = limixStoreSet(bots, botId, raw.name, raw.add, kind);
|
|
160
161
|
return "error" in result ? { status: 422, body: result } : { status: 200, body: { skills: storeItems(bots, botId) } };
|
|
161
162
|
}
|
|
@@ -7,6 +7,7 @@ import { fetchSkillFromSource } from "../skill-fetch.js";
|
|
|
7
7
|
import { readLocalSkills } from "../limix-skill-folder.js";
|
|
8
8
|
import { loadBundledSkills } from "../skill-library.js";
|
|
9
9
|
import { handleLimixHub } from "../limix-skill-hub.js";
|
|
10
|
+
import { proxyLimixGateway } from "../limix-gateway-sidecar.js";
|
|
10
11
|
import { handleLimixSkillStore, LIMIX_CORE_SKILLS, limixBundledListings, limixBundledSwitch } from "../limix-skill-store.js";
|
|
11
12
|
import { skillImportSummary } from "../skill-folder.js";
|
|
12
13
|
import { installLibrarySkill, librarySkillOptOuts, listLibrarySkills, readLibrarySkillFile, readSkillLibraryIndex, setLibrarySkillEveryBot, setLibrarySkillOptOut, setLibrarySkillReviewState, skillsLibraryEnabled, unassignLibrarySkill } from "../skill-library.js";
|
|
@@ -16,6 +17,8 @@ export function createBotSkillsRoutes(deps) {
|
|
|
16
17
|
const { store, cfg, listBotSkills, readBotSkillFile, stagedSkillListing } = deps;
|
|
17
18
|
return async ({ req, res, url, path, method, json, readBody }) => {
|
|
18
19
|
let m = null;
|
|
20
|
+
if (path.startsWith("/api/limix/gateway") && proxyLimixGateway(req, res, path))
|
|
21
|
+
return;
|
|
19
22
|
if (path.startsWith("/api/limix/bots")) {
|
|
20
23
|
const library = await handleLimixBotLibrary(method, path);
|
|
21
24
|
if (library)
|
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
// notice row with what the person can do about it. The row's tool name is a
|
|
3
3
|
// whole plain sentence, so a client that only prints tool names (the phones)
|
|
4
4
|
// still reads it; this payload is what lets the desktop draw its buttons.
|
|
5
|
+
const limixVi = () => /^vi/i.test((typeof process !== "undefined" ? process.env?.OMB_UI_LANGUAGE : "") ?? "");
|
|
5
6
|
/** The waiting row's words, for clients that print the tool name. */
|
|
6
7
|
export function firstReplyWaitingName(botName, ai) {
|
|
7
|
-
return `notice: ${botName} vẫn chưa nhận được phản hồi từ ${ai}.`;
|
|
8
|
+
return limixVi() ? `notice: ${botName} vẫn chưa nhận được phản hồi từ ${ai}.` : `notice: ${botName} hasn't heard back from ${ai} yet.`;
|
|
8
9
|
}
|
|
9
10
|
/** The same row once its turn ended without an answer: history, true as it stands. */
|
|
10
11
|
export function firstReplyOverName(botName, ai) {
|
|
11
|
-
return `notice: ${botName} không nhận được phản hồi từ ${ai}.`;
|
|
12
|
+
return limixVi() ? `notice: ${botName} không nhận được phản hồi từ ${ai}.` : `notice: ${botName} didn't hear back from ${ai}.`;
|
|
12
13
|
}
|
|
13
14
|
/** The same row once the AI's first output arrived. */
|
|
14
15
|
export function firstReplySettledName(ai) {
|
|
15
|
-
return `notice: ${ai} đã trả lời, sau một lúc chậm.`;
|
|
16
|
+
return limixVi() ? `notice: ${ai} đã trả lời, sau một lúc chậm.` : `notice: ${ai} answered after a slow start.`;
|
|
16
17
|
}
|