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
program.js413 linesDownload Raw Back to lib
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 program_exports = {};30__export(program_exports, {31  program: () => import_program2.program32});33module.exports = __toCommonJS(program_exports);34var import_fs = __toESM(require("fs"));35var import_path = __toESM(require("path"));36var import_program = require("playwright-core/lib/cli/program");37var import_utils = require("playwright-core/lib/utils");38var import_config = require("./common/config");39var import_configLoader = require("./common/configLoader");40var import_program2 = require("playwright-core/lib/cli/program");41var import_base = require("./reporters/base");42var import_html = require("./reporters/html");43var import_merge = require("./reporters/merge");44var import_projectUtils = require("./runner/projectUtils");45var testServer = __toESM(require("./runner/testServer"));46var import_watchMode = require("./runner/watchMode");47var import_testRunner = require("./runner/testRunner");48var import_reporters = require("./runner/reporters");49var import_exports = require("./mcp/sdk/exports");50var import_testBackend = require("./mcp/test/testBackend");51var import_seed = require("./mcp/test/seed");52var import_program3 = require("./mcp/program");53var import_watchdog = require("./mcp/browser/watchdog");54var import_generateAgents = require("./agents/generateAgents");55const packageJSON = require("../package.json");56function addTestCommand(program3) {57  const command = program3.command("test [test-filter...]");58  command.description("run tests with Playwright Test");59  const options = testOptions.sort((a, b) => a[0].replace(/-/g, "").localeCompare(b[0].replace(/-/g, "")));60  options.forEach(([name, { description, choices, preset }]) => {61    const option = command.createOption(name, description);62    if (choices)63      option.choices(choices);64    if (preset)65      option.preset(preset);66    command.addOption(option);67    return command;68  });69  command.action(async (args, opts) => {70    try {71      await runTests(args, opts);72    } catch (e) {73      console.error(e);74      (0, import_utils.gracefullyProcessExitDoNotHang)(1);75    }76  });77  command.addHelpText("afterAll", `78Arguments [test-filter...]:79  Pass arguments to filter test files. Each argument is treated as a regular expression. Matching is performed against the absolute file paths.80 81Examples:82  $ npx playwright test my.spec.ts83  $ npx playwright test some.spec.ts:4284  $ npx playwright test --headed85  $ npx playwright test --project=webkit`);86}87function addClearCacheCommand(program3) {88  const command = program3.command("clear-cache");89  command.description("clears build and test caches");90  command.option("-c, --config <file>", `Configuration file, or a test directory with optional "playwright.config.{m,c}?{js,ts}"`);91  command.action(async (opts) => {92    const runner = new import_testRunner.TestRunner((0, import_configLoader.resolveConfigLocation)(opts.config), {});93    const { status } = await runner.clearCache((0, import_reporters.createErrorCollectingReporter)(import_base.terminalScreen));94    const exitCode = status === "interrupted" ? 130 : status === "passed" ? 0 : 1;95    (0, import_utils.gracefullyProcessExitDoNotHang)(exitCode);96  });97}98function addDevServerCommand(program3) {99  const command = program3.command("dev-server", { hidden: true });100  command.description("start dev server");101  command.option("-c, --config <file>", `Configuration file, or a test directory with optional "playwright.config.{m,c}?{js,ts}"`);102  command.action(async (options) => {103    const runner = new import_testRunner.TestRunner((0, import_configLoader.resolveConfigLocation)(options.config), {});104    await runner.startDevServer((0, import_reporters.createErrorCollectingReporter)(import_base.terminalScreen), "in-process");105  });106}107function addTestServerCommand(program3) {108  const command = program3.command("test-server", { hidden: true });109  command.description("start test server");110  command.option("-c, --config <file>", `Configuration file, or a test directory with optional "playwright.config.{m,c}?{js,ts}"`);111  command.option("--host <host>", "Host to start the server on", "localhost");112  command.option("--port <port>", "Port to start the server on", "0");113  command.action((opts) => runTestServer(opts));114}115function addShowReportCommand(program3) {116  const command = program3.command("show-report [report]");117  command.description("show HTML report");118  command.action((report, options) => (0, import_html.showHTMLReport)(report, options.host, +options.port));119  command.option("--host <host>", "Host to serve report on", "localhost");120  command.option("--port <port>", "Port to serve report on", "9323");121  command.addHelpText("afterAll", `122Arguments [report]:123  When specified, opens given report, otherwise opens last generated report.124 125Examples:126  $ npx playwright show-report127  $ npx playwright show-report playwright-report`);128}129function addMergeReportsCommand(program3) {130  const command = program3.command("merge-reports [dir]");131  command.description("merge multiple blob reports (for sharded tests) into a single report");132  command.action(async (dir, options) => {133    try {134      await mergeReports(dir, options);135    } catch (e) {136      console.error(e);137      (0, import_utils.gracefullyProcessExitDoNotHang)(1);138    }139  });140  command.option("-c, --config <file>", `Configuration file. Can be used to specify additional configuration for the output report.`);141  command.option("--reporter <reporter>", `Reporter to use, comma-separated, can be ${import_config.builtInReporters.map((name) => `"${name}"`).join(", ")} (default: "${import_config.defaultReporter}")`);142  command.addHelpText("afterAll", `143Arguments [dir]:144  Directory containing blob reports.145 146Examples:147  $ npx playwright merge-reports playwright-report`);148}149function addBrowserMCPServerCommand(program3) {150  const command = program3.command("run-mcp-server", { hidden: true });151  command.description("Interact with the browser over MCP");152  (0, import_program3.decorateCommand)(command, packageJSON.version);153}154function addTestMCPServerCommand(program3) {155  const command = program3.command("run-test-mcp-server", { hidden: true });156  command.description("Interact with the test runner over MCP");157  command.option("--headless", "run browser in headless mode, headed by default");158  command.option("-c, --config <file>", `Configuration file, or a test directory with optional "playwright.config.{m,c}?{js,ts}"`);159  command.option("--host <host>", "host to bind server to. Default is localhost. Use 0.0.0.0 to bind to all interfaces.");160  command.option("--port <port>", "port to listen on for SSE transport.");161  command.action(async (options) => {162    (0, import_watchdog.setupExitWatchdog)();163    const backendFactory = {164      name: "Playwright Test Runner",165      nameInConfig: "playwright-test-runner",166      version: packageJSON.version,167      create: () => new import_testBackend.TestServerBackend(options.config, { muteConsole: options.port === void 0, headless: options.headless })168    };169    const mdbUrl = await (0, import_exports.runMainBackend)(170      backendFactory,171      {172        port: options.port === void 0 ? void 0 : +options.port173      }174    );175    if (mdbUrl)176      console.error("MCP Listening on: ", mdbUrl);177  });178}179function addInitAgentsCommand(program3) {180  const command = program3.command("init-agents");181  command.description("Initialize repository agents");182  const option = command.createOption("--loop <loop>", "Agentic loop provider");183  option.choices(["vscode", "claude", "opencode"]);184  command.addOption(option);185  command.option("-c, --config <file>", `Configuration file to find a project to use for seed test`);186  command.option("--project <project>", "Project to use for seed test");187  command.action(async (opts) => {188    if (opts.loop === "opencode") {189      await (0, import_generateAgents.initOpencodeRepo)();190    } else if (opts.loop === "vscode") {191      await (0, import_generateAgents.initVSCodeRepo)();192    } else if (opts.loop === "claude") {193      await (0, import_generateAgents.initClaudeCodeRepo)();194    } else {195      command.help();196      return;197    }198    const config = await (0, import_configLoader.loadConfigFromFile)(opts.config);199    const project = (0, import_seed.seedProject)(config, opts.project);200    await (0, import_seed.ensureSeedTest)(project, true);201  });202}203async function runTests(args, opts) {204  await (0, import_utils.startProfiling)();205  const cliOverrides = overridesFromOptions(opts);206  const config = await (0, import_configLoader.loadConfigFromFile)(opts.config, cliOverrides, opts.deps === false);207  config.cliArgs = args;208  config.cliGrep = opts.grep;209  config.cliOnlyChanged = opts.onlyChanged === true ? "HEAD" : opts.onlyChanged;210  config.cliGrepInvert = opts.grepInvert;211  config.cliListOnly = !!opts.list;212  config.cliProjectFilter = opts.project || void 0;213  config.cliPassWithNoTests = !!opts.passWithNoTests;214  config.cliLastFailed = !!opts.lastFailed;215  config.cliTestList = opts.testList ? import_path.default.resolve(process.cwd(), opts.testList) : void 0;216  config.cliTestListInvert = opts.testListInvert ? import_path.default.resolve(process.cwd(), opts.testListInvert) : void 0;217  (0, import_projectUtils.filterProjects)(config.projects, config.cliProjectFilter);218  if (opts.ui || opts.uiHost || opts.uiPort) {219    if (opts.onlyChanged)220      throw new Error(`--only-changed is not supported in UI mode. If you'd like that to change, see https://github.com/microsoft/playwright/issues/15075 for more details.`);221    const status2 = await testServer.runUIMode(opts.config, cliOverrides, {222      host: opts.uiHost,223      port: opts.uiPort ? +opts.uiPort : void 0,224      args,225      grep: opts.grep,226      grepInvert: opts.grepInvert,227      project: opts.project || void 0,228      reporter: Array.isArray(opts.reporter) ? opts.reporter : opts.reporter ? [opts.reporter] : void 0229    });230    await (0, import_utils.stopProfiling)("runner");231    const exitCode2 = status2 === "interrupted" ? 130 : status2 === "passed" ? 0 : 1;232    (0, import_utils.gracefullyProcessExitDoNotHang)(exitCode2);233    return;234  }235  if (process.env.PWTEST_WATCH) {236    if (opts.onlyChanged)237      throw new Error(`--only-changed is not supported in watch mode. If you'd like that to change, file an issue and let us know about your usecase for it.`);238    const status2 = await (0, import_watchMode.runWatchModeLoop)(239      (0, import_configLoader.resolveConfigLocation)(opts.config),240      {241        projects: opts.project,242        files: args,243        grep: opts.grep244      }245    );246    await (0, import_utils.stopProfiling)("runner");247    const exitCode2 = status2 === "interrupted" ? 130 : status2 === "passed" ? 0 : 1;248    (0, import_utils.gracefullyProcessExitDoNotHang)(exitCode2);249    return;250  }251  const status = await (0, import_testRunner.runAllTestsWithConfig)(config);252  await (0, import_utils.stopProfiling)("runner");253  const exitCode = status === "interrupted" ? 130 : status === "passed" ? 0 : 1;254  (0, import_utils.gracefullyProcessExitDoNotHang)(exitCode);255}256async function runTestServer(opts) {257  const host = opts.host || "localhost";258  const port = opts.port ? +opts.port : 0;259  const status = await testServer.runTestServer(opts.config, {}, { host, port });260  const exitCode = status === "interrupted" ? 130 : status === "passed" ? 0 : 1;261  (0, import_utils.gracefullyProcessExitDoNotHang)(exitCode);262}263async function mergeReports(reportDir, opts) {264  const configFile = opts.config;265  const config = configFile ? await (0, import_configLoader.loadConfigFromFile)(configFile) : await (0, import_configLoader.loadEmptyConfigForMergeReports)();266  const dir = import_path.default.resolve(process.cwd(), reportDir || "");267  const dirStat = await import_fs.default.promises.stat(dir).catch((e) => null);268  if (!dirStat)269    throw new Error("Directory does not exist: " + dir);270  if (!dirStat.isDirectory())271    throw new Error(`"${dir}" is not a directory`);272  let reporterDescriptions = resolveReporterOption(opts.reporter);273  if (!reporterDescriptions && configFile)274    reporterDescriptions = config.config.reporter;275  if (!reporterDescriptions)276    reporterDescriptions = [[import_config.defaultReporter]];277  const rootDirOverride = configFile ? config.config.rootDir : void 0;278  await (0, import_merge.createMergedReport)(config, dir, reporterDescriptions, rootDirOverride);279  (0, import_utils.gracefullyProcessExitDoNotHang)(0);280}281function overridesFromOptions(options) {282  const overrides = {283    failOnFlakyTests: options.failOnFlakyTests ? true : void 0,284    forbidOnly: options.forbidOnly ? true : void 0,285    fullyParallel: options.fullyParallel ? true : void 0,286    globalTimeout: options.globalTimeout ? parseInt(options.globalTimeout, 10) : void 0,287    maxFailures: options.x ? 1 : options.maxFailures ? parseInt(options.maxFailures, 10) : void 0,288    outputDir: options.output ? import_path.default.resolve(process.cwd(), options.output) : void 0,289    quiet: options.quiet ? options.quiet : void 0,290    repeatEach: options.repeatEach ? parseInt(options.repeatEach, 10) : void 0,291    retries: options.retries ? parseInt(options.retries, 10) : void 0,292    reporter: resolveReporterOption(options.reporter),293    shard: resolveShardOption(options.shard),294    timeout: options.timeout ? parseInt(options.timeout, 10) : void 0,295    tsconfig: options.tsconfig ? import_path.default.resolve(process.cwd(), options.tsconfig) : void 0,296    ignoreSnapshots: options.ignoreSnapshots ? !!options.ignoreSnapshots : void 0,297    updateSnapshots: options.updateSnapshots,298    updateSourceMethod: options.updateSourceMethod,299    workers: options.workers300  };301  if (options.browser) {302    const browserOpt = options.browser.toLowerCase();303    if (!["all", "chromium", "firefox", "webkit"].includes(browserOpt))304      throw new Error(`Unsupported browser "${options.browser}", must be one of "all", "chromium", "firefox" or "webkit"`);305    const browserNames = browserOpt === "all" ? ["chromium", "firefox", "webkit"] : [browserOpt];306    overrides.projects = browserNames.map((browserName) => {307      return {308        name: browserName,309        use: { browserName }310      };311    });312  }313  if (options.headed || options.debug)314    overrides.use = { headless: false };315  if (!options.ui && options.debug) {316    overrides.debug = true;317    process.env.PWDEBUG = "1";318  }319  if (!options.ui && options.trace) {320    overrides.use = overrides.use || {};321    overrides.use.trace = options.trace;322  }323  if (overrides.tsconfig && !import_fs.default.existsSync(overrides.tsconfig))324    throw new Error(`--tsconfig "${options.tsconfig}" does not exist`);325  return overrides;326}327function resolveReporterOption(reporter) {328  if (!reporter || !reporter.length)329    return void 0;330  return reporter.split(",").map((r) => [resolveReporter(r)]);331}332function resolveShardOption(shard) {333  if (!shard)334    return void 0;335  const shardPair = shard.split("/");336  if (shardPair.length !== 2) {337    throw new Error(338      `--shard "${shard}", expected format is "current/all", 1-based, for example "3/5".`339    );340  }341  const current = parseInt(shardPair[0], 10);342  const total = parseInt(shardPair[1], 10);343  if (isNaN(total) || total < 1)344    throw new Error(`--shard "${shard}" total must be a positive number`);345  if (isNaN(current) || current < 1 || current > total) {346    throw new Error(347      `--shard "${shard}" current must be a positive number, not greater than shard total`348    );349  }350  return { current, total };351}352function resolveReporter(id) {353  if (import_config.builtInReporters.includes(id))354    return id;355  const localPath = import_path.default.resolve(process.cwd(), id);356  if (import_fs.default.existsSync(localPath))357    return localPath;358  return require.resolve(id, { paths: [process.cwd()] });359}360const kTraceModes = ["on", "off", "on-first-retry", "on-all-retries", "retain-on-failure", "retain-on-first-failure"];361const testOptions = [362  /* deprecated */363  ["--browser <browser>", { description: `Browser to use for tests, one of "all", "chromium", "firefox" or "webkit" (default: "chromium")` }],364  ["-c, --config <file>", { description: `Configuration file, or a test directory with optional "playwright.config.{m,c}?{js,ts}"` }],365  ["--debug", { description: `Run tests with Playwright Inspector. Shortcut for "PWDEBUG=1" environment variable and "--timeout=0 --max-failures=1 --headed --workers=1" options` }],366  ["--fail-on-flaky-tests", { description: `Fail if any test is flagged as flaky (default: false)` }],367  ["--forbid-only", { description: `Fail if test.only is called (default: false)` }],368  ["--fully-parallel", { description: `Run all tests in parallel (default: false)` }],369  ["--global-timeout <timeout>", { description: `Maximum time this test suite can run in milliseconds (default: unlimited)` }],370  ["-g, --grep <grep>", { description: `Only run tests matching this regular expression (default: ".*")` }],371  ["--grep-invert <grep>", { description: `Only run tests that do not match this regular expression` }],372  ["--headed", { description: `Run tests in headed browsers (default: headless)` }],373  ["--ignore-snapshots", { description: `Ignore screenshot and snapshot expectations` }],374  ["--last-failed", { description: `Only re-run the failures` }],375  ["--list", { description: `Collect all the tests and report them, but do not run` }],376  ["--max-failures <N>", { description: `Stop after the first N failures` }],377  ["--no-deps", { description: `Do not run project dependencies` }],378  ["--output <dir>", { description: `Folder for output artifacts (default: "test-results")` }],379  ["--only-changed [ref]", { description: `Only run test files that have been changed between 'HEAD' and 'ref'. Defaults to running all uncommitted changes. Only supports Git.` }],380  ["--pass-with-no-tests", { description: `Makes test run succeed even if no tests were found` }],381  ["--project <project-name...>", { description: `Only run tests from the specified list of projects, supports '*' wildcard (default: run all projects)` }],382  ["--quiet", { description: `Suppress stdio` }],383  ["--repeat-each <N>", { description: `Run each test N times (default: 1)` }],384  ["--reporter <reporter>", { description: `Reporter to use, comma-separated, can be ${import_config.builtInReporters.map((name) => `"${name}"`).join(", ")} (default: "${import_config.defaultReporter}")` }],385  ["--retries <retries>", { description: `Maximum retry count for flaky tests, zero for no retries (default: no retries)` }],386  ["--shard <shard>", { description: `Shard tests and execute only the selected shard, specify in the form "current/all", 1-based, for example "3/5"` }],387  ["--test-list <file>", { description: `Path to a file containing a list of tests to run. See https://playwright.dev/docs/test-cli for more details.` }],388  ["--test-list-invert <file>", { description: `Path to a file containing a list of tests to skip. See https://playwright.dev/docs/test-cli for more details.` }],389  ["--timeout <timeout>", { description: `Specify test timeout threshold in milliseconds, zero for unlimited (default: ${import_config.defaultTimeout})` }],390  ["--trace <mode>", { description: `Force tracing mode`, choices: kTraceModes }],391  ["--tsconfig <path>", { description: `Path to a single tsconfig applicable to all imported files (default: look up tsconfig for each imported file separately)` }],392  ["--ui", { description: `Run tests in interactive UI mode` }],393  ["--ui-host <host>", { description: `Host to serve UI on; specifying this option opens UI in a browser tab` }],394  ["--ui-port <port>", { description: `Port to serve UI on, 0 for any free port; specifying this option opens UI in a browser tab` }],395  ["-u, --update-snapshots [mode]", { description: `Update snapshots with actual results. Running tests without the flag defaults to "missing"`, choices: ["all", "changed", "missing", "none"], preset: "changed" }],396  ["--update-source-method <method>", { description: `Chooses the way source is updated (default: "patch")`, choices: ["overwrite", "3way", "patch"] }],397  ["-j, --workers <workers>", { description: `Number of concurrent workers or percentage of logical CPU cores, use 1 to run in a single worker (default: 50%)` }],398  ["-x", { description: `Stop after the first failure` }]399];400addTestCommand(import_program.program);401addShowReportCommand(import_program.program);402addMergeReportsCommand(import_program.program);403addClearCacheCommand(import_program.program);404addBrowserMCPServerCommand(import_program.program);405addTestMCPServerCommand(import_program.program);406addDevServerCommand(import_program.program);407addTestServerCommand(import_program.program);408addInitAgentsCommand(import_program.program);409// Annotate the CommonJS export names for ESM import in node:4100 && (module.exports = {411  program412});413