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 __defProp = Object.defineProperty;3var __getOwnPropDesc = Object.getOwnPropertyDescriptor;4var __getOwnPropNames = Object.getOwnPropertyNames;5var __hasOwnProp = Object.prototype.hasOwnProperty;6var __export = (target, all) => {7 for (var name in all)8 __defProp(target, name, { get: all[name], enumerable: true });9};10var __copyProps = (to, from, except, desc) => {11 if (from && typeof from === "object" || typeof from === "function") {12 for (let key of __getOwnPropNames(from))13 if (!__hasOwnProp.call(to, key) && key !== except)14 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });15 }16 return to;17};18var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);19var bidiConnection_exports = {};20__export(bidiConnection_exports, {21 BidiConnection: () => BidiConnection,22 BidiSession: () => BidiSession,23 kBrowserCloseMessageId: () => kBrowserCloseMessageId,24 kShutdownSessionNewMessageId: () => kShutdownSessionNewMessageId25});26module.exports = __toCommonJS(bidiConnection_exports);27var import_events = require("events");28var import_debugLogger = require("../utils/debugLogger");29var import_helper = require("../helper");30var import_protocolError = require("../protocolError");31const kBrowserCloseMessageId = Number.MAX_SAFE_INTEGER - 1;32const kShutdownSessionNewMessageId = kBrowserCloseMessageId - 1;33class BidiConnection {34 constructor(transport, onDisconnect, protocolLogger, browserLogsCollector) {35 this._lastId = 0;36 this._closed = false;37 this._browsingContextToSession = /* @__PURE__ */ new Map();38 this._realmToBrowsingContext = /* @__PURE__ */ new Map();39 // TODO: shared/service workers might have multiple owner realms.40 this._realmToOwnerRealm = /* @__PURE__ */ new Map();41 this._transport = transport;42 this._onDisconnect = onDisconnect;43 this._protocolLogger = protocolLogger;44 this._browserLogsCollector = browserLogsCollector;45 this.browserSession = new BidiSession(this, "", (message) => {46 this.rawSend(message);47 });48 this._transport.onmessage = this._dispatchMessage.bind(this);49 this._transport.onclose = this._onClose.bind(this);50 }51 nextMessageId() {52 return ++this._lastId;53 }54 rawSend(message) {55 this._protocolLogger("send", message);56 this._transport.send(message);57 }58 _dispatchMessage(message) {59 this._protocolLogger("receive", message);60 const object = message;61 if (object.type === "event") {62 if (object.method === "script.realmCreated") {63 if ("context" in object.params)64 this._realmToBrowsingContext.set(object.params.realm, object.params.context);65 if (object.params.type === "dedicated-worker")66 this._realmToOwnerRealm.set(object.params.realm, object.params.owners[0]);67 } else if (object.method === "script.realmDestroyed") {68 this._realmToBrowsingContext.delete(object.params.realm);69 this._realmToOwnerRealm.delete(object.params.realm);70 }71 let context;72 let realm;73 if ("context" in object.params) {74 context = object.params.context;75 } else if (object.method === "log.entryAdded" || object.method === "script.message") {76 context = object.params.source?.context;77 realm = object.params.source?.realm;78 } else if (object.method === "script.realmCreated" && object.params.type === "dedicated-worker") {79 realm = object.params.owners[0];80 }81 if (!context && realm) {82 while (this._realmToOwnerRealm.get(realm))83 realm = this._realmToOwnerRealm.get(realm);84 context = this._realmToBrowsingContext.get(realm);85 }86 if (context) {87 const session = this._browsingContextToSession.get(context);88 if (session) {89 session.dispatchMessage(message);90 return;91 }92 }93 } else if (message.id) {94 for (const session of this._browsingContextToSession.values()) {95 if (session.hasCallback(message.id)) {96 session.dispatchMessage(message);97 return;98 }99 }100 }101 this.browserSession.dispatchMessage(message);102 }103 _onClose(reason) {104 this._closed = true;105 this._transport.onmessage = void 0;106 this._transport.onclose = void 0;107 this._browserDisconnectedLogs = import_helper.helper.formatBrowserLogs(this._browserLogsCollector.recentLogs(), reason);108 this.browserSession.dispose();109 this._onDisconnect();110 }111 isClosed() {112 return this._closed;113 }114 close() {115 if (!this._closed)116 this._transport.close();117 }118 createMainFrameBrowsingContextSession(bowsingContextId) {119 const result = new BidiSession(this, bowsingContextId, (message) => this.rawSend(message));120 this._browsingContextToSession.set(bowsingContextId, result);121 return result;122 }123}124class BidiSession extends import_events.EventEmitter {125 constructor(connection, sessionId, rawSend) {126 super();127 this._disposed = false;128 this._callbacks = /* @__PURE__ */ new Map();129 this._crashed = false;130 this._browsingContexts = /* @__PURE__ */ new Set();131 this.setMaxListeners(0);132 this.connection = connection;133 this.sessionId = sessionId;134 this._rawSend = rawSend;135 this.on = super.on;136 this.off = super.removeListener;137 this.addListener = super.addListener;138 this.removeListener = super.removeListener;139 this.once = super.once;140 }141 addFrameBrowsingContext(context) {142 this._browsingContexts.add(context);143 this.connection._browsingContextToSession.set(context, this);144 }145 removeFrameBrowsingContext(context) {146 this._browsingContexts.delete(context);147 this.connection._browsingContextToSession.delete(context);148 }149 async send(method, params) {150 if (this._crashed || this._disposed || this.connection._browserDisconnectedLogs)151 throw new import_protocolError.ProtocolError(this._crashed ? "crashed" : "closed", void 0, this.connection._browserDisconnectedLogs);152 const id = this.connection.nextMessageId();153 const messageObj = { id, method, params };154 this._rawSend(messageObj);155 return new Promise((resolve, reject) => {156 this._callbacks.set(id, { resolve, reject, error: new import_protocolError.ProtocolError("error", method) });157 });158 }159 sendMayFail(method, params) {160 return this.send(method, params).catch((error) => import_debugLogger.debugLogger.log("error", error));161 }162 markAsCrashed() {163 this._crashed = true;164 }165 isDisposed() {166 return this._disposed;167 }168 dispose() {169 this._disposed = true;170 this.connection._browsingContextToSession.delete(this.sessionId);171 for (const context of this._browsingContexts)172 this.connection._browsingContextToSession.delete(context);173 this._browsingContexts.clear();174 for (const callback of this._callbacks.values()) {175 callback.error.type = this._crashed ? "crashed" : "closed";176 callback.error.logs = this.connection._browserDisconnectedLogs;177 callback.reject(callback.error);178 }179 this._callbacks.clear();180 }181 hasCallback(id) {182 return this._callbacks.has(id);183 }184 dispatchMessage(message) {185 const object = message;186 if (object.id === kBrowserCloseMessageId || object.id === kShutdownSessionNewMessageId)187 return;188 if (object.id && this._callbacks.has(object.id)) {189 const callback = this._callbacks.get(object.id);190 this._callbacks.delete(object.id);191 if (object.type === "error") {192 callback.error.setMessage(object.error + "\nMessage: " + object.message);193 callback.reject(callback.error);194 } else if (object.type === "success") {195 callback.resolve(object.result);196 } else {197 callback.error.setMessage("Internal error, unexpected response type: " + JSON.stringify(object));198 callback.reject(callback.error);199 }200 } else if (object.id) {201 } else {202 Promise.resolve().then(() => this.emit(object.method, object.params));203 }204 }205}206// Annotate the CommonJS export names for ESM import in node:2070 && (module.exports = {208 BidiConnection,209 BidiSession,210 kBrowserCloseMessageId,211 kShutdownSessionNewMessageId212});213 