limixbot 0.3.145 → 0.3.147
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-CqObZQbN.js → ActivityPanel-ha5UB6JF.js} +1 -1
- package/dist/assets/{App-DcG1JmK6.js → App-OHzELG1X.js} +104 -104
- package/dist/assets/{AppEventEditor-DR01sHAK.js → AppEventEditor-obfXqLac.js} +1 -1
- package/dist/assets/{BotSettingsDialog-BHgSIU9E.js → BotSettingsDialog-B4xJoXAR.js} +1 -1
- package/dist/assets/{BrowserPanel-g96rlnqQ.js → BrowserPanel-BA3MHxLE.js} +1 -1
- package/dist/assets/{BrowserProfilesManager-UJJC6OPf.js → BrowserProfilesManager-C69B2qW7.js} +1 -1
- package/dist/assets/{CloudAddDialog-BjPYPhnk.js → CloudAddDialog-Cl1kfUfv.js} +1 -1
- package/dist/assets/{ComputerFilesPane-DA7MBSD0.js → ComputerFilesPane-CIE18AsH.js} +1 -1
- package/dist/assets/{ComputerPanel--rY7_KCN.js → ComputerPanel-DUlHlmJs.js} +2 -2
- package/dist/assets/{DataPanel-CEhe1WKo.js → DataPanel-BhAdUpy-.js} +1 -1
- package/dist/assets/{DesktopViewer-RNuariIo.js → DesktopViewer-uyCSG2he.js} +1 -1
- package/dist/assets/{GrokMoveDialog-DoUN6m5b.js → GrokMoveDialog-Cj9CtyFz.js} +1 -1
- package/dist/assets/{InspectorPanel-CdCXUouJ.js → InspectorPanel-CTOKraf7.js} +1 -1
- package/dist/assets/{KeyboardShortcutsModal-CZ-BQqzV.js → KeyboardShortcutsModal-B8s_z7Bf.js} +1 -1
- package/dist/assets/KnowledgePanel-DWDBULkL.js +1 -0
- package/dist/assets/{LimixResizeHandles-BUe_6hSJ.js → LimixResizeHandles-C2c3aYPm.js} +1 -1
- package/dist/assets/{LiveDesktop-BnaxuTzU.js → LiveDesktop-BnagL5Xd.js} +1 -1
- package/dist/assets/{LocalVmWorkspace-X1ev9Wov.js → LocalVmWorkspace-C_6HF5Be.js} +1 -1
- package/dist/assets/{MacLocalControl-RXW-1ET9.js → MacLocalControl-DfNRhU6Z.js} +1 -1
- package/dist/assets/{MarkdownFilePreview-CIYTKbNj.js → MarkdownFilePreview-D8j47umK.js} +1 -1
- package/dist/assets/{MenuMotion-C-qcisoG.js → MenuMotion-B0aZnuh_.js} +1 -1
- package/dist/assets/{NewBotDialog-D_22AmDd.js → NewBotDialog-CxY9p3uW.js} +1 -1
- package/dist/assets/{PhoneAppDialog-WOhzSF82.js → PhoneAppDialog-BB0rq01m.js} +1 -1
- package/dist/assets/{PlacesRail-DoUGQSpd.js → PlacesRail-tZyNm-l3.js} +1 -1
- package/dist/assets/{PluginsPanel-DxM_qWtC.js → PluginsPanel-Cod2cJ3m.js} +6 -6
- package/dist/assets/{ProIntroduction-CQFDxYxi.js → ProIntroduction-BYeJLd6v.js} +1 -1
- package/dist/assets/{RemoteAgentSettingsPanel-CdQmz7Qu.js → RemoteAgentSettingsPanel-DrDaWqZQ.js} +1 -1
- package/dist/assets/{RoomPanel-DVsYTCX7.js → RoomPanel-BldqgGbT.js} +1 -1
- package/dist/assets/{RoutinesPage-DG30sQw7.js → RoutinesPage-Dt5n6TUd.js} +3 -3
- package/dist/assets/{SettingsModal-BFeWJ1OS.js → SettingsModal-5DXP6Iyh.js} +1 -1
- package/dist/assets/{ShareTeamDialog-BLddRjax.js → ShareTeamDialog-Bzte6WGL.js} +1 -1
- package/dist/assets/{SignedInSites-BREmZ6gH.js → SignedInSites-f8T3aw_5.js} +1 -1
- package/dist/assets/{TeamLibraryPanel-Sg1D_gYP.js → TeamLibraryPanel-PS2c5SeX.js} +1 -1
- package/dist/assets/{TeamMapPage-CP7ug7dF.js → TeamMapPage-DlOu0vvo.js} +1 -1
- package/dist/assets/{TriggersPage-DmY-ibGg.js → TriggersPage-t4c2-ZAC.js} +1 -1
- package/dist/assets/{VisibilitySection-BqQTMT_O.js → VisibilitySection-X3MwlVCH.js} +5 -5
- package/dist/assets/{WebhookTrigger-Bk2khhKt.js → WebhookTrigger-DlLdx-JP.js} +1 -1
- package/dist/assets/{WorksOnGrid-BhZTjLmG.js → WorksOnGrid-C-i85Bh5.js} +1 -1
- package/dist/assets/{abnfDiagram-YUKMZFIV-4h66COg4.js → abnfDiagram-YUKMZFIV-DDXPrZzl.js} +1 -1
- package/dist/assets/{activity-JVyqvn--.js → activity-BlL5ycb5.js} +1 -1
- package/dist/assets/{architectureDiagram-47P4ROYG-XVFtgz_w.js → architectureDiagram-47P4ROYG-BiqBgMDV.js} +1 -1
- package/dist/assets/{blockDiagram-E7TT5TSB-Bzpnrunu.js → blockDiagram-E7TT5TSB-vc1neoFp.js} +1 -1
- package/dist/assets/{c4Diagram-CRA5TL53-Baf7lWcX.js → c4Diagram-CRA5TL53-CQbtBKOv.js} +1 -1
- package/dist/assets/{calendar-days-DJ8Sk4Wo.js → calendar-days-_dtxyR4U.js} +1 -1
- package/dist/assets/channel-BzyEyDo_.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-C01NJDuW.js → chunk-2Q5K7J3B-Dq_aCCIt.js} +1 -1
- package/dist/assets/{chunk-5VM5RSS4-zCxCK82Z.js → chunk-5VM5RSS4-EcX_ZXzF.js} +1 -1
- package/dist/assets/{chunk-7TKQ45FW-Dn3xzwzp.js → chunk-7TKQ45FW-BA7CgKU2.js} +1 -1
- package/dist/assets/{chunk-AW2ZBBNX-D5v1LEvi.js → chunk-AW2ZBBNX-DkvVwaph.js} +1 -1
- package/dist/assets/{chunk-FVRAUYC3-B_j2BQfP.js → chunk-FVRAUYC3-CdyGRg6v.js} +2 -2
- package/dist/assets/{chunk-HTAEGDNF-CYEfb4lj.js → chunk-HTAEGDNF-CS-veEVV.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-DYxCqsdI.js → chunk-JWPE2WC7-BiUYpinX.js} +1 -1
- package/dist/assets/{chunk-KQW6MTUR-BVs1owNv.js → chunk-KQW6MTUR-DDPkIuwB.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-oNREPc9w.js → chunk-XXDRQBXY-C4YyKEem.js} +1 -1
- package/dist/assets/{classDiagram-v2-K4WV4PDN-B8JOWdQM.js → classDiagram-v2-K4WV4PDN-BjmVbVHi.js} +1 -1
- package/dist/assets/{coins-D-zVxeJ6.js → coins-Cu3qn-3t.js} +1 -1
- package/dist/assets/{core-DGyt94O8.js → core-DpqVMT4r.js} +1 -1
- package/dist/assets/{cose-bilkent-JH36ORCC-Cvvvdg2x.js → cose-bilkent-JH36ORCC-Bra0B-5z.js} +1 -1
- package/dist/assets/{cynefin-EF2NZ3EQ-BlyJPVpP.js → cynefin-EF2NZ3EQ-BRMKNbnx.js} +1 -1
- package/dist/assets/{cynefinDiagram-3GCD6N5R-aXWhkS0N.js → cynefinDiagram-3GCD6N5R-DMhNix9A.js} +1 -1
- package/dist/assets/{dagre-W4DXFKR2-CK9mZlxS.js → dagre-W4DXFKR2-BWwdFKCx.js} +1 -1
- package/dist/assets/{diagram-2UJZ2QOL-ciDDPAUW.js → diagram-2UJZ2QOL-D_4J-D-V.js} +1 -1
- package/dist/assets/{diagram-OVF4WLC6-ZC2XGXAQ.js → diagram-OVF4WLC6-CQ4l30Dm.js} +1 -1
- package/dist/assets/{diagram-PFPMY2P6-B_UNW8Y1.js → diagram-PFPMY2P6-D3W2IEHX.js} +1 -1
- package/dist/assets/{diagram-UMYRVEAY-BzqwG15l.js → diagram-UMYRVEAY-C9cpNhET.js} +1 -1
- package/dist/assets/{diagram-YEKJPTXX-f7zBrJwE.js → diagram-YEKJPTXX-DIyquCXt.js} +1 -1
- package/dist/assets/{diagram-ZIFT7M5P-QClomp2E.js → diagram-ZIFT7M5P-CO6216kK.js} +1 -1
- package/dist/assets/{ebnfDiagram-VR2GEFS7-BwcmIXBL.js → ebnfDiagram-VR2GEFS7-BeHXJPN4.js} +1 -1
- package/dist/assets/{elk-IJKZMXRS-DPv8qzg-.js → elk-IJKZMXRS-BdT_tK3j.js} +1 -1
- package/dist/assets/{erDiagram-O2IAPWRE-BHknllso.js → erDiagram-O2IAPWRE-Cz_TiHab.js} +1 -1
- package/dist/assets/{file-up-B5lQ3tIu.js → file-up-flw1aUka.js} +1 -1
- package/dist/assets/{flowDiagram-OXPTDLAJ-LwDo9oFR.js → flowDiagram-OXPTDLAJ-BXLr0anm.js} +1 -1
- package/dist/assets/{ganttDiagram-R7TSEDQI-DDXQuF2p.js → ganttDiagram-R7TSEDQI-C37QIpaR.js} +1 -1
- package/dist/assets/{gitGraphDiagram-XJZIOB7I-DxAL8MxK.js → gitGraphDiagram-XJZIOB7I-Cs8fTfJZ.js} +1 -1
- package/dist/assets/{import-name-fUZKEQiu.js → import-name-B6edwqYP.js} +1 -1
- package/dist/assets/{index-C_1rKgRm.js → index-BruSVBU0.js} +3 -3
- package/dist/assets/{index-Bb6OwohQ.js → index-DDwC7qII.js} +2 -2
- package/dist/assets/{infoDiagram-5W2HQ5XZ-BxZNIlp6.js → infoDiagram-5W2HQ5XZ-BpliNVPR.js} +1 -1
- package/dist/assets/{ishikawaDiagram-K3B6WC7H-C6c1u1w2.js → ishikawaDiagram-K3B6WC7H-Dov7w4qz.js} +1 -1
- package/dist/assets/{journeyDiagram-COXZFDF6-BrngL-3X.js → journeyDiagram-COXZFDF6-DoihiGaK.js} +1 -1
- package/dist/assets/{kanban-definition-P3RFRI5V-BhTOtF-B.js → kanban-definition-P3RFRI5V-D_gNx8dG.js} +1 -1
- package/dist/assets/{mermaid.core-Cy9_uq1T.js → mermaid.core-BYPxVPn-.js} +4 -4
- package/dist/assets/{mindmap-definition-LZFPQGKD-Dr3QB9wA.js → mindmap-definition-LZFPQGKD-wH2aKxFy.js} +1 -1
- package/dist/assets/{minimize-Ct6C2khA.js → minimize-sGQL0Xsy.js} +1 -1
- package/dist/assets/{monitor-BZrhga_j.js → monitor-zecPzfR5.js} +1 -1
- package/dist/assets/{new-bot-DCA0S24E.js → new-bot-DehPHgMa.js} +1 -1
- package/dist/assets/{org-library-DgVAGwBY.js → org-library-CA4y9Ru8.js} +1 -1
- package/dist/assets/{package-format-BvWgfqGs.js → package-format-CpbqH_LB.js} +1 -1
- package/dist/assets/{pegDiagram-BGZESJAR-D0bSaHqd.js → pegDiagram-BGZESJAR-B7RTZksQ.js} +1 -1
- package/dist/assets/{pieDiagram-CAPJLFHJ-B8i7ox8l.js → pieDiagram-CAPJLFHJ-B5mPB7O-.js} +1 -1
- package/dist/assets/{quadrantDiagram-GDMTTRAM-BcJTpsdR.js → quadrantDiagram-GDMTTRAM-CZqo7j7U.js} +1 -1
- package/dist/assets/{rail-Bzq4BbCt.js → rail-Ok0cs7cA.js} +1 -1
- package/dist/assets/{railroadDiagram-SM67HX2B-DSO-XOKW.js → railroadDiagram-SM67HX2B-MFpfIts_.js} +1 -1
- package/dist/assets/{remote-desktop-panel-BVRS7AXc.js → remote-desktop-panel-BIXUp23K.js} +1 -1
- package/dist/assets/{requirementDiagram-X7JNWC4A-B5gEynme.js → requirementDiagram-X7JNWC4A-CJ49gC_q.js} +1 -1
- package/dist/assets/{sankeyDiagram-UM26HJRW-CK2T6Pgm.js → sankeyDiagram-UM26HJRW-DxpTSw3D.js} +1 -1
- package/dist/assets/{sequenceDiagram-ZO4K6R2Y-Dx9DVGEG.js → sequenceDiagram-ZO4K6R2Y-XEyCx2Ue.js} +1 -1
- package/dist/assets/{sizeCapture-INFHLROL-BbirmlCW.js → sizeCapture-INFHLROL-1Fx1tcNn.js} +1 -1
- package/dist/assets/{stateDiagram-v2-TBUQTH76-CuJOlmiS.js → stateDiagram-v2-TBUQTH76-CwxyNDK4.js} +1 -1
- package/dist/assets/styles-CMOouTIW.css +1 -0
- package/dist/assets/{styles-CLQR3ehf.js → styles-DO3EUxm2.js} +1 -1
- package/dist/assets/{swimlanes-N4OXWK64-BWFqBYF_.js → swimlanes-N4OXWK64-BuwwuENy.js} +1 -1
- package/dist/assets/swimlanesDiagram-K3J5GTZL-CcmXEgRh.js +8 -0
- package/dist/assets/{team-share-1e1FK9fo.js → team-share-CL18_anr.js} +1 -1
- package/dist/assets/{timeline-definition-YOQAKGHF-CzxPBKDi.js → timeline-definition-YOQAKGHF-CauwqKMA.js} +1 -1
- package/dist/assets/{usecaseDiagram-VIAY4XPW-B5-pXbU3.js → usecaseDiagram-VIAY4XPW-YZ3Cf2do.js} +1 -1
- package/dist/assets/{vennDiagram-BLWOH2XV-BccL1p-U.js → vennDiagram-BLWOH2XV-CDX8i7ID.js} +1 -1
- package/dist/assets/{vi-DyvsTHbT.js → vi-CiY3ddy3.js} +1 -1
- package/dist/assets/{wardleyDiagram-YMQ3BMBF-DdJ9Pves.js → wardleyDiagram-YMQ3BMBF-CCdRrEMh.js} +1 -1
- package/dist/assets/{xychartDiagram-TAQBALBS-BAg7I3YQ.js → xychartDiagram-TAQBALBS-Vz4NaN0U.js} +1 -1
- package/dist/index.html +3 -3
- package/dist/rail.html +5 -5
- package/dist-server/drivers/agents-proxy.js +412 -400
- package/dist-server/index.js +6845 -6649
- package/dist-server/knowledge-collection.worker.js +4737 -0
- package/dist-server/licenses/knowledge.txt +688 -0
- package/dist-server/limixbot.js +1560 -1542
- package/dist-server/package.json +1 -1
- package/dist-server/pair-cli.js +1560 -1542
- package/dist-server/server/agents-turn.js +1 -0
- package/dist-server/server/bot-moves.js +16 -13
- package/dist-server/server/cloud-send-arrived.js +21 -3
- package/dist-server/server/drivers/agents-call.js +8 -0
- package/dist-server/server/drivers/agents-catalog-profile.js +1 -0
- package/dist-server/server/drivers/agents-catalog.js +4 -1
- package/dist-server/server/host/bot-access-gate.js +3 -0
- package/dist-server/server/index.js +52 -3
- package/dist-server/server/knowledge/core.bench.js +35 -0
- package/dist-server/server/knowledge/core.js +338 -0
- package/dist-server/server/knowledge/database.js +153 -0
- package/dist-server/server/knowledge/documents.js +169 -0
- package/dist-server/server/knowledge/files.js +64 -0
- package/dist-server/server/knowledge/host.js +158 -0
- package/dist-server/server/knowledge/memory.js +51 -0
- package/dist-server/server/knowledge/plugin.js +17 -0
- package/dist-server/server/knowledge/retrieval.js +90 -0
- package/dist-server/server/knowledge/schema.js +39 -0
- package/dist-server/server/knowledge/semantic.js +135 -0
- package/dist-server/server/knowledge/tools.js +58 -0
- package/dist-server/server/knowledge-collection-fetch.js +101 -0
- package/dist-server/server/knowledge-collection.js +300 -0
- package/dist-server/server/knowledge-collection.worker.js +142 -0
- package/dist-server/server/move-freeze.js +1 -16
- package/dist-server/server/plugin-hub.js +17 -0
- package/dist-server/server/routes/knowledge.js +48 -0
- package/dist-server/server/routes/move-freeze.js +2 -6
- package/package.json +1 -1
- package/dist/assets/channel-DJthUr0W.js +0 -1
- package/dist/assets/styles-CE5PtWhb.css +0 -1
- package/dist/assets/swimlanesDiagram-K3J5GTZL-BjpCZGc-.js +0 -8
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { parentPort, workerData } from "node:worker_threads";
|
|
2
|
+
import { parse } from "parse5";
|
|
3
|
+
import { Defuddle } from "defuddle/node";
|
|
4
|
+
import { createEngine, standardFilters } from "knap";
|
|
5
|
+
import { redactSecretsInText } from "../shared/redact.js";
|
|
6
|
+
const blocks = new Set("article main section header h1 h2 h3 h4 h5 h6 p ul ol li dl dt dd blockquote pre code em strong b i s sup sub br hr figure figcaption table thead tbody tr td th caption".split(" "));
|
|
7
|
+
const omitted = new Set("script style template svg math iframe frame object embed form input textarea button select nav aside footer noscript meta link base title head canvas video audio source picture img".split(" "));
|
|
8
|
+
const policy = "default-src 'none'; base-uri 'none'; form-action 'none'";
|
|
9
|
+
const escapeHtml = (s) => s.replace(/[&<>"]/g, c => ({ "&": "&", "<": "<", ">": ">", '"': """ })[c]);
|
|
10
|
+
const cleanText = (s) => redactSecretsInText(s)
|
|
11
|
+
.replace(/\b(?:set-cookie|cookie|authorization)\s*:[^\n\r]+/gi, "[redacted header]")
|
|
12
|
+
.replace(/\b(api[_-]?key|password|passwd|access[_-]?token|refresh[_-]?token|session[_-]?id|cookie)["']?\s*[:=]\s*(?:"[^"\r\n]*"|'[^'\r\n]*'|[^\s,;<>"']+)/gi, "$1=[redacted]");
|
|
13
|
+
function prepare(html, source) {
|
|
14
|
+
const doc = parse(html);
|
|
15
|
+
let count = 0;
|
|
16
|
+
const links = new Set();
|
|
17
|
+
let title = "", author = "", description = "";
|
|
18
|
+
function walk(node, depth) {
|
|
19
|
+
if (++count > 40_000 || depth > 120)
|
|
20
|
+
throw new Error("Page structure exceeds limit");
|
|
21
|
+
if ("value" in node)
|
|
22
|
+
return escapeHtml(cleanText(node.value));
|
|
23
|
+
if (!("childNodes" in node))
|
|
24
|
+
return "";
|
|
25
|
+
if (!("tagName" in node))
|
|
26
|
+
return node.childNodes.map(n => walk(n, depth + 1)).join("");
|
|
27
|
+
const tag = node.tagName;
|
|
28
|
+
const attr = (name) => node.attrs.find(a => a.name === name)?.value ?? "";
|
|
29
|
+
if (tag === "head") {
|
|
30
|
+
for (const item of node.childNodes) {
|
|
31
|
+
if (!("tagName" in item))
|
|
32
|
+
continue;
|
|
33
|
+
if (item.tagName === "title")
|
|
34
|
+
title = cleanText(item.childNodes.map(n => "value" in n ? n.value : "").join("")).trim().slice(0, 200);
|
|
35
|
+
if (item.tagName === "meta") {
|
|
36
|
+
const name = item.attrs.find(a => a.name === "name")?.value.toLowerCase();
|
|
37
|
+
const value = cleanText(item.attrs.find(a => a.name === "content")?.value ?? "").trim().slice(0, 512);
|
|
38
|
+
if (name === "author")
|
|
39
|
+
author = value;
|
|
40
|
+
if (name === "description")
|
|
41
|
+
description = value;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return "";
|
|
45
|
+
}
|
|
46
|
+
if (omitted.has(tag) || node.namespaceURI !== "http://www.w3.org/1999/xhtml" || node.attrs.some(a => a.name === "hidden")
|
|
47
|
+
|| attr("aria-hidden") === "true" || /(?:^|[\s_-])(?:ads?|advertisement|cookie-banner|sponsored)(?:$|[\s_-])/i.test(attr("class") + " " + attr("id")))
|
|
48
|
+
return "";
|
|
49
|
+
if (tag === "a" && source && attr("href") && links.size < 24) {
|
|
50
|
+
let target;
|
|
51
|
+
try {
|
|
52
|
+
target = new URL(attr("href"), source);
|
|
53
|
+
}
|
|
54
|
+
catch { }
|
|
55
|
+
if (target && target.protocol === "https:" && !target.username && !target.password && !target.search && !target.port
|
|
56
|
+
&& target.hostname.includes(".") && target.href.length <= 500 && cleanText(target.href) === target.href) {
|
|
57
|
+
target.hash = "";
|
|
58
|
+
links.add(target.href);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
const inner = node.childNodes.map(n => walk(n, depth + 1)).join("");
|
|
62
|
+
if (!blocks.has(tag))
|
|
63
|
+
return inner;
|
|
64
|
+
return "<" + tag + ">" + inner + (tag === "br" || tag === "hr" ? "" : "</" + tag + ">");
|
|
65
|
+
}
|
|
66
|
+
const body = walk(doc, 0);
|
|
67
|
+
return { title, author, description, links: [...links], html: '<!doctype html><html><head><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="' + policy + '"><title>' + escapeHtml(title) + "</title></head><body>" + body + "</body></html>" };
|
|
68
|
+
}
|
|
69
|
+
async function extract(page, source) {
|
|
70
|
+
try {
|
|
71
|
+
const extracted = await Defuddle(page.html, source, { markdown: true, useAsync: false, removeImages: true,
|
|
72
|
+
fetch: async () => { throw new Error("Network disabled in extraction"); } });
|
|
73
|
+
if (extracted.content?.trim())
|
|
74
|
+
return { title: page.title || cleanText(extracted.title ?? ""), author: page.author || cleanText(extracted.author ?? ""),
|
|
75
|
+
description: page.description || cleanText(extracted.description ?? ""), markdown: cleanText(extracted.content).slice(0, 128_000), extractor: "defuddle" };
|
|
76
|
+
}
|
|
77
|
+
catch { /* A local DOM extraction failure falls back to visible text. */ }
|
|
78
|
+
const tree = parse(page.html);
|
|
79
|
+
const lines = [];
|
|
80
|
+
function visit(node) {
|
|
81
|
+
if ("value" in node) {
|
|
82
|
+
lines.push(node.value);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (!("childNodes" in node) || "tagName" in node && node.tagName === "head")
|
|
86
|
+
return;
|
|
87
|
+
node.childNodes.forEach(visit);
|
|
88
|
+
if ("tagName" in node && ["p", "li", "br", "article", "h1", "h2", "h3"].includes(node.tagName))
|
|
89
|
+
lines.push("\n");
|
|
90
|
+
}
|
|
91
|
+
visit(tree);
|
|
92
|
+
const markdown = cleanText(lines.join("")).trim().slice(0, 128_000);
|
|
93
|
+
if (!markdown)
|
|
94
|
+
throw new Error("No readable content");
|
|
95
|
+
return { title: page.title, author: page.author, description: page.description, markdown, extractor: "text" };
|
|
96
|
+
}
|
|
97
|
+
async function render({ template, rows }) {
|
|
98
|
+
if (!template || template.length > 8192 || !Array.isArray(rows) || !rows.length || rows.length > 32)
|
|
99
|
+
throw new Error("Invalid template batch");
|
|
100
|
+
const filters = Object.fromEntries(["trim", "upper", "lower", "capitalize", "list", "yaml_property", "safe_name"].filter(k => Object.hasOwn(standardFilters, k)).map(k => [k, standardFilters[k]]));
|
|
101
|
+
const engine = createEngine({ filters, allowRegex: false, limits: { maxTemplateLength: 8192, maxValueLength: 8192, maxOutputLength: 32_000, maxOperations: 3000, maxDepth: 12 } });
|
|
102
|
+
if (engine.validate(template).length)
|
|
103
|
+
throw new Error("Invalid template or unsupported filter");
|
|
104
|
+
const files = new Set();
|
|
105
|
+
const outputs = [];
|
|
106
|
+
for (const { filename, variables } of rows) {
|
|
107
|
+
if (!/^[\p{L}\p{N}][\p{L}\p{N} _.-]{0,88}\.md$/iu.test(filename) || /^(?:con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\.|$)/i.test(filename)
|
|
108
|
+
|| filename.includes("..") || files.has(filename.normalize("NFC").toLowerCase()))
|
|
109
|
+
throw new Error("Invalid or duplicate Markdown filename");
|
|
110
|
+
files.add(filename.normalize("NFC").toLowerCase());
|
|
111
|
+
if (!variables || Array.isArray(variables) || Object.keys(variables).length > 64)
|
|
112
|
+
throw new Error("Invalid template data");
|
|
113
|
+
const data = Object.create(null);
|
|
114
|
+
for (const [key, value] of Object.entries(variables)) {
|
|
115
|
+
if (!/^[a-zA-Z][a-zA-Z0-9_]{0,63}$/.test(key) || key in Object.prototype || key === "prototype"
|
|
116
|
+
|| !["string", "number", "boolean"].includes(typeof value) || String(value).length > 8192)
|
|
117
|
+
throw new Error("Invalid template variable");
|
|
118
|
+
data[key] = value;
|
|
119
|
+
}
|
|
120
|
+
outputs.push({ filename, markdown: cleanText(await engine.renderOrThrow(template, { variables: data })) });
|
|
121
|
+
}
|
|
122
|
+
return outputs;
|
|
123
|
+
}
|
|
124
|
+
try {
|
|
125
|
+
let result;
|
|
126
|
+
switch (workerData.action) {
|
|
127
|
+
case "prepare":
|
|
128
|
+
result = prepare(workerData.html, workerData.source);
|
|
129
|
+
break;
|
|
130
|
+
case "extract":
|
|
131
|
+
result = await extract(workerData.page, workerData.source);
|
|
132
|
+
break;
|
|
133
|
+
case "template":
|
|
134
|
+
result = await render(workerData.batch);
|
|
135
|
+
break;
|
|
136
|
+
default: throw new Error("Unknown collection operation");
|
|
137
|
+
}
|
|
138
|
+
parentPort.postMessage({ ok: true, result });
|
|
139
|
+
}
|
|
140
|
+
catch {
|
|
141
|
+
parentPort.postMessage({ ok: false });
|
|
142
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// move's own with one sentence. Nothing in the workspace is edited, so lifting the marker leaves this computer exactly
|
|
4
4
|
// as it was. A Cloud that ended, started only so its owner can take their things home (OMB_CLOUD_EXPORT_ONLY=1), runs
|
|
5
5
|
// frozen the same way and is never lifted.
|
|
6
|
-
import { existsSync,
|
|
6
|
+
import { existsSync, readFileSync, rmSync } from "node:fs";
|
|
7
7
|
import { join } from "node:path";
|
|
8
8
|
import { writeFileAtomic } from "./atomic.js";
|
|
9
9
|
export const MOVED_REFUSAL = "This bot lives on My Cloud now.";
|
|
@@ -26,11 +26,6 @@ export const ENDED_REFUSAL = "My Cloud has ended. It is open only so you can tak
|
|
|
26
26
|
* own exact exemption in refuses().) */
|
|
27
27
|
const STILL_CHANGES = /^\/api\/(?:move\/|cloud-send\/|auth\/|workspace-backup\/|cloud\/|sync\/|shared-computers\/)/u;
|
|
28
28
|
const READS = new Set(["GET", "HEAD", "OPTIONS"]);
|
|
29
|
-
/** What a frozen copy keeps once its workspace is deleted: the marker, this server's identity, Files, downloaded tools
|
|
30
|
-
* and caches, and its own runtime files. Everything else, credentials included, is the person's workspace. */
|
|
31
|
-
const DEVICE_STATE = new Set(["moved.json", "environment-id", "sync", "tools", "cache", ".cache", "tmp", ".tmp", "dist-native", "tunnel-runtime",
|
|
32
|
-
".limixbot-server-child", ".openmausbot-server-child", "openmausbot-server.lease", "limixbot-server.lease"]);
|
|
33
|
-
const kept = (name) => DEVICE_STATE.has(name) || /^(?:limixbot|openmausbot)-server\.lease\./.test(name);
|
|
34
29
|
/** Switches off every automation that is on, or only those named by key ("routine:<id>", "call:<id>", "webhook:<id>",
|
|
35
30
|
* "app-event:<id>", "wait:<id>"); the person can switch each on again by hand, and a wait is cancelled. Done while frozen,
|
|
36
31
|
* so none of them runs once the freeze lifts. One that can't be switched off is logged, never a reason to stay frozen.
|
|
@@ -137,16 +132,6 @@ export function createMoveFreeze({ dataDir, exportOnly = false }) {
|
|
|
137
132
|
place = named;
|
|
138
133
|
each("stop");
|
|
139
134
|
},
|
|
140
|
-
/** Deletes this computer's copy of the workspace, credentials included, once the move is long done; only a computer
|
|
141
|
-
* frozen by a move ever does. The server starts again after, frozen and empty. */
|
|
142
|
-
forget() {
|
|
143
|
-
if (exportOnly || !existsSync(file))
|
|
144
|
-
return false;
|
|
145
|
-
for (const name of readdirSync(dataDir))
|
|
146
|
-
if (!kept(name))
|
|
147
|
-
rmSync(join(dataDir, name), { recursive: true, force: true });
|
|
148
|
-
return true;
|
|
149
|
-
},
|
|
150
135
|
/** False for a server that may never be lifted: a Cloud that ended. */
|
|
151
136
|
lifts: () => !exportOnly,
|
|
152
137
|
/** False when this server may never be lifted: a Cloud that ended. */
|
|
@@ -313,6 +313,23 @@ export function createPluginHub(dir, targets, load = download) {
|
|
|
313
313
|
};
|
|
314
314
|
const approved = (id, sha256) => state.installed.find(p => p.id === id && p.sha256 === sha256)?.manifest;
|
|
315
315
|
return { route,
|
|
316
|
+
builtinActive(bot, pin) {
|
|
317
|
+
return active(bot, []).some(row => row.id === pin.id && row.sha256 === pin.sha256);
|
|
318
|
+
},
|
|
319
|
+
configureBuiltin(bot, revision, enabled, actor) {
|
|
320
|
+
const current = state.installed.find(row => row.id === revision.id && row.sha256 === revision.sha256);
|
|
321
|
+
if (!current && !enabled)
|
|
322
|
+
return;
|
|
323
|
+
if (current?.bots[bot.id] === enabled)
|
|
324
|
+
return;
|
|
325
|
+
const { warnings: _warnings, ...pack } = revision;
|
|
326
|
+
const row = current ?? { ...pack, instructions: "", teams: [], bots: {} };
|
|
327
|
+
const selected = { ...row, bots: { ...row.bots, [bot.id]: enabled } };
|
|
328
|
+
const installed = state.installed.filter(p => p !== current).map(p => enabled && p.id === row.id
|
|
329
|
+
? { ...p, bots: { ...p.bots, [bot.id]: false } } : p);
|
|
330
|
+
const events = current ? [] : [audit("install", row, actor)];
|
|
331
|
+
save({ ...state, installed: [...installed, selected], pending: state.pending.filter(p => p.sha256 !== row.sha256) }, [...events, audit("assign", row, actor, "bot:" + bot.id, enabled)]);
|
|
332
|
+
},
|
|
316
333
|
getApproved(id, sha256) {
|
|
317
334
|
const m = approved(id, sha256);
|
|
318
335
|
return m && !m.source ? m : null;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ZodError } from "zod";
|
|
2
|
+
import { KnowledgeError } from "../knowledge/schema.js";
|
|
3
|
+
import { PASS } from "./table.js";
|
|
4
|
+
export function knowledgeFailure(error) {
|
|
5
|
+
if (error instanceof ZodError)
|
|
6
|
+
return { status: 400, body: { error: "Invalid knowledge input.", fields: error.issues.slice(0, 6).map(issue => issue.path.join(".")) } };
|
|
7
|
+
if (error instanceof KnowledgeError)
|
|
8
|
+
return { status: error.status, body: { error: error.message } };
|
|
9
|
+
if (error instanceof Error && error.name === "AbortError")
|
|
10
|
+
return { status: 409, body: { error: "Knowledge operation cancelled." } };
|
|
11
|
+
return { status: 500, body: { error: "The knowledge operation could not finish." } };
|
|
12
|
+
}
|
|
13
|
+
export function knowledgeRoutes(host, actor) {
|
|
14
|
+
return async ({ req, res, auth, path, method, readBody, json }) => {
|
|
15
|
+
const found = /^\/api\/bots\/([\w-]+)\/knowledge\/([a-z_]+)$/.exec(path);
|
|
16
|
+
if (!found)
|
|
17
|
+
return PASS;
|
|
18
|
+
const id = found[1], action = found[2];
|
|
19
|
+
const identify = () => actor(auth, id);
|
|
20
|
+
const controller = new AbortController();
|
|
21
|
+
const cancel = () => controller.abort();
|
|
22
|
+
res.once("close", cancel);
|
|
23
|
+
try {
|
|
24
|
+
identify();
|
|
25
|
+
if (action === "settings") {
|
|
26
|
+
if (method === "GET")
|
|
27
|
+
return json(res, 200, host.settings(id, identify()));
|
|
28
|
+
if (method === "PUT") {
|
|
29
|
+
const input = await readBody(req, 1024);
|
|
30
|
+
return json(res, 200, host.configure(id, identify(), input));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
else if (method === "POST") {
|
|
34
|
+
const input = await readBody(req, action === "import" ? 2_000_000 : 256_000);
|
|
35
|
+
return json(res, 200, await host.run(id, action, input, identify, controller.signal));
|
|
36
|
+
}
|
|
37
|
+
return json(res, 405, { error: "Method not allowed." });
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
const { status, body } = knowledgeFailure(error);
|
|
41
|
+
if (!res.destroyed)
|
|
42
|
+
return json(res, status, body);
|
|
43
|
+
}
|
|
44
|
+
finally {
|
|
45
|
+
res.off("close", cancel);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
@@ -7,7 +7,7 @@ import { phoneMovedRefusal } from "../move-freeze.js";
|
|
|
7
7
|
import { PASS } from "./table.js";
|
|
8
8
|
const freezeBody = z.object({ cloud: z.string().url().max(300).optional(), place: z.string().trim().min(1).max(120).optional() });
|
|
9
9
|
const thawBody = z.object({ automations: z.literal("off").optional() });
|
|
10
|
-
export function createMoveFreezeRoutes({ freeze, busy,
|
|
10
|
+
export function createMoveFreezeRoutes({ freeze, busy, automationsOff, platform = process.platform }) {
|
|
11
11
|
return async ({ req, res, path, method, auth, json, readBody }) => {
|
|
12
12
|
// Health still answers: without it the companion tells the phone OpenMausBot isn't ready here, and the phone keeps
|
|
13
13
|
// trying instead of reading the reason.
|
|
@@ -20,11 +20,7 @@ export function createMoveFreezeRoutes({ freeze, busy, restart, automationsOff,
|
|
|
20
20
|
return json(res, 403, { error: "Only Limix Bot on this computer can do this." });
|
|
21
21
|
if (method !== "POST")
|
|
22
22
|
return json(res, 405, { error: "method not allowed" });
|
|
23
|
-
|
|
24
|
-
return json(res, 409, { error: "Only a computer whose bots moved to My Cloud deletes its copy." });
|
|
25
|
-
json(res, 200, { forgot: true });
|
|
26
|
-
restart();
|
|
27
|
-
return;
|
|
23
|
+
return json(res, 409, { error: "This computer keeps its workspace after a transfer." });
|
|
28
24
|
}
|
|
29
25
|
if (path === "/api/move/freeze") {
|
|
30
26
|
if (auth.kind !== "loopback")
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{U as a,C as n}from"./mermaid.core-Cy9_uq1T.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c};
|