// npm 패키지
@antv/ava
A framework for automated visual analytics.
주간
1,334
월간
3,789
버전
44
메인테이너
51
라이선스
MIT
최초 publish
2022-11-20
publisher
leondt1
tarball
2,463,858 B
AUTO-PUBLISHED·1개 버전 인덱싱됨·최근 publish: 2025-12-04
// offending code· @3.6.0-alpha.0· 3 files flagged
llm: benign · 0.85→ 의심 전송지 없음, 원격 실행 형태 없음 — 2 known-vendor host(s).
- @3.6.0-alpha.0··AUTO-PUBLISHED·publisher: leondt1heuristic 75/100static flags 2llm benign (0.85) via ollamarecent-owner-changepopularity:highmature-packageosv-flagged:MAL-2026-3853reads-env-varschild-process-spawn
→ 의심 전송지 없음, 원격 실행 형태 없음 — 2 known-vendor host(s).
// offending code· 3 files flaggedpatterns: 2
--- package/lib/utils/common.js (excerpt) --- "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.metasToMap = exports.safeJsonParse = exports.sleep = exports.logError = exports.logInDev = void 0; exports.sign = sign; exports.unique = unique; exports.rank = rank; exports.assert = assert; exports.range = range; exports.nOnes = nOnes; exports.nZeros = nZeros; exports.isParentChild = isParentChild; exports.ascending = ascending; exports.descending = descending; const lodash_1 = require("lodash"); const isType_1 = require("./isType"); /** * Returns the sign of the x, indicating whether x is positive, negative or zero. */ function sign(value) { return Math.sign(value); } /** * Returns the unique elements in the array and their counts. */ function unique(arr) { const sorted = arr.slice().sort(); const uniqArr = [sorted[0]]; const countArr = [1]; for (let i = 1; i < sorted.length; i += 1) { if (sorted[i] !== uniqArr[uniqArr.length - 1]) { uniqArr.push(sorted[i]); countArr.push(1); } else { countArr[countArr.length - 1] += 1; } } return [uniqArr, countArr]; } /** * Returns the rank of each element in the array. */ function rank(arr) { const sorted = arr.slice().sort(); const rank = []; for (let i = 0; i < arr.length; i += 1) { const value = arr[i]; const firstRank = sorted.indexOf(value) + 1; const lastRank = (0, lodash_1.lastIndexOf)(sorted, value) + 1; --- package/lib/utils/statistics/bayesian.js (excerpt) --- "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.bayesian = bayesian; const tslib_1 = require("tslib"); const bayesian_changepoint_1 = tslib_1.__importDefault(require("bayesian-changepoint")); const pettitt_test_1 = require("./pettitt-test"); function breakpointVerifier(next, prev) { if (Math.abs(next.data - prev.data) >= 1) { return true; } return false; } /** * Bayesian Online Changepoint Detection */ function bayesian(series = []) { const detection = new bayesian_changepoint_1.default({ breakpointVerifier, chunkSize: series.length, iteratee: (t) => t, }); detection.exec(series); const result = detection.breakPoints().map((breakPoint) => ({ index: breakPoint.index, significance: 1 - (0, pettitt_test_1.calcPValue)(series, breakPoint.index), })); return result; } //# sourceMappingURL=bayesian.js.map --- package/lib/ntv/generate/utils.js (excerpt) --- "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getByPath = getByPath; exports.templateStr2Structure = templateStr2Structure; exports.formattedAsArray = formattedAsArray; exports.getScopeVariableArray = getScopeVariableArray; exports.getAssessment = getAssessment; exports.getFormattedNumberValue = getFormattedNumberValue; exports.getDisplayValue = getDisplayValue; const lodash_1 = require("lodash"); const utils_1 = require("../../utils"); /** * simple path system * if starts with '.', it's relative path * // TODO 支持相对路径找到上级 * if starts with '..', it's can get prev level variable * otherwise, it's absolute path */ function getByPath(globalVar, scopeVar, path) { if (!path) return scopeVar; if ((0, lodash_1.startsWith)(path, '.')) return (0, lodash_1.get)(scopeVar, path.slice(1)); return (0, lodash_1.get)(globalVar, path); } /** * parse template string * Use $ for variable * Use & for template * @example 'aaa ${key} &{temp1}' * => [{ type: 'text', value: 'aaa ' }, { type: 'variable', value: 'key' }, { type: 'template', value: 'temp1' }] */ function templateStr2Structure(templateStr) { // eslint-disable-next-line no-useless-escape const splitReg = /([\$|&]{.*?})/; const varReg = /\${(.*?)}/; const tempReg = /&{(.*?)}/; return templateStr .split(splitReg) .filter((str) => str) .map((str) => { var _a, _b; const templateId = (_a = tempReg.ex --- bundled output (OSV-MAL flagged — LLM scope expansion) --- --- lib/prompt/chart-advise.js (bundled) --- "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.adviseChartByInputPrompt = exports.adviseChartByDataShardPrompt = void 0; const ckb_1 = require("../ckb"); /** * 生成基于数据分片推荐图标的prompt */ const adviseChartByDataShardPrompt = (params, allowedChartIds) => { const chartIds = Array.isArray(allowedChartIds) && allowedChartIds.length > 0 ? allowedChartIds : Object.keys(ckb_1.CHARTS); const chartDescriptions = Object.entries(ckb_1.CHARTS) .map(([chartId, item]) => { return `${chartId}: ${item.description}`; }) .join('\n\n'); return ` # Role You are a chart recommendation and configuration generation expert, capable of selecting the most suitable chart type from the given Chart Knowledge Base based on data and requirements. # Objective Output the “best chart type (chartId)” with the rationale for selection, and provide 1–2 alternative chart types with reasons why they are not chosen as the primary chart. Only choose types from the provided Chart Knowledge Base. # Inputs - data: raw data (array) used to draw charts. - meta: field metadata (array), each item includes id, name, dataType (number/string/date/geo), unit (string, optional; data unit such as %, °C, 元, 件, 人, 小时)。 - purpose: visualization intent (a sentence or several bullet points). - Chart Knowledge Base: the collection of knowledge definitions for all available charts (including chart names, usage descriptions, etc.). - Batch input support: The input may be an array containing multiple items, each with data, meta, and purpose. When the input is an array, you must make a recommendation for each item independently and output results in the same order as the input. # Output - chartIdsList: a two-dimensional array. Each item is a string array whose elements are chartId (from the provided CKB list), ordered from best to worst match, up to 3 items. - If candidates are fewer than 3, output the actual number; do not exceed 3. - When the input is --- lib/prompt/spec-generate.js (bundled) --- "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.genSpecByInputPrompt = exports.genSpecByDataShardPrompt = void 0; const ckb_1 = require("../ckb"); /** * 基于数据分片生成图表配置的prompt */ const genSpecByDataShardPrompt = (params) => { const inputSchema = params .map((item) => { return `ChartId: ${item.chartId}\nInputSchema: ${JSON.stringify(ckb_1.CHARTS[item.chartId].inputSchema)}`; }) .join('\n\n'); return ` # Role - You are a chart configuration generator. Given a chartId and raw data, output a chart configuration object that strictly conforms to the chart’s inputSchema defined under Chart InputSchema. # Objective - Produce a valid configuration for the requested chart type by normalizing input fields, filling defaults, and validating against the corresponding JSON Schema. Do not invent keys or alter data semantics. # Inputs - Supports single or batch input. - Single: provide chartId and data. - Batch: provide an array of items, each item is { chartId, data }, e.g., [ { chartId: "line", data: [...] }, { chartId: "area", data: [...] } ]. - Fields: - chartId: a chart type identifier, e.g., line, area, bar, pie, scatter, etc. - data: raw data records (array) provided by the user. - meta: field meta info, e.g., unit, format, etc. # Strict Rules - Use only properties allowed by the chart’s inputSchema; do not output extra keys. - Respect types and required fields; ensure all required keys exist. - Apply schema defaults if a property is optional and has a default (theme, style.texture, width, height). - Do not modify numeric values other than parsing strings to numbers when necessary. Do not aggregate unless explicitly required by schema. - Output must be a JSON array of configuration objects. No prose, no code fences, no extra commentary. # Batch Handling - When the input is an array, treat each item independently based on its chartId and data. - Do not share, merge, or infer fields across ite
