@hcmai/sdk 0.4.0 → 0.4.2
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/dist/index.d.ts +227 -1
- package/dist/index.js +534 -94
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1083,18 +1083,18 @@ async function action(http, model, actionName, input) {
|
|
|
1083
1083
|
if (scope === "object" && !input.id) {
|
|
1084
1084
|
throw new Error(`object action ${model}.${actionName} requires id`);
|
|
1085
1085
|
}
|
|
1086
|
-
const
|
|
1086
|
+
const path24 = scope === "object" ? `/api/models/${model}/${input.id}/action/${actionName}` : `/api/models/${model}/action/${actionName}`;
|
|
1087
1087
|
const resp = await (async () => {
|
|
1088
1088
|
if (method === "GET") {
|
|
1089
|
-
return http.get(
|
|
1089
|
+
return http.get(path24, { params: queryParams(input) });
|
|
1090
1090
|
}
|
|
1091
1091
|
if (method === "DELETE") {
|
|
1092
|
-
return http.delete(
|
|
1092
|
+
return http.delete(path24, { params: queryParams(input) });
|
|
1093
1093
|
}
|
|
1094
1094
|
if (method === "PUT") {
|
|
1095
|
-
return http.put(
|
|
1095
|
+
return http.put(path24, scope === "object" ? objectBody(input) : classBody(input));
|
|
1096
1096
|
}
|
|
1097
|
-
return http.post(
|
|
1097
|
+
return http.post(path24, scope === "object" ? objectBody(input) : classBody(input));
|
|
1098
1098
|
})();
|
|
1099
1099
|
return resp.data;
|
|
1100
1100
|
}
|
|
@@ -5211,22 +5211,24 @@ async function bootstrapTenant(http, bootstrapKey, req) {
|
|
|
5211
5211
|
// src/meta/tenant-meta.ts
|
|
5212
5212
|
async function listTenantMeta(http, opts = {}) {
|
|
5213
5213
|
const resp = await http.get("/api/tenant-meta/list", { params: opts });
|
|
5214
|
-
const
|
|
5215
|
-
const
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5214
|
+
const body = resp.data;
|
|
5215
|
+
const payload = body?.data ?? body;
|
|
5216
|
+
const items = Array.isArray(payload) ? payload : payload?.items ?? payload?.list ?? payload?.records ?? [];
|
|
5217
|
+
const total = typeof body?.total === "number" ? body.total : payload?.total;
|
|
5218
|
+
return { items, total, raw: payload };
|
|
5219
|
+
}
|
|
5220
|
+
async function getTenantMeta(http, path24) {
|
|
5221
|
+
const resp = await http.get("/api/tenant-meta/meta", { params: { path: path24 } });
|
|
5220
5222
|
const payload = resp.data?.data ?? resp.data;
|
|
5221
5223
|
if (typeof payload === "string") return payload;
|
|
5222
5224
|
return String(payload?.content ?? "");
|
|
5223
5225
|
}
|
|
5224
|
-
async function saveTenantMeta(http,
|
|
5225
|
-
const resp = await http.put("/api/tenant-meta/meta", { content }, { params: { path:
|
|
5226
|
+
async function saveTenantMeta(http, path24, content) {
|
|
5227
|
+
const resp = await http.put("/api/tenant-meta/meta", { content }, { params: { path: path24 } });
|
|
5226
5228
|
return resp.data?.data ?? resp.data;
|
|
5227
5229
|
}
|
|
5228
|
-
async function deleteTenantMeta(http,
|
|
5229
|
-
const resp = await http.delete("/api/tenant-meta/meta", { params: { path:
|
|
5230
|
+
async function deleteTenantMeta(http, path24) {
|
|
5231
|
+
const resp = await http.delete("/api/tenant-meta/meta", { params: { path: path24 } });
|
|
5230
5232
|
return resp.data?.data ?? resp.data;
|
|
5231
5233
|
}
|
|
5232
5234
|
|
|
@@ -5328,14 +5330,14 @@ function resolveSkillInstallOrder(manifest2, targetId) {
|
|
|
5328
5330
|
throw invalid(`\u6280\u80FD\u76EE\u5F55\u4E2D\u4E0D\u5B58\u5728 ${targetId}`);
|
|
5329
5331
|
}
|
|
5330
5332
|
const state = /* @__PURE__ */ new Map();
|
|
5331
|
-
const
|
|
5333
|
+
const path24 = [];
|
|
5332
5334
|
const order = [];
|
|
5333
5335
|
const visit = (id, requiredBy) => {
|
|
5334
5336
|
const current = state.get(id);
|
|
5335
5337
|
if (current === "done") return;
|
|
5336
5338
|
if (current === "visiting") {
|
|
5337
|
-
const cycleStart =
|
|
5338
|
-
const cycle = [...
|
|
5339
|
+
const cycleStart = path24.indexOf(id);
|
|
5340
|
+
const cycle = [...path24.slice(Math.max(0, cycleStart)), id];
|
|
5339
5341
|
throw invalid(`\u6280\u80FD\u4F9D\u8D56\u5B58\u5728\u73AF: ${cycle.join(" -> ")}`);
|
|
5340
5342
|
}
|
|
5341
5343
|
const skill = byId.get(id);
|
|
@@ -5344,11 +5346,11 @@ function resolveSkillInstallOrder(manifest2, targetId) {
|
|
|
5344
5346
|
}
|
|
5345
5347
|
assertSafeSkillId(skill.id);
|
|
5346
5348
|
state.set(id, "visiting");
|
|
5347
|
-
|
|
5349
|
+
path24.push(id);
|
|
5348
5350
|
for (const required2 of normalizeRequirements(skill.requires, skill.id)) {
|
|
5349
5351
|
visit(required2, skill.id);
|
|
5350
5352
|
}
|
|
5351
|
-
|
|
5353
|
+
path24.pop();
|
|
5352
5354
|
state.set(id, "done");
|
|
5353
5355
|
order.push(skill);
|
|
5354
5356
|
};
|
|
@@ -5439,11 +5441,11 @@ async function resetSettingItem(http, domain, namespace, settingKey, revision) {
|
|
|
5439
5441
|
function parseSettingAssignment(raw) {
|
|
5440
5442
|
const eq = raw.indexOf("=");
|
|
5441
5443
|
if (eq <= 0) throw new Error(`--set \u9700\u8981 namespace.key=value \u5F62\u6001\uFF0C\u6536\u5230 "${raw}"`);
|
|
5442
|
-
const
|
|
5444
|
+
const path24 = raw.slice(0, eq).trim();
|
|
5443
5445
|
const value = raw.slice(eq + 1);
|
|
5444
|
-
const dot =
|
|
5445
|
-
if (dot <= 0) throw new Error(`--set \u7684\u952E\u9700\u542B namespace\uFF0C\u5982 security.password.passwordPolicy=complex\uFF0C\u6536\u5230 "${
|
|
5446
|
-
return { namespace:
|
|
5446
|
+
const dot = path24.lastIndexOf(".");
|
|
5447
|
+
if (dot <= 0) throw new Error(`--set \u7684\u952E\u9700\u542B namespace\uFF0C\u5982 security.password.passwordPolicy=complex\uFF0C\u6536\u5230 "${path24}"`);
|
|
5448
|
+
return { namespace: path24.slice(0, dot), settingKey: path24.slice(dot + 1), value };
|
|
5447
5449
|
}
|
|
5448
5450
|
|
|
5449
5451
|
// src/fde/layout.ts
|
|
@@ -5687,8 +5689,8 @@ var WorkLayout = class {
|
|
|
5687
5689
|
}
|
|
5688
5690
|
/** 读出**文本**,按 UTF-8 严格解码(BOM 先剥掉)。解不出时抛 `TypeError`。 */
|
|
5689
5691
|
readText(rel) {
|
|
5690
|
-
const
|
|
5691
|
-
const text2 = new TextDecoder("utf-8", { fatal: true }).decode(
|
|
5692
|
+
const bytes2 = this.readBytes(rel);
|
|
5693
|
+
const text2 = new TextDecoder("utf-8", { fatal: true }).decode(bytes2);
|
|
5692
5694
|
return text2.startsWith("\uFEFF") ? text2.slice(1) : text2;
|
|
5693
5695
|
}
|
|
5694
5696
|
/**
|
|
@@ -5832,11 +5834,11 @@ function classifyStatus(status) {
|
|
|
5832
5834
|
return "bad-response";
|
|
5833
5835
|
}
|
|
5834
5836
|
var CAPABILITIES_HEADER = "x-hcm-capabilities";
|
|
5835
|
-
function buildUrl(
|
|
5837
|
+
function buildUrl(path24, params) {
|
|
5836
5838
|
const entries = Object.entries(params ?? {}).filter(([, v]) => v !== void 0 && v !== null);
|
|
5837
|
-
if (entries.length === 0) return
|
|
5839
|
+
if (entries.length === 0) return path24;
|
|
5838
5840
|
const qs = entries.map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(String(v))}`).join("&");
|
|
5839
|
-
return `${
|
|
5841
|
+
return `${path24}${path24.includes("?") ? "&" : "?"}${qs}`;
|
|
5840
5842
|
}
|
|
5841
5843
|
function lowerHeaders(raw) {
|
|
5842
5844
|
const out = {};
|
|
@@ -5878,14 +5880,14 @@ function httpProbe(http, capabilities) {
|
|
|
5878
5880
|
const headers = { [CAPABILITIES_HEADER]: capabilities };
|
|
5879
5881
|
const probe = {
|
|
5880
5882
|
capabilities,
|
|
5881
|
-
get(
|
|
5883
|
+
get(path24, params) {
|
|
5882
5884
|
return once(
|
|
5883
|
-
() => http.get(buildUrl(
|
|
5885
|
+
() => http.get(buildUrl(path24, params), { headers, validateStatus: () => true })
|
|
5884
5886
|
);
|
|
5885
5887
|
},
|
|
5886
|
-
post(
|
|
5888
|
+
post(path24, body) {
|
|
5887
5889
|
return once(
|
|
5888
|
-
() => http.post(
|
|
5890
|
+
() => http.post(path24, body, {
|
|
5889
5891
|
headers: { ...headers, "content-type": "application/json" },
|
|
5890
5892
|
validateStatus: () => true
|
|
5891
5893
|
})
|
|
@@ -5997,8 +5999,8 @@ async function crawlMeta(probe, modelKeys2, metaType = DEFAULT_META_TYPE) {
|
|
|
5997
5999
|
const results = probe.getMany ? await probe.getMany([...paths.keys()]) : await sequentialGet(probe, [...paths.keys()]);
|
|
5998
6000
|
const metas = {};
|
|
5999
6001
|
const unavailable = [];
|
|
6000
|
-
for (const [
|
|
6001
|
-
const out = results[
|
|
6002
|
+
for (const [path24, key] of paths) {
|
|
6003
|
+
const out = results[path24];
|
|
6002
6004
|
if (out === void 0) {
|
|
6003
6005
|
unavailable.push({
|
|
6004
6006
|
modelKey: key,
|
|
@@ -6214,8 +6216,8 @@ async function collectActionGates(probe, modelKeys2, state = "") {
|
|
|
6214
6216
|
const statesEchoed = /* @__PURE__ */ new Set();
|
|
6215
6217
|
let noStateEcho = 0;
|
|
6216
6218
|
let answered = 0;
|
|
6217
|
-
for (const [
|
|
6218
|
-
const out = results[
|
|
6219
|
+
for (const [path24, model] of paths) {
|
|
6220
|
+
const out = results[path24];
|
|
6219
6221
|
if (out === void 0) {
|
|
6220
6222
|
unavailable.push({
|
|
6221
6223
|
modelKey: model,
|
|
@@ -6594,8 +6596,8 @@ async function collectMutation(probe, modelKeys2) {
|
|
|
6594
6596
|
const results = probe.getMany ? await probe.getMany([...paths.keys()]) : await sequentialGet(probe, [...paths.keys()]);
|
|
6595
6597
|
const mutation = {};
|
|
6596
6598
|
const problems = [];
|
|
6597
|
-
for (const [
|
|
6598
|
-
const out = results[
|
|
6599
|
+
for (const [path24, key] of paths) {
|
|
6600
|
+
const out = results[path24];
|
|
6599
6601
|
if (out === void 0) {
|
|
6600
6602
|
problems.push(`${key}: mutation-capability ${BATCH_LOST}`);
|
|
6601
6603
|
mutation[key] = Object.fromEntries(
|
|
@@ -7040,11 +7042,11 @@ async function collectCodeTables(probe, modelEntries2, opts = {}) {
|
|
|
7040
7042
|
keys.push(key);
|
|
7041
7043
|
}
|
|
7042
7044
|
for (const key of [...new Set(keys)].sort()) {
|
|
7043
|
-
const
|
|
7045
|
+
const path24 = listPath(key);
|
|
7044
7046
|
const started = tick();
|
|
7045
7047
|
let requests = 0;
|
|
7046
7048
|
let truncatedBy = null;
|
|
7047
|
-
const probeOut = await post.call(probe,
|
|
7049
|
+
const probeOut = await post.call(probe, path24, { page: 0, size: 0 });
|
|
7048
7050
|
requests += 1;
|
|
7049
7051
|
let total = null;
|
|
7050
7052
|
let reason = null;
|
|
@@ -7093,7 +7095,7 @@ async function collectCodeTables(probe, modelEntries2, opts = {}) {
|
|
|
7093
7095
|
failed = `\u89E6\u53D1\u5DE5\u5177\u7684\u6BCF\u8868${which === "requests" ? "\u8BF7\u6C42" : "\u5899\u949F"}\u4E0A\u9650\uFF08${which === "requests" ? `\u5DF2\u53D1 ${requests} \u6B21\u8BF7\u6C42` : `\u5DF2\u82B1 ${elapsed.toFixed(3)}s`}\uFF09\uFF0C\u505C\u5728\u7B2C ${page} \u9875\uFF0C\u5DF2\u6536 ${rows.length} \u884C / \u8BA1\u6570 ${total} \u884C\uFF0C\u672C\u8868\u6807 partial\u3002**\u8FD9\u662F\u5DE5\u5177\u7684\u622A\u65AD\uFF0C\u4E0D\u662F\u670D\u52A1\u7AEF\u7684\u6BDB\u75C5** \u2014\u2014 \u8C03\u5927 valuedomain.${which === "requests" ? "MAX_REQUESTS_PER_TABLE" : "MAX_SECONDS_PER_TABLE"} \u6216\u7ED9 collectCodeTables \u4F20 ${which === "requests" ? "maxRequests" : "maxSeconds"} \u540E\u91CD\u8DD1\u5C31\u80FD\u53D6\u5168`;
|
|
7094
7096
|
break;
|
|
7095
7097
|
}
|
|
7096
|
-
const out = await post.call(probe,
|
|
7098
|
+
const out = await post.call(probe, path24, { page, size: PAGE_SIZE });
|
|
7097
7099
|
requests += 1;
|
|
7098
7100
|
if (out.error !== "ok") {
|
|
7099
7101
|
failed = `\u7B2C ${page} \u9875\u5931\u8D25\uFF08HTTP ${out.status} / ${out.error}\uFF09`;
|
|
@@ -7833,7 +7835,7 @@ async function loadKeyIndex(client, model, keyFields, pageSize = PAGE_SIZE_DEFAU
|
|
|
7833
7835
|
for (const name of ["id", ...fields]) {
|
|
7834
7836
|
if (!projected.includes(name)) projected.push(name);
|
|
7835
7837
|
}
|
|
7836
|
-
const
|
|
7838
|
+
const path24 = listPath2(model);
|
|
7837
7839
|
const idx = /* @__PURE__ */ new Map();
|
|
7838
7840
|
let total = null;
|
|
7839
7841
|
let pages = 0;
|
|
@@ -7850,7 +7852,7 @@ async function loadKeyIndex(client, model, keyFields, pageSize = PAGE_SIZE_DEFAU
|
|
|
7850
7852
|
let repeatedIds = 0;
|
|
7851
7853
|
while (total === null || received < total) {
|
|
7852
7854
|
const pageNo = pages;
|
|
7853
|
-
const out = await client.post(
|
|
7855
|
+
const out = await client.post(path24, {
|
|
7854
7856
|
page: pageNo,
|
|
7855
7857
|
size: pageSize,
|
|
7856
7858
|
fields: projected,
|
|
@@ -8042,8 +8044,8 @@ var CFB_MAGIC = Buffer.from([208, 207, 17, 224, 161, 177, 26, 225]);
|
|
|
8042
8044
|
var ENCRYPTED_PACKAGE = Buffer.from("EncryptedPackage", "utf16le");
|
|
8043
8045
|
var MAX_ENTRY_BYTES = 128 * 1024 * 1024;
|
|
8044
8046
|
var SCAN_CHUNK_BYTES = 1024 * 1024;
|
|
8045
|
-
function scanFor(
|
|
8046
|
-
const fd = openSync2(
|
|
8047
|
+
function scanFor(path24, needle = ENCRYPTED_PACKAGE, budget = MAX_ENTRY_BYTES) {
|
|
8048
|
+
const fd = openSync2(path24, "r");
|
|
8047
8049
|
try {
|
|
8048
8050
|
let tail = Buffer.alloc(0);
|
|
8049
8051
|
let seen = 0;
|
|
@@ -8064,9 +8066,9 @@ function scanFor(path22, needle = ENCRYPTED_PACKAGE, budget = MAX_ENTRY_BYTES) {
|
|
|
8064
8066
|
closeSync2(fd);
|
|
8065
8067
|
}
|
|
8066
8068
|
}
|
|
8067
|
-
function isCfb(
|
|
8068
|
-
if (statSync2(
|
|
8069
|
-
const fd = openSync2(
|
|
8069
|
+
function isCfb(path24) {
|
|
8070
|
+
if (statSync2(path24).size < CFB_MAGIC.length) return false;
|
|
8071
|
+
const fd = openSync2(path24, "r");
|
|
8070
8072
|
try {
|
|
8071
8073
|
const head = Buffer.alloc(CFB_MAGIC.length);
|
|
8072
8074
|
const n = readSync(fd, head, 0, CFB_MAGIC.length, 0);
|
|
@@ -8075,9 +8077,9 @@ function isCfb(path22) {
|
|
|
8075
8077
|
closeSync2(fd);
|
|
8076
8078
|
}
|
|
8077
8079
|
}
|
|
8078
|
-
function classifyCfb(
|
|
8079
|
-
if (!isCfb(
|
|
8080
|
-
switch (scanFor(
|
|
8080
|
+
function classifyCfb(path24, budget = MAX_ENTRY_BYTES) {
|
|
8081
|
+
if (!isCfb(path24)) return "not-cfb";
|
|
8082
|
+
switch (scanFor(path24, ENCRYPTED_PACKAGE, budget)) {
|
|
8081
8083
|
case "found":
|
|
8082
8084
|
return "encrypted";
|
|
8083
8085
|
case "absent":
|
|
@@ -9978,6 +9980,19 @@ function problem(code, model, message, hint, entry) {
|
|
|
9978
9980
|
// src/fde/seed/plan.ts
|
|
9979
9981
|
var VERSION2 = 1;
|
|
9980
9982
|
var IMPORT_PLAN_FILE = "import-plan.json";
|
|
9983
|
+
var PLAN_PROBLEM_CODES = [
|
|
9984
|
+
"DUPLICATE_BUSINESS_KEY",
|
|
9985
|
+
"DANGLING_PARENT",
|
|
9986
|
+
"ROW_LEVEL_CYCLE",
|
|
9987
|
+
"MODEL_ORDER_CONFLICT",
|
|
9988
|
+
"BUSINESS_KEY_VALUE_MISSING",
|
|
9989
|
+
"BUSINESS_KEY_REFERENCE_UNRESOLVED",
|
|
9990
|
+
"SELF_REFERENCE_UNUSABLE",
|
|
9991
|
+
"EXISTING_INDEX_MISSING",
|
|
9992
|
+
"SOURCE_ROWS_MISSING",
|
|
9993
|
+
"MAPPING_NOT_USABLE",
|
|
9994
|
+
"PLAN_CHECKS_SKIPPED"
|
|
9995
|
+
];
|
|
9981
9996
|
var PREMISE_CODES2 = [
|
|
9982
9997
|
"DUPLICATE_BUSINESS_KEY",
|
|
9983
9998
|
"BUSINESS_KEY_VALUE_MISSING",
|
|
@@ -10604,16 +10619,16 @@ function rowCycles(parents) {
|
|
|
10604
10619
|
const cycles = [];
|
|
10605
10620
|
for (const start of [...parents.keys()].sort((a, b) => a - b)) {
|
|
10606
10621
|
if (done.has(start)) continue;
|
|
10607
|
-
const
|
|
10622
|
+
const path24 = [];
|
|
10608
10623
|
const seen = /* @__PURE__ */ new Map();
|
|
10609
10624
|
let node = start;
|
|
10610
10625
|
while (node !== void 0 && !seen.has(node) && !done.has(node)) {
|
|
10611
|
-
seen.set(node,
|
|
10612
|
-
|
|
10626
|
+
seen.set(node, path24.length);
|
|
10627
|
+
path24.push(node);
|
|
10613
10628
|
node = parents.get(node);
|
|
10614
10629
|
}
|
|
10615
|
-
if (node !== void 0 && seen.has(node)) cycles.push(
|
|
10616
|
-
for (const n of
|
|
10630
|
+
if (node !== void 0 && seen.has(node)) cycles.push(path24.slice(seen.get(node)));
|
|
10631
|
+
for (const n of path24) done.add(n);
|
|
10617
10632
|
}
|
|
10618
10633
|
return cycles;
|
|
10619
10634
|
}
|
|
@@ -11199,9 +11214,9 @@ function enumKey(model, field) {
|
|
|
11199
11214
|
}
|
|
11200
11215
|
var Utf8Error = class extends Error {
|
|
11201
11216
|
};
|
|
11202
|
-
function decodeUtf8(
|
|
11217
|
+
function decodeUtf8(bytes2) {
|
|
11203
11218
|
try {
|
|
11204
|
-
return new TextDecoder("utf-8", { fatal: true }).decode(
|
|
11219
|
+
return new TextDecoder("utf-8", { fatal: true }).decode(bytes2).replace(/^\uFEFF/, "");
|
|
11205
11220
|
} catch {
|
|
11206
11221
|
throw new Utf8Error("not utf-8");
|
|
11207
11222
|
}
|
|
@@ -12538,9 +12553,9 @@ function readImportPlan(out) {
|
|
|
12538
12553
|
"\u5148\u5728\u540C\u4E00\u4E2A work \u76EE\u5F55\u4E0A\u8DD1\u4E00\u6B21 `plan` \u5B50\u547D\u4EE4\u3002\u{1F534} `apply` \u4E0D\u4F1A\u81EA\u5DF1\u53BB\u7B97\u8BA1\u5212\uFF1A\u7B97\u8BA1\u5212\u8981\u53D1\u8BF7\u6C42\u5EFA\u65E2\u5B58\u7D22\u5F15\uFF0C\u800C\u300C\u987A\u624B\u7B97\u4E00\u4EFD\u300D\u610F\u5473\u7740\u4F60 apply \u7684\u4E0D\u662F\u4F60\u770B\u8FC7\u7684\u90A3\u4E00\u4EFD"
|
|
12539
12554
|
);
|
|
12540
12555
|
}
|
|
12541
|
-
let
|
|
12556
|
+
let bytes2;
|
|
12542
12557
|
try {
|
|
12543
|
-
|
|
12558
|
+
bytes2 = work.readBytes(IMPORT_PLAN_FILE);
|
|
12544
12559
|
} catch (e) {
|
|
12545
12560
|
throw new PlanReadError(
|
|
12546
12561
|
"plan-unreadable",
|
|
@@ -12550,7 +12565,7 @@ function readImportPlan(out) {
|
|
|
12550
12565
|
}
|
|
12551
12566
|
let raw;
|
|
12552
12567
|
try {
|
|
12553
|
-
raw = new TextDecoder("utf-8", { fatal: true }).decode(
|
|
12568
|
+
raw = new TextDecoder("utf-8", { fatal: true }).decode(bytes2).replace(/^\uFEFF/, "");
|
|
12554
12569
|
} catch {
|
|
12555
12570
|
throw new PlanReadError(
|
|
12556
12571
|
"plan-unreadable",
|
|
@@ -15203,12 +15218,410 @@ function writeRisk(risk, out) {
|
|
|
15203
15218
|
return new WorkLayout(out).writeJson(RISK_FILE, riskToJson(risk));
|
|
15204
15219
|
}
|
|
15205
15220
|
|
|
15206
|
-
// src/fde/
|
|
15207
|
-
import { existsSync as existsSync10, readFileSync as
|
|
15221
|
+
// src/fde/seed/value-hints.ts
|
|
15222
|
+
import { existsSync as existsSync10, readFileSync as readFileSync9 } from "fs";
|
|
15208
15223
|
import * as path18 from "path";
|
|
15224
|
+
var HINT_REF = (domain) => ` \u503C\uFF1A\u586B id\uFF08\u4E0D\u662F code\uFF09\u2190 ${domain}`;
|
|
15225
|
+
var HINT_NO_DOMAIN = (to) => ` \u503C\uFF1A\u586B ${to} \u7684 id\uFF08\u4E0D\u662F code\uFF09\uFF1B\u65E0\u5BF9\u7167\u8868\uFF0C\u6309\u4E1A\u52A1\u952E\u73B0\u67E5`;
|
|
15226
|
+
var HINT_ENUM = (n, model) => ` \u503C\uFF1A\u679A\u4E3E ${n} \u9879 \u2190 mapping/${model}.json`;
|
|
15227
|
+
var HINT_DOMAIN_MISSING = (to) => `\uFF1B\u26A0\uFE0F \u7D22\u5F15\u91CC\u6709\u8FD9\u5F20\u8868\u4F46\u76D8\u4E0A\u6CA1\u6709\u6587\u4EF6\uFF08\`values ${to}\` \u770B\u539F\u56E0\uFF09`;
|
|
15228
|
+
var HINT_DOMAIN_UNAVAILABLE = "\uFF1B\u26A0\uFE0F \u8FD9\u5F20\u8868\u672C\u8F6E\u8FDE\u8BA1\u6570\u90FD\u6CA1\u8BFB\u5230\uFF08unavailable\uFF09\uFF0C\u7981\u6B62\u636E\u6B64\u5199\u811A\u672C";
|
|
15229
|
+
var HINT_DOMAIN_INDEX_UNREADABLE = (to) => `\uFF1B\u26A0\uFE0F \u8FD9\u4EFD\u57FA\u7EBF\u7684 valuedomain/_index.json \u8BFB\u4E0D\u5230\uFF0C**\u65E0\u6CD5\u5224\u65AD**\u6709\u6CA1\u6709\u5BF9\u7167\u8868\uFF08\u53BB valuedomain/ \u76EE\u5F55\u770B\u6709\u6CA1\u6709 ${to}.json\uFF09`;
|
|
15230
|
+
var HINT_DOMAIN_UNKNOWN_TO_INDEX = "\uFF1B\u26A0\uFE0F mapping \u8BF4\u5B83\u662F\u7801\u8868\uFF0Cvaluedomain \u7D22\u5F15\u91CC\u5374\u6CA1\u6709\u8FD9\u5F20\u8868\uFF08\u5BF9\u4E0D\u4E0A\u8D26\uFF09";
|
|
15231
|
+
var HINT_LABEL = (label) => `\uFF1B\u62FF ${label} \u53CD\u67E5 id`;
|
|
15232
|
+
var HINT_LABEL_UNKNOWN = "\uFF1B\u6807\u7B7E\u5B57\u6BB5\u672A\u77E5\uFF08\u4EA7\u54C1\u6CA1\u58F0\u660E\u663E\u793A\u5B57\u6BB5\u540D\uFF0C\u522B\u9ED8\u8BA4\u662F name\uFF09";
|
|
15233
|
+
var HINT_AUDIT = "\uFF1B\u26A0\uFE0F \u5BA1\u8BA1\u56DE\u6307\uFF0C\u670D\u52A1\u7AEF\u81EA\u5DF1\u586B\uFF0C\u987E\u95EE\u4E0D\u586B";
|
|
15234
|
+
var VALUE_FOOTNOTE = "\uFF08\u6307\u8DEF\u53EA\u4F9D\u636E\u4EA7\u7269\u91CC**\u771F\u5B9E\u5B58\u5728**\u7684\u6587\u4EF6\u3002\u26A0\uFE0F \u300C\u6211\u8981\u4E86\u5B57\u6BB5 X\uFF0C\u56DE\u6765\u6CA1\u6709 X\u300D\u6709\u4E09\u79CD\u540C\u5F62\u6210\u56E0\uFF1A\u2460 \u4EA7\u54C1\u91CC\u6CA1\u8FD9\u4E2A\u5B57\u6BB5 \u2461 \u8BE5\u884C\u8BE5\u5B57\u6BB5\u4E3A null \u2462 \u4F60\u7684\u89D2\u8272\u88AB RBAC \u88C1\u6389\u4E86\u8FD9\u4E00\u5217 \u2014\u2014 \u4EA7\u7269\u5206\u4E0D\u5F00\uFF0C\u522B\u628A\u5176\u4E2D\u4EFB\u4E00\u8BFB\u6210\u53E6\u4E00\u4E2A\u3002\uFF09\n";
|
|
15235
|
+
function isLocalName(name) {
|
|
15236
|
+
if (typeof name !== "string" || name.length === 0) return false;
|
|
15237
|
+
if (name.includes("/") || name.includes("\\")) return false;
|
|
15238
|
+
if (name === "." || name === "..") return false;
|
|
15239
|
+
return !path18.isAbsolute(name);
|
|
15240
|
+
}
|
|
15241
|
+
var readJson = (file) => {
|
|
15242
|
+
try {
|
|
15243
|
+
return JSON.parse(readFileSync9(file, "utf-8"));
|
|
15244
|
+
} catch {
|
|
15245
|
+
return void 0;
|
|
15246
|
+
}
|
|
15247
|
+
};
|
|
15248
|
+
var isRec = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
15249
|
+
var ValueHints = class {
|
|
15250
|
+
root;
|
|
15251
|
+
sheets = /* @__PURE__ */ new Map();
|
|
15252
|
+
domains = void 0;
|
|
15253
|
+
constructor(root) {
|
|
15254
|
+
this.root = root;
|
|
15255
|
+
}
|
|
15256
|
+
/** → `{modelKey: completeness}`;**索引根本读不到时返回 `null`**(与「读到了但是空的」分开)。 */
|
|
15257
|
+
domainIndex() {
|
|
15258
|
+
if (this.domains === void 0) {
|
|
15259
|
+
const body = readJson(path18.join(this.root, "valuedomain", "_index.json"));
|
|
15260
|
+
const by = isRec(body) ? body.byCompleteness : void 0;
|
|
15261
|
+
if (!isRec(by)) {
|
|
15262
|
+
this.domains = null;
|
|
15263
|
+
} else {
|
|
15264
|
+
const index = /* @__PURE__ */ new Map();
|
|
15265
|
+
for (const [completeness, names] of Object.entries(by)) {
|
|
15266
|
+
if (!Array.isArray(names)) continue;
|
|
15267
|
+
for (const n of names) if (typeof n === "string") index.set(n, completeness);
|
|
15268
|
+
}
|
|
15269
|
+
this.domains = index;
|
|
15270
|
+
}
|
|
15271
|
+
}
|
|
15272
|
+
return this.domains;
|
|
15273
|
+
}
|
|
15274
|
+
/** 某个模型的 `mapping/<model>.json` → `{fieldKey: 该字段那一行}`;没有则 null。 */
|
|
15275
|
+
sheet(model) {
|
|
15276
|
+
const key = String(model ?? "");
|
|
15277
|
+
if (!this.sheets.has(key)) {
|
|
15278
|
+
let fields = null;
|
|
15279
|
+
if (isLocalName(key)) {
|
|
15280
|
+
const body = readJson(path18.join(this.root, "mapping", `${key}.json`));
|
|
15281
|
+
const rows = isRec(body) ? body.fields : void 0;
|
|
15282
|
+
if (Array.isArray(rows)) {
|
|
15283
|
+
fields = /* @__PURE__ */ new Map();
|
|
15284
|
+
for (const f of rows) {
|
|
15285
|
+
if (isRec(f) && typeof f.key === "string") fields.set(f.key, f);
|
|
15286
|
+
}
|
|
15287
|
+
}
|
|
15288
|
+
}
|
|
15289
|
+
this.sheets.set(key, fields);
|
|
15290
|
+
}
|
|
15291
|
+
return this.sheets.get(key) ?? null;
|
|
15292
|
+
}
|
|
15293
|
+
refLine(ref) {
|
|
15294
|
+
const target = String(ref.toModel ?? "");
|
|
15295
|
+
const index = this.domainIndex();
|
|
15296
|
+
const completeness = index === null ? void 0 : index.get(target);
|
|
15297
|
+
const pointer = ref.valueDomain;
|
|
15298
|
+
const landed = isLocalName(target) && existsSync10(path18.join(this.root, "valuedomain", `${target}.json`));
|
|
15299
|
+
let line;
|
|
15300
|
+
if (pointer && completeness && completeness !== "unavailable" && landed) {
|
|
15301
|
+
line = HINT_REF(String(pointer));
|
|
15302
|
+
} else {
|
|
15303
|
+
line = HINT_NO_DOMAIN(target);
|
|
15304
|
+
if (pointer && index === null) line += HINT_DOMAIN_INDEX_UNREADABLE(target);
|
|
15305
|
+
else if (pointer && completeness === void 0) line += HINT_DOMAIN_UNKNOWN_TO_INDEX;
|
|
15306
|
+
else if (pointer && completeness === "unavailable") line += HINT_DOMAIN_UNAVAILABLE;
|
|
15307
|
+
else if (pointer && !landed) line += HINT_DOMAIN_MISSING(target);
|
|
15308
|
+
}
|
|
15309
|
+
if (ref.labelFieldSource === "declared" && ref.labelField) line += HINT_LABEL(String(ref.labelField));
|
|
15310
|
+
else line += HINT_LABEL_UNKNOWN;
|
|
15311
|
+
if (ref.auditBackref) line += HINT_AUDIT;
|
|
15312
|
+
return `${line}
|
|
15313
|
+
`;
|
|
15314
|
+
}
|
|
15315
|
+
/** 一条命中的指路行(含换行);无从指路时返回空串。 */
|
|
15316
|
+
line(model, key) {
|
|
15317
|
+
const sheet = this.sheet(model);
|
|
15318
|
+
if (!sheet || sheet.size === 0) return "";
|
|
15319
|
+
const field = sheet.get(String(key ?? ""));
|
|
15320
|
+
if (!isRec(field)) return "";
|
|
15321
|
+
const ref = field.ref;
|
|
15322
|
+
if (isRec(ref)) return this.refLine(ref);
|
|
15323
|
+
const count = field.enumCount;
|
|
15324
|
+
if (typeof count === "number" && Number.isInteger(count) && count > 0) {
|
|
15325
|
+
return `${HINT_ENUM(count, String(model))}
|
|
15326
|
+
`;
|
|
15327
|
+
}
|
|
15328
|
+
return "";
|
|
15329
|
+
}
|
|
15330
|
+
};
|
|
15331
|
+
|
|
15332
|
+
// src/fde/seed/find.ts
|
|
15333
|
+
var MAX_BYTES = 8192;
|
|
15334
|
+
var FIND_LIMIT = 500;
|
|
15335
|
+
var ENUM_SHOW = 8;
|
|
15336
|
+
var SYNTH_MARK = "\u26A0\u5408\u6210";
|
|
15337
|
+
var SYNTH_FOOTNOTE = `\uFF08\u5E26 ${SYNTH_MARK} \u7684\u53D6\u503C\u662F\u5DE5\u5177\u4ECE label \u6216\u5143\u7D20\u672C\u8EAB\u8865\u51FA\u6765\u7684\uFF0C\u4EA7\u54C1\u4ECE\u672A\u53D1\u51FA\u8FD9\u4E2A value\uFF0C**\u4E0D\u53EF**\u76F4\u63A5\u62FF\u53BB\u62FC\u7B5B\u9009\u6761\u4EF6\u3002\uFF09
|
|
15338
|
+
`;
|
|
15339
|
+
var DIMENSION_LABELS = {
|
|
15340
|
+
name: "\u540D\u79F0",
|
|
15341
|
+
key: "\u5B57\u6BB5\u540D",
|
|
15342
|
+
model: "\u6A21\u578B\u540D",
|
|
15343
|
+
synonyms: "\u540C\u4E49\u8BCD",
|
|
15344
|
+
description: "\u63CF\u8FF0",
|
|
15345
|
+
enumLabel: "\u679A\u4E3E\u6807\u7B7E",
|
|
15346
|
+
enumValue: "\u679A\u4E3E\u503C"
|
|
15347
|
+
};
|
|
15348
|
+
var KIT_MATCHED_ON = "_kitMatchedOn";
|
|
15349
|
+
var DIMENSION_RANK = {
|
|
15350
|
+
name: 2,
|
|
15351
|
+
key: 3,
|
|
15352
|
+
model: 3,
|
|
15353
|
+
synonyms: 4,
|
|
15354
|
+
enumLabel: 5,
|
|
15355
|
+
enumValue: 6,
|
|
15356
|
+
description: 7
|
|
15357
|
+
};
|
|
15358
|
+
var EXACT_NAME_RANK = 0;
|
|
15359
|
+
var EXACT_KEY_RANK = 1;
|
|
15360
|
+
var WEAKEST_RANK = Object.keys(DIMENSION_RANK).length;
|
|
15361
|
+
var VISIBLE_DIMENSIONS = /* @__PURE__ */ new Set(["name", "key", "model"]);
|
|
15362
|
+
var asList = (v) => v === null || v === void 0 ? [] : Array.isArray(v) ? v : [v];
|
|
15363
|
+
var str2 = (v) => v === null || v === void 0 ? "" : String(v);
|
|
15364
|
+
var bytes = (s) => Buffer.byteLength(s, "utf-8");
|
|
15365
|
+
function loadRows(text2) {
|
|
15366
|
+
const rows = [];
|
|
15367
|
+
const problems = [];
|
|
15368
|
+
const lines = text2.split("\n");
|
|
15369
|
+
lines.forEach((raw, i) => {
|
|
15370
|
+
const line = raw.trim();
|
|
15371
|
+
if (!line) return;
|
|
15372
|
+
try {
|
|
15373
|
+
const parsed = JSON.parse(line);
|
|
15374
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
15375
|
+
problems.push(`\u7B2C ${i + 1} \u884C\u4E0D\u662F JSON \u5BF9\u8C61\uFF0C\u5DF2\u8DF3\u8FC7`);
|
|
15376
|
+
return;
|
|
15377
|
+
}
|
|
15378
|
+
rows.push(parsed);
|
|
15379
|
+
} catch {
|
|
15380
|
+
problems.push(`\u7B2C ${i + 1} \u884C\u89E3\u6790\u5931\u8D25\uFF0C\u5DF2\u8DF3\u8FC7`);
|
|
15381
|
+
}
|
|
15382
|
+
});
|
|
15383
|
+
return { rows, problems };
|
|
15384
|
+
}
|
|
15385
|
+
function matchedDimensions(row, term) {
|
|
15386
|
+
const t = term.toLowerCase();
|
|
15387
|
+
const dims = [];
|
|
15388
|
+
for (const dim of ["name", "key", "model"]) {
|
|
15389
|
+
if (str2(row[dim]).toLowerCase().includes(t)) dims.push(dim);
|
|
15390
|
+
}
|
|
15391
|
+
if (asList(row.synonyms).some((s) => str2(s).toLowerCase().includes(t))) dims.push("synonyms");
|
|
15392
|
+
if (str2(row.description).toLowerCase().includes(t)) dims.push("description");
|
|
15393
|
+
const labels = [];
|
|
15394
|
+
const values = [];
|
|
15395
|
+
for (const e of asList(row.enums)) {
|
|
15396
|
+
if (e && typeof e === "object" && !Array.isArray(e)) {
|
|
15397
|
+
const o = e;
|
|
15398
|
+
values.push(str2(o.value));
|
|
15399
|
+
labels.push(str2(o.label));
|
|
15400
|
+
} else {
|
|
15401
|
+
values.push(str2(e));
|
|
15402
|
+
}
|
|
15403
|
+
}
|
|
15404
|
+
if (labels.some((x) => x.toLowerCase().includes(t))) dims.push("enumLabel");
|
|
15405
|
+
if (values.some((x) => x.toLowerCase().includes(t))) dims.push("enumValue");
|
|
15406
|
+
return dims;
|
|
15407
|
+
}
|
|
15408
|
+
function hitRank(row, dims, term) {
|
|
15409
|
+
const t = term.toLowerCase();
|
|
15410
|
+
if (dims.includes("name") && str2(row.name).toLowerCase() === t) return EXACT_NAME_RANK;
|
|
15411
|
+
if (dims.includes("key") && str2(row.key).toLowerCase() === t) return EXACT_KEY_RANK;
|
|
15412
|
+
let best = WEAKEST_RANK;
|
|
15413
|
+
for (const d of dims) best = Math.min(best, DIMENSION_RANK[d] ?? WEAKEST_RANK);
|
|
15414
|
+
return best;
|
|
15415
|
+
}
|
|
15416
|
+
function find(rows, term, limit = FIND_LIMIT) {
|
|
15417
|
+
const t = (term ?? "").toLowerCase();
|
|
15418
|
+
if (!t) return [];
|
|
15419
|
+
const scored = [];
|
|
15420
|
+
rows.forEach((r, i) => {
|
|
15421
|
+
const dims = matchedDimensions(r, t);
|
|
15422
|
+
if (dims.length === 0) return;
|
|
15423
|
+
scored.push({ rank: hitRank(r, dims, t), i, hit: { ...r, [KIT_MATCHED_ON]: dims } });
|
|
15424
|
+
});
|
|
15425
|
+
scored.sort((a, b) => a.rank - b.rank || a.i - b.i);
|
|
15426
|
+
return scored.slice(0, limit).map((s) => s.hit);
|
|
15427
|
+
}
|
|
15428
|
+
function enumTail(row) {
|
|
15429
|
+
const items = asList(row.enums);
|
|
15430
|
+
if (items.length === 0) return { tail: "", hasSynth: false };
|
|
15431
|
+
const shown = [];
|
|
15432
|
+
let hasSynth = false;
|
|
15433
|
+
for (const e of items.slice(0, ENUM_SHOW)) {
|
|
15434
|
+
if (e && typeof e === "object" && !Array.isArray(e)) {
|
|
15435
|
+
const o = e;
|
|
15436
|
+
const synth = o[KIT_VALUE_SOURCE] !== void 0 && o[KIT_VALUE_SOURCE] !== null;
|
|
15437
|
+
if (synth) hasSynth = true;
|
|
15438
|
+
shown.push(`${str2(o.value)}${synth ? SYNTH_MARK : ""}`);
|
|
15439
|
+
} else {
|
|
15440
|
+
shown.push(str2(e));
|
|
15441
|
+
}
|
|
15442
|
+
}
|
|
15443
|
+
const more = items.length > ENUM_SHOW ? `\u2026\u5171 ${items.length} \u4E2A` : "";
|
|
15444
|
+
return { tail: ` {${shown.join("/")}${more}}`, hasSynth };
|
|
15445
|
+
}
|
|
15446
|
+
function matchNote(hit) {
|
|
15447
|
+
const dims = asList(hit[KIT_MATCHED_ON]).map(str2);
|
|
15448
|
+
if (dims.length === 0) return "";
|
|
15449
|
+
if (dims.some((d) => VISIBLE_DIMENSIONS.has(d))) return "";
|
|
15450
|
+
return " \u2190\u547D\u4E2D\u4E8E" + dims.map((d) => DIMENSION_LABELS[d] ?? d).join("/");
|
|
15451
|
+
}
|
|
15452
|
+
var budgetNote = (hitCount, shown) => `
|
|
15453
|
+
\uFF08\u5DF2\u622A\u65AD\uFF1A\u547D\u4E2D ${hitCount} \u6761\uFF0C\u6B64\u5904\u53EA\u663E\u793A ${shown} \u6761\u3002\u8BF7\u7F29\u5C0F\u68C0\u7D22\u8BCD\u3002\uFF09
|
|
15454
|
+
`;
|
|
15455
|
+
var searchCapNote = () => `\uFF08\u547D\u4E2D\u5DF2\u8FBE\u68C0\u7D22\u4E0A\u9650 ${FIND_LIMIT}\uFF0C\u5B9E\u9645\u53EF\u80FD\u66F4\u591A\uFF0C\u8BF7\u7F29\u5C0F\u68C0\u7D22\u8BCD\u3002\uFF09
|
|
15456
|
+
`;
|
|
15457
|
+
function renderFind(hits, term, total, options = {}) {
|
|
15458
|
+
const head = `# find \`${term}\` \u2014 ${hits.length} \u547D\u4E2D / \u7D22\u5F15\u5171 ${total} \u5B57\u6BB5
|
|
15459
|
+
|
|
15460
|
+
`;
|
|
15461
|
+
const reserve = bytes(budgetNote(hits.length, hits.length) + searchCapNote() + SYNTH_FOOTNOTE + VALUE_FOOTNOTE);
|
|
15462
|
+
const budget = MAX_BYTES - Math.max(0, Math.trunc(options.prefixBytes ?? 0));
|
|
15463
|
+
const lines = [];
|
|
15464
|
+
let shown = 0;
|
|
15465
|
+
let synthShown = false;
|
|
15466
|
+
let valueShown = false;
|
|
15467
|
+
for (const h of hits) {
|
|
15468
|
+
const { tail, hasSynth } = enumTail(h);
|
|
15469
|
+
const line = `- ${str2(h.name)} \u2192 \`${str2(h.model)}\`.\`${str2(h.key)}\` [${str2(h.type)}]${h.isRequired ? "\u5FC5\u586B" : ""}${tail}${matchNote(h)}
|
|
15470
|
+
`;
|
|
15471
|
+
const hint = options.hints ? options.hints.line(h.model, h.key) : "";
|
|
15472
|
+
const block = line + hint;
|
|
15473
|
+
if (bytes(head + lines.join("") + block) > budget - reserve) break;
|
|
15474
|
+
lines.push(block);
|
|
15475
|
+
shown += 1;
|
|
15476
|
+
synthShown = synthShown || hasSynth;
|
|
15477
|
+
valueShown = valueShown || hint.length > 0;
|
|
15478
|
+
}
|
|
15479
|
+
let out = head + lines.join("");
|
|
15480
|
+
if (shown < hits.length) out += budgetNote(hits.length, shown);
|
|
15481
|
+
if (hits.length >= FIND_LIMIT) out += searchCapNote();
|
|
15482
|
+
if (synthShown) out += SYNTH_FOOTNOTE;
|
|
15483
|
+
if (valueShown) out += VALUE_FOOTNOTE;
|
|
15484
|
+
return out;
|
|
15485
|
+
}
|
|
15486
|
+
|
|
15487
|
+
// src/fde/seed/values.ts
|
|
15488
|
+
import { existsSync as existsSync11, readFileSync as readFileSync10 } from "fs";
|
|
15489
|
+
import * as path19 from "path";
|
|
15490
|
+
var readJson2 = (file) => {
|
|
15491
|
+
try {
|
|
15492
|
+
return JSON.parse(readFileSync10(file, "utf-8"));
|
|
15493
|
+
} catch {
|
|
15494
|
+
return void 0;
|
|
15495
|
+
}
|
|
15496
|
+
};
|
|
15497
|
+
var isRec2 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
15498
|
+
var VALUE_CELL_MISSING = "\u2014";
|
|
15499
|
+
var VALUE_STATE_DISABLED = "\u505C\u7528";
|
|
15500
|
+
var VALUE_STATE_ENABLED = "";
|
|
15501
|
+
var VALUE_STATE_UNKNOWN = "enabled?";
|
|
15502
|
+
var VALUE_STATE_FOOTNOTE = `\uFF08\u300C${VALUE_STATE_DISABLED}\u300D= \u8BE5\u884C \`enabled=false\`\uFF0C**\u522B\u5199\u8FDB\u5BFC\u5165\u811A\u672C**\uFF1B\u300C${VALUE_STATE_UNKNOWN}\u300D= \u8FD9\u4EFD\u4EA7\u7269\u91CC\u90A3\u4E00\u884C**\u6CA1\u6709 \`enabled\` \u952E**\uFF0C\u5DE5\u5177\u4E0D\u66FF\u4EA7\u54C1\u5047\u8BBE\u5B83\u662F\u542F\u7528\u7684\u3002\uFF09
|
|
15503
|
+
`;
|
|
15504
|
+
var valuesTruncated = (total, shown, file) => `\uFF08\u5DF2\u622A\u65AD\uFF1A\u5171 ${total} \u884C\uFF0C\u6B64\u5904\u53EA\u663E\u793A ${shown} \u884C \u2014\u2014 \u884C\u5757\u6709 ${MAX_BYTES} \u5B57\u8282\u9884\u7B97\uFF08\u62AC\u5934\u4E0E\u811A\u6CE8\u4E0D\u8BA1\u5165\uFF09\u3002\u5168\u91CF\u5728 ${file}\uFF1B\u8981\u5168\u90E8\u6253\u5370\u7528 \`--limit 0\`\uFF0C\u6216 \`--limit N\` \u6307\u5B9A\u884C\u6570\u3002\uFF09
|
|
15505
|
+
`;
|
|
15506
|
+
function valueState(row) {
|
|
15507
|
+
if (!Object.prototype.hasOwnProperty.call(row, "enabled")) return VALUE_STATE_UNKNOWN;
|
|
15508
|
+
const enabled = row.enabled;
|
|
15509
|
+
if (enabled === false) return VALUE_STATE_DISABLED;
|
|
15510
|
+
if (enabled === true) return VALUE_STATE_ENABLED;
|
|
15511
|
+
return `${VALUE_STATE_UNKNOWN}=${JSON.stringify(enabled)}`;
|
|
15512
|
+
}
|
|
15513
|
+
var VALUES_ROUND_STALE = (detail) => `> \u{1F534} \`valuedomain/_index.json\` ${detail} \u2014\u2014 \u4E0B\u9762\u90A3\u53E5\u53E3\u5F84\u91CC\u7684\u300C\u672C\u8F6E\u300D**\u4E0D\u662F\u4F60\u521A\u8DD1\u7684\u90A3\u4E00\u8F6E**\uFF0C\u8FD9\u5F20\u7801\u8868\u5FEB\u7167\u53EF\u80FD\u66F4\u65E9\u3002
|
|
15514
|
+
`;
|
|
15515
|
+
var VALUES_ROUND_MIXED = (state) => `> \u26A0\uFE0F \u8FD9\u4EFD\u57FA\u7EBF\u4E0D\u662F\u4E00\u8F6E\u5B8C\u6574\u8DD1\u51FA\u6765\u7684\uFF08\`round\` = ${state}\uFF09\uFF0C\u4E0D\u8FC7 \`valuedomain/_index.json\` \u672C\u8EAB\u662F\u672C\u8F6E\u7684 \u2014\u2014 \u4E0B\u9762\u90A3\u53E5\u53E3\u5F84\u91CC\u7684\u300C\u672C\u8F6E\u300D\u6309\u5B83\u7406\u89E3\u3002
|
|
15516
|
+
`;
|
|
15517
|
+
var STALE_WORDS = {
|
|
15518
|
+
"older-round": "\u662F**\u522B\u7684\u8F6E\u6B21**\u7559\u4E0B\u7684",
|
|
15519
|
+
unstamped: "**\u6CA1\u6709\u8F6E\u6B21\u6233**\uFF08\u66F4\u65E9\u7248\u672C\u5199\u7684\uFF09",
|
|
15520
|
+
missing: "**\u4E0D\u5728\u76D8\u4E0A**",
|
|
15521
|
+
unreadable: "**\u8BFB\u4E0D\u51FA JSON**"
|
|
15522
|
+
};
|
|
15523
|
+
function valuesRoundCaveat(round) {
|
|
15524
|
+
if (!isRec2(round)) return "";
|
|
15525
|
+
const state = round.state;
|
|
15526
|
+
if (state === "complete") return "";
|
|
15527
|
+
const products = round.products;
|
|
15528
|
+
const entry = Array.isArray(products) ? products.find((p) => isRec2(p) && p.path === "valuedomain/_index.json") : void 0;
|
|
15529
|
+
const productState = isRec2(entry) ? entry.state : void 0;
|
|
15530
|
+
if (typeof productState === "string" && productState in STALE_WORDS) {
|
|
15531
|
+
return VALUES_ROUND_STALE(STALE_WORDS[productState]);
|
|
15532
|
+
}
|
|
15533
|
+
return VALUES_ROUND_MIXED(String(state ?? "unknown"));
|
|
15534
|
+
}
|
|
15535
|
+
function renderValues(root, model, options = {}) {
|
|
15536
|
+
const indexBody = readJson2(path19.join(root, "valuedomain", "_index.json"));
|
|
15537
|
+
const byCompleteness = isRec2(indexBody) ? indexBody.byCompleteness : void 0;
|
|
15538
|
+
if (!isRec2(byCompleteness)) {
|
|
15539
|
+
return {
|
|
15540
|
+
ok: false,
|
|
15541
|
+
kind: "index-unreadable",
|
|
15542
|
+
message: `\u8BFB\u4E0D\u5230 valuedomain/_index.json\uFF08${root}\uFF09\u2014\u2014 \u53EF\u80FD\u662F\uFF1A\u8FD9\u4EFD\u57FA\u7EBF\u7531\u66F4\u65E9\u7248\u672C\u722C\u7684\u3001\u4F60\u6CA1\u62F7 valuedomain/ \u76EE\u5F55\u8FC7\u6765\u3001\u6216\u8005\u90A3\u4E2A\u6587\u4EF6\u574F\u4E86\u3002\u5148 \`ls ${path19.join(root, "valuedomain")}\` \u770B\u4E00\u773C\uFF1B\u786E\u5B9E\u6CA1\u6709\u5C31\u91CD\u8DD1\u4E00\u6B21 recon\u3002`
|
|
15543
|
+
};
|
|
15544
|
+
}
|
|
15545
|
+
let completeness;
|
|
15546
|
+
for (const [c, names] of Object.entries(byCompleteness)) {
|
|
15547
|
+
if (Array.isArray(names) && names.includes(model)) {
|
|
15548
|
+
completeness = c;
|
|
15549
|
+
break;
|
|
15550
|
+
}
|
|
15551
|
+
}
|
|
15552
|
+
if (completeness === void 0) {
|
|
15553
|
+
if (isLocalName(model) && existsSync11(path19.join(root, "mapping", `${model}.json`))) {
|
|
15554
|
+
return {
|
|
15555
|
+
ok: false,
|
|
15556
|
+
kind: "not-a-code-table",
|
|
15557
|
+
message: `${model} \u4E0D\u662F\u7801\u8868\uFF08\`type != DYNAMIC\`\uFF0Cvaluedomain/ \u91CC\u6CA1\u6709\u5B83\uFF09\u2014\u2014 \u6307\u5411\u5B83\u7684\u5F15\u7528\u503C\u53EA\u80FD\u6309\u4E1A\u52A1\u952E\u73B0\u67E5\u3002\u5B83\u7684\u5B57\u6BB5\u6E05\u5355\u5728 mapping/${model}.json\u3002`
|
|
15558
|
+
};
|
|
15559
|
+
}
|
|
15560
|
+
return {
|
|
15561
|
+
ok: false,
|
|
15562
|
+
kind: "model-not-in-baseline",
|
|
15563
|
+
message: `\u57FA\u7EBF\u91CC\u6CA1\u6709\u8FD9\u4E2A\u6A21\u578B\uFF1A${model}\u3002\`ls ${path19.join(root, "mapping")}\` \u770B\u6709\u54EA\u4E9B\u3002`
|
|
15564
|
+
};
|
|
15565
|
+
}
|
|
15566
|
+
const file = path19.join(root, "valuedomain", `${model}.json`);
|
|
15567
|
+
if (!isLocalName(model) || !existsSync11(file)) {
|
|
15568
|
+
return {
|
|
15569
|
+
ok: false,
|
|
15570
|
+
kind: "file-missing",
|
|
15571
|
+
message: `${model} \u5728 valuedomain/_index.json \u91CC\u6302\u7740\uFF08completeness=${completeness}\uFF09\uFF0C\u4F46\u76D8\u4E0A\u6CA1\u6709\u8FD9\u4EFD\u6587\u4EF6 \u2014\u2014 \u53BB\u770B _index.json \u7684 writeProblems\u3002`
|
|
15572
|
+
};
|
|
15573
|
+
}
|
|
15574
|
+
const table = readJson2(file);
|
|
15575
|
+
const rows = isRec2(table) ? table.rows : void 0;
|
|
15576
|
+
if (!Array.isArray(rows)) {
|
|
15577
|
+
return { ok: false, kind: "rows-unreadable", message: `${file} \u8BFB\u4E0D\u51FA rows` };
|
|
15578
|
+
}
|
|
15579
|
+
const head = `# values ${model} \u2014 completeness=${completeness}\uFF0C\u53D6\u56DE ${String(isRec2(table) ? table.rowsRetrieved : "?")} \u884C / \u8BA1\u6570 ${String(isRec2(table) ? table.totalElements : "?")} \u884C
|
|
15580
|
+
`;
|
|
15581
|
+
const caveat = options.roundCaveat ?? "";
|
|
15582
|
+
const wording = `> ${String(indexBody && isRec2(indexBody) ? indexBody.wording ?? "" : "")}
|
|
15583
|
+
`;
|
|
15584
|
+
const lines = ["id code name \u72B6\u6001\n"];
|
|
15585
|
+
let missing = false;
|
|
15586
|
+
let stateShown = false;
|
|
15587
|
+
let shown = 0;
|
|
15588
|
+
let used = 0;
|
|
15589
|
+
const limit = options.limit;
|
|
15590
|
+
for (const row of rows) {
|
|
15591
|
+
if (!isRec2(row)) continue;
|
|
15592
|
+
const cells = [];
|
|
15593
|
+
for (const key of ["id", "code", "name"]) {
|
|
15594
|
+
const v = row[key];
|
|
15595
|
+
if (v === null || v === void 0) missing = true;
|
|
15596
|
+
cells.push(v === null || v === void 0 ? VALUE_CELL_MISSING : String(v));
|
|
15597
|
+
}
|
|
15598
|
+
const state = valueState(row);
|
|
15599
|
+
const line = `${[...cells, state].join(" ")}
|
|
15600
|
+
`;
|
|
15601
|
+
if (limit === void 0) {
|
|
15602
|
+
used += Buffer.byteLength(line, "utf-8");
|
|
15603
|
+
if (used > MAX_BYTES) break;
|
|
15604
|
+
} else if (limit > 0 && shown >= limit) {
|
|
15605
|
+
break;
|
|
15606
|
+
}
|
|
15607
|
+
lines.push(line);
|
|
15608
|
+
shown += 1;
|
|
15609
|
+
stateShown = stateShown || state.length > 0;
|
|
15610
|
+
}
|
|
15611
|
+
const total = rows.filter((r) => isRec2(r)).length;
|
|
15612
|
+
let out = head + caveat + wording + lines.join("");
|
|
15613
|
+
if (shown < total) out += valuesTruncated(total, shown, `valuedomain/${model}.json`);
|
|
15614
|
+
if (stateShown) out += VALUE_STATE_FOOTNOTE;
|
|
15615
|
+
if (missing) out += VALUE_FOOTNOTE;
|
|
15616
|
+
return { ok: true, text: out };
|
|
15617
|
+
}
|
|
15618
|
+
|
|
15619
|
+
// src/fde/gate0/aclass.ts
|
|
15620
|
+
import { existsSync as existsSync12, readFileSync as readFileSync12, readdirSync as readdirSync3, statSync as statSync9 } from "fs";
|
|
15621
|
+
import * as path20 from "path";
|
|
15209
15622
|
|
|
15210
15623
|
// src/fde/gate0/mapping-artifact.ts
|
|
15211
|
-
import { readFileSync as
|
|
15624
|
+
import { readFileSync as readFileSync11 } from "fs";
|
|
15212
15625
|
var MAPPING_ARTIFACT_VERSION = 1;
|
|
15213
15626
|
var MappingArtifactError = class extends Error {
|
|
15214
15627
|
constructor(reason, message) {
|
|
@@ -15226,7 +15639,7 @@ function isRecord6(value) {
|
|
|
15226
15639
|
function readBusinessKeyFields(file) {
|
|
15227
15640
|
let text2;
|
|
15228
15641
|
try {
|
|
15229
|
-
text2 =
|
|
15642
|
+
text2 = readFileSync11(file, "utf8");
|
|
15230
15643
|
} catch (e) {
|
|
15231
15644
|
const code = e?.code;
|
|
15232
15645
|
if (code === "ENOENT") throw new MappingArtifactError("not-found", `\u627E\u4E0D\u5230\u6620\u5C04\u5DE5\u4EF6 ${file}`);
|
|
@@ -15337,10 +15750,10 @@ function scalarsWithin(value) {
|
|
|
15337
15750
|
}
|
|
15338
15751
|
function readText(file, kinds, scope, problems) {
|
|
15339
15752
|
try {
|
|
15340
|
-
return
|
|
15753
|
+
return readFileSync12(file, "utf8");
|
|
15341
15754
|
} catch (e) {
|
|
15342
15755
|
const code = e?.code;
|
|
15343
|
-
const name =
|
|
15756
|
+
const name = path20.basename(file);
|
|
15344
15757
|
problems.push({
|
|
15345
15758
|
scope,
|
|
15346
15759
|
reason: REASON_UNREAD,
|
|
@@ -15353,7 +15766,7 @@ function readText(file, kinds, scope, problems) {
|
|
|
15353
15766
|
function readJsonl(file, kinds, scope, problems) {
|
|
15354
15767
|
const text2 = readText(file, kinds, scope, problems);
|
|
15355
15768
|
if (text2 === null) return [];
|
|
15356
|
-
const name =
|
|
15769
|
+
const name = path20.basename(file);
|
|
15357
15770
|
const rows = [];
|
|
15358
15771
|
text2.split("\n").forEach((raw, i) => {
|
|
15359
15772
|
const line = raw.trim();
|
|
@@ -15384,7 +15797,7 @@ function readJsonl(file, kinds, scope, problems) {
|
|
|
15384
15797
|
return rows;
|
|
15385
15798
|
}
|
|
15386
15799
|
var UNREADABLE = /* @__PURE__ */ Symbol("unreadable");
|
|
15387
|
-
function
|
|
15800
|
+
function readJson3(file, kinds, scope, problems) {
|
|
15388
15801
|
const text2 = readText(file, kinds, scope, problems);
|
|
15389
15802
|
if (text2 === null) return UNREADABLE;
|
|
15390
15803
|
try {
|
|
@@ -15394,13 +15807,13 @@ function readJson(file, kinds, scope, problems) {
|
|
|
15394
15807
|
scope,
|
|
15395
15808
|
reason: REASON_UNREAD,
|
|
15396
15809
|
kinds,
|
|
15397
|
-
message: `\u4EA7\u7269 ${
|
|
15810
|
+
message: `\u4EA7\u7269 ${path20.basename(file)} \u4E0D\u662F\u5408\u6CD5 JSON\uFF08${String(e)}\uFF09\u21D2 ${unguardedWord(kinds)} \u8FD9\u51E0\u7C7B\u6B64\u523B\u65E0\u4EBA\u5B88`
|
|
15398
15811
|
});
|
|
15399
15812
|
return UNREADABLE;
|
|
15400
15813
|
}
|
|
15401
15814
|
}
|
|
15402
15815
|
function listUnder(payload, key, file, kinds, scope, problems) {
|
|
15403
|
-
const name =
|
|
15816
|
+
const name = path20.basename(file);
|
|
15404
15817
|
if (typeof payload !== "object" || payload === null || Array.isArray(payload)) {
|
|
15405
15818
|
problems.push({
|
|
15406
15819
|
scope,
|
|
@@ -15436,7 +15849,7 @@ function deriveAclass(root, mappingArtifact = null) {
|
|
|
15436
15849
|
const problems = [];
|
|
15437
15850
|
const out = Object.fromEntries(ACLASS_KINDS.map((k) => [k, /* @__PURE__ */ new Set()]));
|
|
15438
15851
|
for (const row of readJsonl(
|
|
15439
|
-
|
|
15852
|
+
path20.join(root, ...FIELDS_INDEX),
|
|
15440
15853
|
["fieldKey", "fieldLabel", "caliber"],
|
|
15441
15854
|
CLASS_SCOPE,
|
|
15442
15855
|
problems
|
|
@@ -15452,7 +15865,7 @@ function deriveAclass(root, mappingArtifact = null) {
|
|
|
15452
15865
|
}
|
|
15453
15866
|
}
|
|
15454
15867
|
for (const row of readJsonl(
|
|
15455
|
-
|
|
15868
|
+
path20.join(root, ...ENUM_MIRROR),
|
|
15456
15869
|
["enumValue"],
|
|
15457
15870
|
CLASS_SCOPE,
|
|
15458
15871
|
problems
|
|
@@ -15466,8 +15879,8 @@ function deriveAclass(root, mappingArtifact = null) {
|
|
|
15466
15879
|
}
|
|
15467
15880
|
}
|
|
15468
15881
|
}
|
|
15469
|
-
const rosterPath =
|
|
15470
|
-
const roster =
|
|
15882
|
+
const rosterPath = path20.join(root, ...MODEL_ROSTER);
|
|
15883
|
+
const roster = readJson3(rosterPath, ["modelName"], CLASS_SCOPE, problems);
|
|
15471
15884
|
if (roster !== UNREADABLE) {
|
|
15472
15885
|
const rows = listUnder(roster, "models", rosterPath, ["modelName"], CLASS_SCOPE, problems);
|
|
15473
15886
|
const entries = modelEntries(roster);
|
|
@@ -15494,12 +15907,12 @@ function deriveAclass(root, mappingArtifact = null) {
|
|
|
15494
15907
|
});
|
|
15495
15908
|
}
|
|
15496
15909
|
}
|
|
15497
|
-
const valueDomain =
|
|
15498
|
-
if (
|
|
15910
|
+
const valueDomain = path20.join(root, VALUE_DOMAIN_DIR);
|
|
15911
|
+
if (existsSync12(valueDomain) && statSync9(valueDomain).isDirectory()) {
|
|
15499
15912
|
const tables = readdirSync3(valueDomain).filter((f) => f.endsWith(".json") && !RESERVED_FILENAMES.includes(f)).sort();
|
|
15500
15913
|
for (const name of tables) {
|
|
15501
|
-
const file =
|
|
15502
|
-
const payload =
|
|
15914
|
+
const file = path20.join(valueDomain, name);
|
|
15915
|
+
const payload = readJson3(file, ["codeValue"], ENTRY_SCOPE, problems);
|
|
15503
15916
|
if (payload === UNREADABLE) continue;
|
|
15504
15917
|
for (const row of listUnder(payload, "rows", file, ["codeValue"], ENTRY_SCOPE, problems)) {
|
|
15505
15918
|
if (typeof row !== "object" || row === null || Array.isArray(row)) {
|
|
@@ -15564,8 +15977,8 @@ function deriveAclass(root, mappingArtifact = null) {
|
|
|
15564
15977
|
}
|
|
15565
15978
|
|
|
15566
15979
|
// src/fde/gate0/facts.ts
|
|
15567
|
-
import { existsSync as
|
|
15568
|
-
import * as
|
|
15980
|
+
import { existsSync as existsSync13, readFileSync as readFileSync13 } from "fs";
|
|
15981
|
+
import * as path21 from "path";
|
|
15569
15982
|
var REGISTRY_SCOPE = "registry";
|
|
15570
15983
|
var ENTRY_SCOPE2 = "entry";
|
|
15571
15984
|
var REASON_NO_ENTRIES = "no-entries";
|
|
@@ -15647,9 +16060,9 @@ function loadProtocolFacts(entries = PROTOCOL_FACTS, options = {}) {
|
|
|
15647
16060
|
return;
|
|
15648
16061
|
}
|
|
15649
16062
|
if (probeRoot !== void 0) {
|
|
15650
|
-
const file =
|
|
16063
|
+
const file = path21.join(probeRoot, shape.groups.file);
|
|
15651
16064
|
const mark = `${PROBE_MARK_PREFIX} ${shape.groups.mark}`;
|
|
15652
|
-
const found =
|
|
16065
|
+
const found = existsSync13(file) && readFileSync13(file, "utf8").includes(mark);
|
|
15653
16066
|
if (!found) {
|
|
15654
16067
|
problems.push({
|
|
15655
16068
|
scope: ENTRY_SCOPE2,
|
|
@@ -15667,8 +16080,8 @@ function loadProtocolFacts(entries = PROTOCOL_FACTS, options = {}) {
|
|
|
15667
16080
|
}
|
|
15668
16081
|
|
|
15669
16082
|
// src/fde/gate0/scan.ts
|
|
15670
|
-
import { readFileSync as
|
|
15671
|
-
import * as
|
|
16083
|
+
import { readFileSync as readFileSync14, readdirSync as readdirSync4, readlinkSync, statSync as statSync10 } from "fs";
|
|
16084
|
+
import * as path22 from "path";
|
|
15672
16085
|
var CHANNEL_ACLASS = "aclass";
|
|
15673
16086
|
var CHANNEL_ARTIFACT = "artifact-path";
|
|
15674
16087
|
var CHANNEL_UNREGISTERED = "protocol-unregistered";
|
|
@@ -16235,7 +16648,7 @@ function scan(skillRoot, aclass, facts, options = {}) {
|
|
|
16235
16648
|
}
|
|
16236
16649
|
premise2.push({
|
|
16237
16650
|
reason: REASON_SYMLINK_NOT_SCANNED,
|
|
16238
|
-
message: `${
|
|
16651
|
+
message: `${path22.relative(skillRoot, link)} \u662F\u4E00\u4E2A\u7B26\u53F7\u94FE\u63A5\uFF08\u6307\u5411 ${JSON.stringify(target)}\uFF09\u21D2 \u95E8 0 **\u6CA1\u6709\u987A\u7740\u5B83\u626B\u8FC7\u4E00\u4E2A\u5B57**\uFF0C\u8FD9\u4E00\u8F6E\u7684\u7EFF\u4E0D\u7B97\u6570\u3002\u51FA\u8DEF\uFF1A\u628A\u8FD9\u6761\u94FE\u4ECE skill \u91CC\u53BB\u6389 \u2014\u2014 \u94FE\u540E\u9762\u90A3\u4EFD\u5185\u5BB9\u672C\u8BE5\u88AB\u5224\u5C31 \`cp -RL\` \u62F7\u6210\u771F\u5185\u5BB9\uFF08\u26A0\uFE0F \u73AF\u8DEF\u4E0E\u65AD\u94FE\u4E0A\u5B83\u4F1A\u5F53\u573A\u62A5\u9519\uFF0C\u90A3\u4E24\u79CD\u76F4\u63A5\u5220\uFF09\uFF1B\u5185\u5BB9\u5DF2\u7ECF\u5728 skill \u91CC\uFF08\u6307\u5411\u540C\u6811\u7684\u522B\u540D\uFF09\u4E5F\u76F4\u63A5\u5220\u3002**\u4E0D\u8DDF\u968F**\u662F\u523B\u610F\u7684 \u2014\u2014 \u8DDF\u8FC7\u53BB\u4F1A\u8FDE\u4E0A\u73AF\u8DEF\u3001\u6216\u8D8A\u51FA skill \u76EE\u5F55\u626B\u5230\u65E0\u5173\u6587\u4EF6`
|
|
16239
16652
|
});
|
|
16240
16653
|
}
|
|
16241
16654
|
if (files.length === 0) {
|
|
@@ -16248,7 +16661,7 @@ function scan(skillRoot, aclass, facts, options = {}) {
|
|
|
16248
16661
|
for (const file of files) {
|
|
16249
16662
|
let text2;
|
|
16250
16663
|
try {
|
|
16251
|
-
text2 =
|
|
16664
|
+
text2 = readFileSync14(file, "utf8");
|
|
16252
16665
|
} catch (e) {
|
|
16253
16666
|
premise2.push({
|
|
16254
16667
|
reason: REASON_FILE_UNREADABLE,
|
|
@@ -16256,7 +16669,7 @@ function scan(skillRoot, aclass, facts, options = {}) {
|
|
|
16256
16669
|
});
|
|
16257
16670
|
continue;
|
|
16258
16671
|
}
|
|
16259
|
-
const rel =
|
|
16672
|
+
const rel = path22.relative(skillRoot, file);
|
|
16260
16673
|
scanned.push(rel);
|
|
16261
16674
|
text2.split("\n").forEach((line, i) => {
|
|
16262
16675
|
judgeLine(line, i + 1, rel, matcher, index, reds, gaps);
|
|
@@ -16293,7 +16706,7 @@ function walk3(root) {
|
|
|
16293
16706
|
const unscannedLinks = [];
|
|
16294
16707
|
const visit = (dir) => {
|
|
16295
16708
|
for (const entry of readdirSync4(dir, { withFileTypes: true })) {
|
|
16296
|
-
const full =
|
|
16709
|
+
const full = path22.join(dir, entry.name);
|
|
16297
16710
|
let followed = null;
|
|
16298
16711
|
try {
|
|
16299
16712
|
followed = statSync10(full);
|
|
@@ -16377,8 +16790,8 @@ function buildCarrierResult(carrier, verdict, options = {}) {
|
|
|
16377
16790
|
}
|
|
16378
16791
|
|
|
16379
16792
|
// src/fde/triage/probe.ts
|
|
16380
|
-
import { readFileSync as
|
|
16381
|
-
import * as
|
|
16793
|
+
import { readFileSync as readFileSync15 } from "fs";
|
|
16794
|
+
import * as path23 from "path";
|
|
16382
16795
|
var WORKSPACES_PATH = "/api/tenant-extension/workspaces";
|
|
16383
16796
|
var MODELS_REL = "models.json";
|
|
16384
16797
|
var FIELDS_REL = "index/fields.jsonl";
|
|
@@ -16401,10 +16814,10 @@ function unavailableCell(carrier, err) {
|
|
|
16401
16814
|
});
|
|
16402
16815
|
}
|
|
16403
16816
|
function readArtifactJson(dir, rel) {
|
|
16404
|
-
return JSON.parse(
|
|
16817
|
+
return JSON.parse(readFileSync15(path23.join(dir, rel), "utf8"));
|
|
16405
16818
|
}
|
|
16406
16819
|
function readArtifactJsonl(dir, rel) {
|
|
16407
|
-
const body =
|
|
16820
|
+
const body = readFileSync15(path23.join(dir, rel), "utf8");
|
|
16408
16821
|
const rows = [];
|
|
16409
16822
|
for (const line of body.split("\n")) {
|
|
16410
16823
|
const trimmed = line.trim();
|
|
@@ -16730,6 +17143,7 @@ export {
|
|
|
16730
17143
|
AGREEING_VERDICTS,
|
|
16731
17144
|
APPLY_CAVEAT,
|
|
16732
17145
|
APPLY_PROBLEM_CODES,
|
|
17146
|
+
PROBLEM_CODES as ARTIFACT_PROBLEM_CODES,
|
|
16733
17147
|
ARTIFACT_ROOT,
|
|
16734
17148
|
ARTIFACT_SUFFIXES,
|
|
16735
17149
|
ARTIFACT_WORDING,
|
|
@@ -16764,6 +17178,7 @@ export {
|
|
|
16764
17178
|
DEFAULT_AGENT_ID,
|
|
16765
17179
|
DEFAULT_SESSION_TTL_SECONDS,
|
|
16766
17180
|
PREMISE_CODES4 as DELIVERY_PREMISE_CODES,
|
|
17181
|
+
DIMENSION_LABELS,
|
|
16767
17182
|
DOCTOR_ANCHORS,
|
|
16768
17183
|
DRY_RUN_NOTE,
|
|
16769
17184
|
DRY_RUN_TAIL,
|
|
@@ -16771,12 +17186,15 @@ export {
|
|
|
16771
17186
|
ENDPOINT_PREFIXES,
|
|
16772
17187
|
ENTRY_SCOPE,
|
|
16773
17188
|
ENUM_ELEMENT_KEYS,
|
|
17189
|
+
ENUM_SHOW,
|
|
16774
17190
|
EXEMPTIBLE_CODES,
|
|
16775
17191
|
EXEMPTION_CODES,
|
|
16776
17192
|
EXEMPTION_REQUIRED_KEYS,
|
|
16777
17193
|
EXTENSION_SOURCE_HEADER,
|
|
16778
17194
|
ExitCode,
|
|
16779
17195
|
FACTS_REASONS,
|
|
17196
|
+
FIND_LIMIT,
|
|
17197
|
+
MAX_BYTES as FIND_MAX_BYTES,
|
|
16780
17198
|
FOLDED_NOTE,
|
|
16781
17199
|
FORCE_STALE_FLAG,
|
|
16782
17200
|
FORCE_STALE_FLAG_TEXT,
|
|
@@ -16795,6 +17213,7 @@ export {
|
|
|
16795
17213
|
JournalError,
|
|
16796
17214
|
KIT_CARRY_OVER_KEY,
|
|
16797
17215
|
KIT_CRAWLED_AT_FILE,
|
|
17216
|
+
KIT_MATCHED_ON,
|
|
16798
17217
|
LEASE_FILE,
|
|
16799
17218
|
LEDGER_MISSING_WORD,
|
|
16800
17219
|
LEDGER_ONLY_FLAG,
|
|
@@ -16823,7 +17242,10 @@ export {
|
|
|
16823
17242
|
NOT_COVERED_LAYER2,
|
|
16824
17243
|
NOT_COVERED_SELF,
|
|
16825
17244
|
OFFLINE_COMMANDS,
|
|
17245
|
+
ON_EXISTING,
|
|
16826
17246
|
PASSWORD_CHANGE_REQUIRED,
|
|
17247
|
+
PLAN_JSON_KEYS,
|
|
17248
|
+
PLAN_PROBLEM_CODES,
|
|
16827
17249
|
PREMISE_CLIENT,
|
|
16828
17250
|
PREMISE_IDENTITY,
|
|
16829
17251
|
PREMISE_JOURNAL_HAS_ENTRIES,
|
|
@@ -16873,17 +17295,25 @@ export {
|
|
|
16873
17295
|
STATUSES,
|
|
16874
17296
|
STEP_NOTHING,
|
|
16875
17297
|
STEP_STOP,
|
|
17298
|
+
SYNTH_FOOTNOTE,
|
|
17299
|
+
SYNTH_MARK,
|
|
16876
17300
|
CONFIG as TRIAGE_CONFIG,
|
|
16877
17301
|
GAP as TRIAGE_GAP,
|
|
16878
17302
|
VERDICTS3 as TRIAGE_VERDICTS,
|
|
16879
17303
|
TargetModelNotFound,
|
|
16880
17304
|
TokenStore,
|
|
17305
|
+
VALUE_CELL_MISSING,
|
|
17306
|
+
VALUE_FOOTNOTE,
|
|
17307
|
+
VALUE_STATE_DISABLED,
|
|
17308
|
+
VALUE_STATE_FOOTNOTE,
|
|
17309
|
+
VALUE_STATE_UNKNOWN,
|
|
16881
17310
|
VERDICTS,
|
|
16882
17311
|
VERDICT_DIVERGED,
|
|
16883
17312
|
VERDICT_INCOMPARABLE,
|
|
16884
17313
|
VERDICT_SAME,
|
|
16885
17314
|
VERDICT_WORDS,
|
|
16886
17315
|
VERSION_PATH,
|
|
17316
|
+
ValueHints,
|
|
16887
17317
|
WAIVER_REPLAY,
|
|
16888
17318
|
WARNED_ROUND_STATES,
|
|
16889
17319
|
WORKSPACES_PATH,
|
|
@@ -16975,6 +17405,7 @@ export {
|
|
|
16975
17405
|
fetchSkillMarkdown,
|
|
16976
17406
|
fetchSkillReference,
|
|
16977
17407
|
filterByStage,
|
|
17408
|
+
find,
|
|
16978
17409
|
findLastAssistantSeq,
|
|
16979
17410
|
flattenSkills,
|
|
16980
17411
|
foldConfusables,
|
|
@@ -16990,6 +17421,7 @@ export {
|
|
|
16990
17421
|
globalConfigFile,
|
|
16991
17422
|
guessMimeType,
|
|
16992
17423
|
hcmConfigDir,
|
|
17424
|
+
hitRank,
|
|
16993
17425
|
httpProbe,
|
|
16994
17426
|
identitiesDir,
|
|
16995
17427
|
identityDir,
|
|
@@ -17002,6 +17434,7 @@ export {
|
|
|
17002
17434
|
inspectRound,
|
|
17003
17435
|
isCjk,
|
|
17004
17436
|
isDelegationToolName,
|
|
17437
|
+
isLocalName,
|
|
17005
17438
|
isReadOnly,
|
|
17006
17439
|
isServerSlidingSession,
|
|
17007
17440
|
isZeroNetwork,
|
|
@@ -17023,12 +17456,15 @@ export {
|
|
|
17023
17456
|
loadProfile,
|
|
17024
17457
|
loadProtocolFacts,
|
|
17025
17458
|
loadRecordedFingerprint,
|
|
17459
|
+
loadRows,
|
|
17026
17460
|
loadWorkspaceFileContent,
|
|
17027
17461
|
loginClientCredentials,
|
|
17028
17462
|
loginPairing,
|
|
17029
17463
|
loginPassword,
|
|
17030
17464
|
loginPat,
|
|
17465
|
+
matchNote,
|
|
17031
17466
|
matchSkills,
|
|
17467
|
+
matchedDimensions,
|
|
17032
17468
|
migrateLegacyProfiles,
|
|
17033
17469
|
modelEntries,
|
|
17034
17470
|
modelKeys,
|
|
@@ -17064,8 +17500,10 @@ export {
|
|
|
17064
17500
|
readPullManifest,
|
|
17065
17501
|
refreshToken,
|
|
17066
17502
|
remove,
|
|
17503
|
+
renderFind,
|
|
17067
17504
|
renderRound,
|
|
17068
17505
|
renderTriage,
|
|
17506
|
+
renderValues,
|
|
17069
17507
|
replHistoryFile,
|
|
17070
17508
|
resetSettingItem,
|
|
17071
17509
|
resolveActiveEnv,
|
|
@@ -17111,6 +17549,8 @@ export {
|
|
|
17111
17549
|
update,
|
|
17112
17550
|
uploadDocument,
|
|
17113
17551
|
validateMiniProject,
|
|
17552
|
+
valueState,
|
|
17553
|
+
valuesRoundCaveat,
|
|
17114
17554
|
verifyAttention,
|
|
17115
17555
|
verifyRc,
|
|
17116
17556
|
verifyText,
|