neurarch 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +98 -11
- package/bin/gate.mjs +259 -0
- package/bin/neurarch.mjs +19 -9
- package/bin/scan.mjs +202 -13
- package/bin/templateCheck.mjs +5 -2
- package/engine.bundle.mjs +28 -7
- package/package.json +11 -3
- package/policy.bundle.mjs +962 -45
package/policy.bundle.mjs
CHANGED
|
@@ -1972,7 +1972,7 @@ function stringifyFlowCollection({ items }, ctx, { flowChars, itemIndent }) {
|
|
|
1972
1972
|
str += ",";
|
|
1973
1973
|
} else if (ctx.options.trailingComma) {
|
|
1974
1974
|
if (ctx.options.lineWidth > 0) {
|
|
1975
|
-
reqNewline || (reqNewline = lines.reduce((
|
|
1975
|
+
reqNewline || (reqNewline = lines.reduce((sum2, line) => sum2 + line.length + 2, 2) + (str.length + 2) > ctx.options.lineWidth);
|
|
1976
1976
|
}
|
|
1977
1977
|
if (reqNewline) {
|
|
1978
1978
|
str += ",";
|
|
@@ -1988,7 +1988,7 @@ function stringifyFlowCollection({ items }, ctx, { flowChars, itemIndent }) {
|
|
|
1988
1988
|
return start + end;
|
|
1989
1989
|
} else {
|
|
1990
1990
|
if (!reqNewline) {
|
|
1991
|
-
const len = lines.reduce((
|
|
1991
|
+
const len = lines.reduce((sum2, line) => sum2 + line.length + 2, 2);
|
|
1992
1992
|
reqNewline = ctx.options.lineWidth > 0 && len > ctx.options.lineWidth;
|
|
1993
1993
|
}
|
|
1994
1994
|
if (reqNewline) {
|
|
@@ -5320,9 +5320,9 @@ var Lexer = class {
|
|
|
5320
5320
|
}
|
|
5321
5321
|
}
|
|
5322
5322
|
*parseQuotedScalar() {
|
|
5323
|
-
const
|
|
5324
|
-
let end = this.buffer.indexOf(
|
|
5325
|
-
if (
|
|
5323
|
+
const quote2 = this.charAt(0);
|
|
5324
|
+
let end = this.buffer.indexOf(quote2, this.pos + 1);
|
|
5325
|
+
if (quote2 === "'") {
|
|
5326
5326
|
while (end !== -1 && this.buffer[end + 1] === "'")
|
|
5327
5327
|
end = this.buffer.indexOf("'", end + 2);
|
|
5328
5328
|
} else {
|
|
@@ -5801,8 +5801,8 @@ var Parser = class {
|
|
|
5801
5801
|
return st;
|
|
5802
5802
|
}
|
|
5803
5803
|
*step() {
|
|
5804
|
-
const
|
|
5805
|
-
if (this.type === "doc-end" &&
|
|
5804
|
+
const top2 = this.peek(1);
|
|
5805
|
+
if (this.type === "doc-end" && top2?.type !== "doc-end") {
|
|
5806
5806
|
while (this.stack.length > 0)
|
|
5807
5807
|
yield* this.pop();
|
|
5808
5808
|
this.stack.push({
|
|
@@ -5812,26 +5812,26 @@ var Parser = class {
|
|
|
5812
5812
|
});
|
|
5813
5813
|
return;
|
|
5814
5814
|
}
|
|
5815
|
-
if (!
|
|
5815
|
+
if (!top2)
|
|
5816
5816
|
return yield* this.stream();
|
|
5817
|
-
switch (
|
|
5817
|
+
switch (top2.type) {
|
|
5818
5818
|
case "document":
|
|
5819
|
-
return yield* this.document(
|
|
5819
|
+
return yield* this.document(top2);
|
|
5820
5820
|
case "alias":
|
|
5821
5821
|
case "scalar":
|
|
5822
5822
|
case "single-quoted-scalar":
|
|
5823
5823
|
case "double-quoted-scalar":
|
|
5824
|
-
return yield* this.scalar(
|
|
5824
|
+
return yield* this.scalar(top2);
|
|
5825
5825
|
case "block-scalar":
|
|
5826
|
-
return yield* this.blockScalar(
|
|
5826
|
+
return yield* this.blockScalar(top2);
|
|
5827
5827
|
case "block-map":
|
|
5828
|
-
return yield* this.blockMap(
|
|
5828
|
+
return yield* this.blockMap(top2);
|
|
5829
5829
|
case "block-seq":
|
|
5830
|
-
return yield* this.blockSequence(
|
|
5830
|
+
return yield* this.blockSequence(top2);
|
|
5831
5831
|
case "flow-collection":
|
|
5832
|
-
return yield* this.flowCollection(
|
|
5832
|
+
return yield* this.flowCollection(top2);
|
|
5833
5833
|
case "doc-end":
|
|
5834
|
-
return yield* this.documentEnd(
|
|
5834
|
+
return yield* this.documentEnd(top2);
|
|
5835
5835
|
}
|
|
5836
5836
|
yield* this.pop();
|
|
5837
5837
|
}
|
|
@@ -5846,25 +5846,25 @@ var Parser = class {
|
|
|
5846
5846
|
} else if (this.stack.length === 0) {
|
|
5847
5847
|
yield token;
|
|
5848
5848
|
} else {
|
|
5849
|
-
const
|
|
5849
|
+
const top2 = this.peek(1);
|
|
5850
5850
|
if (token.type === "block-scalar") {
|
|
5851
|
-
token.indent = "indent" in
|
|
5852
|
-
} else if (token.type === "flow-collection" &&
|
|
5851
|
+
token.indent = "indent" in top2 ? top2.indent : 0;
|
|
5852
|
+
} else if (token.type === "flow-collection" && top2.type === "document") {
|
|
5853
5853
|
token.indent = 0;
|
|
5854
5854
|
}
|
|
5855
5855
|
if (token.type === "flow-collection")
|
|
5856
5856
|
fixFlowSeqItems(token);
|
|
5857
|
-
switch (
|
|
5857
|
+
switch (top2.type) {
|
|
5858
5858
|
case "document":
|
|
5859
|
-
|
|
5859
|
+
top2.value = token;
|
|
5860
5860
|
break;
|
|
5861
5861
|
case "block-scalar":
|
|
5862
|
-
|
|
5862
|
+
top2.props.push(token);
|
|
5863
5863
|
break;
|
|
5864
5864
|
case "block-map": {
|
|
5865
|
-
const it =
|
|
5865
|
+
const it = top2.items[top2.items.length - 1];
|
|
5866
5866
|
if (it.value) {
|
|
5867
|
-
|
|
5867
|
+
top2.items.push({ start: [], key: token, sep: [] });
|
|
5868
5868
|
this.onKeyLine = true;
|
|
5869
5869
|
return;
|
|
5870
5870
|
} else if (it.sep) {
|
|
@@ -5877,17 +5877,17 @@ var Parser = class {
|
|
|
5877
5877
|
break;
|
|
5878
5878
|
}
|
|
5879
5879
|
case "block-seq": {
|
|
5880
|
-
const it =
|
|
5880
|
+
const it = top2.items[top2.items.length - 1];
|
|
5881
5881
|
if (it.value)
|
|
5882
|
-
|
|
5882
|
+
top2.items.push({ start: [], value: token });
|
|
5883
5883
|
else
|
|
5884
5884
|
it.value = token;
|
|
5885
5885
|
break;
|
|
5886
5886
|
}
|
|
5887
5887
|
case "flow-collection": {
|
|
5888
|
-
const it =
|
|
5888
|
+
const it = top2.items[top2.items.length - 1];
|
|
5889
5889
|
if (!it || it.value)
|
|
5890
|
-
|
|
5890
|
+
top2.items.push({ start: [], key: token, sep: [] });
|
|
5891
5891
|
else if (it.sep)
|
|
5892
5892
|
it.value = token;
|
|
5893
5893
|
else
|
|
@@ -5899,13 +5899,13 @@ var Parser = class {
|
|
|
5899
5899
|
yield* this.pop();
|
|
5900
5900
|
yield* this.pop(token);
|
|
5901
5901
|
}
|
|
5902
|
-
if ((
|
|
5902
|
+
if ((top2.type === "document" || top2.type === "block-map" || top2.type === "block-seq") && (token.type === "block-map" || token.type === "block-seq")) {
|
|
5903
5903
|
const last = token.items[token.items.length - 1];
|
|
5904
5904
|
if (last && !last.sep && !last.value && last.start.length > 0 && findNonEmptyIndex(last.start) === -1 && (token.indent === 0 || last.start.every((st) => st.type !== "comment" || st.indent < token.indent))) {
|
|
5905
|
-
if (
|
|
5906
|
-
|
|
5905
|
+
if (top2.type === "document")
|
|
5906
|
+
top2.end = last.start;
|
|
5907
5907
|
else
|
|
5908
|
-
|
|
5908
|
+
top2.items.push({ start: last.start });
|
|
5909
5909
|
token.items.splice(-1, 1);
|
|
5910
5910
|
}
|
|
5911
5911
|
}
|
|
@@ -6276,11 +6276,11 @@ var Parser = class {
|
|
|
6276
6276
|
*flowCollection(fc) {
|
|
6277
6277
|
const it = fc.items[fc.items.length - 1];
|
|
6278
6278
|
if (this.type === "flow-error-end") {
|
|
6279
|
-
let
|
|
6279
|
+
let top2;
|
|
6280
6280
|
do {
|
|
6281
6281
|
yield* this.pop();
|
|
6282
|
-
|
|
6283
|
-
} while (
|
|
6282
|
+
top2 = this.peek(1);
|
|
6283
|
+
} while (top2?.type === "flow-collection");
|
|
6284
6284
|
} else if (fc.end.length === 0) {
|
|
6285
6285
|
switch (this.type) {
|
|
6286
6286
|
case "comma":
|
|
@@ -7245,6 +7245,37 @@ function pinFileKind(path) {
|
|
|
7245
7245
|
if (/\.(sh|bash|zsh|slurm|sbatch)$/i.test(base) || /^Dockerfile/i.test(base) || /\.dockerfile$/i.test(base)) return "shell";
|
|
7246
7246
|
return null;
|
|
7247
7247
|
}
|
|
7248
|
+
function refFileKind(path) {
|
|
7249
|
+
const base = path.split("/").pop() ?? path;
|
|
7250
|
+
if (base === "adapter_config.json") return "adapter";
|
|
7251
|
+
return pinFileKind(path);
|
|
7252
|
+
}
|
|
7253
|
+
function engineIn(text) {
|
|
7254
|
+
const v = /vllm\/vllm-openai:v?(\d+\.\d+(?:\.\d+)?)/.exec(text) ?? /\bvllm(?:\[[\w,]+\])?==(\d+\.\d+(?:\.\d+)?)/.exec(text) ?? /(?<!lmcache\/)vllm-openai:v?(\d+\.\d+(?:\.\d+)?)/.exec(text) ?? /repository:\s*["']?(?:docker\.io\/)?vllm\/vllm-openai["']?\s*\n\s*tag:\s*["']?v?(\d+\.\d+(?:\.\d+)?)/.exec(text);
|
|
7255
|
+
if (v) return { name: "vllm", version: v[1] };
|
|
7256
|
+
const sg = /lmsysorg\/sglang:v?(\d+\.\d+(?:\.\d+)?)/.exec(text) ?? /\bsglang(?:\[[\w,]+\])?==(\d+\.\d+(?:\.\d+)?)/.exec(text);
|
|
7257
|
+
if (sg) return { name: "sglang", version: sg[1] };
|
|
7258
|
+
if (/\bvllm serve\b|vllm\.entrypoints|vllm\/vllm-openai/.test(text)) return { name: "vllm" };
|
|
7259
|
+
if (/sglang\.launch_server|lmsysorg\/sglang/.test(text)) return { name: "sglang" };
|
|
7260
|
+
return void 0;
|
|
7261
|
+
}
|
|
7262
|
+
function scanAdapterConfig(text, path) {
|
|
7263
|
+
let c;
|
|
7264
|
+
try {
|
|
7265
|
+
c = JSON.parse(text);
|
|
7266
|
+
} catch {
|
|
7267
|
+
return [];
|
|
7268
|
+
}
|
|
7269
|
+
if (!c || typeof c !== "object") return [];
|
|
7270
|
+
const o = c;
|
|
7271
|
+
const base = o.base_model_name_or_path;
|
|
7272
|
+
if (typeof base !== "string" || !base.includes("/") || looksLocal(base) || !HUB_ID.test(base)) return [];
|
|
7273
|
+
const rev = typeof o.revision === "string" && o.revision ? o.revision : void 0;
|
|
7274
|
+
const at = text.search(/"base_model_name_or_path"\s*:/);
|
|
7275
|
+
const line = at < 0 ? 1 : text.slice(0, at).split("\n").length;
|
|
7276
|
+
const pinned = !!rev && /^[0-9a-f]{40}$/.test(rev);
|
|
7277
|
+
return [{ rule: rev ? "pin/hf-floating-revision" : "pin/hf-unpinned", path, line, api: "adapter_config.json", repo: base, repoType: "model", revision: rev, syntax: "json", ...pinned ? { pinned } : {}, edge: "adapter-base" }];
|
|
7278
|
+
}
|
|
7248
7279
|
function pyTokens(src) {
|
|
7249
7280
|
const out = [];
|
|
7250
7281
|
let i = 0;
|
|
@@ -7464,17 +7495,159 @@ function pyStringConstants(toks) {
|
|
|
7464
7495
|
for (const [k, v] of seen) if (v != null) out.set(k, v);
|
|
7465
7496
|
return out;
|
|
7466
7497
|
}
|
|
7498
|
+
function envFallback(toks, k) {
|
|
7499
|
+
let j = k;
|
|
7500
|
+
if (nameOf(toks[j]) === "os" && toks[j + 1]?.t === "op" && toks[j + 1].v === ".") j += 2;
|
|
7501
|
+
if (nameOf(toks[j]) === "environ" && toks[j + 1]?.t === "op" && toks[j + 1].v === "." && nameOf(toks[j + 2]) === "get") j += 2;
|
|
7502
|
+
else if (nameOf(toks[j]) !== "getenv") return void 0;
|
|
7503
|
+
if (toks[j + 1]?.t !== "op" || toks[j + 1].v !== "(") return void 0;
|
|
7504
|
+
const { args, close } = pyArgs(toks, j + 1);
|
|
7505
|
+
const fb = args.length === 2 && !args[1].kw ? literal(args[1]) : literal(args.find((a) => a.kw === "default"));
|
|
7506
|
+
return fb === void 0 ? void 0 : { value: fb, close };
|
|
7507
|
+
}
|
|
7508
|
+
function pyIdSources(toks, starts, consts) {
|
|
7509
|
+
const lineOfTok = (k) => lineAt(starts, toks[k].at);
|
|
7510
|
+
const colOfTok = (k) => toks[k].at - starts[lineOfTok(k) - 1];
|
|
7511
|
+
const scopes = [];
|
|
7512
|
+
for (let k = 0; k + 2 < toks.length; k++) {
|
|
7513
|
+
if (nameOf(toks[k]) !== "def" || toks[k + 1].t !== "name" || toks[k + 2].t !== "op" || toks[k + 2].v !== "(") continue;
|
|
7514
|
+
const { args, close } = pyArgs(toks, k + 2);
|
|
7515
|
+
const params = /* @__PURE__ */ new Map();
|
|
7516
|
+
for (const a of args) {
|
|
7517
|
+
if (a.star) continue;
|
|
7518
|
+
const name = a.kw ?? nameOf(a.toks[0]);
|
|
7519
|
+
if (!name) continue;
|
|
7520
|
+
let value = a.kw ? a : void 0;
|
|
7521
|
+
if (!a.kw) {
|
|
7522
|
+
let depth3 = 0;
|
|
7523
|
+
let eq = -1;
|
|
7524
|
+
a.toks.forEach((t, i) => {
|
|
7525
|
+
if (t.t !== "op") return;
|
|
7526
|
+
if ("([{".includes(t.v)) depth3++;
|
|
7527
|
+
else if (")]}".includes(t.v)) depth3--;
|
|
7528
|
+
else if (t.v === "=" && depth3 === 0) eq = i;
|
|
7529
|
+
});
|
|
7530
|
+
if (eq > 0) value = { toks: a.toks.slice(eq + 1) };
|
|
7531
|
+
}
|
|
7532
|
+
params.set(name, literal(value) ?? null);
|
|
7533
|
+
}
|
|
7534
|
+
const col = colOfTok(k);
|
|
7535
|
+
let to = toks.length;
|
|
7536
|
+
let depth2 = 0;
|
|
7537
|
+
for (let j = close + 1; j < toks.length; j++) {
|
|
7538
|
+
const t = toks[j];
|
|
7539
|
+
if (t.t === "op" && "([{".includes(t.v)) depth2++;
|
|
7540
|
+
else if (t.t === "op" && ")]}".includes(t.v)) depth2 = Math.max(0, depth2 - 1);
|
|
7541
|
+
else if (depth2 === 0 && lineOfTok(j) !== lineOfTok(j - 1) && lineOfTok(j) > lineOfTok(close) && colOfTok(j) <= col) {
|
|
7542
|
+
to = j;
|
|
7543
|
+
break;
|
|
7544
|
+
}
|
|
7545
|
+
}
|
|
7546
|
+
scopes.push({ from: close, to, params });
|
|
7547
|
+
}
|
|
7548
|
+
const paramDefault = (name, at) => {
|
|
7549
|
+
let best;
|
|
7550
|
+
for (const s of scopes) if (at > s.from && at < s.to && s.params.has(name) && (!best || s.from > best.from)) best = s;
|
|
7551
|
+
return best?.params.get(name) ?? void 0;
|
|
7552
|
+
};
|
|
7553
|
+
const argDefaults = /* @__PURE__ */ new Map();
|
|
7554
|
+
const setArg = (dest, v) => argDefaults.set(dest, argDefaults.has(dest) && argDefaults.get(dest) !== v ? null : v);
|
|
7555
|
+
for (let k = 1; k + 1 < toks.length; k++) {
|
|
7556
|
+
const n = nameOf(toks[k]);
|
|
7557
|
+
if (n !== "add_argument" && n !== "set_defaults" || toks[k - 1].t !== "op" || toks[k - 1].v !== "." || toks[k + 1].t !== "op" || toks[k + 1].v !== "(") continue;
|
|
7558
|
+
const { args } = pyArgs(toks, k + 1);
|
|
7559
|
+
if (n === "set_defaults") {
|
|
7560
|
+
for (const a of args) {
|
|
7561
|
+
const v = a.kw ? literal(a) : void 0;
|
|
7562
|
+
if (a.kw && v !== void 0) setArg(a.kw, v);
|
|
7563
|
+
}
|
|
7564
|
+
continue;
|
|
7565
|
+
}
|
|
7566
|
+
const dflt = literal(args.find((a) => a.kw === "default"));
|
|
7567
|
+
if (dflt === void 0) continue;
|
|
7568
|
+
const flags = args.filter((a) => !a.kw && !a.star).map((a) => literal(a)).filter((x) => x !== void 0);
|
|
7569
|
+
const dest = literal(args.find((a) => a.kw === "dest")) ?? (flags.find((f) => f.startsWith("--")) ?? flags.find((f) => !f.startsWith("-")))?.replace(/^--/, "").replace(/-/g, "_");
|
|
7570
|
+
if (dest) setArg(dest, dflt);
|
|
7571
|
+
}
|
|
7572
|
+
const envConsts = /* @__PURE__ */ new Map();
|
|
7573
|
+
const attrs = /* @__PURE__ */ new Map();
|
|
7574
|
+
let depth = 0;
|
|
7575
|
+
for (let k = 0; k < toks.length; k++) {
|
|
7576
|
+
const t = toks[k];
|
|
7577
|
+
if (t.t === "op" && "([{".includes(t.v)) depth++;
|
|
7578
|
+
else if (t.t === "op" && ")]}".includes(t.v)) depth = Math.max(0, depth - 1);
|
|
7579
|
+
if (depth || t.t !== "name") continue;
|
|
7580
|
+
const eqAt = toks[k + 1]?.t === "op" && toks[k + 1].v === "=" ? k + 1 : -1;
|
|
7581
|
+
if (eqAt < 0) continue;
|
|
7582
|
+
const isAttr = k >= 2 && toks[k - 1].t === "op" && toks[k - 1].v === "." && (nameOf(toks[k - 2]) === "self" || nameOf(toks[k - 2]) === "cls") && !(toks[k - 3]?.t === "op" && toks[k - 3].v === ".");
|
|
7583
|
+
if (k > 0 && toks[k - 1].t === "op" && toks[k - 1].v === "." && !isAttr) continue;
|
|
7584
|
+
const v = toks[eqAt + 1];
|
|
7585
|
+
if (!v) continue;
|
|
7586
|
+
const env = envFallback(toks, eqAt + 1);
|
|
7587
|
+
const endsAt = env ? env.close : eqAt + 1;
|
|
7588
|
+
const after = toks[endsAt + 1];
|
|
7589
|
+
const alone = !after || lineOfTok(endsAt + 1) !== lineOfTok(endsAt);
|
|
7590
|
+
let r = null;
|
|
7591
|
+
if (alone && env) r = { value: env.value, via: "default" };
|
|
7592
|
+
else if (alone && v.t === "str" && v.v != null) r = { value: v.v, via: "variable" };
|
|
7593
|
+
else if (alone && v.t === "name" && isAttr) {
|
|
7594
|
+
const d = paramDefault(v.v, k);
|
|
7595
|
+
const c = d === void 0 ? consts.get(v.v) : void 0;
|
|
7596
|
+
r = d !== void 0 ? { value: d, via: "default" } : c !== void 0 ? { value: c, via: "variable" } : null;
|
|
7597
|
+
}
|
|
7598
|
+
if (isAttr) attrs.set(t.v, attrs.has(t.v) && attrs.get(t.v)?.value !== r?.value ? null : r);
|
|
7599
|
+
else if (env) envConsts.set(t.v, envConsts.has(t.v) && envConsts.get(t.v) !== (alone ? env.value : null) ? null : alone ? env.value : null);
|
|
7600
|
+
}
|
|
7601
|
+
return (a, at) => {
|
|
7602
|
+
if (!a || !a.toks.length) return void 0;
|
|
7603
|
+
const ts = a.toks;
|
|
7604
|
+
const isOp = (t, v) => t?.t === "op" && t.v === v;
|
|
7605
|
+
if (ts.length === 1 && ts[0].t === "name") {
|
|
7606
|
+
const d = paramDefault(ts[0].v, at);
|
|
7607
|
+
if (d !== void 0) return { value: d, via: "default" };
|
|
7608
|
+
const e = envConsts.get(ts[0].v);
|
|
7609
|
+
if (e != null && !consts.has(ts[0].v)) return { value: e, via: "default" };
|
|
7610
|
+
const c = consts.get(ts[0].v);
|
|
7611
|
+
return c === void 0 ? void 0 : { value: c, via: "variable" };
|
|
7612
|
+
}
|
|
7613
|
+
if (ts.length === 3 && ts[0].t === "name" && isOp(ts[1], ".") && ts[2].t === "name") {
|
|
7614
|
+
if (ts[0].v === "self" || ts[0].v === "cls") {
|
|
7615
|
+
const r = attrs.get(ts[2].v);
|
|
7616
|
+
if (r) return r;
|
|
7617
|
+
const c = attrs.has(ts[2].v) ? void 0 : consts.get(ts[2].v);
|
|
7618
|
+
return c === void 0 ? void 0 : { value: c, via: "variable" };
|
|
7619
|
+
}
|
|
7620
|
+
const d = argDefaults.get(ts[2].v);
|
|
7621
|
+
return d == null ? void 0 : { value: d, via: "default" };
|
|
7622
|
+
}
|
|
7623
|
+
const last = ts[ts.length - 1];
|
|
7624
|
+
if (last.t === "str" && last.v != null && (ts.length === 3 && ts[0].t === "name" && nameOf(ts[1]) === "or" || ts.length === 5 && ts[0].t === "name" && nameOf(ts[1]) === "if" && nameOf(ts[3]) === "else")) return { value: last.v, via: "default" };
|
|
7625
|
+
const env = envFallback(ts, 0);
|
|
7626
|
+
if (env && env.close === ts.length - 1) return { value: env.value, via: "default" };
|
|
7627
|
+
return void 0;
|
|
7628
|
+
};
|
|
7629
|
+
}
|
|
7630
|
+
var WRAPPER_CALLS = {
|
|
7631
|
+
HuggingFaceEmbedding: { repoKw: ["model_name"], repoPos: 0 },
|
|
7632
|
+
// llama_index
|
|
7633
|
+
HuggingFaceEmbeddings: { repoKw: ["model_name"], repoPos: -1 },
|
|
7634
|
+
// langchain: keyword only
|
|
7635
|
+
HuggingFaceBgeEmbeddings: { repoKw: ["model_name"], repoPos: -1 }
|
|
7636
|
+
};
|
|
7637
|
+
var WRAPPER_MODULES = ["llama_index", "langchain", "langchain_huggingface", "langchain_community"];
|
|
7638
|
+
var isWrapperOrigin = (origin) => !!origin && WRAPPER_MODULES.includes(origin.split(".")[0]);
|
|
7467
7639
|
var RECORD_NAME_KWS = ["name", "model", "model_name", "model_id", "repo_id", "hf_model_id", "model_name_or_path"];
|
|
7468
7640
|
function scanPython(src, path, lineOf = (l) => l) {
|
|
7469
7641
|
const toks = pyTokens(src);
|
|
7470
7642
|
const imports = pyImports(toks);
|
|
7471
|
-
const hfImported = [...imports.values()].some(isHfOrigin);
|
|
7643
|
+
const hfImported = [...imports.values()].some(isHfOrigin) || KEEP_PINNED && [...imports.values()].some(isWrapperOrigin);
|
|
7472
7644
|
if (!hfImported && !KEEP_PINNED) return [];
|
|
7473
7645
|
const starts = lineStarts(src);
|
|
7474
7646
|
const lines = src.split("\n");
|
|
7475
7647
|
const hits = [];
|
|
7476
7648
|
const consts = KEEP_PINNED ? pyStringConstants(toks) : /* @__PURE__ */ new Map();
|
|
7477
7649
|
const named = (a) => a && a.toks.length === 1 && a.toks[0].t === "name" ? consts.get(a.toks[0].v) : void 0;
|
|
7650
|
+
const idSource = KEEP_PINNED ? pyIdSources(toks, starts, consts) : void 0;
|
|
7478
7651
|
const callSpan = (k, close) => [lineAt(starts, toks[k].at), lineAt(starts, toks[close]?.at ?? toks[k].at)];
|
|
7479
7652
|
if (KEEP_PINNED) {
|
|
7480
7653
|
for (let k = 0; k < toks.length; k++) {
|
|
@@ -7494,12 +7667,63 @@ function scanPython(src, path, lineOf = (l) => l) {
|
|
|
7494
7667
|
hits.push({ rule: "pin/hf-floating-revision", path, line: lineOf(first), api: t.v, repo, repoType: "model", revision: rev, syntax: "python", pinned: true, via: "record", ...lines.slice(first - 1, last).some((l) => /code_revision/.test(l)) ? { codeRevision: true } : {} });
|
|
7495
7668
|
}
|
|
7496
7669
|
}
|
|
7670
|
+
if (KEEP_PINNED) {
|
|
7671
|
+
for (let k = 0; k < toks.length; k++) {
|
|
7672
|
+
if (toks[k].t !== "op" || toks[k].v !== "{") continue;
|
|
7673
|
+
let depth = 1;
|
|
7674
|
+
let owner;
|
|
7675
|
+
let nest = 0;
|
|
7676
|
+
for (let b = k - 1; b >= 0 && b >= k - 20; b--) {
|
|
7677
|
+
const x = toks[b];
|
|
7678
|
+
if (x.t === "op" && (x.v === "]" || x.v === ")")) {
|
|
7679
|
+
nest++;
|
|
7680
|
+
continue;
|
|
7681
|
+
}
|
|
7682
|
+
if (x.t === "op" && (x.v === "[" || x.v === "(")) {
|
|
7683
|
+
if (nest > 0) {
|
|
7684
|
+
nest--;
|
|
7685
|
+
continue;
|
|
7686
|
+
}
|
|
7687
|
+
break;
|
|
7688
|
+
}
|
|
7689
|
+
if (nest > 0) continue;
|
|
7690
|
+
if (x.t === "op" && (x.v === "," || x.v === "{")) break;
|
|
7691
|
+
if (x.t === "name" && toks[b + 1]?.t === "op" && (toks[b + 1].v === "=" || toks[b + 1].v === ":") && (b === 0 || lineAt(starts, toks[b - 1].at) !== lineAt(starts, x.at))) {
|
|
7692
|
+
owner = x.v;
|
|
7693
|
+
break;
|
|
7694
|
+
}
|
|
7695
|
+
}
|
|
7696
|
+
for (let j = k + 1; j < toks.length && depth > 0; j++) {
|
|
7697
|
+
const x = toks[j];
|
|
7698
|
+
if (x.t === "op" && (x.v === "{" || x.v === "[" || x.v === "(")) {
|
|
7699
|
+
depth++;
|
|
7700
|
+
continue;
|
|
7701
|
+
}
|
|
7702
|
+
if (x.t === "op" && (x.v === "}" || x.v === "]" || x.v === ")")) {
|
|
7703
|
+
depth--;
|
|
7704
|
+
continue;
|
|
7705
|
+
}
|
|
7706
|
+
if (depth !== 1 || x.t !== "str" || x.v == null) continue;
|
|
7707
|
+
const colon = toks[j + 1];
|
|
7708
|
+
const val = toks[j + 2];
|
|
7709
|
+
const after = toks[j + 3];
|
|
7710
|
+
if (colon?.t !== "op" || colon.v !== ":" || val?.t !== "str" || val.v == null) continue;
|
|
7711
|
+
if (after && !(after.t === "op" && (after.v === "," || after.v === "}"))) continue;
|
|
7712
|
+
if (!/^[0-9a-f]{40}$/.test(val.v) || !x.v.includes("/") || looksLocal(x.v) || !HUB_ID.test(x.v)) continue;
|
|
7713
|
+
const ln = lineAt(starts, x.at);
|
|
7714
|
+
if (NOSEC.test(lines[ln - 1] ?? "")) continue;
|
|
7715
|
+
hits.push({ rule: "pin/hf-floating-revision", path, line: lineOf(ln), api: owner ?? "pin table", repo: x.v, repoType: "model", revision: val.v, syntax: "python", pinned: true, via: "record" });
|
|
7716
|
+
}
|
|
7717
|
+
}
|
|
7718
|
+
}
|
|
7497
7719
|
if (!hfImported) return hits;
|
|
7498
7720
|
for (let k = 0; k < toks.length; k++) {
|
|
7499
7721
|
const t = toks[k];
|
|
7500
|
-
if (t.t !== "name"
|
|
7722
|
+
if (t.t !== "name") continue;
|
|
7723
|
+
const wrapper = KEEP_PINNED && !CALLS[t.v] ? WRAPPER_CALLS[t.v] : void 0;
|
|
7724
|
+
if (!CALLS[t.v] && !wrapper || toks[k + 1]?.t !== "op" || toks[k + 1].v !== "(") continue;
|
|
7501
7725
|
if (k > 0 && toks[k - 1].t === "name" && toks[k - 1].v === "def") continue;
|
|
7502
|
-
const spec = CALLS[t.v];
|
|
7726
|
+
const spec = wrapper ? { ...wrapper, repoType: "model" } : CALLS[t.v];
|
|
7503
7727
|
const chain = [t.v];
|
|
7504
7728
|
let r = k - 1;
|
|
7505
7729
|
while (r >= 1 && toks[r].t === "op" && toks[r].v === "." && nameOf(toks[r - 1]) !== void 0) {
|
|
@@ -7509,7 +7733,7 @@ function scanPython(src, path, lineOf = (l) => l) {
|
|
|
7509
7733
|
if (r >= 0 && toks[r].t === "op" && toks[r].v === ".") continue;
|
|
7510
7734
|
const root = chain[0];
|
|
7511
7735
|
const origin = imports.get(root);
|
|
7512
|
-
const resolvesHf = isHfOrigin(origin);
|
|
7736
|
+
const resolvesHf = wrapper ? isWrapperOrigin(origin) : isHfOrigin(origin);
|
|
7513
7737
|
if (chain.length === 1 && !resolvesHf) continue;
|
|
7514
7738
|
if (t.v === "pipeline" && !(origin ?? "").startsWith("transformers")) continue;
|
|
7515
7739
|
const { args, close } = pyArgs(toks, k + 1);
|
|
@@ -7519,7 +7743,13 @@ function scanPython(src, path, lineOf = (l) => l) {
|
|
|
7519
7743
|
const kw = (name) => args.find((a) => a.kw === name);
|
|
7520
7744
|
if (args.some((a) => a.star === "**")) continue;
|
|
7521
7745
|
if (isTrue(kw("local_files_only"))) continue;
|
|
7522
|
-
|
|
7746
|
+
let revArg = kw("revision") ?? kw("commit_id");
|
|
7747
|
+
if (wrapper && !revArg) {
|
|
7748
|
+
const mk = kw("model_kwargs");
|
|
7749
|
+
const at = mk ? mk.toks.findIndex((x, i) => x.t === "str" && x.v === "revision" && mk.toks[i + 1]?.t === "op" && mk.toks[i + 1].v === ":") : -1;
|
|
7750
|
+
if (mk && at >= 0) revArg = { toks: [mk.toks[at + 2]].filter(Boolean) };
|
|
7751
|
+
else if (mk && !(mk.toks[0]?.t === "op" && mk.toks[0].v === "{") && /['"]revision['"]/.test(src)) continue;
|
|
7752
|
+
}
|
|
7523
7753
|
let revision;
|
|
7524
7754
|
let via;
|
|
7525
7755
|
if (revArg) {
|
|
@@ -7535,8 +7765,22 @@ function scanPython(src, path, lineOf = (l) => l) {
|
|
|
7535
7765
|
const repoArg = (peft ? kw("model_id") : spec.repoKw.map(kw).find(Boolean)) ?? positional[peft ? 1 : spec.repoPos];
|
|
7536
7766
|
if (!repoArg) continue;
|
|
7537
7767
|
let repo = literal(repoArg);
|
|
7538
|
-
if (repo === void 0
|
|
7768
|
+
if (repo === void 0) {
|
|
7769
|
+
const r2 = idSource ? idSource(repoArg, k) : void 0;
|
|
7770
|
+
if (r2) {
|
|
7771
|
+
repo = r2.value;
|
|
7772
|
+
via = r2.via;
|
|
7773
|
+
}
|
|
7774
|
+
}
|
|
7539
7775
|
const api = chain.join(".");
|
|
7776
|
+
let trust;
|
|
7777
|
+
if (KEEP_PINNED && t.v !== "hf_hub_download" && t.v !== "snapshot_download") {
|
|
7778
|
+
const tk = kw("trust_remote_code");
|
|
7779
|
+
const mk = wrapper ? kw("model_kwargs") : void 0;
|
|
7780
|
+
if (tk) trust = !(tk.toks.length === 1 && tk.toks[0].t === "name" && tk.toks[0].v === "False");
|
|
7781
|
+
else if (mk) trust = mk.toks[0]?.t === "op" && mk.toks[0].v === "{" ? mk.toks.some((x) => x.t === "str" && x.v === "trust_remote_code") : void 0;
|
|
7782
|
+
else trust = false;
|
|
7783
|
+
}
|
|
7540
7784
|
const repoType = spec.repoType === "dataset" || kw("repo_type") && literal(kw("repo_type")) === "dataset" ? "dataset" : "model";
|
|
7541
7785
|
const line = lineOf(firstLine);
|
|
7542
7786
|
if (repo === void 0) {
|
|
@@ -7548,7 +7792,7 @@ function scanPython(src, path, lineOf = (l) => l) {
|
|
|
7548
7792
|
}
|
|
7549
7793
|
if (looksLocal(repo) || !HUB_ID.test(repo)) continue;
|
|
7550
7794
|
if (t.v === "load_dataset" && BUILDERS.has(repo)) continue;
|
|
7551
|
-
hits.push({ rule: revision ? "pin/hf-floating-revision" : "pin/hf-unpinned", path, line, api, repo, repoType, revision, syntax: "python", ...pinned ? { pinned } : {}, ...via ? { via } : {}, ...KEEP_PINNED && (kw("code_revision") || lines.slice(firstLine - 1, lastLine).some((l) => /code_revision/.test(l))) ? { codeRevision: true } : {} });
|
|
7795
|
+
hits.push({ rule: revision ? "pin/hf-floating-revision" : "pin/hf-unpinned", path, line, api, repo, repoType, revision, syntax: "python", ...pinned ? { pinned } : {}, ...via ? { via } : {}, ...wrapper ? { wrapper: true } : {}, ...KEEP_PINNED && peft ? { adapter: true } : {}, ...trust !== void 0 ? { trustRemoteCode: trust } : {}, ...KEEP_PINNED && (kw("code_revision") || lines.slice(firstLine - 1, lastLine).some((l) => /code_revision/.test(l))) ? { codeRevision: true } : {} });
|
|
7552
7796
|
}
|
|
7553
7797
|
return hits;
|
|
7554
7798
|
}
|
|
@@ -7651,6 +7895,14 @@ function flagValue(words, names) {
|
|
|
7651
7895
|
}
|
|
7652
7896
|
return { present: false };
|
|
7653
7897
|
}
|
|
7898
|
+
function flagValues(words, name) {
|
|
7899
|
+
const out = [];
|
|
7900
|
+
for (let i = 0; i < words.length; i++) {
|
|
7901
|
+
if (words[i].startsWith(`${name}=`)) out.push(words[i].slice(name.length + 1));
|
|
7902
|
+
else if (words[i] === name) for (let j = i + 1; j < words.length && !words[j].startsWith("--"); j++) out.push(words[j]);
|
|
7903
|
+
}
|
|
7904
|
+
return out;
|
|
7905
|
+
}
|
|
7654
7906
|
function launchOf(words) {
|
|
7655
7907
|
for (let i = 0; i < words.length; i++) {
|
|
7656
7908
|
const w = words[i];
|
|
@@ -7679,6 +7931,23 @@ function scanShell(src, path, lineOf = (l) => l) {
|
|
|
7679
7931
|
if (/#\s*nosec\b/.test(ll.raw)) continue;
|
|
7680
7932
|
for (const words of shellCommands(ll.text)) {
|
|
7681
7933
|
const L = launchOf(words);
|
|
7934
|
+
if (KEEP_PINNED && L && L.repoType === "model" && !L.api.endsWith("download")) {
|
|
7935
|
+
const served = L.model && !L.model.startsWith("$") && !looksLocal(L.model) && HUB_ID.test(L.model) ? L.model : void 0;
|
|
7936
|
+
for (const flag of ["--lora-modules", "--lora-paths"]) {
|
|
7937
|
+
for (const v of flagValues(L.rest, flag)) {
|
|
7938
|
+
let id = v.includes("=") ? v.slice(v.indexOf("=") + 1) : v;
|
|
7939
|
+
if (v.startsWith("{")) {
|
|
7940
|
+
try {
|
|
7941
|
+
id = String(JSON.parse(v).path ?? "");
|
|
7942
|
+
} catch {
|
|
7943
|
+
id = "";
|
|
7944
|
+
}
|
|
7945
|
+
}
|
|
7946
|
+
if (!id.includes("/") || looksLocal(id) || !HUB_ID.test(id)) continue;
|
|
7947
|
+
hits.push({ rule: "pin/hf-unpinned", path, line: lineOf(ll.line), api: `${L.api} ${flag}`, repo: id, repoType: "model", syntax: "shell", adapter: true, trustRemoteCode: false, ...served ? { servedBase: served } : {} });
|
|
7948
|
+
}
|
|
7949
|
+
}
|
|
7950
|
+
}
|
|
7682
7951
|
if (!L || !L.model) continue;
|
|
7683
7952
|
const rev = flagValue(L.rest, ["--revision"]);
|
|
7684
7953
|
const pinned = rev.present && rev.value !== void 0 && isPinnedRevision(rev.value);
|
|
@@ -7699,7 +7968,7 @@ function scanShell(src, path, lineOf = (l) => l) {
|
|
|
7699
7968
|
var YAML_MODEL_KEYS = ["base_model", "model_name_or_path", "model_name", "model_id", "pretrained_model_name_or_path", "model"];
|
|
7700
7969
|
var API_PREFIXES = /* @__PURE__ */ new Set(["openai", "anthropic", "azure", "azure_ai", "bedrock", "vertex_ai", "gemini", "groq", "together_ai", "ollama", "ollama_chat", "openrouter", "mistral", "cohere", "deepseek", "fireworks_ai", "replicate", "perplexity", "xai", "huggingface", "sagemaker", "watsonx", "cloudflare", "voyage", "hosted_vllm", "text-completion-openai", "databricks", "nvidia_nim", "cerebras", "sambanova", "lm_studio"]);
|
|
7701
7970
|
var YAML_LINE = /^(\s*)(-\s+)?([A-Za-z_][\w.-]*)\s*:\s*(.*?)\s*$/;
|
|
7702
|
-
var unquote = (v) => v.replace(/\s+#.*$/, "").replace(/^(["'])(.*)\1$/, "$2");
|
|
7971
|
+
var unquote = (v) => v.replace(/\s+#.*$/, "").replace(/^&[\w-]+\s+/, "").replace(/^(["'])(.*)\1$/, "$2");
|
|
7703
7972
|
function scanYaml(src, path) {
|
|
7704
7973
|
if (/^\s*litellm_params\s*:/m.test(src)) return scanShell(src, path);
|
|
7705
7974
|
const lines = src.split(/\r?\n/);
|
|
@@ -7748,6 +8017,87 @@ function scanYaml(src, path) {
|
|
|
7748
8017
|
}
|
|
7749
8018
|
return [...hits, ...scanShell(src, path)];
|
|
7750
8019
|
}
|
|
8020
|
+
var MANIFEST_MODEL_KEYS = { model_source: "ray-serve", modelURL: "vllm-stack", hfModelId: "manifest", hf_model_id: "manifest", modelID: "manifest", modelId: "manifest" };
|
|
8021
|
+
var HF_URI = /hf:\/\/([A-Za-z0-9][\w.-]*\/[A-Za-z0-9][\w.-]*)(?:[:@]([\w.-]+))?/g;
|
|
8022
|
+
var MODEL_FLAG = /--(model[_-]id|model[_-]path|model[_-]name[_-]or[_-]path|model)(?:=|\s+|["']\s*,\s*["'])["']?([A-Za-z0-9][\w.-]*\/[A-Za-z0-9][\w.-]*)(?=["'\s,\]]|$)/g;
|
|
8023
|
+
var REVISION_FLAG = /--(?:model[_-])?revision(?:=|\s+|["']\s*,\s*["'])["']?([\w.-]+)/;
|
|
8024
|
+
var TRUST_FLAG = /--trust[_-]remote[_-]code\b(?!\s*=\s*["']?false)/i;
|
|
8025
|
+
function scanManifestModels(src, path) {
|
|
8026
|
+
const lines = src.split(/\r?\n/);
|
|
8027
|
+
const hits = [];
|
|
8028
|
+
const bare = (l) => l.replace(/\s+#.*$/, "");
|
|
8029
|
+
const templated = (s) => /\{\{|\$\{|\$\(/.test(s);
|
|
8030
|
+
const indent = (l) => l.search(/\S/);
|
|
8031
|
+
const blockAround = (i) => {
|
|
8032
|
+
const col = indent(lines[i]);
|
|
8033
|
+
let a = i;
|
|
8034
|
+
while (a > 0 && (lines[a - 1].trim() === "" || indent(lines[a - 1]) >= col || /^\s*#/.test(lines[a - 1]))) a--;
|
|
8035
|
+
a = Math.max(0, a - 2);
|
|
8036
|
+
let b = i;
|
|
8037
|
+
while (b + 1 < lines.length && (lines[b + 1].trim() === "" || indent(lines[b + 1]) >= col || /^\s*#/.test(lines[b + 1]))) b++;
|
|
8038
|
+
return lines.slice(a, b + 1).filter((l) => !/^\s*#/.test(l)).map(bare).join("\n");
|
|
8039
|
+
};
|
|
8040
|
+
const underDataset = (i) => {
|
|
8041
|
+
let col = indent(lines[i]);
|
|
8042
|
+
for (let j = i - 1; j >= 0 && col > 0; j--) {
|
|
8043
|
+
const l = lines[j];
|
|
8044
|
+
if (!l.trim() || /^\s*#/.test(l)) continue;
|
|
8045
|
+
const c = indent(l);
|
|
8046
|
+
if (c < col) {
|
|
8047
|
+
if (/^\s*-?\s*datasets?\s*:/.test(l)) return true;
|
|
8048
|
+
col = c;
|
|
8049
|
+
}
|
|
8050
|
+
}
|
|
8051
|
+
return false;
|
|
8052
|
+
};
|
|
8053
|
+
const push = (i, api, repo, rev, hint, extra = {}) => {
|
|
8054
|
+
if (looksLocal(repo) || !HUB_ID.test(repo)) return;
|
|
8055
|
+
const pinned = rev !== void 0 && isPinnedRevision(rev);
|
|
8056
|
+
hits.push({ rule: rev ? "pin/hf-floating-revision" : "pin/hf-unpinned", path, line: i + 1, api, repo, repoType: "model", revision: rev, syntax: "yaml", pinHint: hint, ...pinned ? { pinned } : {}, ...extra });
|
|
8057
|
+
};
|
|
8058
|
+
for (let i = 0; i < lines.length; i++) {
|
|
8059
|
+
if (/^\s*#/.test(lines[i]) || /#\s*nosec\b/.test(lines[i])) continue;
|
|
8060
|
+
const line = bare(lines[i]);
|
|
8061
|
+
if (templated(line)) continue;
|
|
8062
|
+
const key = YAML_LINE.exec(line);
|
|
8063
|
+
for (const m of line.matchAll(HF_URI)) {
|
|
8064
|
+
const k = key?.[3];
|
|
8065
|
+
const hint2 = k === "storageUri" ? "kserve-uri" : "uri";
|
|
8066
|
+
push(i, `${k ?? "uri"}: hf://`, m[1], m[2], hint2, underDataset(i) ? { repoType: "dataset" } : {});
|
|
8067
|
+
}
|
|
8068
|
+
for (const m of line.matchAll(MODEL_FLAG)) {
|
|
8069
|
+
const block = blockAround(i);
|
|
8070
|
+
const rev = REVISION_FLAG.exec(block)?.[1];
|
|
8071
|
+
const kserve = /model[_-]id/.test(m[1]) && /--model_name\b|modelFormat|huggingface/i.test(`${block}
|
|
8072
|
+
${src.slice(0, 4e3)}`);
|
|
8073
|
+
push(i, `--${m[1]}`, m[2], rev && !templated(rev) ? rev : void 0, kserve ? "kserve-arg" : "engine-arg", { trustRemoteCode: TRUST_FLAG.test(block) });
|
|
8074
|
+
}
|
|
8075
|
+
const hint = key && MANIFEST_MODEL_KEYS[key[3]];
|
|
8076
|
+
if (hint) {
|
|
8077
|
+
const value = unquote(key[4]);
|
|
8078
|
+
if (value.includes("/") && !value.includes("://")) push(i, `${key[3]}:`, value, void 0, hint);
|
|
8079
|
+
}
|
|
8080
|
+
}
|
|
8081
|
+
return hits;
|
|
8082
|
+
}
|
|
8083
|
+
function manifestPinFix(hint, id, sha) {
|
|
8084
|
+
switch (hint) {
|
|
8085
|
+
case "kserve-uri":
|
|
8086
|
+
return `storageUri: hf://${id}:${sha} (KServe reads hf://owner/model[:revision])`;
|
|
8087
|
+
case "uri":
|
|
8088
|
+
return `hf://${id}:${sha} where the chart passes the address to KServe's storage initializer; otherwise download that commit to a volume (hf download ${id} --revision ${sha}) and point the chart at the volume`;
|
|
8089
|
+
case "kserve-arg":
|
|
8090
|
+
return `- --model_revision=${sha} next to --model_id (the KServe Hugging Face runtime's flag)`;
|
|
8091
|
+
case "engine-arg":
|
|
8092
|
+
return `--revision ${sha} in the same argument list`;
|
|
8093
|
+
case "ray-serve":
|
|
8094
|
+
return `revision: ${sha} under engine_kwargs of this llm_config (Ray Serve passes engine_kwargs to vLLM)`;
|
|
8095
|
+
case "vllm-stack":
|
|
8096
|
+
return `"--revision", "${sha}" in this model's vllmConfig.extraArgs`;
|
|
8097
|
+
case "manifest":
|
|
8098
|
+
return `state commit ${sha} where this format takes a revision; if it takes none, download that commit to a volume (hf download ${id} --revision ${sha}) and serve from the volume`;
|
|
8099
|
+
}
|
|
8100
|
+
}
|
|
7751
8101
|
var MODEL_ENV = /^(HF_|HUGGING_FACE_HUB_|VLLM_|TGI_|TEI_)?MODEL(_ID|_NAME|_REPO|_NAME_OR_PATH)?$/;
|
|
7752
8102
|
var REVISION_ENV = /^(HF_|VLLM_|TGI_|TEI_)?(MODEL_)?REVISION$/;
|
|
7753
8103
|
var CODE_REVISION_ENV = /CODE_REVISION$/;
|
|
@@ -7858,9 +8208,11 @@ function scanPins(path, text) {
|
|
|
7858
8208
|
function scanModelRefs(path, text) {
|
|
7859
8209
|
KEEP_PINNED = true;
|
|
7860
8210
|
try {
|
|
8211
|
+
if (refFileKind(path) === "adapter") return scanAdapterConfig(text, path);
|
|
7861
8212
|
const kind = pinFileKind(path);
|
|
7862
8213
|
const env = kind === "yaml" || kind === "shell" ? scanEnvModels(text, path, kind) : [];
|
|
7863
|
-
const
|
|
8214
|
+
const manifest = kind === "yaml" ? scanManifestModels(text, path) : [];
|
|
8215
|
+
const hits = [...scanPins(path, text).filter((h) => h.repo), ...env, ...manifest];
|
|
7864
8216
|
const seen = /* @__PURE__ */ new Set();
|
|
7865
8217
|
return hits.filter((h) => {
|
|
7866
8218
|
const k = `${h.line}|${h.repo}|${h.revision ?? ""}`;
|
|
@@ -7873,7 +8225,7 @@ function scanModelRefs(path, text) {
|
|
|
7873
8225
|
}
|
|
7874
8226
|
}
|
|
7875
8227
|
function pinSpelling(syntax, sha) {
|
|
7876
|
-
return syntax === "python" ? `revision="${sha}"` : syntax === "shell" ? `--revision ${sha}` : `model_revision: ${sha}`;
|
|
8228
|
+
return syntax === "python" ? `revision="${sha}"` : syntax === "shell" ? `--revision ${sha}` : syntax === "json" ? `"revision": "${sha}"` : `model_revision: ${sha}`;
|
|
7877
8229
|
}
|
|
7878
8230
|
function fromPinCheck(hits, opts = {}) {
|
|
7879
8231
|
return hits.map((h) => {
|
|
@@ -8000,6 +8352,503 @@ Severity in this repo is set by \`.neurarch.yml\` (\`rules: { ${id}: off | info
|
|
|
8000
8352
|
};
|
|
8001
8353
|
}
|
|
8002
8354
|
|
|
8355
|
+
// src/utils/policy/adapterCheck.ts
|
|
8356
|
+
var LORA_SUFFIX = /\.(lora_A|lora_B|lora_embedding_A|lora_embedding_B|lora_magnitude_vector)(\.[\w-]+)?(\.weight)?$/;
|
|
8357
|
+
var GENERIC = /* @__PURE__ */ new Set(["model", "base_model"]);
|
|
8358
|
+
function loraModulePaths(tensorNames) {
|
|
8359
|
+
const out = /* @__PURE__ */ new Set();
|
|
8360
|
+
for (const n of tensorNames) {
|
|
8361
|
+
const m = LORA_SUFFIX.exec(n);
|
|
8362
|
+
if (!m) continue;
|
|
8363
|
+
out.add(n.slice(0, m.index).replace(/^base_model\.model\./, ""));
|
|
8364
|
+
}
|
|
8365
|
+
return [...out].sort();
|
|
8366
|
+
}
|
|
8367
|
+
var inc = (o, k) => {
|
|
8368
|
+
o[k] = (o[k] ?? 0) + 1;
|
|
8369
|
+
};
|
|
8370
|
+
var top = (o) => Object.entries(o).sort((a, b) => b[1] - a[1])[0]?.[0];
|
|
8371
|
+
var sum = (o) => Object.values(o).reduce((a, b) => a + b, 0);
|
|
8372
|
+
function adapterLayout(adapterTensors, baseTensors) {
|
|
8373
|
+
const paths = loraModulePaths(adapterTensors);
|
|
8374
|
+
const mods = /* @__PURE__ */ new Set();
|
|
8375
|
+
for (const n2 of baseTensors) mods.add(n2.replace(/\.(weight|bias)$/, ""));
|
|
8376
|
+
if (!paths.length || !mods.size) return null;
|
|
8377
|
+
const tails = /* @__PURE__ */ new Map();
|
|
8378
|
+
for (const m of mods) {
|
|
8379
|
+
const parts = m.split(".");
|
|
8380
|
+
for (let i = 0; i < parts.length; i++) {
|
|
8381
|
+
const t = parts.slice(i).join(".");
|
|
8382
|
+
if (!tails.has(t)) tails.set(t, m);
|
|
8383
|
+
}
|
|
8384
|
+
}
|
|
8385
|
+
const r = { modules: paths.length, exact: 0, sameLayout: 0, missingWrapper: {}, extraWrapper: {}, noMatch: 0, tiedHead: 0, verdict: "mixed" };
|
|
8386
|
+
const storesHead = [...mods].some((m) => m === "lm_head" || m.endsWith(".lm_head"));
|
|
8387
|
+
for (const p of paths) {
|
|
8388
|
+
if (mods.has(p)) {
|
|
8389
|
+
r.exact++;
|
|
8390
|
+
continue;
|
|
8391
|
+
}
|
|
8392
|
+
if (!storesHead && (p === "lm_head" || p.endsWith(".lm_head"))) {
|
|
8393
|
+
r.tiedHead++;
|
|
8394
|
+
continue;
|
|
8395
|
+
}
|
|
8396
|
+
const parts = p.split(".");
|
|
8397
|
+
let at = -1;
|
|
8398
|
+
let base = "";
|
|
8399
|
+
for (let i = 0; i < parts.length && parts.length - i >= 3; i++) {
|
|
8400
|
+
const hit = tails.get(parts.slice(i).join("."));
|
|
8401
|
+
if (hit) {
|
|
8402
|
+
at = i;
|
|
8403
|
+
base = hit;
|
|
8404
|
+
break;
|
|
8405
|
+
}
|
|
8406
|
+
}
|
|
8407
|
+
if (at < 0) {
|
|
8408
|
+
r.noMatch++;
|
|
8409
|
+
continue;
|
|
8410
|
+
}
|
|
8411
|
+
const bparts = base.split(".");
|
|
8412
|
+
const pa = parts.slice(0, at).filter((s) => !GENERIC.has(s));
|
|
8413
|
+
const pb = bparts.slice(0, bparts.length - (parts.length - at)).filter((s) => !GENERIC.has(s));
|
|
8414
|
+
const sa = new Set(pa);
|
|
8415
|
+
const sb = new Set(pb);
|
|
8416
|
+
if ([...pa].sort().join(".") === [...pb].sort().join(".")) r.sameLayout++;
|
|
8417
|
+
else if (pa.every((s) => sb.has(s))) inc(r.missingWrapper, [...sb].filter((s) => !sa.has(s)).sort().join("."));
|
|
8418
|
+
else if (pb.every((s) => sa.has(s))) inc(r.extraWrapper, [...sa].filter((s) => !sb.has(s)).sort().join("."));
|
|
8419
|
+
else r.noMatch++;
|
|
8420
|
+
}
|
|
8421
|
+
const missing = sum(r.missingWrapper);
|
|
8422
|
+
const extra = sum(r.extraWrapper);
|
|
8423
|
+
const n = r.modules - r.tiedHead;
|
|
8424
|
+
if (r.exact + r.sameLayout === n) r.verdict = "match";
|
|
8425
|
+
else if (r.noMatch === n) r.verdict = "no-match";
|
|
8426
|
+
else if (missing >= n * 0.9) {
|
|
8427
|
+
r.verdict = "missing-wrapper";
|
|
8428
|
+
r.wrapper = top(r.missingWrapper);
|
|
8429
|
+
} else if (extra >= n * 0.9) {
|
|
8430
|
+
r.verdict = "extra-wrapper";
|
|
8431
|
+
r.wrapper = top(r.extraWrapper);
|
|
8432
|
+
}
|
|
8433
|
+
return r;
|
|
8434
|
+
}
|
|
8435
|
+
function versionBefore(version, than) {
|
|
8436
|
+
const m = version ? /^v?(\d+)\.(\d+)(?:\.(\d+))?/.exec(version) : null;
|
|
8437
|
+
if (!m) return void 0;
|
|
8438
|
+
const v = [Number(m[1]), Number(m[2]), Number(m[3] ?? 0)];
|
|
8439
|
+
for (let i = 0; i < 3; i++) if (v[i] !== than[i]) return v[i] < than[i];
|
|
8440
|
+
return false;
|
|
8441
|
+
}
|
|
8442
|
+
var VLLM_WRAPPER_FIX = [0, 33, 0];
|
|
8443
|
+
function assessAdapter(a) {
|
|
8444
|
+
const out = [];
|
|
8445
|
+
const l = a.layout;
|
|
8446
|
+
if (l?.verdict === "missing-wrapper" && l.wrapper === "language_model") {
|
|
8447
|
+
const before = a.engine?.name === "vllm" ? versionBefore(a.engine.version, VLLM_WRAPPER_FIX) : void 0;
|
|
8448
|
+
const where2 = a.engine?.name === "vllm" && a.engine.version ? `vLLM ${a.engine.version}` : "vLLM";
|
|
8449
|
+
const what = `${l.modules} of this adapter's modules are named without the language_model level that ${a.base} keeps them under (usually because it was trained through a text-only class).`;
|
|
8450
|
+
if (before === true) out.push({ lane: "behavior", severity: "high", kind: "adapter-noop-wrapper", message: `${what} ${where2} loads it without an error and applies none of it: the output is the base model's. Fixed in vLLM 0.33.0.`, fix: "Serve on vLLM 0.33.0 or later, or merge the adapter into the base before serving.", url: "https://github.com/vllm-project/vllm/issues/34186" });
|
|
8451
|
+
else if (before === false) out.push({ lane: "behavior", severity: "low", kind: "adapter-wrapper-layout", message: `${what} ${where2} applies it (fixed in 0.33.0); earlier versions loaded it and applied none of it.`, url: "https://github.com/vllm-project/vllm/issues/34186" });
|
|
8452
|
+
else out.push({ lane: "behavior", severity: "medium", kind: "adapter-noop-wrapper", message: `${what} vLLM 0.32.0 and earlier load such an adapter without an error and apply none of it; 0.33.0 and later apply it. The engine version is not in this file.`, fix: "Check the vLLM version this is served on, and compare one output with and without the adapter before go-live.", url: "https://github.com/vllm-project/vllm/issues/34186" });
|
|
8453
|
+
} else if (l?.verdict === "missing-wrapper") {
|
|
8454
|
+
out.push({ lane: "behavior", severity: "low", kind: "adapter-wrapper-layout", message: `${l.modules} of this adapter's modules are named without the ${l.wrapper} level that ${a.base} keeps them under. PEFT resolves that through the class it was trained with; a serving engine that matches full paths may apply none of it.`, fix: "Compare one output with and without the adapter on the engine you serve with." });
|
|
8455
|
+
} else if (l?.verdict === "no-match") {
|
|
8456
|
+
out.push({ lane: "behavior", severity: "high", kind: "adapter-no-match", message: `None of this adapter's ${l.modules} target modules exists in ${a.base}. It was trained for a different model, or the base named here is the wrong one.` });
|
|
8457
|
+
} else if (l && l.noMatch > 0 && l.verdict !== "match") {
|
|
8458
|
+
out.push({ lane: "behavior", severity: "medium", kind: "adapter-partial-match", message: `${l.noMatch} of this adapter's ${l.modules} target modules ${l.noMatch === 1 ? "does" : "do"} not exist in ${a.base}.` });
|
|
8459
|
+
}
|
|
8460
|
+
if (a.recordedBase && a.recordedBase.toLowerCase() !== a.base.toLowerCase()) {
|
|
8461
|
+
out.push({ lane: "behavior", severity: "medium", kind: "adapter-base-differs", message: `adapter_config.json says this adapter was trained on ${a.recordedBase}; this file serves it on ${a.base}.`, fix: "Confirm the two are the same weights (a quantized or renamed copy is fine; a different fine-tune is not)." });
|
|
8462
|
+
}
|
|
8463
|
+
if (a.baseCommitRecorded === false) {
|
|
8464
|
+
out.push({ lane: "hygiene", severity: "low", kind: "adapter-base-unpinned", message: `The adapter's config names its base (${a.recordedBase ?? a.base}) without a commit, so nothing records which revision it was trained against.`, fix: 'Add "revision": "<base commit>" to adapter_config.json when you export the adapter.' });
|
|
8465
|
+
}
|
|
8466
|
+
return out;
|
|
8467
|
+
}
|
|
8468
|
+
|
|
8469
|
+
// src/utils/policy/gate.ts
|
|
8470
|
+
var quote = (w) => /[\s"'$`\\]/.test(w) || w === "" ? `'${w.replace(/'/g, `'\\''`)}'` : w;
|
|
8471
|
+
function launchesIn(commands) {
|
|
8472
|
+
const out = [];
|
|
8473
|
+
const seen = /* @__PURE__ */ new Set();
|
|
8474
|
+
for (const words of commands) {
|
|
8475
|
+
let start = -1;
|
|
8476
|
+
let engine = "vllm";
|
|
8477
|
+
for (let i = 0; i < words.length - 1; i++) {
|
|
8478
|
+
const w = words[i];
|
|
8479
|
+
const nx = words[i + 1];
|
|
8480
|
+
if ((w === "vllm" || w.endsWith("/vllm")) && nx === "serve") {
|
|
8481
|
+
start = i;
|
|
8482
|
+
engine = "vllm";
|
|
8483
|
+
break;
|
|
8484
|
+
}
|
|
8485
|
+
if ((w === "sglang" || w.endsWith("/sglang")) && nx === "serve") {
|
|
8486
|
+
start = i;
|
|
8487
|
+
engine = "sglang";
|
|
8488
|
+
break;
|
|
8489
|
+
}
|
|
8490
|
+
if (w === "-m" && /^vllm\.entrypoints\.(openai\.)?api_server$/.test(nx)) {
|
|
8491
|
+
start = Math.max(0, i - 1);
|
|
8492
|
+
engine = "vllm";
|
|
8493
|
+
break;
|
|
8494
|
+
}
|
|
8495
|
+
if (w === "-m" && nx === "sglang.launch_server") {
|
|
8496
|
+
start = Math.max(0, i - 1);
|
|
8497
|
+
engine = "sglang";
|
|
8498
|
+
break;
|
|
8499
|
+
}
|
|
8500
|
+
}
|
|
8501
|
+
if (start < 0) continue;
|
|
8502
|
+
const rest = words.slice(start);
|
|
8503
|
+
if (rest.some((w) => /\$\{?[A-Za-z_]|\{\{/.test(w))) continue;
|
|
8504
|
+
const flag = (names) => {
|
|
8505
|
+
for (let i = 0; i < rest.length; i++) {
|
|
8506
|
+
const eq = /^(--[\w-]+)=(.*)$/.exec(rest[i]);
|
|
8507
|
+
if (eq && names.includes(eq[1])) return eq[2];
|
|
8508
|
+
if (names.includes(rest[i])) return rest[i + 1];
|
|
8509
|
+
}
|
|
8510
|
+
return void 0;
|
|
8511
|
+
};
|
|
8512
|
+
const serveAt = rest.indexOf("serve");
|
|
8513
|
+
const positional = serveAt >= 0 && rest[serveAt + 1] && !rest[serveAt + 1].startsWith("-") ? rest[serveAt + 1] : void 0;
|
|
8514
|
+
const model = positional ?? flag(["--model", "--model-path"]);
|
|
8515
|
+
const command = rest.map(quote).join(" ");
|
|
8516
|
+
if (seen.has(command)) continue;
|
|
8517
|
+
seen.add(command);
|
|
8518
|
+
out.push({ command, engine, ...model && /^[\w.-]+\/[\w.-]+$/.test(model) ? { modelId: model } : {} });
|
|
8519
|
+
}
|
|
8520
|
+
return out;
|
|
8521
|
+
}
|
|
8522
|
+
function acceleratorsIn(text) {
|
|
8523
|
+
const sky = /^\s*accelerators\s*:\s*\{?\s*["']?([A-Za-z][\w-]*)["']?\s*:\s*(\d+)/m.exec(text);
|
|
8524
|
+
if (sky) return { card: sky[1], count: Number(sky[2]) };
|
|
8525
|
+
const k8s = /nvidia\.com\/gpu["']?\s*:\s*["']?(\d+)/.exec(text);
|
|
8526
|
+
return k8s ? { count: Number(k8s[1]) } : {};
|
|
8527
|
+
}
|
|
8528
|
+
function gateVerdict(c, opts = {}) {
|
|
8529
|
+
const blocking = [];
|
|
8530
|
+
if (c.scan.high) blocking.push(`${c.scan.high} high scan finding${c.scan.high === 1 ? "" : "s"}`);
|
|
8531
|
+
if (c.serve.block) blocking.push(`${c.serve.block} launch blocker${c.serve.block === 1 ? "" : "s"}`);
|
|
8532
|
+
if (blocking.length) return { verdict: "refuse", exit: 1, because: blocking };
|
|
8533
|
+
const toRead = [];
|
|
8534
|
+
if (c.scan.medium) toRead.push(`${c.scan.medium} medium scan finding${c.scan.medium === 1 ? "" : "s"}`);
|
|
8535
|
+
if (c.serve.warn) toRead.push(`${c.serve.warn} launch warning${c.serve.warn === 1 ? "" : "s"}`);
|
|
8536
|
+
if (c.promptDiffers) toRead.push(`${c.promptDiffers} prompt${c.promptDiffers === 1 ? "" : "s"} rendered differently from the reference`);
|
|
8537
|
+
if (c.unread) toRead.push(`${c.unread} check${c.unread === 1 ? "" : "s"} could not be read`);
|
|
8538
|
+
if (toRead.length) return { verdict: "review", exit: opts.strict ? 1 : 0, because: toRead };
|
|
8539
|
+
return { verdict: "admit", exit: 0, because: [] };
|
|
8540
|
+
}
|
|
8541
|
+
var GATE_RECORD_SCHEMA = "https://www.neurarch.com/schema/gate-record-v1.json";
|
|
8542
|
+
function buildGateRecord(input) {
|
|
8543
|
+
const { version, strict, ...rest } = input;
|
|
8544
|
+
const v = gateVerdict(rest.counts, { strict });
|
|
8545
|
+
return { $schema: GATE_RECORD_SCHEMA, tool: { name: "neurarch", version }, ...v, ...rest };
|
|
8546
|
+
}
|
|
8547
|
+
function gateSubjectFromEnv(env) {
|
|
8548
|
+
if (env.GITHUB_ACTIONS === "true" || env.GITHUB_SHA) {
|
|
8549
|
+
const repo = env.GITHUB_REPOSITORY ?? null;
|
|
8550
|
+
return {
|
|
8551
|
+
repo,
|
|
8552
|
+
commit: env.GITHUB_SHA ?? null,
|
|
8553
|
+
ref: env.GITHUB_HEAD_REF || env.GITHUB_REF_NAME || null,
|
|
8554
|
+
by: env.GITHUB_ACTOR ?? null,
|
|
8555
|
+
runUrl: repo && env.GITHUB_RUN_ID ? `${env.GITHUB_SERVER_URL ?? "https://github.com"}/${repo}/actions/runs/${env.GITHUB_RUN_ID}` : null
|
|
8556
|
+
};
|
|
8557
|
+
}
|
|
8558
|
+
if (env.GITLAB_CI === "true") {
|
|
8559
|
+
return { repo: env.CI_PROJECT_PATH ?? null, commit: env.CI_COMMIT_SHA ?? null, ref: env.CI_COMMIT_REF_NAME ?? null, by: env.GITLAB_USER_LOGIN ?? null, runUrl: env.CI_JOB_URL ?? null };
|
|
8560
|
+
}
|
|
8561
|
+
return {};
|
|
8562
|
+
}
|
|
8563
|
+
function gateLedgerRow(rec, subject = {}) {
|
|
8564
|
+
return {
|
|
8565
|
+
kind: "gate",
|
|
8566
|
+
at: rec.at,
|
|
8567
|
+
ran_at: rec.at,
|
|
8568
|
+
tool: rec.tool,
|
|
8569
|
+
subject: { repo: subject.repo ?? null, commit: subject.commit ?? null, ref: subject.ref ?? null, by: subject.by ?? null, run_url: subject.runUrl ?? null },
|
|
8570
|
+
verdict: rec.verdict,
|
|
8571
|
+
exit: rec.exit,
|
|
8572
|
+
because: rec.because,
|
|
8573
|
+
counts: { scan: rec.counts.scan, serve: rec.counts.serve, prompt_differs: rec.counts.promptDiffers, unread: rec.counts.unread },
|
|
8574
|
+
models: rec.models.map((m) => ({ id: m.id, pinned: m.pinned, resolved_to: m.resolvedTo, adapter_of: m.adapterOf ?? null })),
|
|
8575
|
+
launches: rec.launches.map((l) => ({
|
|
8576
|
+
file: l.file,
|
|
8577
|
+
model: l.model ?? null,
|
|
8578
|
+
engine: l.engine,
|
|
8579
|
+
engine_version: l.engineVersion,
|
|
8580
|
+
engine_version_assumed: !!l.engineVersionAssumed,
|
|
8581
|
+
card: l.card,
|
|
8582
|
+
gpus: l.gpus,
|
|
8583
|
+
rules: l.findings.map((f) => f.rule)
|
|
8584
|
+
})),
|
|
8585
|
+
prompts: rec.prompts.map((p) => ({ id: p.id, engine: p.engine, verdict: p.verdict, at: p.at ?? null, template_sha256: p.templateSha256 ?? null })),
|
|
8586
|
+
not_checked: rec.notChecked
|
|
8587
|
+
};
|
|
8588
|
+
}
|
|
8589
|
+
|
|
8590
|
+
// src/utils/policy/engineRecord.ts
|
|
8591
|
+
var FAMILIES = [
|
|
8592
|
+
["paligemma", /pali-?gemma/i],
|
|
8593
|
+
["gemma", /\bgemma|(?<![a-z])t5gemma|embeddinggemma/i],
|
|
8594
|
+
["qwen", /qwen|\bqwq\b/i],
|
|
8595
|
+
["llama", /llama(?!\.cpp|[-_ ]?cpp|index)/i],
|
|
8596
|
+
["deepseek", /deepseek/i],
|
|
8597
|
+
["glm", /\bglm\b|\bglm-?\d|chatglm|cogvlm|cogagent/i],
|
|
8598
|
+
["kimi", /\bkimi\b|moonshot/i],
|
|
8599
|
+
["mistral", /mistral|mixtral|ministral|devstral|magistral|voxtral|pixtral|codestral/i],
|
|
8600
|
+
["nemotron", /nemotron/i],
|
|
8601
|
+
["gpt-oss", /gpt-?oss/i],
|
|
8602
|
+
["phi", /\bphi-?\d|\bphi\b(?=[- ]?(\d|silica|mini|medium|vision))/i],
|
|
8603
|
+
["granite", /granite/i],
|
|
8604
|
+
["minicpm", /minicpm/i],
|
|
8605
|
+
["internvl", /internvl|internlm/i],
|
|
8606
|
+
["hermes", /hermes/i],
|
|
8607
|
+
["minimax", /minimax/i],
|
|
8608
|
+
["ernie", /ernie/i],
|
|
8609
|
+
["hunyuan", /hunyuan/i],
|
|
8610
|
+
["llava", /llava/i],
|
|
8611
|
+
["whisper", /whisper/i],
|
|
8612
|
+
["cohere", /\bcommand-?[ar]\b|\baya\b|cohere/i],
|
|
8613
|
+
["smol", /smol(lm|vlm)/i],
|
|
8614
|
+
["bge", /\bbge\b/i],
|
|
8615
|
+
["jina", /\bjina/i],
|
|
8616
|
+
["nomic", /nomic/i]
|
|
8617
|
+
];
|
|
8618
|
+
function familiesIn(text) {
|
|
8619
|
+
const out = [];
|
|
8620
|
+
let rest = text;
|
|
8621
|
+
for (const [name, re] of FAMILIES) {
|
|
8622
|
+
if (!re.test(rest)) continue;
|
|
8623
|
+
out.push(name);
|
|
8624
|
+
if (name === "paligemma") rest = rest.replace(/pali-?gemma/gi, " ");
|
|
8625
|
+
}
|
|
8626
|
+
return out;
|
|
8627
|
+
}
|
|
8628
|
+
function familyOf(modelId) {
|
|
8629
|
+
const [owner, name] = modelId.includes("/") ? modelId.split("/", 2) : ["", modelId];
|
|
8630
|
+
return familiesIn(name)[0] ?? familiesIn(owner)[0];
|
|
8631
|
+
}
|
|
8632
|
+
var KIND_RULES = [
|
|
8633
|
+
["adapter", /\blora\b|\bdora\b|\bpeft\b|\badapters?\b/i],
|
|
8634
|
+
["tool-calling", /tool[- _]?(call|pars|choice|use)|function[- ]call|\btool parser|reasoning[- _]pars|\bparser\b/i],
|
|
8635
|
+
["prompt", /chat[- _]?template|\btemplate\b|\brenderer\b|\btokeniz|special tokens?|\bbos\b|\beos\b|system prompt|prompt format/i],
|
|
8636
|
+
["quantization", /quanti[sz]|\bfp8\b|\bawq\b|\bgptq\b|\bgguf\b|bitsandbytes|\bint[48]\b|nvfp4|\bw4a16\b|\bw8a8\b|\bmxfp/i]
|
|
8637
|
+
];
|
|
8638
|
+
function classifyEngineChange(text, section) {
|
|
8639
|
+
if (/breaking|deprecat|before you upgrade/i.test(section)) return "breaking";
|
|
8640
|
+
if (/^security/i.test(section)) return "security";
|
|
8641
|
+
for (const [kind, re] of KIND_RULES) if (re.test(text)) return kind;
|
|
8642
|
+
for (const [kind, re] of KIND_RULES) if (re.test(section)) return kind;
|
|
8643
|
+
if (/model support|new models/i.test(section) && familiesIn(text).length) return "model";
|
|
8644
|
+
return null;
|
|
8645
|
+
}
|
|
8646
|
+
var MAX_TEXT = 240;
|
|
8647
|
+
var NUMBER_RANGE = new RegExp(`(\\d)\\s*[${String.fromCharCode(8211)}${String.fromCharCode(8212)}]\\s*(\\d)`, "g");
|
|
8648
|
+
var LONG_DASH = new RegExp(`\\s*[${String.fromCharCode(8211)}${String.fromCharCode(8212)}]\\s*`, "g");
|
|
8649
|
+
function plain(line) {
|
|
8650
|
+
const s = line.replace(/\[([^\]]+)\]\([^)]*\)/g, "$1").replace(/<[^>]+>/g, "").replace(/[*`]+/g, "").replace(NUMBER_RANGE, "$1 to $2").replace(LONG_DASH, ", ").replace(/\s+/g, " ").replace(/^[\s:,;.]+|[\s:,;]+$/g, "").trim();
|
|
8651
|
+
return s.length > MAX_TEXT ? `${s.slice(0, MAX_TEXT - 3).replace(/\s+\S*$/, "")}...` : s;
|
|
8652
|
+
}
|
|
8653
|
+
function releaseVersion(tag, name, body) {
|
|
8654
|
+
const heading = /^#\s+(?:vLLM\s+)?v?(\d+\.\d+\.\d+)\s*$/m.exec(body ?? "")?.[1];
|
|
8655
|
+
const titled = /v?(\d+\.\d+\.\d+)(?!\w)/.exec(name ?? "")?.[1];
|
|
8656
|
+
return heading ?? titled ?? /v?(\d+\.\d+\.\d+)/.exec(tag)?.[1];
|
|
8657
|
+
}
|
|
8658
|
+
var prsIn = (s) => [...new Set([...s.matchAll(/#(\d{3,6})\b/g)].map((m) => Number(m[1])))];
|
|
8659
|
+
function splitClauses(text) {
|
|
8660
|
+
const parts = [];
|
|
8661
|
+
let depth = 0;
|
|
8662
|
+
let cur = "";
|
|
8663
|
+
const refEnded = () => /\(#[^()]*\)$/.test(cur.trimEnd()) || /#\d{3,6}$/.test(cur.trimEnd());
|
|
8664
|
+
for (let i = 0; i < text.length; i++) {
|
|
8665
|
+
const ch = text[i];
|
|
8666
|
+
if (ch === "(") depth++;
|
|
8667
|
+
if (ch === ")") depth = Math.max(0, depth - 1);
|
|
8668
|
+
if (depth === 0 && (ch === ";" || ch === "," && refEnded())) {
|
|
8669
|
+
parts.push(cur);
|
|
8670
|
+
cur = "";
|
|
8671
|
+
continue;
|
|
8672
|
+
}
|
|
8673
|
+
cur += ch;
|
|
8674
|
+
if (depth === 0 && refEnded() && /^\s+and\s+/.test(text.slice(i + 1))) {
|
|
8675
|
+
parts.push(cur);
|
|
8676
|
+
cur = "";
|
|
8677
|
+
i += /^\s+and/.exec(text.slice(i + 1))[0].length;
|
|
8678
|
+
}
|
|
8679
|
+
}
|
|
8680
|
+
if (cur.trim()) parts.push(cur);
|
|
8681
|
+
const out = [];
|
|
8682
|
+
let carry2 = "";
|
|
8683
|
+
for (const p of parts) {
|
|
8684
|
+
const piece = `${carry2}${p}`;
|
|
8685
|
+
if (prsIn(p).length) {
|
|
8686
|
+
out.push(piece.trim());
|
|
8687
|
+
carry2 = "";
|
|
8688
|
+
} else carry2 = `${piece.trim()}; `;
|
|
8689
|
+
}
|
|
8690
|
+
if (carry2.trim()) {
|
|
8691
|
+
if (out.length) out[out.length - 1] += `; ${carry2.replace(/;\s*$/, "").trim()}`;
|
|
8692
|
+
else out.push(carry2.replace(/;\s*$/, "").trim());
|
|
8693
|
+
}
|
|
8694
|
+
return out.filter(Boolean);
|
|
8695
|
+
}
|
|
8696
|
+
var SKIP_SECTION = /^(release artifacts|python wheels|docker images|other artifacts|install|new contributors|contributors|dependencies|build|documentation|tl;dr|full changelog)\b/i;
|
|
8697
|
+
var SUMMARY_TOP = /^(highlights|tl;dr)\b/i;
|
|
8698
|
+
function parseEngineRelease(r) {
|
|
8699
|
+
const version = releaseVersion(r.tag, r.name, r.body);
|
|
8700
|
+
if (!version) return null;
|
|
8701
|
+
const drafts = [];
|
|
8702
|
+
const lines = (r.body ?? "").split(/\r?\n/);
|
|
8703
|
+
let top2 = "";
|
|
8704
|
+
let section = "";
|
|
8705
|
+
let depth = 0;
|
|
8706
|
+
let parent = "";
|
|
8707
|
+
const add = (label, body) => {
|
|
8708
|
+
for (const piece of splitClauses(body)) {
|
|
8709
|
+
const clause = piece.replace(/^\s*and\s+/i, "");
|
|
8710
|
+
const text = plain(label ? `${label}: ${clause}` : clause);
|
|
8711
|
+
if (!text) continue;
|
|
8712
|
+
const kind = classifyEngineChange(`${label} ${clause}`, section);
|
|
8713
|
+
if (!kind) continue;
|
|
8714
|
+
const prs = prsIn(clause);
|
|
8715
|
+
if (!prs.length && kind !== "breaking" && kind !== "security") continue;
|
|
8716
|
+
const families = familiesIn(clause);
|
|
8717
|
+
drafts.push({ version, date: r.date, section, kind, text, prs, families: families.length ? families : familiesIn(label), top: top2, depth });
|
|
8718
|
+
}
|
|
8719
|
+
};
|
|
8720
|
+
for (let i = 0; i < lines.length; i++) {
|
|
8721
|
+
const raw = lines[i];
|
|
8722
|
+
const h = /^(#{2,4})\s+(.+?)\s*$/.exec(raw);
|
|
8723
|
+
if (h) {
|
|
8724
|
+
const title = plain(h[2]);
|
|
8725
|
+
if (h[1].length === 2) {
|
|
8726
|
+
top2 = title;
|
|
8727
|
+
depth = 2;
|
|
8728
|
+
} else depth = h[1].length;
|
|
8729
|
+
section = title;
|
|
8730
|
+
parent = "";
|
|
8731
|
+
continue;
|
|
8732
|
+
}
|
|
8733
|
+
const sum2 = /<summary>(.*?)<\/summary>/i.exec(raw);
|
|
8734
|
+
if (sum2) {
|
|
8735
|
+
section = plain(sum2[1]);
|
|
8736
|
+
depth = 3;
|
|
8737
|
+
parent = "";
|
|
8738
|
+
if (SKIP_SECTION.test(top2) && /full changelog/i.test(top2)) top2 = "Changelog";
|
|
8739
|
+
continue;
|
|
8740
|
+
}
|
|
8741
|
+
if (SKIP_SECTION.test(section) || SKIP_SECTION.test(top2) && section === top2) continue;
|
|
8742
|
+
const bold = /^\*\*([^*]+?):?\*\*:?\s*$/.exec(raw.trim());
|
|
8743
|
+
if (bold && !/^\s*[*-]\s/.test(raw)) {
|
|
8744
|
+
section = plain(bold[1]);
|
|
8745
|
+
depth = Math.max(depth, 3);
|
|
8746
|
+
parent = "";
|
|
8747
|
+
continue;
|
|
8748
|
+
}
|
|
8749
|
+
if (/^\s*\|/.test(raw)) {
|
|
8750
|
+
if (/^\s*\|[\s:|-]+\|\s*$/.test(raw) || /^\s*\|[\s:|-]+\|\s*$/.test(lines[i + 1] ?? "")) continue;
|
|
8751
|
+
const cells = raw.trim().replace(/^\||\|$/g, "").split("|").map((c) => c.trim());
|
|
8752
|
+
const refs = cells.filter((c) => /^(#\d+[,\s]*)+$/.test(c)).join(" ");
|
|
8753
|
+
const words = cells.filter((c) => c && !/^(#\d+[,\s]*)+$/.test(c) && !new RegExp(`^[${String.fromCharCode(8212)}-]$`).test(c));
|
|
8754
|
+
if (!words.length) continue;
|
|
8755
|
+
const said = words.join(": ");
|
|
8756
|
+
const kind = classifyEngineChange(said, section);
|
|
8757
|
+
if (kind) drafts.push({ version, date: r.date, section, kind, text: plain(said), prs: prsIn(refs), families: familiesIn(said), top: top2, depth });
|
|
8758
|
+
continue;
|
|
8759
|
+
}
|
|
8760
|
+
const b = /^(\s*)[*-]\s+(.+)$/.exec(raw);
|
|
8761
|
+
if (!b || !section) continue;
|
|
8762
|
+
const nested = b[1].length > 0;
|
|
8763
|
+
const lab = /^\*\*(.+?)\*\*:?\s*(.*)$/.exec(b[2]);
|
|
8764
|
+
if (!nested) {
|
|
8765
|
+
if (lab) {
|
|
8766
|
+
parent = plain(lab[1]);
|
|
8767
|
+
if (lab[2].trim()) add(parent, lab[2]);
|
|
8768
|
+
} else {
|
|
8769
|
+
parent = /:\s*$/.test(b[2]) ? plain(b[2]) : "";
|
|
8770
|
+
add("", b[2]);
|
|
8771
|
+
}
|
|
8772
|
+
} else if (lab && lab[2].trim()) add(parent ? `${parent}, ${plain(lab[1])}` : plain(lab[1]), lab[2]);
|
|
8773
|
+
else add(parent, lab ? lab[1] : b[2]);
|
|
8774
|
+
}
|
|
8775
|
+
const hasTopics = drafts.some((d) => !SUMMARY_TOP.test(d.top));
|
|
8776
|
+
const isSummary = (d) => SUMMARY_TOP.test(d.top) && (hasTopics || d.depth === 2) && d.kind !== "breaking";
|
|
8777
|
+
const rows = [];
|
|
8778
|
+
const claimed = /* @__PURE__ */ new Set();
|
|
8779
|
+
const texts = /* @__PURE__ */ new Set();
|
|
8780
|
+
const keep = (d) => {
|
|
8781
|
+
if (d.prs.length ? d.prs.every((p) => claimed.has(p)) : texts.has(d.text)) return;
|
|
8782
|
+
d.prs.forEach((p) => claimed.add(p));
|
|
8783
|
+
texts.add(d.text);
|
|
8784
|
+
rows.push({ version: d.version, date: d.date, section: d.section, kind: d.kind, text: d.text, prs: d.prs, families: d.families });
|
|
8785
|
+
};
|
|
8786
|
+
drafts.filter((d) => !isSummary(d)).forEach(keep);
|
|
8787
|
+
drafts.filter(isSummary).forEach(keep);
|
|
8788
|
+
return { version, rows };
|
|
8789
|
+
}
|
|
8790
|
+
function cmp(a, b) {
|
|
8791
|
+
const x = a.split(".").map(Number);
|
|
8792
|
+
const y = b.split(".").map(Number);
|
|
8793
|
+
for (let i = 0; i < 3; i++) if ((x[i] ?? 0) !== (y[i] ?? 0)) return (x[i] ?? 0) - (y[i] ?? 0);
|
|
8794
|
+
return 0;
|
|
8795
|
+
}
|
|
8796
|
+
var norm2 = (v) => {
|
|
8797
|
+
const m = /^v?(\d+)\.(\d+)(?:\.(\d+))?/.exec(v);
|
|
8798
|
+
return m ? `${m[1]}.${m[2]}.${m[3] ?? 0}` : void 0;
|
|
8799
|
+
};
|
|
8800
|
+
function engineChangesSince(record, version, modelId, opts = {}) {
|
|
8801
|
+
const v = version ? norm2(version) : void 0;
|
|
8802
|
+
if (!v || !record.releases.length) return null;
|
|
8803
|
+
const newer = record.releases.filter((r) => cmp(r.version, v) > 0);
|
|
8804
|
+
if (!newer.length) return null;
|
|
8805
|
+
const latest = record.releases.map((r) => r.version).sort(cmp).pop();
|
|
8806
|
+
const family = familyOf(modelId);
|
|
8807
|
+
const later = record.rows.filter((r) => cmp(r.version, v) > 0);
|
|
8808
|
+
const rows = family ? later.filter((r) => r.families.includes(family)).sort((a, b) => cmp(b.version, a.version)) : [];
|
|
8809
|
+
const adapterRows = opts.adapter ? later.filter((r) => r.kind === "adapter" && !r.families.length).length : 0;
|
|
8810
|
+
const breaking = later.filter((r) => r.kind === "breaking" && !(family && r.families.includes(family))).sort((a, b) => cmp(b.version, a.version));
|
|
8811
|
+
const byKind = {};
|
|
8812
|
+
for (const r of rows) byKind[r.kind] = (byKind[r.kind] ?? 0) + 1;
|
|
8813
|
+
return { engine: "vllm", version: v, latest, behind: newer.length, family, rows, adapterRows, breaking, byKind };
|
|
8814
|
+
}
|
|
8815
|
+
var KIND_ORDER = ["tool-calling", "prompt", "adapter", "quantization", "security", "breaking", "model"];
|
|
8816
|
+
var KIND_WORD = {
|
|
8817
|
+
adapter: "adapter loading",
|
|
8818
|
+
"tool-calling": "tool calling",
|
|
8819
|
+
prompt: "prompt rendering",
|
|
8820
|
+
quantization: "quantization",
|
|
8821
|
+
breaking: "breaking change",
|
|
8822
|
+
security: "security",
|
|
8823
|
+
model: "model support"
|
|
8824
|
+
};
|
|
8825
|
+
var FAMILY_NAME = { qwen: "Qwen", llama: "Llama", gemma: "Gemma", deepseek: "DeepSeek", glm: "GLM", kimi: "Kimi", mistral: "Mistral", nemotron: "Nemotron", "gpt-oss": "gpt-oss", phi: "Phi", granite: "Granite", minicpm: "MiniCPM", internvl: "InternVL", hermes: "Hermes", minimax: "MiniMax", ernie: "ERNIE", hunyuan: "Hunyuan", llava: "LLaVA", whisper: "Whisper", cohere: "Cohere", smol: "Smol", bge: "BGE", jina: "Jina", nomic: "Nomic", paligemma: "PaliGemma" };
|
|
8826
|
+
var ENGINE_RECORD_URL = "https://www.neurarch.com/engine-changes/vllm.json";
|
|
8827
|
+
function assessEngine(since) {
|
|
8828
|
+
if (!since) return [];
|
|
8829
|
+
const { rows, adapterRows, breaking } = since;
|
|
8830
|
+
if (!rows.length && !adapterRows && !breaking.length) return [];
|
|
8831
|
+
const fam = since.family ? FAMILY_NAME[since.family] ?? since.family : "";
|
|
8832
|
+
const rank = (k) => KIND_ORDER.indexOf(k);
|
|
8833
|
+
const kinds = Object.entries(since.byKind).sort((a, b) => rank(a[0]) - rank(b[0])).map(([k, n]) => `${n} ${KIND_WORD[k]}`).join(", ");
|
|
8834
|
+
const lead = [...rows].sort((a, b) => rank(a.kind) - rank(b.kind) || cmp(b.version, a.version))[0];
|
|
8835
|
+
const parts = [];
|
|
8836
|
+
if (rows.length) parts.push(`${rows.length} change${rows.length === 1 ? "" : "s"} that name${rows.length === 1 ? "s" : ""} ${fam} (${kinds})`);
|
|
8837
|
+
if (adapterRows) parts.push(`${adapterRows} LoRA change${adapterRows === 1 ? "" : "s"} that name no model`);
|
|
8838
|
+
if (breaking.length) parts.push(`${breaking.length} breaking change${breaking.length === 1 ? "" : "s"} or removal${breaking.length === 1 ? "" : "s"}`);
|
|
8839
|
+
const said = parts.length > 1 ? `${parts.slice(0, -1).join(", ")} and ${parts[parts.length - 1]}` : parts[0];
|
|
8840
|
+
const quote2 = (r) => `${r.text}${r.prs.length && !r.text.includes(`#${r.prs[0]}`) ? ` (#${r.prs[0]})` : ""}`;
|
|
8841
|
+
const examples = [lead ? `For ${fam}, in ${lead.version}: ${quote2(lead)}.` : "", breaking[0] ? `Newest removal, in ${breaking[0].version}: ${quote2(breaking[0])}.` : ""].filter(Boolean).join(" ");
|
|
8842
|
+
return [{
|
|
8843
|
+
lane: "behavior",
|
|
8844
|
+
severity: "low",
|
|
8845
|
+
kind: "engine-changes-since",
|
|
8846
|
+
message: `Served by vLLM ${since.version}, ${since.behind} release${since.behind === 1 ? "" : "s"} behind ${since.latest}. Later release notes record ${said}. ${examples}`.replace(/\.\.+/g, ".").replace(/\s+$/, ""),
|
|
8847
|
+
fix: "Read these before moving the engine, and compare one output on the old and the new engine before go-live. The release notes say what changed, not whether it changes your outputs.",
|
|
8848
|
+
url: ENGINE_RECORD_URL
|
|
8849
|
+
}];
|
|
8850
|
+
}
|
|
8851
|
+
|
|
8003
8852
|
// src/utils/policy/report.ts
|
|
8004
8853
|
var word = (j) => j.effective === "block" ? "block" : j.effective === "warn" ? "warn " : j.effective === "info" ? "info " : "off ";
|
|
8005
8854
|
function renderPolicyText(ev, opts) {
|
|
@@ -8050,6 +8899,29 @@ function codeChanged(before, after) {
|
|
|
8050
8899
|
const b = codeFiles(after);
|
|
8051
8900
|
return [.../* @__PURE__ */ new Set([...Object.keys(a), ...Object.keys(b)])].filter((f) => a[f] !== b[f]).sort();
|
|
8052
8901
|
}
|
|
8902
|
+
var WEIGHT_FILE = /\.(safetensors|bin|pt|pth|gguf|h5|msgpack|onnx|ckpt)$/i;
|
|
8903
|
+
var TOKENIZER_FILE = /(^|\/)(tokenizer\.json|tokenizer_config\.json|special_tokens_map\.json|vocab\.json|vocab\.txt|merges\.txt|added_tokens\.json|[\w.-]*\.model|chat_template\.(jinja|json))$/i;
|
|
8904
|
+
var CONFIG_FILE = /(^|\/)(config|generation_config|preprocessor_config|processor_config)\.json$/i;
|
|
8905
|
+
var LICENCE_FILE = /(^|\/)(LICEN[CS]E|NOTICE|USE_POLICY)(\.\w+)?$/i;
|
|
8906
|
+
function fileClass(path) {
|
|
8907
|
+
if (WEIGHT_FILE.test(path) && !/training_args|optimizer/.test(path)) return "weights";
|
|
8908
|
+
if (TOKENIZER_FILE.test(path)) return "tokenizer";
|
|
8909
|
+
if (CONFIG_FILE.test(path)) return "config";
|
|
8910
|
+
if (/\.py$/i.test(path)) return "code";
|
|
8911
|
+
if (LICENCE_FILE.test(path)) return "licence";
|
|
8912
|
+
return "other";
|
|
8913
|
+
}
|
|
8914
|
+
function filesDiffer(before, after) {
|
|
8915
|
+
if (!before?.siblings?.length || !after?.siblings?.length) return null;
|
|
8916
|
+
const key = (x) => x.lfs?.sha256 ?? x.blobId;
|
|
8917
|
+
const a = new Map(before.siblings.map((x) => [x.rfilename, key(x)]));
|
|
8918
|
+
const b = new Map(after.siblings.map((x) => [x.rfilename, key(x)]));
|
|
8919
|
+
if (![...a.values()].some(Boolean) || ![...b.values()].some(Boolean)) return null;
|
|
8920
|
+
const changed = [...a.keys()].filter((f) => b.has(f) && a.get(f) && b.get(f) && a.get(f) !== b.get(f)).sort();
|
|
8921
|
+
const added = [...b.keys()].filter((f) => !a.has(f)).sort();
|
|
8922
|
+
const removed = [...a.keys()].filter((f) => !b.has(f)).sort();
|
|
8923
|
+
return { changed, added, removed };
|
|
8924
|
+
}
|
|
8053
8925
|
function weightFormat(info) {
|
|
8054
8926
|
const names = (info?.siblings ?? []).map((s) => s.rfilename);
|
|
8055
8927
|
if (names.some((n) => n.endsWith(".safetensors") || n.endsWith(".gguf"))) return "safetensors";
|
|
@@ -8133,6 +9005,25 @@ function assessRef(r) {
|
|
|
8133
9005
|
if (r.templateVerdict === "different") {
|
|
8134
9006
|
out.push({ lane: "behavior", severity: "high", kind: "template-render-changed", message: "The chat template at main renders a different prompt than at your pin (system, multi-turn or tool-call conversation).", fix: `npx neurarch template-check ${r.id} --from ${r.pinned?.slice(0, 12)}` });
|
|
8135
9007
|
}
|
|
9008
|
+
if (moved && r.atPin && main) {
|
|
9009
|
+
const d = filesDiffer(r.atPin, main);
|
|
9010
|
+
if (d) {
|
|
9011
|
+
const list = (fs) => fs.slice(0, 4).join(", ") + (fs.length > 4 ? ` +${fs.length - 4}` : "");
|
|
9012
|
+
const of = (cls, fs) => fs.filter((f) => fileClass(f) === cls);
|
|
9013
|
+
const weights = [...of("weights", d.changed), ...of("weights", d.removed)];
|
|
9014
|
+
const tok = [...of("tokenizer", d.changed), ...of("tokenizer", d.added), ...of("tokenizer", d.removed)];
|
|
9015
|
+
const cfg = of("config", d.changed);
|
|
9016
|
+
const lic = [...of("licence", d.changed), ...of("licence", d.added)];
|
|
9017
|
+
if (weights.length) out.push({ lane: "behavior", severity: "high", kind: "weights-changed", message: `Weight files differ between your pin and main: ${list(weights)}. Moving the pin loads different weights under the same name.`, fix: "Re-run your evaluation at the new commit before moving the pin." });
|
|
9018
|
+
if (tok.length || cfg.length) out.push({ lane: "behavior", severity: "medium", kind: "files-changed", message: `Changed since your pin: ${list([...tok, ...cfg])}.${r.templateVerdict === "same" ? " The chat template still renders the same prompt on the fixed conversations." : ""}` });
|
|
9019
|
+
if (lic.length) out.push({ lane: "hygiene", severity: "medium", kind: "licence-file-changed", message: `The licence text changed since your pin (${list(lic)}). Read it before moving the pin.` });
|
|
9020
|
+
const model = [...d.changed, ...d.added, ...d.removed].filter((f) => fileClass(f) !== "other");
|
|
9021
|
+
if (!model.length) {
|
|
9022
|
+
const rest = [...d.changed, ...d.added, ...d.removed];
|
|
9023
|
+
out.push({ lane: "hygiene", severity: "low", kind: "pin-behind-docs-only", message: `main has moved since your pin, and no model file differs${rest.length ? ` (only ${list(rest)})` : ""}. Moving the pin loads the same weights, tokenizer, config and code.` });
|
|
9024
|
+
}
|
|
9025
|
+
}
|
|
9026
|
+
}
|
|
8136
9027
|
for (const c of relevant) {
|
|
8137
9028
|
const eos = c.consequence?.eos != null;
|
|
8138
9029
|
const render = c.templateRender?.verdict === "rendering-changed";
|
|
@@ -8323,6 +9214,8 @@ export {
|
|
|
8323
9214
|
CHANGE_FEEDS_URL,
|
|
8324
9215
|
CHECKERS,
|
|
8325
9216
|
DEFAULT_WAIVER_DAYS,
|
|
9217
|
+
ENGINE_RECORD_URL,
|
|
9218
|
+
GATE_RECORD_SCHEMA,
|
|
8326
9219
|
NIST_MAP,
|
|
8327
9220
|
PIN_RULE_META,
|
|
8328
9221
|
POLICY_FILE_NAMES,
|
|
@@ -8330,18 +9223,29 @@ export {
|
|
|
8330
9223
|
RENOVATE_PRESET_URL,
|
|
8331
9224
|
RULE_RENAMES,
|
|
8332
9225
|
SCHEMA_ID,
|
|
9226
|
+
VLLM_WRAPPER_FIX,
|
|
8333
9227
|
YAML_MODEL_KEYS,
|
|
9228
|
+
acceleratorsIn,
|
|
9229
|
+
adapterLayout,
|
|
8334
9230
|
addDays,
|
|
8335
9231
|
allLineHashes,
|
|
8336
9232
|
anchorLine,
|
|
9233
|
+
assessAdapter,
|
|
9234
|
+
assessEngine,
|
|
8337
9235
|
assessRef,
|
|
8338
9236
|
attnRepoRefs,
|
|
8339
9237
|
budgetFindings,
|
|
9238
|
+
buildGateRecord,
|
|
8340
9239
|
buildSarif,
|
|
8341
9240
|
cardMatches,
|
|
9241
|
+
classifyEngineChange,
|
|
8342
9242
|
codeChanged,
|
|
9243
|
+
engineChangesSince,
|
|
9244
|
+
engineIn,
|
|
8343
9245
|
envPairs,
|
|
8344
9246
|
evaluate,
|
|
9247
|
+
familiesIn,
|
|
9248
|
+
familyOf,
|
|
8345
9249
|
findingFingerprint,
|
|
8346
9250
|
fixPythonCall,
|
|
8347
9251
|
fixShellLine,
|
|
@@ -8351,18 +9255,25 @@ export {
|
|
|
8351
9255
|
fromLint,
|
|
8352
9256
|
fromPinCheck,
|
|
8353
9257
|
fromServe,
|
|
9258
|
+
gateLedgerRow,
|
|
9259
|
+
gateSubjectFromEnv,
|
|
9260
|
+
gateVerdict,
|
|
8354
9261
|
globToRegExp,
|
|
8355
9262
|
isPinnedRevision,
|
|
8356
9263
|
isValidDate,
|
|
8357
9264
|
keysFor,
|
|
9265
|
+
launchesIn,
|
|
8358
9266
|
levelFor,
|
|
8359
9267
|
lineHash,
|
|
8360
9268
|
loadPolicy,
|
|
9269
|
+
loraModulePaths,
|
|
9270
|
+
manifestPinFix,
|
|
8361
9271
|
matchWaiver,
|
|
8362
9272
|
memoryFindings,
|
|
8363
9273
|
mergeBaseline,
|
|
8364
9274
|
parseChangedLines,
|
|
8365
9275
|
parseCount,
|
|
9276
|
+
parseEngineRelease,
|
|
8366
9277
|
parseInlineWaivers,
|
|
8367
9278
|
parsePolicyText,
|
|
8368
9279
|
parsePresetRef,
|
|
@@ -8372,21 +9283,27 @@ export {
|
|
|
8372
9283
|
readBaseline,
|
|
8373
9284
|
readPolicyDoc,
|
|
8374
9285
|
recordedSince,
|
|
9286
|
+
refFileKind,
|
|
9287
|
+
releaseVersion,
|
|
8375
9288
|
remoteCodeOf,
|
|
8376
9289
|
renderPolicyText,
|
|
8377
9290
|
resolveCard,
|
|
8378
9291
|
resolveWaivers,
|
|
9292
|
+
scanAdapterConfig,
|
|
8379
9293
|
scanBom,
|
|
8380
9294
|
scanEnvModels,
|
|
8381
9295
|
scanExitCode,
|
|
9296
|
+
scanManifestModels,
|
|
8382
9297
|
scanModelRefs,
|
|
8383
9298
|
scanNotebook,
|
|
8384
9299
|
scanPins,
|
|
8385
9300
|
scanPython,
|
|
8386
9301
|
scanShell,
|
|
8387
9302
|
scanYaml,
|
|
9303
|
+
shellCommands,
|
|
8388
9304
|
stableHash,
|
|
8389
9305
|
today,
|
|
9306
|
+
versionBefore,
|
|
8390
9307
|
waiverKey,
|
|
8391
9308
|
weightFormat
|
|
8392
9309
|
};
|