Team Ai
Datasetpublic

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.

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes3.1kdownloads
crConnection.js203 linesDownload Raw Back to chromium
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 crConnection_exports = {};20__export(crConnection_exports, {21  CDPSession: () => CDPSession,22  CRConnection: () => CRConnection,23  CRSession: () => CRSession,24  ConnectionEvents: () => ConnectionEvents,25  kBrowserCloseMessageId: () => kBrowserCloseMessageId26});27module.exports = __toCommonJS(crConnection_exports);28var import_utils = require("../../utils");29var import_debugLogger = require("../utils/debugLogger");30var import_helper = require("../helper");31var import_protocolError = require("../protocolError");32var import_instrumentation = require("../instrumentation");33const ConnectionEvents = {34  Disconnected: Symbol("ConnectionEvents.Disconnected")35};36const kBrowserCloseMessageId = -9999;37class CRConnection extends import_instrumentation.SdkObject {38  constructor(parent, transport, protocolLogger, browserLogsCollector) {39    super(parent, "cr-connection");40    this._lastId = 0;41    this._sessions = /* @__PURE__ */ new Map();42    this._closed = false;43    this.setMaxListeners(0);44    this._transport = transport;45    this._protocolLogger = protocolLogger;46    this._browserLogsCollector = browserLogsCollector;47    this.rootSession = new CRSession(this, null, "");48    this._sessions.set("", this.rootSession);49    this._transport.onmessage = this._onMessage.bind(this);50    this._transport.onclose = this._onClose.bind(this);51  }52  _rawSend(sessionId, method, params) {53    const id = ++this._lastId;54    const message = { id, method, params };55    if (sessionId)56      message.sessionId = sessionId;57    this._protocolLogger("send", message);58    this._transport.send(message);59    return id;60  }61  async _onMessage(message) {62    this._protocolLogger("receive", message);63    if (message.id === kBrowserCloseMessageId)64      return;65    const session = this._sessions.get(message.sessionId || "");66    if (session)67      session._onMessage(message);68  }69  _onClose(reason) {70    this._closed = true;71    this._transport.onmessage = void 0;72    this._transport.onclose = void 0;73    this._browserDisconnectedLogs = import_helper.helper.formatBrowserLogs(this._browserLogsCollector.recentLogs(), reason);74    this.rootSession.dispose();75    Promise.resolve().then(() => this.emit(ConnectionEvents.Disconnected));76  }77  close() {78    if (!this._closed)79      this._transport.close();80  }81  async createBrowserSession() {82    const { sessionId } = await this.rootSession.send("Target.attachToBrowserTarget");83    return new CDPSession(this.rootSession, sessionId);84  }85}86class CRSession extends import_instrumentation.SdkObject {87  constructor(connection, parentSession, sessionId, eventListener) {88    super(connection, "cr-session");89    this._callbacks = /* @__PURE__ */ new Map();90    this._crashed = false;91    this._closed = false;92    this.setMaxListeners(0);93    this._connection = connection;94    this._parentSession = parentSession;95    this._sessionId = sessionId;96    this._eventListener = eventListener;97    this.on = super.on;98    this.addListener = super.addListener;99    this.off = super.removeListener;100    this.removeListener = super.removeListener;101    this.once = super.once;102  }103  _markAsCrashed() {104    this._crashed = true;105  }106  createChildSession(sessionId, eventListener) {107    const session = new CRSession(this._connection, this, sessionId, eventListener);108    this._connection._sessions.set(sessionId, session);109    return session;110  }111  async send(method, params) {112    if (this._crashed || this._closed || this._connection._closed || this._connection._browserDisconnectedLogs)113      throw new import_protocolError.ProtocolError(this._crashed ? "crashed" : "closed", void 0, this._connection._browserDisconnectedLogs);114    const id = this._connection._rawSend(this._sessionId, method, params);115    return new Promise((resolve, reject) => {116      this._callbacks.set(id, { resolve, reject, error: new import_protocolError.ProtocolError("error", method) });117    });118  }119  _sendMayFail(method, params) {120    return this.send(method, params).catch((error) => import_debugLogger.debugLogger.log("error", error));121  }122  _onMessage(object) {123    if (object.id && this._callbacks.has(object.id)) {124      const callback = this._callbacks.get(object.id);125      this._callbacks.delete(object.id);126      if (object.error) {127        callback.error.setMessage(object.error.message);128        callback.reject(callback.error);129      } else {130        callback.resolve(object.result);131      }132    } else if (object.id && object.error?.code === -32001) {133    } else {134      (0, import_utils.assert)(!object.id, object?.error?.message || void 0);135      Promise.resolve().then(() => {136        if (this._eventListener)137          this._eventListener(object.method, object.params);138        this.emit(object.method, object.params);139      });140    }141  }142  async detach() {143    if (this._closed)144      throw new Error(`Session already detached. Most likely the page has been closed.`);145    if (!this._parentSession)146      throw new Error("Root session cannot be closed");147    await this._sendMayFail("Runtime.runIfWaitingForDebugger");148    await this._parentSession.send("Target.detachFromTarget", { sessionId: this._sessionId });149    this.dispose();150  }151  dispose() {152    this._closed = true;153    this._connection._sessions.delete(this._sessionId);154    for (const callback of this._callbacks.values()) {155      callback.error.setMessage(`Internal server error, session closed.`);156      callback.error.type = this._crashed ? "crashed" : "closed";157      callback.error.logs = this._connection._browserDisconnectedLogs;158      callback.reject(callback.error);159    }160    this._callbacks.clear();161  }162}163class CDPSession extends import_instrumentation.SdkObject {164  constructor(parentSession, sessionId) {165    super(parentSession, "cdp-session");166    this._listeners = [];167    this._session = parentSession.createChildSession(sessionId, (method, params) => this.emit(CDPSession.Events.Event, { method, params }));168    this._listeners = [import_utils.eventsHelper.addEventListener(parentSession, "Target.detachedFromTarget", (event) => {169      if (event.sessionId === sessionId)170        this._onClose();171    })];172  }173  static {174    this.Events = {175      Event: "event",176      Closed: "close"177    };178  }179  async send(method, params) {180    return await this._session.send(method, params);181  }182  async detach() {183    return await this._session.detach();184  }185  async attachToTarget(targetId) {186    const { sessionId } = await this.send("Target.attachToTarget", { targetId, flatten: true });187    return new CDPSession(this._session, sessionId);188  }189  _onClose() {190    import_utils.eventsHelper.removeEventListeners(this._listeners);191    this._session.dispose();192    this.emit(CDPSession.Events.Closed);193  }194}195// Annotate the CommonJS export names for ESM import in node:1960 && (module.exports = {197  CDPSession,198  CRConnection,199  CRSession,200  ConnectionEvents,201  kBrowserCloseMessageId202});203