Brunobkr/llama.cpp_AlgMor24_github
ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.
03.1k
1"use strict";2var __create = Object.create;3var __defProp = Object.defineProperty;4var __getOwnPropDesc = Object.getOwnPropertyDescriptor;5var __getOwnPropNames = Object.getOwnPropertyNames;6var __getProtoOf = Object.getPrototypeOf;7var __hasOwnProp = Object.prototype.hasOwnProperty;8var __export = (target, all) => {9 for (var name in all)10 __defProp(target, name, { get: all[name], enumerable: true });11};12var __copyProps = (to, from, except, desc) => {13 if (from && typeof from === "object" || typeof from === "function") {14 for (let key of __getOwnPropNames(from))15 if (!__hasOwnProp.call(to, key) && key !== except)16 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });17 }18 return to;19};20var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(21 // If the importer is in node compatibility mode or this is not an ESM22 // file that has been converted to a CommonJS file using a Babel-23 // compatible transform (i.e. "__esModule" has not been set), then set24 // "default" to the CommonJS "module.exports" for node compatibility.25 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,26 mod27));28var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);29var server_exports = {};30__export(server_exports, {31 connect: () => connect,32 createServer: () => createServer,33 firstRootPath: () => firstRootPath,34 start: () => start,35 wrapInProcess: () => wrapInProcess36});37module.exports = __toCommonJS(server_exports);38var import_url = require("url");39var import_utilsBundle = require("playwright-core/lib/utilsBundle");40var mcpBundle = __toESM(require("./bundle"));41var import_http = require("./http");42var import_inProcessTransport = require("./inProcessTransport");43const serverDebug = (0, import_utilsBundle.debug)("pw:mcp:server");44async function connect(factory, transport, runHeartbeat) {45 const server = createServer(factory.name, factory.version, factory.create(), runHeartbeat);46 await server.connect(transport);47}48async function wrapInProcess(backend) {49 const server = createServer("Internal", "0.0.0", backend, false);50 return new import_inProcessTransport.InProcessTransport(server);51}52function createServer(name, version, backend, runHeartbeat) {53 const server = new mcpBundle.Server({ name, version }, {54 capabilities: {55 tools: {}56 }57 });58 server.setRequestHandler(mcpBundle.ListToolsRequestSchema, async () => {59 serverDebug("listTools");60 const tools = await backend.listTools();61 return { tools };62 });63 let initializePromise;64 server.setRequestHandler(mcpBundle.CallToolRequestSchema, async (request, extra) => {65 serverDebug("callTool", request);66 const progressToken = request.params._meta?.progressToken;67 let progressCounter = 0;68 const progress = progressToken ? (params) => {69 extra.sendNotification({70 method: "notifications/progress",71 params: {72 progressToken,73 progress: params.progress ?? ++progressCounter,74 total: params.total,75 message: params.message76 }77 }).catch(serverDebug);78 } : () => {79 };80 try {81 if (!initializePromise)82 initializePromise = initializeServer(server, backend, runHeartbeat);83 await initializePromise;84 return mergeTextParts(await backend.callTool(request.params.name, request.params.arguments || {}, progress));85 } catch (error) {86 return {87 content: [{ type: "text", text: "### Result\n" + String(error) }],88 isError: true89 };90 }91 });92 addServerListener(server, "close", () => backend.serverClosed?.(server));93 return server;94}95const initializeServer = async (server, backend, runHeartbeat) => {96 const capabilities = server.getClientCapabilities();97 let clientRoots = [];98 if (capabilities?.roots) {99 const { roots } = await server.listRoots().catch((e) => {100 serverDebug(e);101 return { roots: [] };102 });103 clientRoots = roots;104 }105 const clientInfo = {106 name: server.getClientVersion()?.name ?? "unknown",107 version: server.getClientVersion()?.version ?? "unknown",108 roots: clientRoots,109 timestamp: Date.now()110 };111 await backend.initialize?.(server, clientInfo);112 if (runHeartbeat)113 startHeartbeat(server);114};115const startHeartbeat = (server) => {116 const beat = () => {117 Promise.race([118 server.ping(),119 new Promise((_, reject) => setTimeout(() => reject(new Error("ping timeout")), 5e3))120 ]).then(() => {121 setTimeout(beat, 3e3);122 }).catch(() => {123 void server.close();124 });125 };126 beat();127};128function addServerListener(server, event, listener) {129 const oldListener = server[`on${event}`];130 server[`on${event}`] = () => {131 oldListener?.();132 listener();133 };134}135async function start(serverBackendFactory, options) {136 if (options.port === void 0) {137 await connect(serverBackendFactory, new mcpBundle.StdioServerTransport(), false);138 return;139 }140 const httpServer = await (0, import_http.startHttpServer)(options);141 const url = (0, import_http.httpAddressToString)(httpServer.address());142 await (0, import_http.installHttpTransport)(httpServer, serverBackendFactory, options.allowedHosts);143 const mcpConfig = { mcpServers: {} };144 mcpConfig.mcpServers[serverBackendFactory.nameInConfig] = {145 url: `${url}/mcp`146 };147 const message = [148 `Listening on ${url}`,149 "Put this in your client config:",150 JSON.stringify(mcpConfig, void 0, 2),151 "For legacy SSE transport support, you can use the /sse endpoint instead."152 ].join("\n");153 console.error(message);154}155function firstRootPath(clientInfo) {156 if (clientInfo.roots.length === 0)157 return void 0;158 const firstRootUri = clientInfo.roots[0]?.uri;159 const url = firstRootUri ? new URL(firstRootUri) : void 0;160 return url ? (0, import_url.fileURLToPath)(url) : void 0;161}162function mergeTextParts(result) {163 const content = [];164 const testParts = [];165 for (const part of result.content) {166 if (part.type === "text") {167 testParts.push(part.text);168 continue;169 }170 if (testParts.length > 0) {171 content.push({ type: "text", text: testParts.join("\n") });172 testParts.length = 0;173 }174 content.push(part);175 }176 if (testParts.length > 0)177 content.push({ type: "text", text: testParts.join("\n") });178 return {179 ...result,180 content181 };182}183// Annotate the CommonJS export names for ESM import in node:1840 && (module.exports = {185 connect,186 createServer,187 firstRootPath,188 start,189 wrapInProcess190});191 