@hcmai/sdk 0.29.0 → 0.31.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/dist/index.js CHANGED
@@ -66,6 +66,8 @@ var ExitCode = /* @__PURE__ */ ((ExitCode2) => {
66
66
  ExitCode2[ExitCode2["BUSINESS_ERROR"] = 3] = "BUSINESS_ERROR";
67
67
  ExitCode2[ExitCode2["NETWORK_ERROR"] = 4] = "NETWORK_ERROR";
68
68
  ExitCode2[ExitCode2["CONFIG_ERROR"] = 5] = "CONFIG_ERROR";
69
+ ExitCode2[ExitCode2["VERIFY_MISMATCH"] = 6] = "VERIFY_MISMATCH";
70
+ ExitCode2[ExitCode2["VERIFY_UNAVAILABLE"] = 7] = "VERIFY_UNAVAILABLE";
69
71
  ExitCode2[ExitCode2["SIGINT"] = 130] = "SIGINT";
70
72
  return ExitCode2;
71
73
  })(ExitCode || {});
@@ -258,9 +260,9 @@ var CliError = class extends Error {
258
260
  const localDiagnosis = this.context?.localDiagnosis;
259
261
  if (typeof localDiagnosis === "string" && localDiagnosis) out += `
260
262
  \u8BCA\u65AD: ${localDiagnosis}`;
261
- const nextStep = this.context?.nextStep;
262
- if (typeof nextStep === "string" && nextStep) out += `
263
- \u4E0B\u4E00\u6B65: ${nextStep}`;
263
+ const nextStep2 = this.context?.nextStep;
264
+ if (typeof nextStep2 === "string" && nextStep2) out += `
265
+ \u4E0B\u4E00\u6B65: ${nextStep2}`;
264
266
  return out;
265
267
  }
266
268
  toJSON() {
@@ -566,11 +568,11 @@ var SDK_VERSION = manifest.version;
566
568
 
567
569
  // src/http/endpoint.ts
568
570
  function assertUsableEndpoint(endpoint, field = "endpoint") {
569
- const fail2 = (message, nextStep) => {
571
+ const fail2 = (message, nextStep2) => {
570
572
  throw new CliError({
571
573
  code: "INVALID_ARGUMENT" /* INVALID_ARGUMENT */,
572
574
  message,
573
- context: { field, nextStep }
575
+ context: { field, nextStep: nextStep2 }
574
576
  });
575
577
  };
576
578
  if (!endpoint) {
@@ -1968,7 +1970,10 @@ async function listModels(http) {
1968
1970
 
1969
1971
  // src/models/create.ts
1970
1972
  function writeParams(opts) {
1971
- return opts?.i18n ? { params: { i18n: "true" } } : {};
1973
+ const params = {};
1974
+ if (opts?.i18n) params.i18n = "true";
1975
+ if (opts?.verify) params.verify = "true";
1976
+ return Object.keys(params).length ? { params } : {};
1972
1977
  }
1973
1978
  async function create(http, model, data, opts) {
1974
1979
  const resp = await http.post(`/api/models/${model}`, data, writeParams(opts));
@@ -2166,6 +2171,270 @@ function parseFixture(yamlText, sourcePath) {
2166
2171
  return fixture;
2167
2172
  }
2168
2173
 
2174
+ // src/models/write-verification.ts
2175
+ var EXCLUDED_REASONS = {
2176
+ SYSTEM_FIELD: "\u7CFB\u7EDF\u5B57\u6BB5\uFF0C\u7531\u670D\u52A1\u7AEF\u7EF4\u62A4\uFF0C\u4E0D\u6BD4",
2177
+ NULL_IS_NO_OP: "\u9001\u7684\u662F null\uFF0C\u6309\u534F\u8BAE\u4E0D\u6539\u8FD9\u4E00\u683C\uFF1B\u8981\u6E05\u7A7A\u7528 _clearFields",
2178
+ SERVER_GENERATES_WHEN_EMPTY: "\u9001\u7684\u662F\u7A7A\u4E32\uFF0C\u7F16\u7801\u7531\u670D\u52A1\u7AEF\u6309\u7F16\u7801\u89C4\u5219\u751F\u6210\uFF0C\u4E0D\u6BD4",
2179
+ TIMELINE_MANAGED: "\u65F6\u95F4\u8F74\u5B57\u6BB5\uFF0C\u7531\u65F6\u95F4\u6A21\u578B\u7EF4\u62A4\uFF0C\u4E0D\u6BD4",
2180
+ READ_TIME_DERIVED: "\u8BFB\u65F6\u6D3E\u751F\u7684\u5B57\u6BB5\uFF0C\u5B58\u4E0D\u8FDB\u53BB\uFF0C\u4E0D\u6BD4",
2181
+ CONSUMED_BY_MODEL: "\u4E0D\u5728\u5143\u6570\u636E\u91CC\uFF0C\u6A21\u578B\u5199\u5165\u65F6\u8BFB\u8D70\u4E86\u5B83\uFF08\u5199\u540E\u5DF2\u4E0D\u5728\u56DE\u5305\u4E0A\uFF09\uFF0C\u4E0D\u6BD4",
2182
+ RESPONSE_ONLY: "\u53EA\u51FA\u73B0\u5728\u54CD\u5E94\u91CC\u7684\u5B57\u6BB5\uFF0C\u5199\u4E0D\u8FDB\u53BB\uFF0C\u4E0D\u6BD4"
2183
+ };
2184
+ var REASON_MEANING = {
2185
+ VALUE_NOT_STORED: "\u9001\u4E86\u503C\uFF0C\u5E93\u91CC\u662F\u7A7A\u7684",
2186
+ VALUE_DIFFERS: "\u5E93\u91CC\u7684\u503C\u548C\u9001\u7684\u4E0D\u4E00\u6837",
2187
+ NOT_A_FIELD: "\u4E0D\u662F\u8FD9\u4E2A\u6A21\u578B\u7684\u5B57\u6BB5\uFF0C\u6807\u51C6\u5199\u5165\u4E0D\u8BFB\u5B83",
2188
+ CONTAINER_KEYS_DROPPED: "\u6574\u4EFD\u9001\u5BB9\u5668\u5B57\u6BB5\uFF0C\u6CA1\u9001\u7684\u5B50\u952E\u88AB\u6E05\u6389\u4E86",
2189
+ FIELD_NOT_READABLE: "\u4F60\u5BF9\u8FD9\u4E2A\u5B57\u6BB5\u6CA1\u6709\u8BFB\u6743\u9650",
2190
+ MASKED: "\u8FD9\u4E2A\u5B57\u6BB5\u5BF9\u4F60\u8131\u654F",
2191
+ AMBIGUOUS: "\u53D6\u503C\u4E0D\u552F\u4E00\uFF0C\u56DE\u8BFB\u683C\u6309\u89C4\u8303\u503C\u56DE\u586B",
2192
+ DEGRADED: "\u56DE\u8BFB\u65F6\u8FD9\u4E00\u683C\u6280\u672F\u964D\u7EA7",
2193
+ UNRESOLVED: "\u8BFB\u65F6\u6D3E\u751F\u5217\u7B97\u4E0D\u51FA",
2194
+ NOT_RETURNED: "\u56DE\u8BFB\u91CC\u6CA1\u6709\u8FD9\u4E2A\u5B57\u6BB5\uFF08\u4F8B\u5982\u53E3\u4EE4\uFF0C\u5929\u751F\u6838\u9A8C\u4E0D\u4E86\uFF09",
2195
+ CONTAINER_BASELINE_UNAVAILABLE: "\u6574\u4EFD\u9001\u5BB9\u5668\u5B57\u6BB5\uFF0C\u5199\u524D\u7684\u5BB9\u5668\u8BFB\u4E0D\u5230\uFF0C\u4E22\u952E\u68C0\u67E5\u505A\u4E0D\u4E86",
2196
+ CONTAINER_KEYS_UNREADABLE: "\u5BB9\u5668\u91CC\u6709\u4F60\u8BFB\u4E0D\u5230\u7684\u5B50\u952E\uFF0C\u770B\u4E0D\u51FA\u5B83\u4EEC\u88AB\u6CA1\u88AB\u6E05\u6389",
2197
+ COMPARE_FAILED: "\u6BD4\u8F83\u65F6\u51FA\u9519",
2198
+ NOTHING_TO_COMPARE: "\u6CA1\u6709\u53EF\u6BD4\u7684\u5185\u5BB9",
2199
+ ALL_FIELDS_UNVERIFIABLE: "\u6BCF\u4E2A\u5B57\u6BB5\u90FD\u6CA1\u6838\u6210",
2200
+ NO_READ_PERMISSION: "\u6309\u5199\u5165\u90A3\u4E00\u7248\u7684\u751F\u6548\u65E5\uFF0C\u4F60\u8BFB\u4E0D\u5230\u8FD9\u4E00\u884C",
2201
+ READBACK_INSIDE_TRANSACTION: "\u56DE\u8BFB\u65F6\u5199\u5165\u8FD8\u6CA1\u63D0\u4EA4",
2202
+ META_UNAVAILABLE: "\u6BD4\u8F83\u8981\u7528\u7684\u5143\u6570\u636E\u8BFB\u4E0D\u5230",
2203
+ EFFECTIVE_DATE_UNKNOWN: "\u65F6\u95F4\u6A21\u578B\u5199\u5B8C\u540E\u5B9A\u4E0D\u51FA\u56DE\u8BFB\u65E5",
2204
+ READBACK_FAILED: "\u56DE\u8BFB\u51FA\u9519",
2205
+ NOT_FOUND_ON_READBACK: "\u6309\u521A\u5199\u5165\u56DE\u7684 id \u8BFB\u4E0D\u5230\u8FD9\u4E00\u884C"
2206
+ };
2207
+ var NEXT_STEP = {
2208
+ VALUE_NOT_STORED: "\u6570\u636E\u6CA1\u5B58\u8FDB\u53BB\uFF0C\u4E0D\u8981\u91CD\u8DD1\uFF1B\u62A5\u7ED9\u4EA7\u54C1\u4FA7\uFF08\u9644\u4E0A\u9762\u7684\u9001\u503C\uFF09",
2209
+ VALUE_DIFFERS: "\u4EE5\u5E93\u91CC\u7684\u503C\u4E3A\u51C6\u6539\u672C\u5730\u6E90\uFF0C\u4E0D\u8981\u91CD\u8DD1\uFF1B\u82E5\u56DE\u8BFB\u65F6\u523B\uFF08readAt\uFF09\u524D\u540E\u6709\u4ED6\u4EBA\u4FEE\u6539\uFF0C\u4EE5\u6700\u65B0\u503C\u4E3A\u51C6",
2210
+ NOT_A_FIELD: "\u6309 /meta \u6539\u5B57\u6BB5\u540D\uFF0C\u4E0D\u8981\u91CD\u8DD1\u540C\u4E00\u6761\uFF08\u82E5\u8BE5\u6A21\u578B\u5728\u94A9\u5B50\u91CC\u8BFB\u8FD9\u4E2A\u952E\uFF0C\u53EF\u5FFD\u7565\uFF09",
2211
+ CONTAINER_KEYS_DROPPED: "\u8865\u56DE\u88AB\u6E05\u6389\u7684\u5B50\u952E\uFF0C\u4E0D\u8981\u91CD\u8DD1\uFF1B\u53EA\u6539\u4E00\u4E2A\u6269\u5C55\u5B57\u6BB5\u65F6\uFF0C\u6309 /meta \u91CC\u8BE5\u5B57\u6BB5\u7684\u952E\u540D\u4F5C\u4E3A\u9876\u5C42\u952E\u5355\u72EC\u9001\uFF0C\u4E0D\u8981\u6574\u4EFD\u9001 flexData",
2212
+ NOT_FOUND_ON_READBACK: "\u6309 id \u8BFB\u4E0D\u5230\uFF0C\u4E0D\u8981\u91CD\u8DD1\uFF1B\u7528\u6709\u6743\u9650\u7684\u8D26\u53F7\u6309 id \u67E5\u4E00\u6B21",
2213
+ FIELD_NOT_READABLE: "\u627E\u6709\u8BFB\u6743\u9650\u7684\u4EBA\u6838\u5BF9\uFF0C\u6216\u63A5\u53D7\u4E0D\u53EF\u6838\u9A8C",
2214
+ MASKED: "\u627E\u6709\u8BFB\u6743\u9650\u7684\u4EBA\u6838\u5BF9\uFF0C\u6216\u63A5\u53D7\u4E0D\u53EF\u6838\u9A8C",
2215
+ NO_READ_PERMISSION: "\u627E\u6709\u8BFB\u6743\u9650\u7684\u4EBA\u6838\u5BF9\uFF0C\u6216\u63A5\u53D7\u4E0D\u53EF\u6838\u9A8C",
2216
+ CONTAINER_KEYS_UNREADABLE: "\u627E\u6709\u8BFB\u6743\u9650\u7684\u4EBA\u6838\u5BF9",
2217
+ AMBIGUOUS: "\u5E26 effectiveDate \u6307\u5B9A\u7248\u672C\u540E\u7528 {get} \u6838\u5BF9",
2218
+ DEGRADED: "\u7A0D\u540E\u7528 {get} \u6838\u5BF9",
2219
+ UNRESOLVED: "\u7A0D\u540E\u7528 {get} \u6838\u5BF9",
2220
+ CONTAINER_BASELINE_UNAVAILABLE: "\u7528 {get} \u8BFB\u51FA\u5BB9\u5668\uFF0C\u786E\u8BA4\u6CA1\u9001\u7684\u5B50\u952E\u8FD8\u5728",
2221
+ COMPARE_FAILED: "\u7528 {get} \u624B\u5DE5\u6838\u5BF9\uFF1B\u62A5\u7ED9\u4EA7\u54C1\u4FA7\u65F6\u9644 traceId\uFF08\u670D\u52A1\u7AEF\u7ED9\u4E86\u4F1A\u6253\u5728\u4E0A\u9762\uFF0C\u6CA1\u7ED9\u5C31\u9644\u8FD9\u6B21\u8BF7\u6C42\u7684\u65F6\u95F4\u4E0E id\uFF09",
2222
+ META_UNAVAILABLE: "\u7A0D\u540E\u7528 {get} \u6838\u5BF9",
2223
+ READBACK_FAILED: "\u7528 {get} \u624B\u5DE5\u6838\u5BF9\uFF1B\u4E0D\u8981\u76F4\u63A5\u91CD\u8DD1 {cmd}",
2224
+ EFFECTIVE_DATE_UNKNOWN: "\u62A5\u7ED9\u4EA7\u54C1\u4FA7\uFF1B\u7528\u5E26 effectiveDate \u7684 {get} \u624B\u5DE5\u6838\u5BF9",
2225
+ READBACK_INSIDE_TRANSACTION: "\u62A5\u7ED9\u4EA7\u54C1\u4FA7\uFF08\u901A\u7528\u5199\u5165\u7AEF\u70B9\u4E0D\u5E94\u51FA\u73B0\uFF09"
2226
+ };
2227
+ var KNOWN_STATUS = /* @__PURE__ */ new Set(["VERIFIED", "MISMATCH", "PARTIAL", "UNVERIFIABLE"]);
2228
+ var VERIFY_ECHO_KEYS = ["writeVerification", "verifyExitReason"];
2229
+ var isObj = (v) => !!v && typeof v === "object" && !Array.isArray(v);
2230
+ var str = (v) => typeof v === "string" && v.length > 0 ? v : void 0;
2231
+ function nonEmptyStrings(value) {
2232
+ return Array.isArray(value) ? value.filter((v) => typeof v === "string" && v.length > 0) : [];
2233
+ }
2234
+ function getUrl(ctx) {
2235
+ return ctx.id ? `GET /api/models/${ctx.model}/${ctx.id}` : `GET /api/models/${ctx.model}/{id}`;
2236
+ }
2237
+ function meaning(reason) {
2238
+ if (!reason) return "\u670D\u52A1\u7AEF\u6CA1\u7ED9\u539F\u56E0\u7801";
2239
+ return REASON_MEANING[reason] ? `${reason}\uFF0C${REASON_MEANING[reason]}` : `${reason}\uFF08\u8FD9\u7248 CLI \u4E0D\u8BA4\u8BC6\u8FD9\u4E2A\u539F\u56E0\u7801\uFF0C\u539F\u6837\u7167\u767B\uFF09`;
2240
+ }
2241
+ function nextStep(reason, ctx) {
2242
+ const step = reason ? NEXT_STEP[reason] : void 0;
2243
+ return step?.replace("{get}", getUrl(ctx)).replace("{cmd}", ctx.command ?? "create");
2244
+ }
2245
+ function show(value, truncated) {
2246
+ const text3 = JSON.stringify(value ?? null);
2247
+ return truncated === true ? `${text3}\u2026\uFF08\u670D\u52A1\u7AEF\u622A\u65AD\uFF09` : text3;
2248
+ }
2249
+ function fieldLines(fields, markUnverifiable = false) {
2250
+ const out = [];
2251
+ let malformed = 0;
2252
+ for (const f of fields) {
2253
+ if (!isObj(f)) {
2254
+ malformed++;
2255
+ continue;
2256
+ }
2257
+ const tag = markUnverifiable && f.status === "UNVERIFIABLE" ? "\uFF08\u6CA1\u6838\u6210\uFF0C\u4E0D\u7B97\u5BF9\u4E0D\u4E0A\uFF09" : "";
2258
+ let line = ` - ${str(f.field) ?? "\uFF08\u6CA1\u7ED9\u5B57\u6BB5\u540D\uFF09"}${tag}\uFF1A${meaning(str(f.reason))}`;
2259
+ const sides = [
2260
+ ..."sent" in f ? [`\u9001 ${show(f.sent, f.sentTruncated)}`] : [],
2261
+ ..."stored" in f ? [`\u5B58 ${show(f.stored, f.storedTruncated)}`] : []
2262
+ ];
2263
+ if (sides.length) line += `\uFF1B${sides.join(" \u2192 ")}`;
2264
+ out.push(line);
2265
+ const dropped = nonEmptyStrings(f.droppedKeys);
2266
+ if (dropped.length) out.push(` \u88AB\u6E05\u6389\u7684\u5B50\u952E\uFF1A${dropped.join("\u3001")}`);
2267
+ for (const leaf of Array.isArray(f.leaves) ? f.leaves : []) {
2268
+ if (!isObj(leaf)) {
2269
+ malformed++;
2270
+ continue;
2271
+ }
2272
+ if (leaf.status === "VERIFIED") continue;
2273
+ out.push(` \xB7 ${str(leaf.path) ?? "\uFF08\u6CA1\u7ED9\u8DEF\u5F84\uFF09"}\uFF1A${str(leaf.status) ?? "\uFF08\u6CA1\u7ED9\u72B6\u6001\uFF09"}\uFF0C${meaning(str(leaf.reason))}`);
2274
+ }
2275
+ }
2276
+ if (malformed) out.push(` \uFF08\u53E6\u6709 ${malformed} \u6761\u5B57\u6BB5 / \u53F6\u5B50\u6761\u76EE\u5F62\u72B6\u8BA4\u4E0D\u51FA\uFF0C\u6CA1\u6253\u51FA\u6765\uFF1B\u539F\u6837\u89C1 --output json \u7684 writeVerification\uFF09`);
2277
+ return out;
2278
+ }
2279
+ function nextStepLines(reasons, ctx) {
2280
+ const seen = /* @__PURE__ */ new Set();
2281
+ const out = [];
2282
+ for (const r of reasons) {
2283
+ const step = nextStep(r, ctx);
2284
+ if (!step || seen.has(step)) continue;
2285
+ seen.add(step);
2286
+ out.push(`\u4E0B\u4E00\u6B65\uFF1A${step}`);
2287
+ }
2288
+ return out;
2289
+ }
2290
+ function excludedLines(block) {
2291
+ const excluded = (Array.isArray(block.excluded) ? block.excluded : []).filter(isObj);
2292
+ if (!excluded.length) return [];
2293
+ return [
2294
+ `\u6CA1\u6BD4\u5BF9\u7684 ${excluded.length} \u4E2A\u5B57\u6BB5\uFF08\u6392\u9664\u6E05\u5355\uFF0C\u4E0D\u7B97\u6CA1\u6838\u6210\uFF09\uFF1A`,
2295
+ ...excluded.map((e) => {
2296
+ const reason = str(e.reason);
2297
+ return ` - ${str(e.field) ?? "\uFF08\u6CA1\u7ED9\u5B57\u6BB5\u540D\uFF09"}\uFF1A${reason && EXCLUDED_REASONS[reason] ? EXCLUDED_REASONS[reason] : `${reason ?? "\u6CA1\u7ED9\u539F\u56E0"}\uFF08\u8FD9\u7248 CLI \u4E0D\u8BA4\u8BC6\u8FD9\u4E2A\u539F\u56E0\u7801\uFF0C\u539F\u6837\u7167\u767B\uFF09`}`;
2298
+ })
2299
+ ];
2300
+ }
2301
+ function countsText(counts) {
2302
+ if (!isObj(counts)) return "\u670D\u52A1\u7AEF\u6CA1\u7ED9\u8BA1\u6570";
2303
+ const parts = ["considered", "verified", "mismatched", "unverifiable", "excluded"].filter((k) => typeof counts[k] === "number").map((k) => `${k}=${counts[k]}`);
2304
+ return parts.length ? parts.join("\uFF0C") : "\u670D\u52A1\u7AEF\u6CA1\u7ED9\u8BA1\u6570";
2305
+ }
2306
+ function contextLines(block) {
2307
+ const out = [];
2308
+ const detail = isObj(block.detail) ? block.detail : {};
2309
+ if (str(detail.message)) out.push(` \u670D\u52A1\u7AEF\u8BF4\u660E\uFF1A${detail.message}`);
2310
+ const read = [
2311
+ ...str(block.readAt) ? [`\u56DE\u8BFB\u65F6\u523B readAt=${block.readAt}`] : [],
2312
+ ...str(block.asOf) ? [`\u6309\u751F\u6548\u65E5 asOf=${block.asOf}${str(block.asOfSource) ? `\uFF08${block.asOfSource}\uFF09` : ""} \u8BFB`] : [],
2313
+ ...str(detail.asOf) && detail.asOf !== block.asOf ? [`\u8BFB\u4E0D\u5230\u7684\u90A3\u4E00\u7248\u751F\u6548\u65E5 ${detail.asOf}`] : []
2314
+ ];
2315
+ if (read.length) out.push(` ${read.join("\uFF1B")}`);
2316
+ if (str(detail.traceId)) out.push(` traceId=${detail.traceId}`);
2317
+ return out;
2318
+ }
2319
+ function truncatedLines(block, listed3) {
2320
+ return block.fieldsTruncated === true ? [` \u2026\u670D\u52A1\u7AEF\u622A\u65AD\u4E86\u5B57\u6BB5\u6E05\u5355\uFF08fieldsTruncated\uFF09\uFF0C\u4E0A\u9762\u53EA\u5217\u51FA ${listed3} \u6761\uFF1B\u5B8C\u6574\u8BA1\u6570\uFF1A${countsText(block.counts)}`] : [];
2321
+ }
2322
+ function malformedVerdict(why, ctx) {
2323
+ return {
2324
+ exitCode: 7 /* VERIFY_UNAVAILABLE */,
2325
+ verifyExitReason: "MALFORMED_VERIFICATION",
2326
+ lines: [
2327
+ `\u5199\u540E\u6838\u9A8C\uFF1A\u6838\u9A8C\u5757\u5F62\u72B6\u8BA4\u4E0D\u51FA\uFF08${why}\uFF09\uFF0C\u5DF2\u5199\u5165\u3001\u672A\u6838\u9A8C\u3002`,
2328
+ `\u4E0B\u4E00\u6B65\uFF1A\u7528 ${getUrl(ctx)} \u624B\u5DE5\u6838\u5BF9\uFF1B\u62A5\u7ED9\u4EA7\u54C1\u4FA7\u65F6\u9644 --output json \u91CC\u7684 writeVerification \u539F\u6837`
2329
+ ]
2330
+ };
2331
+ }
2332
+ function stripVerifyEchoKeys(data) {
2333
+ if (!isObj(data)) return { data, stripped: [] };
2334
+ const stripped = VERIFY_ECHO_KEYS.filter((k) => k in data);
2335
+ if (!stripped.length) return { data, stripped };
2336
+ const copy = { ...data };
2337
+ for (const k of stripped) delete copy[k];
2338
+ return { data: copy, stripped: [...stripped] };
2339
+ }
2340
+ function assessWriteVerification(response, ctx) {
2341
+ try {
2342
+ return assess(response, ctx);
2343
+ } catch (e) {
2344
+ return malformedVerdict(`\u5224\u8BFB\u65F6\u51FA\u9519\uFF1A${e instanceof Error ? e.message : String(e)}`, ctx);
2345
+ }
2346
+ }
2347
+ function assess(response, ctx) {
2348
+ const body = isObj(response) ? response : {};
2349
+ const unknown = nonEmptyStrings(body.fieldsUnknown);
2350
+ const echoed = unknown.includes("writeVerification");
2351
+ const raw = echoed ? void 0 : body.writeVerification;
2352
+ if (raw === void 0 || raw === null) {
2353
+ const echoNote = echoed ? [" \u56DE\u5305\u91CC\u7684 writeVerification \u662F\u8BF7\u6C42\u91CC\u5E26\u8FC7\u53BB\u7684\u952E\u88AB\u539F\u6837\u56DE\u663E\uFF08\u5B83\u5728\u672A\u77E5\u952E\u56DE\u6267\u91CC\uFF09\uFF0C\u4E0D\u662F\u670D\u52A1\u7AEF\u7684\u6838\u9A8C\u7ED3\u8BBA\u3002"] : [];
2354
+ if (unknown.length) {
2355
+ return {
2356
+ exitCode: 6 /* VERIFY_MISMATCH */,
2357
+ verifyExitReason: "LEGACY_UNKNOWN_FIELDS",
2358
+ lines: [
2359
+ "\u5199\u540E\u6838\u9A8C\uFF1A\u6CA1\u6536\u5230\u6838\u9A8C\u5757\uFF0C\u7ED3\u8BBA\u6765\u81EA\u670D\u52A1\u7AEF\u7684\u672A\u77E5\u952E\u56DE\u6267\u2014\u2014\u5DF2\u5199\u5165\uFF0C\u4F46\u4E0B\u9762\u8FD9\u4E9B\u952E\u4E0D\u5728\u5143\u6570\u636E\u91CC\uFF0C\u6807\u51C6\u5199\u5165\u4E0D\u8BFB\u5B83\u4EEC\uFF08NOT_A_FIELD\uFF09\uFF1A",
2360
+ ...unknown.map((k) => ` - ${k}`),
2361
+ ...echoNote,
2362
+ ...body.fieldsUnknownUnverified === true ? [" \u670D\u52A1\u7AEF\u8BF4\u8FD9\u4EFD\u672A\u77E5\u952E\u540D\u5355\u6CA1\u67E5\u5168\uFF0C\u53EF\u80FD\u8FD8\u6709\u522B\u7684\u9519\u540D\u952E\u3002"] : [],
2363
+ `\u4E0B\u4E00\u6B65\uFF1A${NEXT_STEP.NOT_A_FIELD}`
2364
+ ]
2365
+ };
2366
+ }
2367
+ return {
2368
+ exitCode: 7 /* VERIFY_UNAVAILABLE */,
2369
+ verifyExitReason: "LEGACY_NO_VERIFICATION",
2370
+ lines: [
2371
+ "\u5199\u540E\u6838\u9A8C\uFF1A\u6CA1\u6536\u5230\u6838\u9A8C\u5757\uFF08\u5E38\u89C1\u539F\u56E0\uFF1ACore \u7248\u672C\u65E9\u4E8E\u5199\u540E\u6838\u9A8C\u4E0A\u7EBF\uFF1B\u6216\u670D\u52A1\u7AEF\u7EC4\u88C5\u54CD\u5E94\u526F\u672C\u5931\u8D25\uFF09\uFF0C\u5DF2\u5199\u5165\u3001\u672A\u6838\u9A8C\u3002" + (body.fieldsUnknownUnverified === true ? "\u670D\u52A1\u7AEF\u7684\u672A\u77E5\u952E\u56DE\u6267\u4E5F\u6CA1\u67E5\u6210\u3002" : ""),
2372
+ `\u4E0B\u4E00\u6B65\uFF1A\u7528 ${getUrl(ctx)} \u624B\u5DE5\u6838\u5BF9\uFF1B\u5347\u7EA7 Core \u540E --verify \u624D\u6709\u7ED3\u8BBA`
2373
+ ]
2374
+ };
2375
+ }
2376
+ if (!isObj(raw)) return malformedVerdict("writeVerification \u4E0D\u662F\u5BF9\u8C61", ctx);
2377
+ const block = raw;
2378
+ const status = str(block.status);
2379
+ if (!status) return malformedVerdict("\u6CA1\u6709\u53EF\u8BFB\u7684 status", ctx);
2380
+ const fields = Array.isArray(block.fields) ? block.fields : [];
2381
+ const reason = str(block.reason);
2382
+ const counts = isObj(block.counts) ? block.counts : void 0;
2383
+ const fieldReasons = fields.filter(isObj).map((f) => str(f.reason));
2384
+ if (!KNOWN_STATUS.has(status)) {
2385
+ return {
2386
+ exitCode: 7 /* VERIFY_UNAVAILABLE */,
2387
+ verifyExitReason: status,
2388
+ lines: [
2389
+ `\u5199\u540E\u6838\u9A8C\uFF1A\u8FD9\u7248 CLI \u4E0D\u8BA4\u8BC6\u6838\u9A8C\u72B6\u6001 ${status}\uFF0C\u5DF2\u5199\u5165\uFF0C\u6309\u300C\u672A\u6838\u9A8C\u300D\u5904\u7406\u3002`,
2390
+ `\u4E0B\u4E00\u6B65\uFF1A\u5347\u7EA7 CLI \u540E\u518D\u770B\uFF1B\u73B0\u5728\u7528 ${getUrl(ctx)} \u624B\u5DE5\u6838\u5BF9`
2391
+ ]
2392
+ };
2393
+ }
2394
+ if (status === "VERIFIED") {
2395
+ const n = typeof counts?.verified === "number" ? counts.verified : Array.isArray(block.verifiedFields) ? block.verifiedFields.length : void 0;
2396
+ return {
2397
+ exitCode: 0 /* SUCCESS */,
2398
+ verifyExitReason: status,
2399
+ lines: [
2400
+ `\u5199\u540E\u6838\u9A8C\uFF1A\u901A\u8FC7\uFF08VERIFIED\uFF09${n !== void 0 ? `\uFF0C${n} \u4E2A\u5B57\u6BB5\u4E0E\u5E93\u91CC\u4E00\u81F4` : ""}\u3002`,
2401
+ ...excludedLines(block)
2402
+ ]
2403
+ };
2404
+ }
2405
+ if (status === "MISMATCH") {
2406
+ const lines2 = ["\u5199\u540E\u6838\u9A8C\uFF1A\u6CA1\u8FC7\uFF08MISMATCH\uFF09\u2014\u2014\u5DF2\u5199\u5165\uFF0C\u4F46\u4E0E\u5E93\u91CC\u5BF9\u4E0D\u4E0A\u3002\u{1F534} \u4E0D\u8981\u91CD\u8DD1\u3002"];
2407
+ if (reason === "NOT_FOUND_ON_READBACK") {
2408
+ lines2.push(` \u6574\u884C\uFF1A${meaning(reason)}`);
2409
+ } else {
2410
+ lines2.push(...fieldLines(fields, true), ...truncatedLines(block, fields.length));
2411
+ if (reason) lines2.push(` \u5176\u4F59\u5B57\u6BB5\u6CA1\u6838\uFF1A${meaning(reason)}`);
2412
+ }
2413
+ lines2.push(...contextLines(block), ...excludedLines(block));
2414
+ lines2.push(...nextStepLines([...fieldReasons, reason], ctx));
2415
+ return { exitCode: 6 /* VERIFY_MISMATCH */, verifyExitReason: status, lines: lines2 };
2416
+ }
2417
+ if (status === "PARTIAL") {
2418
+ const verified = typeof counts?.verified === "number" ? `${counts.verified} \u4E2A\u5B57\u6BB5\u4E00\u81F4` : "\u4E00\u81F4\u7684\u5B57\u6BB5\u6570\u670D\u52A1\u7AEF\u6CA1\u7ED9";
2419
+ const lines2 = [
2420
+ `\u5199\u540E\u6838\u9A8C\uFF1A\u53EA\u6838\u4E86\u4E00\u90E8\u5206\uFF08PARTIAL\uFF09\u2014\u2014\u5DF2\u5199\u5165\uFF0C${verified}\uFF0C\u4E0B\u9762\u8FD9\u4E9B\u6CA1\u6838\u6210\uFF1A`,
2421
+ ...fieldLines(fields),
2422
+ ...truncatedLines(block, fields.length),
2423
+ ...contextLines(block),
2424
+ ...excludedLines(block),
2425
+ ...nextStepLines(fieldReasons, ctx)
2426
+ ];
2427
+ return { exitCode: 7 /* VERIFY_UNAVAILABLE */, verifyExitReason: status, lines: lines2 };
2428
+ }
2429
+ const lines = [`\u5199\u540E\u6838\u9A8C\uFF1A\u6CA1\u6838\u6210\uFF08UNVERIFIABLE\uFF09\u2014\u2014\u5DF2\u5199\u5165\u3001\u672A\u6838\u9A8C\u3002\u539F\u56E0\uFF1A${meaning(reason)}`, ...contextLines(block)];
2430
+ if (reason === "NOTHING_TO_COMPARE") {
2431
+ lines.push(" \u8FD9\u6B21\u9001\u7684\u5B57\u6BB5\u90FD\u5728\u6392\u9664\u6E05\u5355\u91CC\uFF0C\u6CA1\u6709\u53EF\u6BD4\u7684\u3002", ...excludedLines(block));
2432
+ }
2433
+ if (fields.length) lines.push(...fieldLines(fields), ...truncatedLines(block, fields.length));
2434
+ lines.push(...nextStepLines([reason, ...fieldReasons], ctx));
2435
+ return { exitCode: 7 /* VERIFY_UNAVAILABLE */, verifyExitReason: status, lines };
2436
+ }
2437
+
2169
2438
  // src/import/runner.ts
2170
2439
  var DEFAULT_KEY_FIELD = "code";
2171
2440
  async function runImport(client, fixtures, opts = {}) {
@@ -2176,14 +2445,33 @@ async function runImport(client, fixtures, opts = {}) {
2176
2445
  const warnings = fixtures.flatMap((fixture) => fixture.warnings ?? []);
2177
2446
  const knownKeysOf = /* @__PURE__ */ new Map();
2178
2447
  const fieldNamesUnverified = [];
2448
+ const verify = !!opts.verify && !opts.dryRun;
2449
+ const writeOpts = verify ? { verify: true } : void 0;
2450
+ const vsum = { verified: 0, mismatched: 0, unverified: 0, skippedNotVerified: 0 };
2451
+ let stoppedOn;
2452
+ const totalItems = fixtures.reduce((n, fx) => n + fx.items.length, 0);
2453
+ const stop = (model, key, cause) => {
2454
+ stoppedOn = { model, key, cause, notAttempted: totalItems - rows.length };
2455
+ return result();
2456
+ };
2179
2457
  const result = () => ({
2180
2458
  ...tally,
2181
2459
  rows,
2182
2460
  refs: store.snapshot(),
2183
2461
  refsFromTarget: [...refsFromTarget],
2184
2462
  ...warnings.length > 0 ? { warnings: [...warnings] } : {},
2185
- fieldNamesUnverified: [...fieldNamesUnverified]
2463
+ fieldNamesUnverified: [...fieldNamesUnverified],
2464
+ ...verify ? { verification: { ...vsum } } : {},
2465
+ ...stoppedOn ? { stoppedOn } : {}
2186
2466
  });
2467
+ const verifyNote = (response, model, id, command) => {
2468
+ if (!verify) return {};
2469
+ const verification = rowVerification(response, { model, id, command });
2470
+ if (verification.exitCode === 0) vsum.verified++;
2471
+ else if (verification.exitCode === 6) vsum.mismatched++;
2472
+ else vsum.unverified++;
2473
+ return { verification };
2474
+ };
2187
2475
  const knownKeysFor = async (model) => {
2188
2476
  if (!knownKeysOf.has(model)) {
2189
2477
  let resolved = null;
@@ -2219,7 +2507,7 @@ async function runImport(client, fixtures, opts = {}) {
2219
2507
  error: unresolvedError(unresolved, !!opts.dryRun)
2220
2508
  });
2221
2509
  tally.failed++;
2222
- if (opts.onError === "stop") return result();
2510
+ if (opts.onError === "stop") return stop(fx.model, key, "failed");
2223
2511
  continue;
2224
2512
  }
2225
2513
  if (opts.dryRun) {
@@ -2236,17 +2524,35 @@ async function runImport(client, fixtures, opts = {}) {
2236
2524
  store.register(fx.model, key, existingId);
2237
2525
  rows.push({ model: fx.model, key, status: "skipped", id: existingId, ...unmappedNote });
2238
2526
  tally.skipped++;
2527
+ if (verify) vsum.skippedNotVerified++;
2239
2528
  } else if (existingId && opts.updateOnly) {
2240
- await client.update(fx.model, existingId, payload);
2529
+ const updated = writeOpts ? await client.update(fx.model, existingId, payload, writeOpts) : await client.update(fx.model, existingId, payload);
2241
2530
  store.register(fx.model, key, existingId);
2242
- rows.push({ model: fx.model, key, status: "updated", id: existingId, ...unmappedNote });
2531
+ rows.push({
2532
+ model: fx.model,
2533
+ key,
2534
+ status: "updated",
2535
+ id: existingId,
2536
+ ...unmappedNote,
2537
+ ...verifyNote(updated, fx.model, existingId, "update")
2538
+ });
2243
2539
  tally.updated++;
2244
2540
  } else {
2245
- const created = await client.create(fx.model, payload);
2541
+ const created = writeOpts ? await client.create(fx.model, payload, writeOpts) : await client.create(fx.model, payload);
2246
2542
  store.register(fx.model, key, created.id);
2247
- rows.push({ model: fx.model, key, status: "created", id: created.id, ...unmappedNote });
2543
+ rows.push({
2544
+ model: fx.model,
2545
+ key,
2546
+ status: "created",
2547
+ id: created.id,
2548
+ ...unmappedNote,
2549
+ ...verifyNote(created, fx.model, created.id, "create")
2550
+ });
2248
2551
  tally.created++;
2249
2552
  }
2553
+ if (opts.onError === "stop" && rows[rows.length - 1]?.verification?.exitCode === 6) {
2554
+ return stop(fx.model, key, "verify-mismatch");
2555
+ }
2250
2556
  } catch (e) {
2251
2557
  const err = e instanceof CliError ? e : fromAxiosError(e);
2252
2558
  const context = err.context;
@@ -2264,12 +2570,55 @@ async function runImport(client, fixtures, opts = {}) {
2264
2570
  ...unmappedNote
2265
2571
  });
2266
2572
  tally.failed++;
2267
- if (opts.onError === "stop") return result();
2573
+ if (opts.onError === "stop") return stop(fx.model, key, "failed");
2268
2574
  }
2269
2575
  }
2270
2576
  }
2271
2577
  return result();
2272
2578
  }
2579
+ function rowVerification(response, ctx) {
2580
+ const verdict2 = assessWriteVerification(response, ctx);
2581
+ const body = isRecord2(response) ? response : {};
2582
+ const block = isRecord2(body.writeVerification) && verdict2.verifyExitReason !== "LEGACY_UNKNOWN_FIELDS" ? body.writeVerification : void 0;
2583
+ const reason = typeof block?.reason === "string" && block.reason ? block.reason : void 0;
2584
+ let fields;
2585
+ if (block) {
2586
+ fields = (Array.isArray(block.fields) ? block.fields : []).filter(isRecord2).filter((f) => typeof f.field === "string" && f.field).map(toRowField);
2587
+ } else if (verdict2.verifyExitReason === "LEGACY_UNKNOWN_FIELDS") {
2588
+ fields = (Array.isArray(body.fieldsUnknown) ? body.fieldsUnknown : []).filter((k) => typeof k === "string" && k.length > 0).map((field) => ({ field, status: "MISMATCH", reason: "NOT_A_FIELD" }));
2589
+ } else {
2590
+ fields = [];
2591
+ }
2592
+ return {
2593
+ status: verdict2.verifyExitReason,
2594
+ exitCode: verdict2.exitCode,
2595
+ ...reason ? { reason } : {},
2596
+ ...fields.length ? { fields } : {},
2597
+ // 服务端说清单不完整就照记:不记的话截断的清单与完整的清单同值
2598
+ ...block?.fieldsTruncated === true ? { fieldsTruncated: true } : {},
2599
+ ...!block && body.fieldsUnknownUnverified === true ? { fieldNamesIncomplete: true } : {}
2600
+ };
2601
+ }
2602
+ var nonEmpty = (v) => typeof v === "string" && v.length > 0;
2603
+ function toRowField(f) {
2604
+ const droppedKeys = Array.isArray(f.droppedKeys) ? f.droppedKeys.filter(nonEmpty) : [];
2605
+ const leaves = (Array.isArray(f.leaves) ? f.leaves : []).filter(isRecord2).filter((l) => nonEmpty(l.path) && l.status !== "VERIFIED").map((l) => ({ path: l.path, ...nonEmpty(l.status) ? { status: l.status } : {}, ...nonEmpty(l.reason) ? { reason: l.reason } : {} }));
2606
+ return {
2607
+ field: f.field,
2608
+ ...nonEmpty(f.status) ? { status: f.status } : {},
2609
+ ...nonEmpty(f.reason) ? { reason: f.reason } : {},
2610
+ ...droppedKeys.length ? { droppedKeys } : {},
2611
+ ...leaves.length ? { leaves } : {}
2612
+ };
2613
+ }
2614
+ var isRecord2 = (v) => !!v && typeof v === "object" && !Array.isArray(v);
2615
+ function importExitCode(result) {
2616
+ const v = result.verification;
2617
+ if (v && v.mismatched > 0) return 6;
2618
+ if (result.failed > 0) return 3;
2619
+ if (v && v.unverified > 0) return 7;
2620
+ return 0;
2621
+ }
2273
2622
  async function lookupMissingRefs(item, ctx) {
2274
2623
  for (const value of Object.values(item)) {
2275
2624
  const ph = parsePlaceholder(value);
@@ -3505,7 +3854,7 @@ function handshakeRejectedError(res, body) {
3505
3854
  const bodyText = body.trim().slice(0, 300);
3506
3855
  const isAuthReject = httpStatus === 401 || httpStatus === 403;
3507
3856
  const rejectedBy = reason ? `HCM \u540E\u7AEF\u63E1\u624B\u62E6\u622A\u5668\u62D2\u7EDD\uFF08X-WebSocket-Auth-Error: ${reason}\uFF09` : "\u54CD\u5E94\u91CC\u6CA1\u6709 X-WebSocket-Auth-Error\uFF0C\u62D2\u7EDD\u65B9\u4E0D\u662F HCM \u540E\u7AEF\u7684\u63E1\u624B\u62E6\u622A\u5668\uFF08\u591A\u534A\u662F\u7F51\u5173 / \u53CD\u5411\u4EE3\u7406\uFF0C\u6216\u8DEF\u5F84\u6CA1\u8DEF\u7531\u5230\u540E\u7AEF\uFF09";
3508
- const nextStep = reason ? HANDSHAKE_REJECT_NEXT_STEP[reason] ?? `\u540E\u7AEF\u62D2\u7EDD\u539F\u56E0 ${reason} \u672A\u6536\u5F55\uFF1A\u6309\u539F\u56E0\u7801\u5728 Core WebSocketHandshakeAuthInterceptor \u91CC\u67E5\u5904\u7F6E` : isAuthReject ? 'hcm version --env <\u73AF\u5883> \u786E\u8BA4\u540E\u7AEF\u5728\u7EBF\uFF1B\u518D\u7528 curl --http1.1 -H "Upgrade: websocket" \u6253\u540C\u4E00 URL\uFF0C\u770B 401 \u662F\u5426\u5E26 X-WebSocket-Auth-Error \u5934' : "hcm version --env <\u73AF\u5883> \u786E\u8BA4\u540E\u7AEF\u5728\u7EBF\uFF0C\u5E76\u786E\u8BA4 /ws/conversation \u8DEF\u5F84\u88AB\u7F51\u5173\u8DEF\u7531\u5230\u4E86\u540E\u7AEF";
3857
+ const nextStep2 = reason ? HANDSHAKE_REJECT_NEXT_STEP[reason] ?? `\u540E\u7AEF\u62D2\u7EDD\u539F\u56E0 ${reason} \u672A\u6536\u5F55\uFF1A\u6309\u539F\u56E0\u7801\u5728 Core WebSocketHandshakeAuthInterceptor \u91CC\u67E5\u5904\u7F6E` : isAuthReject ? 'hcm version --env <\u73AF\u5883> \u786E\u8BA4\u540E\u7AEF\u5728\u7EBF\uFF1B\u518D\u7528 curl --http1.1 -H "Upgrade: websocket" \u6253\u540C\u4E00 URL\uFF0C\u770B 401 \u662F\u5426\u5E26 X-WebSocket-Auth-Error \u5934' : "hcm version --env <\u73AF\u5883> \u786E\u8BA4\u540E\u7AEF\u5728\u7EBF\uFF0C\u5E76\u786E\u8BA4 /ws/conversation \u8DEF\u5F84\u88AB\u7F51\u5173\u8DEF\u7531\u5230\u4E86\u540E\u7AEF";
3509
3858
  return new CliError({
3510
3859
  code: isAuthReject ? "WS_HANDSHAKE_REJECTED" /* WS_HANDSHAKE_REJECTED */ : "NETWORK_ERROR" /* NETWORK_ERROR */,
3511
3860
  message: `WebSocket \u63E1\u624B\u88AB\u62D2 HTTP ${httpStatus}\uFF1A${rejectedBy}`,
@@ -3513,7 +3862,7 @@ function handshakeRejectedError(res, body) {
3513
3862
  httpStatus,
3514
3863
  ...reason ? { handshakeAuthError: reason } : {},
3515
3864
  ...bodyText ? { details: bodyText } : {},
3516
- nextStep
3865
+ nextStep: nextStep2
3517
3866
  },
3518
3867
  traceId
3519
3868
  });
@@ -4718,28 +5067,36 @@ function toWorkspacePreflightResult(value) {
4718
5067
  workspaceKey: stringOr(obj.workspaceKey),
4719
5068
  checked: obj.checked,
4720
5069
  checkedPaths: Array.isArray(obj.checkedPaths) ? obj.checkedPaths.map((p) => stringOr(p)) : [],
4721
- issues: obj.issues.map((raw) => {
4722
- const issue = asRecord(raw);
4723
- return {
4724
- path: issue.path == null ? null : stringOr(issue.path),
4725
- errCode: stringOrUndefined(issue.errCode),
4726
- message: stringOr(issue.message),
4727
- description: stringOrUndefined(issue.description),
4728
- field: stringOrUndefined(issue.field),
4729
- data: issue.data
4730
- };
4731
- }),
4732
- warnings: Array.isArray(obj.warnings) ? obj.warnings.map(toWorkspacePreflightWarning) : void 0
5070
+ issues: obj.issues.map(toWorkspacePreflightIssue),
5071
+ warnings: Array.isArray(obj.warnings) ? obj.warnings.map(toWorkspacePreflightWarning) : void 0,
5072
+ protocol: {
5073
+ protocolVersion: obj.protocolVersion,
5074
+ hasCoverage: "coverage" in obj,
5075
+ coverage: obj.coverage,
5076
+ hasReleaseIssues: "releaseIssues" in obj,
5077
+ releaseIssues: obj.releaseIssues
5078
+ }
5079
+ };
5080
+ }
5081
+ function toWorkspacePreflightIssue(raw) {
5082
+ const issue = asRecord(raw);
5083
+ return {
5084
+ path: issue.path == null ? null : stringOr(issue.path),
5085
+ errCode: stringOrUndefined(issue.errCode),
5086
+ message: stringOr(issue.message),
5087
+ description: stringOrUndefined(issue.description),
5088
+ field: stringOrUndefined(issue.field),
5089
+ data: issue.data
4733
5090
  };
4734
5091
  }
4735
5092
  function toWorkspacePreflightWarning(raw) {
4736
5093
  const warning = asRecord(raw);
4737
- const nextStep = stringOrUndefined(warning.next_step) ?? stringOrUndefined(warning.nextStep);
5094
+ const nextStep2 = stringOrUndefined(warning.next_step) ?? stringOrUndefined(warning.nextStep);
4738
5095
  return {
4739
5096
  warnCode: stringOrUndefined(warning.warnCode),
4740
5097
  path: warning.path == null ? null : stringOr(warning.path),
4741
5098
  message: stringOr(warning.message),
4742
- ...nextStep ? { nextStep } : {},
5099
+ ...nextStep2 ? { nextStep: nextStep2 } : {},
4743
5100
  ...typeof warning.model === "string" ? { model: warning.model } : {},
4744
5101
  ...typeof warning.versionModel === "string" ? { versionModel: warning.versionModel } : {},
4745
5102
  ...Array.isArray(warning.fields) ? { fields: warning.fields.map((f) => stringOr(f)) } : {}
@@ -6633,10 +6990,11 @@ function buildMiniVerifyAgentReport(report) {
6633
6990
  })
6634
6991
  );
6635
6992
  const preflightFailed = report.preflight?.status === "failed";
6993
+ const releaseBlocked = report.preflight?.status === "release-blocked";
6636
6994
  const safeToPush = report.validate.valid && dryRunOk && previewUrls.length > 0 && smokeOk && !preflightFailed;
6637
6995
  const nextAction = chooseMiniVerifyNextAction(report, previewUrls, smoke);
6638
6996
  return {
6639
- ok: report.ok && smokeOk && !preflightFailed,
6997
+ ok: report.ok && smokeOk && !preflightFailed && !releaseBlocked,
6640
6998
  safeToPush,
6641
6999
  nextAction,
6642
7000
  summary: {
@@ -6673,7 +7031,12 @@ function buildMiniVerifyAgentReport(report) {
6673
7031
  count: previewUrls.length,
6674
7032
  surfaces: previewUrls.map((target) => target.surface)
6675
7033
  },
6676
- preflight: report.preflight ? { status: report.preflight.status, sent: report.preflight.sent, issues: report.preflight.issues.length } : null
7034
+ preflight: report.preflight ? {
7035
+ status: report.preflight.status,
7036
+ sent: report.preflight.sent,
7037
+ issues: report.preflight.issues.length,
7038
+ ...report.preflight.releaseIssues ? { releaseIssues: report.preflight.releaseIssues.length } : {}
7039
+ } : null
6677
7040
  },
6678
7041
  changedFiles: report.status.filter((entry) => entry.status !== "unchanged").map(
6679
7042
  (entry) => ({
@@ -6728,6 +7091,7 @@ function chooseMiniVerifyNextAction(report, previewUrls, smoke) {
6728
7091
  if (report.preflight?.status === "failed") {
6729
7092
  return report.preflight.issues.some((issue) => issue.errCode === "WORKSPACE_FILE_CONFLICT") ? "resolve-conflict" : "fix-validation";
6730
7093
  }
7094
+ if (report.preflight?.status === "release-blocked") return "fix-validation";
6731
7095
  if (!previewUrls.length) return "inspect-preview";
6732
7096
  return "push";
6733
7097
  }
@@ -6773,6 +7137,9 @@ function formatMiniVerifyReport(report) {
6773
7137
  for (const issue of preflight2.issues) {
6774
7138
  lines.push(` ${issue.path ?? "(\u6574\u6279)"}: [${issue.errCode ?? "ERROR"}] ${issue.message}`);
6775
7139
  }
7140
+ for (const issue of preflight2.releaseIssues ?? []) {
7141
+ lines.push(` release \u2717 ${issue.path ?? "(\u6574\u6279)"}: [${issue.errCode ?? "ERROR"}] ${issue.message}`);
7142
+ }
6776
7143
  }
6777
7144
  if (report.preview.length) {
6778
7145
  lines.push(`[4/${totalSteps}] preview:`);
@@ -6889,7 +7256,7 @@ async function validateManifestObject(manifest2, context, root, errors, warnings
6889
7256
  requireString(manifest2, "sdkVersion", errors, (value) => SEMVER_PATTERN.test(value));
6890
7257
  if (typeof manifest2.sdkVersion === "string" && manifest2.sdkVersion !== MINI_RUNTIME_SDK_VERSION) {
6891
7258
  warnings.push(
6892
- `manifest sdkVersion '${manifest2.sdkVersion}' differs from the Core source default '${MINI_RUNTIME_SDK_VERSION}'; target Core compatibility is unknown until workspace verify server preflight. Core requires an exact ABI match.`
7259
+ `manifest sdkVersion '${manifest2.sdkVersion}' differs from the CLI built-in default SDK version '${MINI_RUNTIME_SDK_VERSION}'; the target Core requires an exact match, and the server preflight of hcm workspace verify is authoritative. Cores older than the release-view preflight (O15 core-4e) do not check this until release-plan.`
6893
7260
  );
6894
7261
  }
6895
7262
  const code = typeof manifest2.code === "string" ? manifest2.code : "";
@@ -7946,291 +8313,64 @@ async function packDataPackage(packageDir, outPath, opts = {}) {
7946
8313
  };
7947
8314
  }
7948
8315
 
7949
- // src/datapackage/install.ts
7950
- var DEFAULT_ARTIFACT_CATEGORY = "attachment";
7951
- function unwrapActionPayload(resp) {
7952
- const body = resp;
7953
- if (body && typeof body === "object") {
7954
- if (body.data && typeof body.data === "object") return body.data;
7955
- if (body.result && typeof body.result === "object") return body.result;
7956
- }
7957
- return resp;
7958
- }
7959
- function isTerminalRunStatus(status) {
7960
- if (!status) return false;
7961
- return status !== "RUNNING" && status !== "QUEUED" && status !== "MAIN_COMMITTED";
7962
- }
7963
- function confirmationParams(opts) {
7964
- return {
7965
- ...opts.allowDowngrade ? { allowDowngrade: true } : {},
7966
- ...opts.acceptContentChange ? { acceptContentChange: true } : {}
7967
- };
7968
- }
7969
- var INSTALL_CONFIRMATION_HINTS = [
7970
- {
7971
- code: "DATA_PACKAGE_DOWNGRADE_REQUIRES_CONFIRMATION",
7972
- flag: "--allow-downgrade",
7973
- nextStep: "\u786E\u8BA4\u964D\u7EA7\u5F71\u54CD\uFF08\u65E7\u7248\u672C\u6570\u636E\u8986\u76D6\u65B0\u7248\u672C\uFF09\u540E\u52A0 --allow-downgrade \u91CD\u8DD1\uFF1B\u5426\u5219\u6539\u88C5\u4E0D\u4F4E\u4E8E\u5DF2\u88C5\u7248\u672C\u7684\u5236\u54C1"
7974
- },
7975
- {
7976
- code: "DATA_PACKAGE_VERSION_DIGEST_CONFLICT",
7977
- flag: "--accept-content-change",
7978
- nextStep: "\u9996\u9009\u5347\u7248\u672C\u53F7\u91CD\u65B0 pack \u518D\u88C5\uFF1B\u786E\u8BA4\u540C\u7248\u672C\u8986\u76D6\u5F71\u54CD\u540E\u624D\u52A0 --accept-content-change \u5168\u91CF\u91CD\u88C5"
7979
- }
7980
- ];
7981
- async function installDataPackageArtifactAsync(client, artifactPath, opts = {}) {
7982
- const meta = await uploadDocument(
7983
- client.raw(),
7984
- artifactPath,
7985
- opts.category ?? DEFAULT_ARTIFACT_CATEGORY
7986
- );
7987
- const resp = await action(
7988
- client.raw(),
7989
- "DataPackage",
7990
- "installFromDocumentAsync",
7991
- {
7992
- params: { documentId: meta.documentId, tenantId: client.tenantId, ...confirmationParams(opts) }
7993
- }
7994
- );
7995
- const body = unwrapActionPayload(resp);
7996
- const runId = body.runId;
7997
- if (typeof runId !== "string" || runId.length === 0) {
7998
- throw new Error("\u670D\u52A1\u7AEF\u672A\u8FD4\u56DE runId\uFF0C\u65E0\u6CD5\u8DDF\u8E2A\u88C5\u8F7D\u8FDB\u5EA6");
7999
- }
8000
- return {
8001
- documentId: meta.documentId,
8002
- runId,
8003
- packageName: typeof body.packageName === "string" ? body.packageName : void 0,
8004
- version: typeof body.version === "string" ? body.version : void 0
8005
- };
8006
- }
8007
- async function fetchInstallRun(client, runId) {
8316
+ // src/datapackage/column-slots.ts
8317
+ import { isMap as isMap2, isScalar as isScalar2, isSeq as isSeq2, parseDocument as parseDocument2 } from "yaml";
8318
+ function columnSlotsToFlex(text3, rewrite = true) {
8319
+ const isColumn = (storage, slot) => typeof storage === "string" && storage.trim().toLowerCase() === "column" || typeof slot === "string" && slot.trim() !== "";
8320
+ let json;
8008
8321
  try {
8009
- const resp = await client.raw().get(`/api/models/DataPackageInstallRun/${runId}`);
8010
- const body = resp.data?.data ?? resp.data;
8011
- return body && typeof body === "object" ? body : void 0;
8012
- } catch (e) {
8013
- if (e?.response?.status === 404) return void 0;
8014
- throw e;
8015
- }
8016
- }
8017
- async function waitForInstallRun(client, runId, opts) {
8018
- const pollMs = opts.pollMs ?? 2e3;
8019
- const now = opts.now ?? (() => Date.now());
8020
- const sleep = opts.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
8021
- const deadline = now() + opts.timeoutMs;
8022
- let last;
8023
- for (; ; ) {
8024
- const current = await fetchInstallRun(client, runId);
8025
- if (current) last = current;
8026
- opts.onProgress?.(current);
8027
- if (isTerminalRunStatus(last?.status)) {
8028
- return { run: last, timedOut: false };
8029
- }
8030
- if (now() >= deadline) {
8031
- return { run: last, timedOut: true };
8032
- }
8033
- await sleep(pollMs);
8034
- }
8035
- }
8036
- async function installDataPackageArtifact(client, artifactPath, opts = {}) {
8037
- const meta = await uploadDocument(
8038
- client.raw(),
8039
- artifactPath,
8040
- opts.category ?? DEFAULT_ARTIFACT_CATEGORY
8041
- );
8042
- const resp = await action(
8043
- client.raw(),
8044
- "DataPackage",
8045
- "installFromDocument",
8046
- {
8047
- params: { documentId: meta.documentId, tenantId: client.tenantId, ...confirmationParams(opts) }
8048
- }
8049
- );
8050
- const view = unwrapActionPayload(resp);
8051
- return { documentId: meta.documentId, view };
8052
- }
8053
-
8054
- // src/cache.ts
8055
- async function getCacheStats(http, model) {
8056
- const resp = await http.get(`/api/models/${model}/cache`);
8057
- return resp.data?.data ?? resp.data;
8058
- }
8059
- async function clearModelCache(http, model, id) {
8060
- const url = id ? `/api/models/${model}/cache/${id}` : `/api/models/${model}/cache`;
8061
- const resp = await http.delete(url);
8062
- return resp.data?.data ?? resp.data;
8063
- }
8064
- async function clearMetaCache(http, model, opts = {}) {
8065
- const params = {};
8066
- if (opts.type) params.type = opts.type;
8067
- if (opts.state) params.state = opts.state;
8068
- const resp = await http.delete(`/api/models/${model}/meta/cache`, { params });
8069
- return resp.data?.data ?? resp.data;
8070
- }
8071
-
8072
- // src/script.ts
8073
- function unwrap(data) {
8074
- const body = data;
8075
- return (body && typeof body === "object" && "data" in body ? body.data : data) ?? data;
8076
- }
8077
- async function scriptDryRun(http, request) {
8078
- const resp = await http.post("/api/script/dry-run", request);
8079
- return unwrap(resp.data);
8080
- }
8081
- async function validateScriptManifest(http, manifestYaml) {
8082
- const resp = await http.post("/api/script/manifest/validate", { manifestYaml });
8083
- return unwrap(resp.data);
8084
- }
8085
- async function queryScriptLogs(http, query2 = {}) {
8086
- const params = {};
8087
- for (const [k, v] of Object.entries(query2)) {
8088
- if (v !== void 0 && v !== null && v !== "") params[k] = v;
8089
- }
8090
- const resp = await http.get("/api/script-logs", { params });
8091
- return unwrap(resp.data);
8092
- }
8093
- async function getScriptTask(http, taskId) {
8094
- const resp = await http.get(`/api/script-tasks/${encodeURIComponent(taskId)}`);
8095
- return unwrap(resp.data);
8096
- }
8097
-
8098
- // src/tenant.ts
8099
- async function bootstrapTenant(http, bootstrapKey, req) {
8100
- const resp = await http.post("/api/bootstrap/tenant", req, {
8101
- headers: { "X-Bootstrap-Key": bootstrapKey }
8102
- });
8103
- return resp.data?.data ?? resp.data;
8104
- }
8105
- async function reconcileTenant(http, expectedTenantId) {
8106
- const { data } = await http.post("/api/operations/bootstrap/reconcile", {}, {
8107
- __skipRetry: true,
8108
- maxRedirects: 0
8109
- });
8110
- const countKeys = ["fromVersion", "toVersion", "created", "updated", "archived"];
8111
- const rows = data?.results;
8112
- if (!data || data.tenantId !== expectedTenantId || typeof data.success !== "boolean" || !(data.error == null || typeof data.error === "string") || !Array.isArray(rows) || !rows.length || !rows.every((row) => row && typeof row.component === "string" && row.component.trim() && typeof row.status === "string" && row.status.trim() && typeof row.message === "string" && countKeys.every((key) => Number.isSafeInteger(row[key]) && Number(row[key]) >= 0) && Number(row.toVersion) >= Number(row.fromVersion)) || new Set(rows.map((row) => row.component)).size !== rows.length) {
8113
- throw new CliError({
8114
- code: "PROTOCOL_UNSUPPORTED" /* PROTOCOL_UNSUPPORTED */,
8115
- message: "\u8865\u8DD1\u63A5\u53E3\u672A\u8FD4\u56DE\u5B8C\u6574\u4E14\u5339\u914D\u5F53\u524D\u79DF\u6237\u7684\u9010\u7EC4\u4EF6\u56DE\u6267\uFF0C\u7ED3\u679C\u672A\u786E\u8BA4\uFF1B\u6CA1\u6709\u628A\u7F3A\u503C\u586B\u6210\u96F6\u6216\u6210\u529F\u3002",
8116
- context: {
8117
- reasonCode: "TENANT_RECONCILE_RECEIPT_UNKNOWN",
8118
- details: { unverifiedReceipt: data },
8119
- nextStep: "\u5148\u53EA\u8BFB\u67E5\u8BE2 tenant.bootstrap \u5E76\u6838\u67E5\u670D\u52A1\u7AEF\u65E5\u5FD7\uFF1B\u4E0D\u8981\u56E0\u56DE\u6267\u672A\u77E5\u81EA\u52A8\u91CD\u53D1\u8865\u8DD1\u3002"
8322
+ json = JSON.parse(text3);
8323
+ } catch {
8324
+ json = void 0;
8325
+ }
8326
+ if (json && typeof json === "object" && !Array.isArray(json)) {
8327
+ const fields2 = [];
8328
+ const list2 = json.fields;
8329
+ if (Array.isArray(list2)) {
8330
+ for (const f of list2) {
8331
+ if (!f || typeof f !== "object") continue;
8332
+ const o = f;
8333
+ if (!isColumn(o.storage, o.columnSlot)) continue;
8334
+ fields2.push({ field: String(o.key ?? "?"), ...typeof o.columnSlot === "string" ? { columnSlot: o.columnSlot } : {}, ...typeof o.type === "string" ? { type: o.type } : {} });
8335
+ if (rewrite) {
8336
+ o.storage = "flex";
8337
+ delete o.columnSlot;
8338
+ }
8120
8339
  }
8121
- });
8122
- }
8123
- return data;
8124
- }
8125
- async function resetTenant(http, tenantId) {
8126
- const { data: envelope2 } = await http.post("/api/models/DataPackage/action/resetTenant", {
8127
- tenantId,
8128
- confirmation: `RESET_TENANT:${tenantId}`
8129
- }, { __skipRetry: true, maxRedirects: 0 });
8130
- const receipt = envelope2?.data;
8131
- const text3 = (value) => typeof value === "string" && value.trim().length > 0;
8132
- const nonPg = receipt?.nonPgSurface;
8133
- if (!envelope2 || envelope2.error != null || envelope2.success === false || !receipt || Array.isArray(receipt) || receipt.tenantId !== tenantId || !text3(receipt.runId) || receipt.state !== "FACTORY_BASELINE" || receipt.stateScope !== "POSTGRESQL" || !["deletedRows", "touchedTables", "reconciledComponents", "restoredRows"].every((key) => Number.isSafeInteger(receipt[key]) && receipt[key] >= 0) || !["pgVerified", "overallVerified", "journalReconciledMarked"].every((key) => typeof receipt[key] === "boolean") || !nonPg || !text3(nonPg.status) || !text3(nonPg.reason) || !text3(nonPg.nextStep) || !Array.isArray(nonPg.unhandledSurfaces) || !nonPg.unhandledSurfaces.length || !nonPg.unhandledSurfaces.every(text3)) {
8134
- throw new CliError({
8135
- code: "PROTOCOL_UNSUPPORTED" /* PROTOCOL_UNSUPPORTED */,
8136
- message: "\u91CD\u7F6E\u63A5\u53E3\u672A\u8FD4\u56DE\u5B8C\u6574\u4E14\u5339\u914D\u76EE\u6807\u7684\u73B0\u5F79\u56DE\u6267\uFF0C\u7ED3\u679C\u672A\u786E\u8BA4\uFF1B\u672A\u5C06\u7F3A\u503C\u8865\u6210\u96F6\u6216\u6210\u529F\u3002",
8137
- context: {
8138
- reasonCode: "TENANT_RESET_RECEIPT_UNKNOWN",
8139
- // 坐标来自未确认回执,只供追查;保留原值,绝不据此声明成功。
8140
- details: {
8141
- ...envelope2?.error ? { error: envelope2.error } : {},
8142
- ...receipt !== void 0 ? { unverifiedReceipt: receipt } : {}
8143
- },
8144
- nextStep: "\u4E0D\u8981\u76F2\u76EE\u91CD\u8DD1\u91CD\u7F6E\uFF1B\u6838\u67E5\u670D\u52A1\u7AEF\u91CD\u7F6E\u6D41\u6C34\u4E0E\u5F53\u524D\u79DF\u6237\u72B6\u6001\u3002"
8340
+ }
8341
+ if (!fields2.length || !rewrite) return { text: text3, fields: fields2 };
8342
+ return { text: JSON.stringify(json, null, 2) + (text3.endsWith("\n") ? "\n" : ""), fields: fields2 };
8343
+ }
8344
+ const doc = parseDocument2(text3);
8345
+ if (doc.errors.length) throw new Error(doc.errors.map((e) => e.message).join("; "));
8346
+ const seq = doc.get("fields", true);
8347
+ const fields = [];
8348
+ if (isSeq2(seq)) {
8349
+ for (const item of seq.items) {
8350
+ if (!isMap2(item)) continue;
8351
+ const val = (k) => {
8352
+ const v = item.get(k, true);
8353
+ return isScalar2(v) ? v.value : void 0;
8354
+ };
8355
+ if (!isColumn(val("storage"), val("columnSlot"))) continue;
8356
+ const slot = val("columnSlot");
8357
+ const type = val("type");
8358
+ fields.push({ field: String(val("key") ?? "?"), ...typeof slot === "string" ? { columnSlot: slot } : {}, ...typeof type === "string" ? { type } : {} });
8359
+ if (rewrite) {
8360
+ item.set("storage", "flex");
8361
+ item.delete("columnSlot");
8145
8362
  }
8146
- });
8147
- }
8148
- return receipt;
8149
- }
8150
-
8151
- // src/meta/tenant-meta.ts
8152
- async function listTenantMeta(http, opts = {}) {
8153
- const resp = await http.get("/api/tenant-meta/list", { params: opts });
8154
- const body = resp.data;
8155
- const payload = body?.data ?? body;
8156
- const items = Array.isArray(payload) ? payload : payload?.items ?? payload?.list ?? payload?.records ?? [];
8157
- const total = typeof body?.total === "number" ? body.total : payload?.total;
8158
- return { items, total, raw: payload };
8159
- }
8160
- async function getTenantMeta(http, path25) {
8161
- const resp = await http.get("/api/tenant-meta/meta", { params: { path: path25 } });
8162
- const payload = resp.data?.data ?? resp.data;
8163
- if (typeof payload === "string") return payload;
8164
- return String(payload?.content ?? "");
8165
- }
8166
- async function saveTenantMeta(http, path25, content) {
8167
- const resp = await http.put("/api/tenant-meta/meta", { content }, { params: { path: path25 } });
8168
- return resp.data?.data ?? resp.data;
8169
- }
8170
- async function deleteTenantMeta(http, path25) {
8171
- const resp = await http.delete("/api/tenant-meta/meta", { params: { path: path25 } });
8172
- return resp.data?.data ?? resp.data;
8173
- }
8174
-
8175
- // src/meta/column-slots.ts
8176
- var WORKSPACE_KEY_HEADER = "X-Workspace-Key";
8177
- var COLUMN_SLOTS_PATH = "/api/tenant-extension/column-slots";
8178
- var COLUMN_SLOT_SQL_PATH = "/api/tenant-extension/column-slots/sql";
8179
- var COLUMN_SLOT_SQL_KEYS = [
8180
- "countSlot",
8181
- "flexToSlotBatched",
8182
- "flexToSlot",
8183
- "verifyFlexToSlot",
8184
- "slotToFlex",
8185
- "removeFlexKey",
8186
- "clearSlot",
8187
- "moveFromSlot",
8188
- "verifyMoveFromSlot",
8189
- "clearFromSlot"
8190
- ];
8191
- var COLUMN_SLOT_REBIND_SQL_KEYS = ["moveFromSlot", "verifyMoveFromSlot", "clearFromSlot"];
8192
- function headers(opts) {
8193
- return opts.workspaceKey ? { [WORKSPACE_KEY_HEADER]: opts.workspaceKey } : void 0;
8194
- }
8195
- function isRecord2(value) {
8196
- return typeof value === "object" && value !== null && !Array.isArray(value);
8197
- }
8198
- function unexpected(path25, body) {
8199
- return new CliError({
8200
- code: "PROTOCOL_UNSUPPORTED" /* PROTOCOL_UNSUPPORTED */,
8201
- message: `${path25} \u8FD4\u56DE\u4E86 2xx\uFF0C\u4F46\u54CD\u5E94\u91CC\u6CA1\u6709\u7EA6\u5B9A\u7684 data \u7ED3\u6784\uFF1B\u6CA1\u6709\u628A\u7F3A\u7684\u90E8\u5206\u8865\u6210\u7A7A\u5217\u8868`,
8202
- context: {
8203
- reasonCode: "COLUMN_SLOT_RESPONSE_UNRECOGNIZED",
8204
- details: body,
8205
- nextStep: "\u7528 `hcm version` \u6838\u5BF9\u540E\u7AEF\u7248\u672C\u662F\u5426\u542B\u5217\u69FD\u767B\u8BB0\u8868\uFF08ADR-452\uFF09\uFF1B\u7248\u672C\u5BF9\u5F97\u4E0A\u5C31\u628A\u8FD9\u6BB5\u54CD\u5E94\u62A5\u7ED9 CLI \u7EF4\u62A4\u8005"
8206
8363
  }
8207
- });
8208
- }
8209
- async function getColumnSlots(http, model, opts = {}) {
8210
- const resp = await http.get(COLUMN_SLOTS_PATH, { params: { model }, headers: headers(opts) });
8211
- const data = resp.data?.data;
8212
- if (!isRecord2(data) || !Array.isArray(data.slots) || !Array.isArray(data.occupied)) {
8213
- throw unexpected(COLUMN_SLOTS_PATH, resp.data);
8214
8364
  }
8215
- return data;
8216
- }
8217
- async function getColumnSlotSql(http, params, opts = {}) {
8218
- const query2 = { model: params.model, field: params.field };
8219
- if (params.slot) query2.slot = params.slot;
8220
- if (params.fromSlot) query2.fromSlot = params.fromSlot;
8221
- const resp = await http.get(COLUMN_SLOT_SQL_PATH, { params: query2, headers: headers(opts) });
8222
- const data = resp.data?.data;
8223
- if (!isRecord2(data) || !isRecord2(data.sql)) {
8224
- throw unexpected(COLUMN_SLOT_SQL_PATH, resp.data);
8225
- }
8226
- return data;
8365
+ if (!fields.length || !rewrite) return { text: text3, fields };
8366
+ return { text: doc.toString(), fields };
8227
8367
  }
8228
8368
 
8229
- // src/meta/validate-meta.ts
8230
- import yaml8 from "js-yaml";
8369
+ // src/datapackage/extension-sanitize.ts
8370
+ import { isMap as isMap3, isScalar as isScalar3, isSeq as isSeq3, parseDocument as parseDocument3 } from "yaml";
8231
8371
 
8232
8372
  // src/meta/generated/meta-schemas.ts
8233
- var META_SCHEMA_SOURCE_COMMIT = "206fd90621975757bd5c77c014e037ff74f2506c";
8373
+ var META_SCHEMA_SOURCE_COMMIT = "71adaaa601037dcc8ac84d2bfb537b873be37a7c";
8234
8374
  var META_SCHEMAS = {
8235
8375
  list: {
8236
8376
  "$schema": "https://json-schema.org/draft/2020-12/schema",
@@ -8714,6 +8854,36 @@ var META_SCHEMAS = {
8714
8854
  "$ref": "#/$defs/Map(String,Object)"
8715
8855
  }
8716
8856
  },
8857
+ "preview": {
8858
+ "type": "object",
8859
+ "properties": {
8860
+ "bindings": {
8861
+ "$ref": "#/$defs/Map(String,String)"
8862
+ },
8863
+ "fields": {
8864
+ "type": "array",
8865
+ "items": {
8866
+ "type": "string"
8867
+ }
8868
+ },
8869
+ "itemField": {
8870
+ "type": "string"
8871
+ },
8872
+ "itemsField": {
8873
+ "type": "string"
8874
+ },
8875
+ "model": {
8876
+ "type": "string"
8877
+ },
8878
+ "pageSize": {
8879
+ "type": "integer"
8880
+ },
8881
+ "state": {
8882
+ "type": "string"
8883
+ }
8884
+ },
8885
+ "$ref": "#/$defs/FormPreview"
8886
+ },
8717
8887
  "submitLabel": {
8718
8888
  "type": "string"
8719
8889
  },
@@ -9093,6 +9263,51 @@ var META_SCHEMAS = {
9093
9263
  }
9094
9264
  },
9095
9265
  "additionalProperties": false
9266
+ },
9267
+ "FormPreview": {
9268
+ "type": "object",
9269
+ "description": "\u72EC\u7ACB\u53EA\u8BFB\u9010\u9879\u9884\u89C8\uFF1A\u590D\u7528\u76EE\u6807\u6A21\u578B info \u5B57\u6BB5\u548C behavior\uFF0C\u4E0D\u56DE\u5199\u53C2\u6570\u3001\u4E0D\u66FF\u4EE3\u63D0\u4EA4\u6821\u9A8C\u3002",
9270
+ "required": ["model", "itemsField", "itemField", "fields"],
9271
+ "properties": {
9272
+ "model": {
9273
+ "type": "string",
9274
+ "minLength": 1
9275
+ },
9276
+ "state": {
9277
+ "type": "string"
9278
+ },
9279
+ "itemsField": {
9280
+ "type": "string",
9281
+ "minLength": 1
9282
+ },
9283
+ "itemField": {
9284
+ "type": "string",
9285
+ "minLength": 1
9286
+ },
9287
+ "bindings": {
9288
+ "type": "object",
9289
+ "additionalProperties": {
9290
+ "type": "string",
9291
+ "minLength": 1
9292
+ }
9293
+ },
9294
+ "fields": {
9295
+ "type": "array",
9296
+ "minItems": 1,
9297
+ "uniqueItems": true,
9298
+ "items": {
9299
+ "type": "string",
9300
+ "minLength": 1
9301
+ }
9302
+ },
9303
+ "pageSize": {
9304
+ "type": "integer",
9305
+ "minimum": 1,
9306
+ "maximum": 20,
9307
+ "default": 10
9308
+ }
9309
+ },
9310
+ "additionalProperties": false
9096
9311
  }
9097
9312
  },
9098
9313
  "type": "object",
@@ -9625,6 +9840,9 @@ var META_SCHEMAS = {
9625
9840
  "items": {
9626
9841
  "$ref": "#/$defs/Map(String,Object)"
9627
9842
  }
9843
+ },
9844
+ "preview": {
9845
+ "$ref": "#/$defs/FormPreview"
9628
9846
  }
9629
9847
  }
9630
9848
  },
@@ -10063,11 +10281,11 @@ var META_SCHEMAS = {
10063
10281
  },
10064
10282
  "render": {
10065
10283
  "$ref": "#/$defs/Map(String,Object)",
10066
- "description": "\u6E32\u67D3\u914D\u7F6E\uFF1BmergeRows\u652F\u6301\u72EC\u7ACB\u7EC4\u952E\uFF0C1.81\u589E\u52A0valueMode:first/singleText/emptyText\u4E0EsecondaryField\u7EAF\u6587\u672C\u526F\u6587\u6848\uFF1B\u4EC5\u5F53\u524D\u9875\u76F8\u90BB\u65E0\u5B57\u6BB5\u88C1\u51B3\uFF0C\u4E0D\u4EE3\u8868\u5B8C\u6574\u7EC4",
10284
+ "description": "\u6E32\u67D3\u914D\u7F6E\uFF1BmergeRows\u652F\u6301\u72EC\u7ACB\u7EC4\u952E\uFF0C1.81\u589E\u52A0valueMode:first/singleText/emptyText\u4E0EsecondaryField\u7EAF\u6587\u672C\u526F\u6587\u6848\uFF0C1.89\u589E\u52A0\u4E0E\u7EC4\u952E\u4E92\u65A5\u7684continuationField\u5E03\u5C14\u7EED\u884C\u6807\u8BB0\uFF1B\u4EC5\u5F53\u524D\u9875\u76F8\u90BB\u65E0\u5B57\u6BB5\u88C1\u51B3\uFF0C\u4E0D\u4EE3\u8868\u5B8C\u6574\u7EC4",
10067
10285
  "type": "object",
10068
10286
  "properties": {
10069
10287
  "mergeRows": {
10070
- "description": "\u5F53\u524D\u9875\u8FDE\u7EED\u7EC4\uFF1B\u7F3A\u7701same\u8981\u6C42\u663E\u793A\u503C\u4E00\u81F4\uFF0Cfirst\u53D6\u6BB5\u9996\u503C\u5E76\u5141\u8BB8\u6587\u6848\uFF1B\u5B57\u6BB5\u88C1\u51B3\u62C6\u6BB5\uFF1B\u4E0D\u8868\u793A\u5B8C\u6574\u7EC4",
10288
+ "description": "\u5F53\u524D\u9875\u8FDE\u7EED\u5408\u5E76\uFF1BgroupField\u6309\u7EC4\u952E\u5408\u5E76\uFF1B1.89\u8D77continuationField\u5E03\u5C14\u6807\u8BB0\u4E0E\u7EC4\u952E\u4E92\u65A5\uFF0Cfalse\u4E14\u975E\u7A7A\u4E3A\u6BB5\u9996\u3001\u8FDE\u7EEDtrue\u4E3A\u7EED\u884C\uFF0C\u9875\u9996true\u72EC\u7ACB\u7A7A\u767D\uFF1B\u5B57\u6BB5\u88C1\u51B3\u62C6\u6BB5\uFF1B\u4E0D\u8DE8\u9875",
10071
10289
  "oneOf": [{
10072
10290
  "type": "boolean"
10073
10291
  }, {
@@ -10091,11 +10309,49 @@ var META_SCHEMAS = {
10091
10309
  "type": "string",
10092
10310
  "maxLength": 256
10093
10311
  },
10312
+ "singleTextWhen": {
10313
+ "description": "1.88.0\uFF1A\u5355\u884C\u6BB5\u6587\u6848\u7684\u5B57\u6BB5\u7B49\u503C\u6761\u4EF6\uFF1Bfield\u987B\u5DF2\u58F0\u660E\u6295\u5F71\uFF0C\u4E25\u683C\u533A\u5206\u6570\u503C/\u5B57\u7B26\u4E32/\u5E03\u5C14\u503C",
10314
+ "type": "object",
10315
+ "required": ["field", "equals"],
10316
+ "additionalProperties": false,
10317
+ "properties": {
10318
+ "field": {
10319
+ "type": "string",
10320
+ "pattern": "^[A-Za-z_][A-Za-z0-9_]*(\\.[A-Za-z_][A-Za-z0-9_]*)*$"
10321
+ },
10322
+ "equals": {
10323
+ "oneOf": [{
10324
+ "type": "string",
10325
+ "maxLength": 256
10326
+ }, {
10327
+ "type": "number"
10328
+ }, {
10329
+ "type": "boolean"
10330
+ }]
10331
+ }
10332
+ }
10333
+ },
10094
10334
  "emptyText": {
10095
10335
  "type": "string",
10096
10336
  "maxLength": 256
10097
10337
  }
10098
10338
  }
10339
+ }, {
10340
+ "type": "object",
10341
+ "required": ["continuationField"],
10342
+ "additionalProperties": false,
10343
+ "properties": {
10344
+ "continuationField": {
10345
+ "type": "string",
10346
+ "minLength": 1,
10347
+ "pattern": "^[A-Za-z_][A-Za-z0-9_]*(\\.[A-Za-z_][A-Za-z0-9_]*)*$",
10348
+ "description": "\u5DF2\u58F0\u660E\u6295\u5F71\u7684\u5E03\u5C14\u8DEF\u5F84\uFF1B\u4E25\u683Cfalse\u4E3A\u6BB5\u9996\u5019\u9009\u3001true\u5EF6\u7EED\u524D\u683C\uFF1B\u7F3A\u5931/\u975E\u5E03\u5C14/\u5B57\u6BB5\u88C1\u51B3\u62C6\u6BB5\uFF1B\u4E0D\u8FFD\u6EAF\u524D\u9875"
10349
+ },
10350
+ "displayField": {
10351
+ "type": "string",
10352
+ "minLength": 1
10353
+ }
10354
+ }
10099
10355
  }]
10100
10356
  },
10101
10357
  "secondaryField": {
@@ -10288,6 +10544,10 @@ var META_SCHEMAS = {
10288
10544
  "type": "string",
10289
10545
  "description": "\u5408\u8BA1\u884C\u7684\u7EAF\u6587\u672C\u6807\u9898\uFF0C\u7F3A\u7701\u672C\u9875\u5408\u8BA1",
10290
10546
  "maxLength": 128
10547
+ },
10548
+ "nullAsZero": {
10549
+ "type": "boolean",
10550
+ "description": "\u975E\u7A7A\u9875\u5168\u6388\u6743\u4E1A\u52A1\u7A7A\u503C\u8BA1\u96F6\uFF0C\u9ED8\u8BA4false\uFF1B\u9700\u524D\u7AEF1.87.0"
10291
10551
  }
10292
10552
  },
10293
10553
  "description": "\u5F53\u524D\u9875\u5DF2\u6388\u6743\u660E\u7EC6\u5408\u8BA1\uFF1B\u7A7A\u9875\u9690\u85CF\uFF0C\u672A\u77E5/\u62D2\u7EDD\u4E0D\u5F53\u4F5C0\uFF1B\u9700\u524D\u7AEF1.81.0",
@@ -10341,6 +10601,10 @@ var META_SCHEMAS = {
10341
10601
  "additionalProperties": false,
10342
10602
  "required": ["default", "options"]
10343
10603
  },
10604
+ "selectAllScope": {
10605
+ "type": "boolean",
10606
+ "description": "\u6309\u5F53\u524D\u6388\u6743\u7EC4\u7EC7\u3001\u65F6\u70B9\u548C\u7B5B\u9009\u6761\u4EF6\u9009\u5168\uFF0C\u5305\u542B\u8DE8\u9875\u53CA\u5173\u952E\u8BCD\u9690\u85CF\u8BB0\u5F55\uFF1B\u9700 selectable:true\u3001reserveSelection:true\uFF1B\u4E0D\u652F\u6301\u5361\u7247\u6216AI\u67E5\u8BE2\u65B9\u6848\uFF1B\u4EC5\u8303\u56F4\u6A21\u5F0F\u643A\u5E26selectionScope\uFF0C\u670D\u52A1\u7AEF\u6BCF500\u6761\u590D\u6838\u5217\u8868\u53CA\u52A8\u4F5C\u6388\u6743\u4EA4\u96C6\uFF0C\u65E0\u6807\u8BB0\u6CBF\u7528\u65E2\u6709\u52A8\u4F5C\u8BED\u4E49\uFF1B\u9700\u524D\u7AEF1.90.0"
10607
+ },
10344
10608
  "selectable": {
10345
10609
  "type": "boolean",
10346
10610
  "description": "\u662F\u5426\u542F\u7528\u884C\u9009\u62E9;true \u65F6\u5217\u8868\u663E\u793A\u590D\u9009\u6846,\u652F\u6301\u6279\u91CF\u64CD\u4F5C(\u6279\u91CF\u5220\u9664\u7B49)\u3002\u9ED8\u8BA4 false"
@@ -10628,7 +10892,12 @@ var META_SCHEMAS = {
10628
10892
  "type": "string"
10629
10893
  },
10630
10894
  "formSchema": {
10631
- "$ref": "#/$defs/Map(String,Object)"
10895
+ "$ref": "#/$defs/Map(String,Object)",
10896
+ "properties": {
10897
+ "preview": {
10898
+ "$ref": "#/$defs/FormPreview"
10899
+ }
10900
+ }
10632
10901
  },
10633
10902
  "formRef": {
10634
10903
  "$ref": "#/$defs/Map(String,Object)"
@@ -10710,7 +10979,52 @@ var META_SCHEMAS = {
10710
10979
  }]
10711
10980
  }
10712
10981
  }
10713
- }
10982
+ }
10983
+ },
10984
+ "FormPreview": {
10985
+ "type": "object",
10986
+ "description": "\u72EC\u7ACB\u53EA\u8BFB\u9010\u9879\u9884\u89C8\uFF1A\u590D\u7528\u76EE\u6807\u6A21\u578B info \u5B57\u6BB5\u548C behavior\uFF0C\u4E0D\u56DE\u5199\u53C2\u6570\u3001\u4E0D\u66FF\u4EE3\u63D0\u4EA4\u6821\u9A8C\u3002",
10987
+ "required": ["model", "itemsField", "itemField", "fields"],
10988
+ "properties": {
10989
+ "model": {
10990
+ "type": "string",
10991
+ "minLength": 1
10992
+ },
10993
+ "state": {
10994
+ "type": "string"
10995
+ },
10996
+ "itemsField": {
10997
+ "type": "string",
10998
+ "minLength": 1
10999
+ },
11000
+ "itemField": {
11001
+ "type": "string",
11002
+ "minLength": 1
11003
+ },
11004
+ "bindings": {
11005
+ "type": "object",
11006
+ "additionalProperties": {
11007
+ "type": "string",
11008
+ "minLength": 1
11009
+ }
11010
+ },
11011
+ "fields": {
11012
+ "type": "array",
11013
+ "minItems": 1,
11014
+ "uniqueItems": true,
11015
+ "items": {
11016
+ "type": "string",
11017
+ "minLength": 1
11018
+ }
11019
+ },
11020
+ "pageSize": {
11021
+ "type": "integer",
11022
+ "minimum": 1,
11023
+ "maximum": 20,
11024
+ "default": 10
11025
+ }
11026
+ },
11027
+ "additionalProperties": false
10714
11028
  }
10715
11029
  },
10716
11030
  "type": "object",
@@ -11056,6 +11370,36 @@ var META_SCHEMAS = {
11056
11370
  "$ref": "#/$defs/Map(String,Object)"
11057
11371
  }
11058
11372
  },
11373
+ "preview": {
11374
+ "type": "object",
11375
+ "properties": {
11376
+ "bindings": {
11377
+ "$ref": "#/$defs/Map(String,String)"
11378
+ },
11379
+ "fields": {
11380
+ "type": "array",
11381
+ "items": {
11382
+ "type": "string"
11383
+ }
11384
+ },
11385
+ "itemField": {
11386
+ "type": "string"
11387
+ },
11388
+ "itemsField": {
11389
+ "type": "string"
11390
+ },
11391
+ "model": {
11392
+ "type": "string"
11393
+ },
11394
+ "pageSize": {
11395
+ "type": "integer"
11396
+ },
11397
+ "state": {
11398
+ "type": "string"
11399
+ }
11400
+ },
11401
+ "$ref": "#/$defs/FormPreview"
11402
+ },
11059
11403
  "submitLabel": {
11060
11404
  "type": "string"
11061
11405
  },
@@ -11447,7 +11791,12 @@ var META_SCHEMAS = {
11447
11791
  "type": "string"
11448
11792
  },
11449
11793
  "formSchema": {
11450
- "$ref": "#/$defs/Map(String,Object)"
11794
+ "$ref": "#/$defs/Map(String,Object)",
11795
+ "properties": {
11796
+ "preview": {
11797
+ "$ref": "#/$defs/FormPreview"
11798
+ }
11799
+ }
11451
11800
  },
11452
11801
  "formRef": {
11453
11802
  "$ref": "#/$defs/Map(String,Object)"
@@ -11530,6 +11879,51 @@ var META_SCHEMAS = {
11530
11879
  }
11531
11880
  }
11532
11881
  }
11882
+ },
11883
+ "FormPreview": {
11884
+ "type": "object",
11885
+ "description": "\u72EC\u7ACB\u53EA\u8BFB\u9010\u9879\u9884\u89C8\uFF1A\u590D\u7528\u76EE\u6807\u6A21\u578B info \u5B57\u6BB5\u548C behavior\uFF0C\u4E0D\u56DE\u5199\u53C2\u6570\u3001\u4E0D\u66FF\u4EE3\u63D0\u4EA4\u6821\u9A8C\u3002",
11886
+ "required": ["model", "itemsField", "itemField", "fields"],
11887
+ "properties": {
11888
+ "model": {
11889
+ "type": "string",
11890
+ "minLength": 1
11891
+ },
11892
+ "state": {
11893
+ "type": "string"
11894
+ },
11895
+ "itemsField": {
11896
+ "type": "string",
11897
+ "minLength": 1
11898
+ },
11899
+ "itemField": {
11900
+ "type": "string",
11901
+ "minLength": 1
11902
+ },
11903
+ "bindings": {
11904
+ "type": "object",
11905
+ "additionalProperties": {
11906
+ "type": "string",
11907
+ "minLength": 1
11908
+ }
11909
+ },
11910
+ "fields": {
11911
+ "type": "array",
11912
+ "minItems": 1,
11913
+ "uniqueItems": true,
11914
+ "items": {
11915
+ "type": "string",
11916
+ "minLength": 1
11917
+ }
11918
+ },
11919
+ "pageSize": {
11920
+ "type": "integer",
11921
+ "minimum": 1,
11922
+ "maximum": 20,
11923
+ "default": 10
11924
+ }
11925
+ },
11926
+ "additionalProperties": false
11533
11927
  }
11534
11928
  },
11535
11929
  "type": "object",
@@ -11905,6 +12299,36 @@ var META_SCHEMAS = {
11905
12299
  "$ref": "#/$defs/Map(String,Object)"
11906
12300
  }
11907
12301
  },
12302
+ "preview": {
12303
+ "type": "object",
12304
+ "properties": {
12305
+ "bindings": {
12306
+ "$ref": "#/$defs/Map(String,String)"
12307
+ },
12308
+ "fields": {
12309
+ "type": "array",
12310
+ "items": {
12311
+ "type": "string"
12312
+ }
12313
+ },
12314
+ "itemField": {
12315
+ "type": "string"
12316
+ },
12317
+ "itemsField": {
12318
+ "type": "string"
12319
+ },
12320
+ "model": {
12321
+ "type": "string"
12322
+ },
12323
+ "pageSize": {
12324
+ "type": "integer"
12325
+ },
12326
+ "state": {
12327
+ "type": "string"
12328
+ }
12329
+ },
12330
+ "$ref": "#/$defs/FormPreview"
12331
+ },
11908
12332
  "submitLabel": {
11909
12333
  "type": "string"
11910
12334
  },
@@ -12521,6 +12945,13 @@ var META_SCHEMAS = {
12521
12945
  },
12522
12946
  "source": {
12523
12947
  "type": "string"
12948
+ },
12949
+ "verification": {
12950
+ "type": "string",
12951
+ "enum": ["NONE", "UNKNOWN"]
12952
+ },
12953
+ "verificationNote": {
12954
+ "type": "string"
12524
12955
  }
12525
12956
  }
12526
12957
  }
@@ -12936,7 +13367,7 @@ var META_SCHEMAS = {
12936
13367
  "type": "string"
12937
13368
  },
12938
13369
  "referenceDisplaySynonyms": {
12939
- "description": "\u5F15\u7528\u5C55\u793A\u503C\u79F0\u8C13\uFF1B\u5FC5\u987B\u662F\u5355\u503C object \u5B57\u6BB5\u6709\u6548 name/synonyms \u7684\u5B50\u96C6\uFF1Bnull/\u7A7A\u6570\u7EC4\u53D6\u6D88\u58F0\u660E",
13370
+ "description": "\u5F15\u7528\u5C55\u793A\u503C\u79F0\u8C13\uFF1B\u5FC5\u987B\u662F\u5355\u503C object \u5B57\u6BB5\u6709\u6548 name/synonyms \u7684\u5B50\u96C6\uFF1B\u672A\u58F0\u660E\u4E14\u76EE\u6807\u4E3A\u7801\u8868\u65F6\u9ED8\u8BA4\u53D6\u5B57\u6BB5\u81EA\u8EAB name/synonyms\uFF0C\u7A7A\u6570\u7EC4\u5173\u95ED\u9ED8\u8BA4",
12940
13371
  "type": ["array", "null"],
12941
13372
  "items": {
12942
13373
  "type": "string",
@@ -14133,6 +14564,36 @@ var META_SCHEMAS = {
14133
14564
  "$ref": "#/$defs/Map(String,Object)"
14134
14565
  }
14135
14566
  },
14567
+ "preview": {
14568
+ "type": "object",
14569
+ "properties": {
14570
+ "bindings": {
14571
+ "$ref": "#/$defs/Map(String,String)"
14572
+ },
14573
+ "fields": {
14574
+ "type": "array",
14575
+ "items": {
14576
+ "type": "string"
14577
+ }
14578
+ },
14579
+ "itemField": {
14580
+ "type": "string"
14581
+ },
14582
+ "itemsField": {
14583
+ "type": "string"
14584
+ },
14585
+ "model": {
14586
+ "type": "string"
14587
+ },
14588
+ "pageSize": {
14589
+ "type": "integer"
14590
+ },
14591
+ "state": {
14592
+ "type": "string"
14593
+ }
14594
+ },
14595
+ "$ref": "#/$defs/FormPreview"
14596
+ },
14136
14597
  "submitLabel": {
14137
14598
  "type": "string"
14138
14599
  },
@@ -14733,6 +15194,51 @@ var META_SCHEMAS = {
14733
15194
  }
14734
15195
  },
14735
15196
  "additionalProperties": false
15197
+ },
15198
+ "FormPreview": {
15199
+ "type": "object",
15200
+ "description": "\u72EC\u7ACB\u53EA\u8BFB\u9010\u9879\u9884\u89C8\uFF1A\u590D\u7528\u76EE\u6807\u6A21\u578B info \u5B57\u6BB5\u548C behavior\uFF0C\u4E0D\u56DE\u5199\u53C2\u6570\u3001\u4E0D\u66FF\u4EE3\u63D0\u4EA4\u6821\u9A8C\u3002",
15201
+ "required": ["model", "itemsField", "itemField", "fields"],
15202
+ "properties": {
15203
+ "model": {
15204
+ "type": "string",
15205
+ "minLength": 1
15206
+ },
15207
+ "state": {
15208
+ "type": "string"
15209
+ },
15210
+ "itemsField": {
15211
+ "type": "string",
15212
+ "minLength": 1
15213
+ },
15214
+ "itemField": {
15215
+ "type": "string",
15216
+ "minLength": 1
15217
+ },
15218
+ "bindings": {
15219
+ "type": "object",
15220
+ "additionalProperties": {
15221
+ "type": "string",
15222
+ "minLength": 1
15223
+ }
15224
+ },
15225
+ "fields": {
15226
+ "type": "array",
15227
+ "minItems": 1,
15228
+ "uniqueItems": true,
15229
+ "items": {
15230
+ "type": "string",
15231
+ "minLength": 1
15232
+ }
15233
+ },
15234
+ "pageSize": {
15235
+ "type": "integer",
15236
+ "minimum": 1,
15237
+ "maximum": 20,
15238
+ "default": 10
15239
+ }
15240
+ },
15241
+ "additionalProperties": false
14736
15242
  }
14737
15243
  },
14738
15244
  "type": "object",
@@ -15416,6 +15922,10 @@ var META_SCHEMAS = {
15416
15922
  },
15417
15923
  "showAllOnRoot": {
15418
15924
  "type": "boolean"
15925
+ },
15926
+ "showScopeSelector": {
15927
+ "type": "boolean",
15928
+ "default": false
15419
15929
  }
15420
15930
  }
15421
15931
  },
@@ -16932,22 +17442,521 @@ var META_SCHEMAS = {
16932
17442
  "enum": ["SUPPORTED", "READ_ONLY", "UNSUPPORTED"]
16933
17443
  }
16934
17444
  },
16935
- "required": ["mode"]
16936
- },
16937
- "source": {
16938
- "type": "string"
16939
- },
16940
- "type": {
16941
- "type": "string"
17445
+ "required": ["mode"]
17446
+ },
17447
+ "source": {
17448
+ "type": "string"
17449
+ },
17450
+ "type": {
17451
+ "type": "string"
17452
+ }
17453
+ },
17454
+ "x-hcm-authoring": {
17455
+ "topLevel": "closed",
17456
+ "errCode": "META_UNKNOWN_AUTHORING_KEY",
17457
+ "retiredTopLevelKeys": {}
17458
+ }
17459
+ }
17460
+ };
17461
+
17462
+ // src/datapackage/extension-sanitize.ts
17463
+ var UUID_RE = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi;
17464
+ var REDACTED_SOURCE_ID = "[\u6E90\u73AF\u5883ID\u5DF2\u79FB\u9664]";
17465
+ var DESCRIPTIVE_KEY_RE = /^(description|desc|tip|tips|hint|help|helpText|label|title|subtitle|caption|tooltip|placeholder|remark|comment|note|notes|summary|purpose|message|text|example|examples|typicalQueries|synonyms)$/i;
17466
+ function redactDescriptiveUuids(text3) {
17467
+ const doc = parseDocument3(text3);
17468
+ if (doc.errors.length) throw new Error(doc.errors.map((e) => e.message).join("; "));
17469
+ const edits = [];
17470
+ const redactions = [];
17471
+ const walk4 = (node, path25, inDesc) => {
17472
+ if (isMap3(node)) {
17473
+ for (const pair of node.items) {
17474
+ const k = isScalar3(pair.key) ? String(pair.key.value) : "?";
17475
+ walk4(pair.value, path25 ? `${path25}.${k}` : k, inDesc || DESCRIPTIVE_KEY_RE.test(k));
17476
+ }
17477
+ } else if (isSeq3(node)) {
17478
+ node.items.forEach((item, i) => walk4(item, `${path25}[${i}]`, inDesc));
17479
+ } else if (isScalar3(node) && inDesc && typeof node.value === "string" && node.range) {
17480
+ const [start, end] = node.range;
17481
+ for (const m of text3.slice(start, end).matchAll(UUID_RE)) {
17482
+ edits.push({ start: start + m.index, end: start + m.index + m[0].length });
17483
+ redactions.push({ path: path25, uuidPrefix: m[0].slice(0, 8) });
17484
+ }
17485
+ }
17486
+ };
17487
+ walk4(doc.contents, "", false);
17488
+ let out = text3;
17489
+ for (const e of edits.sort((a, b) => b.start - a.start)) out = out.slice(0, e.start) + REDACTED_SOURCE_ID + out.slice(e.end);
17490
+ return { text: out, redactions };
17491
+ }
17492
+ function removeActionsUsingScripts(text3, droppedScriptKeys) {
17493
+ if (!droppedScriptKeys.size) return { text: text3, removed: [] };
17494
+ const doc = parseDocument3(text3);
17495
+ if (doc.errors.length) throw new Error(doc.errors.map((e) => e.message).join("; "));
17496
+ const removed = [];
17497
+ const scriptKeyOf = (node) => {
17498
+ if (isMap3(node)) {
17499
+ for (const pair of node.items) {
17500
+ const k = isScalar3(pair.key) ? String(pair.key.value) : "";
17501
+ if (k === "scriptKey" && isScalar3(pair.value) && droppedScriptKeys.has(String(pair.value.value))) return String(pair.value.value);
17502
+ const hit = scriptKeyOf(pair.value);
17503
+ if (hit) return hit;
17504
+ }
17505
+ } else if (isSeq3(node)) for (const item of node.items) {
17506
+ const hit = scriptKeyOf(item);
17507
+ if (hit) return hit;
17508
+ }
17509
+ return void 0;
17510
+ };
17511
+ const walk4 = (node, path25) => {
17512
+ if (isMap3(node)) {
17513
+ for (const pair of node.items) {
17514
+ const k = isScalar3(pair.key) ? String(pair.key.value) : "?";
17515
+ const p = path25 ? `${path25}.${k}` : k;
17516
+ if (k === "actions" && isSeq3(pair.value)) {
17517
+ const seq = pair.value;
17518
+ seq.items = seq.items.filter((item, i) => {
17519
+ const hit = scriptKeyOf(item);
17520
+ if (!hit) return true;
17521
+ const key = isMap3(item) ? item.get("key") : void 0;
17522
+ removed.push({ path: `${p}[${i}]`, actionKey: typeof key === "string" ? key : "?", scriptKey: hit });
17523
+ return false;
17524
+ });
17525
+ }
17526
+ walk4(pair.value, p);
17527
+ }
17528
+ } else if (isSeq3(node)) node.items.forEach((item, i) => walk4(item, `${path25}[${i}]`));
17529
+ };
17530
+ walk4(doc.contents, "");
17531
+ return removed.length ? { text: doc.toString(), removed } : { text: text3, removed };
17532
+ }
17533
+ function fieldContractKind(path25) {
17534
+ const typed = /(?:^|\/)metas\/[A-Za-z0-9_]+\.(list|info|edit|view|page|filter|wiz|impexp)(\.[A-Za-z0-9_]+)?\.ya?ml$/i.exec(path25);
17535
+ if (typed) {
17536
+ const k = typed[1].toLowerCase();
17537
+ return k === "edit" ? "info" : ["list", "info", "view", "filter"].includes(k) ? k : void 0;
17538
+ }
17539
+ return /(?:^|\/)metas\/[A-Za-z0-9_]+(\.model)?\.ya?ml$/i.test(path25) ? "model" : void 0;
17540
+ }
17541
+ function fieldContractKeys(schemas, kind) {
17542
+ const s = schemas[kind];
17543
+ let items = s?.properties?.fields?.items;
17544
+ if (items?.$ref) items = s?.$defs?.[items.$ref.split("/").pop()];
17545
+ return new Set(Object.keys(items?.properties ?? {}));
17546
+ }
17547
+ function stripUnknownFieldKeys(text3, known) {
17548
+ if (!known.size) return { text: text3, removed: [] };
17549
+ const removed = [];
17550
+ const isDirective = (keys) => keys.some((k) => k.startsWith("__"));
17551
+ let json;
17552
+ try {
17553
+ json = JSON.parse(text3);
17554
+ } catch {
17555
+ json = void 0;
17556
+ }
17557
+ if (json && typeof json === "object" && !Array.isArray(json)) {
17558
+ const top = json;
17559
+ const lists = [top.fields, ...Array.isArray(top.sections) ? top.sections.map((s) => s?.fields) : []];
17560
+ for (const list2 of lists) {
17561
+ if (!Array.isArray(list2)) continue;
17562
+ for (const f of list2) {
17563
+ if (!f || typeof f !== "object" || Array.isArray(f) || isDirective(Object.keys(f))) continue;
17564
+ for (const k of Object.keys(f)) if (!known.has(k)) {
17565
+ removed.push({ field: String(f.key ?? "?"), key: k });
17566
+ delete f[k];
17567
+ }
17568
+ }
17569
+ }
17570
+ return removed.length ? { text: JSON.stringify(json, null, 2) + (text3.endsWith("\n") ? "\n" : ""), removed } : { text: text3, removed };
17571
+ }
17572
+ const doc = parseDocument3(text3);
17573
+ if (doc.errors.length) throw new Error(doc.errors.map((e) => e.message).join("; "));
17574
+ const seqs = [doc.get("fields", true)];
17575
+ const sections = doc.get("sections", true);
17576
+ if (isSeq3(sections)) {
17577
+ for (const s of sections.items) if (isMap3(s)) seqs.push(s.get("fields", true));
17578
+ }
17579
+ for (const seq of seqs) {
17580
+ if (!isSeq3(seq)) continue;
17581
+ for (const item of seq.items) {
17582
+ if (!isMap3(item)) continue;
17583
+ const keys = item.items.map((p) => isScalar3(p.key) ? String(p.key.value) : "");
17584
+ if (isDirective(keys)) continue;
17585
+ const fieldKey = item.get("key");
17586
+ for (const k of keys) if (k && !known.has(k)) {
17587
+ removed.push({ field: typeof fieldKey === "string" ? fieldKey : "?", key: k });
17588
+ item.delete(k);
17589
+ }
17590
+ }
17591
+ }
17592
+ return removed.length ? { text: doc.toString(), removed } : { text: text3, removed };
17593
+ }
17594
+ function stripUnknownFieldKeysForPath(path25, text3) {
17595
+ const kind = fieldContractKind(path25);
17596
+ if (!kind) return { text: text3, removed: [] };
17597
+ return { ...stripUnknownFieldKeys(text3, fieldContractKeys(META_SCHEMAS, kind)), kind };
17598
+ }
17599
+
17600
+ // src/datapackage/install.ts
17601
+ var DEFAULT_ARTIFACT_CATEGORY = "attachment";
17602
+ function unwrapActionPayload(resp) {
17603
+ const body = resp;
17604
+ if (body && typeof body === "object") {
17605
+ if (body.data && typeof body.data === "object") return body.data;
17606
+ if (body.result && typeof body.result === "object") return body.result;
17607
+ }
17608
+ return resp;
17609
+ }
17610
+ function isTerminalRunStatus(status) {
17611
+ if (!status) return false;
17612
+ return status !== "RUNNING" && status !== "QUEUED" && status !== "MAIN_COMMITTED";
17613
+ }
17614
+ function confirmationParams(opts) {
17615
+ return {
17616
+ ...opts.allowDowngrade ? { allowDowngrade: true } : {},
17617
+ ...opts.acceptContentChange ? { acceptContentChange: true } : {}
17618
+ };
17619
+ }
17620
+ var INSTALL_CONFIRMATION_HINTS = [
17621
+ {
17622
+ code: "DATA_PACKAGE_DOWNGRADE_REQUIRES_CONFIRMATION",
17623
+ flag: "--allow-downgrade",
17624
+ nextStep: "\u786E\u8BA4\u964D\u7EA7\u5F71\u54CD\uFF08\u65E7\u7248\u672C\u6570\u636E\u8986\u76D6\u65B0\u7248\u672C\uFF09\u540E\u52A0 --allow-downgrade \u91CD\u8DD1\uFF1B\u5426\u5219\u6539\u88C5\u4E0D\u4F4E\u4E8E\u5DF2\u88C5\u7248\u672C\u7684\u5236\u54C1"
17625
+ },
17626
+ {
17627
+ code: "DATA_PACKAGE_VERSION_DIGEST_CONFLICT",
17628
+ flag: "--accept-content-change",
17629
+ nextStep: "\u9996\u9009\u5347\u7248\u672C\u53F7\u91CD\u65B0 pack \u518D\u88C5\uFF1B\u786E\u8BA4\u540C\u7248\u672C\u8986\u76D6\u5F71\u54CD\u540E\u624D\u52A0 --accept-content-change \u5168\u91CF\u91CD\u88C5"
17630
+ }
17631
+ ];
17632
+ async function installDataPackageArtifactAsync(client, artifactPath, opts = {}) {
17633
+ const meta = await uploadDocument(
17634
+ client.raw(),
17635
+ artifactPath,
17636
+ opts.category ?? DEFAULT_ARTIFACT_CATEGORY
17637
+ );
17638
+ const resp = await action(
17639
+ client.raw(),
17640
+ "DataPackage",
17641
+ "installFromDocumentAsync",
17642
+ {
17643
+ params: { documentId: meta.documentId, tenantId: client.tenantId, ...confirmationParams(opts) }
17644
+ }
17645
+ );
17646
+ const body = unwrapActionPayload(resp);
17647
+ const runId = body.runId;
17648
+ if (typeof runId !== "string" || runId.length === 0) {
17649
+ throw new Error("\u670D\u52A1\u7AEF\u672A\u8FD4\u56DE runId\uFF0C\u65E0\u6CD5\u8DDF\u8E2A\u88C5\u8F7D\u8FDB\u5EA6");
17650
+ }
17651
+ return {
17652
+ documentId: meta.documentId,
17653
+ runId,
17654
+ packageName: typeof body.packageName === "string" ? body.packageName : void 0,
17655
+ version: typeof body.version === "string" ? body.version : void 0
17656
+ };
17657
+ }
17658
+ async function fetchInstallRun(client, runId) {
17659
+ try {
17660
+ const resp = await client.raw().get(`/api/models/DataPackageInstallRun/${runId}`);
17661
+ const body = resp.data?.data ?? resp.data;
17662
+ return body && typeof body === "object" ? body : void 0;
17663
+ } catch (e) {
17664
+ if (e?.response?.status === 404) return void 0;
17665
+ throw e;
17666
+ }
17667
+ }
17668
+ function isTransientPollError(e) {
17669
+ const err = e;
17670
+ const status = err?.response?.status ?? err?.status ?? err?.httpStatus;
17671
+ if (typeof status === "number") return status >= 500 || status === 429;
17672
+ return Boolean(err?.isAxiosError) && !err?.response;
17673
+ }
17674
+ function describePollError(e) {
17675
+ const err = e;
17676
+ const status = err?.response?.status ?? err?.status ?? err?.httpStatus;
17677
+ const message = String(err?.message ?? e).slice(0, 200);
17678
+ return { status: typeof status === "number" ? status : "NETWORK", message };
17679
+ }
17680
+ async function waitForInstallRun(client, runId, opts) {
17681
+ const pollMs = opts.pollMs ?? 2e3;
17682
+ const now = opts.now ?? (() => Date.now());
17683
+ const sleep = opts.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
17684
+ const deadline = now() + opts.timeoutMs;
17685
+ let last;
17686
+ let consecutiveErrors = 0;
17687
+ for (; ; ) {
17688
+ let current;
17689
+ try {
17690
+ current = await fetchInstallRun(client, runId);
17691
+ consecutiveErrors = 0;
17692
+ } catch (e) {
17693
+ if (!isTransientPollError(e)) throw e;
17694
+ consecutiveErrors += 1;
17695
+ opts.onPollError?.(e, consecutiveErrors);
17696
+ if (now() >= deadline) return { run: last, timedOut: true, pollErrors: consecutiveErrors, lastPollError: describePollError(e) };
17697
+ await sleep(pollMs);
17698
+ continue;
17699
+ }
17700
+ if (current) last = current;
17701
+ opts.onProgress?.(current);
17702
+ if (isTerminalRunStatus(last?.status)) {
17703
+ return { run: last, timedOut: false };
17704
+ }
17705
+ if (now() >= deadline) {
17706
+ return { run: last, timedOut: true };
17707
+ }
17708
+ await sleep(pollMs);
17709
+ }
17710
+ }
17711
+ async function installDataPackageArtifact(client, artifactPath, opts = {}) {
17712
+ const meta = await uploadDocument(
17713
+ client.raw(),
17714
+ artifactPath,
17715
+ opts.category ?? DEFAULT_ARTIFACT_CATEGORY
17716
+ );
17717
+ const resp = await action(
17718
+ client.raw(),
17719
+ "DataPackage",
17720
+ "installFromDocument",
17721
+ {
17722
+ params: { documentId: meta.documentId, tenantId: client.tenantId, ...confirmationParams(opts) }
17723
+ }
17724
+ );
17725
+ const view = unwrapActionPayload(resp);
17726
+ return { documentId: meta.documentId, view };
17727
+ }
17728
+
17729
+ // src/models/action-verification.ts
17730
+ async function fetchActionVerification(http, model, action3) {
17731
+ let rows;
17732
+ try {
17733
+ const resp = await http.get(`/api/models/${model}/actions`);
17734
+ rows = resp.data?.actions;
17735
+ } catch (e) {
17736
+ const err = e;
17737
+ const status2 = err?.response?.status;
17738
+ return { kind: "unreadable", detail: status2 ? `HTTP ${status2}` : err?.message ?? String(e) };
17739
+ }
17740
+ if (!Array.isArray(rows)) return { kind: "unreadable", detail: "\u56DE\u5305\u91CC\u6CA1\u6709 actions \u6570\u7EC4" };
17741
+ const row = rows.find((r) => r && typeof r === "object" && r.key === action3);
17742
+ if (!row) return { kind: "no-row" };
17743
+ const cell = row.verification;
17744
+ if (!cell || typeof cell !== "object") return { kind: "missing-cell" };
17745
+ const { status, note } = cell;
17746
+ if (typeof status !== "string" || !status) return { kind: "malformed-cell" };
17747
+ return { kind: "declared", status, ...typeof note === "string" && note ? { note } : {} };
17748
+ }
17749
+ function assessActionVerification(decl, ctx) {
17750
+ const name = `${ctx.model}.${ctx.action}`;
17751
+ const tail = "\u4E0B\u4E00\u6B65\uFF1A\u53BB\u8FD9\u4E2A action \u6539\u52A8\u7684\u6570\u636E\u4E0A\u6838\u4E00\u6B21\u7ED3\u679C\uFF08\u4F8B\u5982 hcm query \u67E5\u5BF9\u5E94\u8BB0\u5F55\uFF09\uFF0C\u522B\u628A\u300C\u6267\u884C\u6210\u529F\u300D\u5F53\u6210\u300C\u5DF2\u843D\u5E93\u300D";
17752
+ let head;
17753
+ let extra = [];
17754
+ switch (decl.kind) {
17755
+ case "declared":
17756
+ if (decl.status === "NONE") {
17757
+ head = `\u5199\u540E\u6838\u9A8C\uFF1A${name} \u58F0\u660E\u4E86\u6267\u884C\u5B8C\u6838\u9A8C\u4E0D\u4E86\uFF0C\u5DF2\u6267\u884C\u3001\u672A\u6838\u9A8C\u3002`;
17758
+ extra = decl.note ? [` \u58F0\u660E\u539F\u6587\uFF1A${decl.note}`] : [" \uFF08\u58F0\u660E\u91CC\u6CA1\u7ED9\u8BF4\u660E\uFF09"];
17759
+ } else if (decl.status === "UNKNOWN") {
17760
+ head = `\u5199\u540E\u6838\u9A8C\uFF1A${name} \u8FD9\u4E2A action \u6CA1\u6709\u58F0\u660E\u53EF\u6838\u9A8C\u56DE\u6267\uFF0C\u5DF2\u6267\u884C\u3001\u672A\u6838\u9A8C\u3002`;
17761
+ } else {
17762
+ head = `\u5199\u540E\u6838\u9A8C\uFF1A\u8FD9\u7248 CLI \u4E0D\u8BA4\u8BC6 ${name} \u7684\u6838\u9A8C\u58F0\u660E ${decl.status}\uFF0C\u5DF2\u6267\u884C\uFF0C\u6309\u300C\u672A\u6838\u9A8C\u300D\u5904\u7406\uFF1B\u5347\u7EA7 CLI \u540E\u518D\u770B\u3002`;
17763
+ extra = decl.note ? [` \u58F0\u660E\u539F\u6587\uFF1A${decl.note}`] : [];
17764
+ }
17765
+ break;
17766
+ case "missing-cell":
17767
+ head = `\u5199\u540E\u6838\u9A8C\uFF1A\u6CA1\u8BFB\u5230 ${name} \u7684\u6838\u9A8C\u58F0\u660E\uFF08\u5E38\u89C1\u539F\u56E0\uFF1ACore \u7248\u672C\u65E9\u4E8E action \u6838\u9A8C\u58F0\u660E\u4E0A\u7EBF\uFF09\uFF0C\u5DF2\u6267\u884C\u3001\u672A\u6838\u9A8C\u3002`;
17768
+ break;
17769
+ case "malformed-cell":
17770
+ head = `\u5199\u540E\u6838\u9A8C\uFF1A${name} \u7684\u6838\u9A8C\u58F0\u660E\u5F62\u72B6\u8BA4\u4E0D\u51FA\uFF08verification \u91CC\u6CA1\u6709\u53EF\u8BFB\u7684 status\uFF09\uFF0C\u5DF2\u6267\u884C\u3001\u672A\u6838\u9A8C\u3002`;
17771
+ break;
17772
+ case "no-row":
17773
+ head = `\u5199\u540E\u6838\u9A8C\uFF1A\u6CA1\u8BFB\u5230\u6838\u9A8C\u58F0\u660E\uFF08GET /api/models/${ctx.model}/actions \u91CC\u6CA1\u6709 ${ctx.action} \u8FD9\u4E00\u884C\uFF09\uFF0C\u5DF2\u6267\u884C\u3001\u672A\u6838\u9A8C\u3002`;
17774
+ extra = [" /actions \u6309\u9875\u9762\u72B6\u6001\u5217\u51FA\uFF0C\u8FD9\u4E2A action \u53EF\u80FD\u53EA\u5728\u67D0\u4E2A\u72B6\u6001\u4E0B\u51FA\u73B0\uFF1B\u4E0D\u4E00\u5B9A\u662F Core \u592A\u65E7"];
17775
+ break;
17776
+ case "unreadable":
17777
+ head = `\u5199\u540E\u6838\u9A8C\uFF1A\u8BFB\u4E0D\u5230 action \u7684\u6838\u9A8C\u58F0\u660E\uFF08${decl.detail}\uFF09\uFF0C\u5DF2\u6267\u884C\u3001\u672A\u6838\u9A8C\u3002`;
17778
+ break;
17779
+ }
17780
+ return { exitCode: 7 /* VERIFY_UNAVAILABLE */, lines: [head, ...extra, tail] };
17781
+ }
17782
+
17783
+ // src/cache.ts
17784
+ async function getCacheStats(http, model) {
17785
+ const resp = await http.get(`/api/models/${model}/cache`);
17786
+ return resp.data?.data ?? resp.data;
17787
+ }
17788
+ async function clearModelCache(http, model, id) {
17789
+ const url = id ? `/api/models/${model}/cache/${id}` : `/api/models/${model}/cache`;
17790
+ const resp = await http.delete(url);
17791
+ return resp.data?.data ?? resp.data;
17792
+ }
17793
+ async function clearMetaCache(http, model, opts = {}) {
17794
+ const params = {};
17795
+ if (opts.type) params.type = opts.type;
17796
+ if (opts.state) params.state = opts.state;
17797
+ const resp = await http.delete(`/api/models/${model}/meta/cache`, { params });
17798
+ return resp.data?.data ?? resp.data;
17799
+ }
17800
+
17801
+ // src/script.ts
17802
+ function unwrap(data) {
17803
+ const body = data;
17804
+ return (body && typeof body === "object" && "data" in body ? body.data : data) ?? data;
17805
+ }
17806
+ async function scriptDryRun(http, request) {
17807
+ const resp = await http.post("/api/script/dry-run", request);
17808
+ return unwrap(resp.data);
17809
+ }
17810
+ async function validateScriptManifest(http, manifestYaml) {
17811
+ const resp = await http.post("/api/script/manifest/validate", { manifestYaml });
17812
+ return unwrap(resp.data);
17813
+ }
17814
+ async function queryScriptLogs(http, query2 = {}) {
17815
+ const params = {};
17816
+ for (const [k, v] of Object.entries(query2)) {
17817
+ if (v !== void 0 && v !== null && v !== "") params[k] = v;
17818
+ }
17819
+ const resp = await http.get("/api/script-logs", { params });
17820
+ return unwrap(resp.data);
17821
+ }
17822
+ async function getScriptTask(http, taskId) {
17823
+ const resp = await http.get(`/api/script-tasks/${encodeURIComponent(taskId)}`);
17824
+ return unwrap(resp.data);
17825
+ }
17826
+
17827
+ // src/tenant.ts
17828
+ async function bootstrapTenant(http, bootstrapKey, req) {
17829
+ const resp = await http.post("/api/bootstrap/tenant", req, {
17830
+ headers: { "X-Bootstrap-Key": bootstrapKey }
17831
+ });
17832
+ return resp.data?.data ?? resp.data;
17833
+ }
17834
+ async function reconcileTenant(http, expectedTenantId) {
17835
+ const { data } = await http.post("/api/operations/bootstrap/reconcile", {}, {
17836
+ __skipRetry: true,
17837
+ maxRedirects: 0
17838
+ });
17839
+ const countKeys = ["fromVersion", "toVersion", "created", "updated", "archived"];
17840
+ const rows = data?.results;
17841
+ if (!data || data.tenantId !== expectedTenantId || typeof data.success !== "boolean" || !(data.error == null || typeof data.error === "string") || !Array.isArray(rows) || !rows.length || !rows.every((row) => row && typeof row.component === "string" && row.component.trim() && typeof row.status === "string" && row.status.trim() && typeof row.message === "string" && countKeys.every((key) => Number.isSafeInteger(row[key]) && Number(row[key]) >= 0) && Number(row.toVersion) >= Number(row.fromVersion)) || new Set(rows.map((row) => row.component)).size !== rows.length) {
17842
+ throw new CliError({
17843
+ code: "PROTOCOL_UNSUPPORTED" /* PROTOCOL_UNSUPPORTED */,
17844
+ message: "\u8865\u8DD1\u63A5\u53E3\u672A\u8FD4\u56DE\u5B8C\u6574\u4E14\u5339\u914D\u5F53\u524D\u79DF\u6237\u7684\u9010\u7EC4\u4EF6\u56DE\u6267\uFF0C\u7ED3\u679C\u672A\u786E\u8BA4\uFF1B\u6CA1\u6709\u628A\u7F3A\u503C\u586B\u6210\u96F6\u6216\u6210\u529F\u3002",
17845
+ context: {
17846
+ reasonCode: "TENANT_RECONCILE_RECEIPT_UNKNOWN",
17847
+ details: { unverifiedReceipt: data },
17848
+ nextStep: "\u5148\u53EA\u8BFB\u67E5\u8BE2 tenant.bootstrap \u5E76\u6838\u67E5\u670D\u52A1\u7AEF\u65E5\u5FD7\uFF1B\u4E0D\u8981\u56E0\u56DE\u6267\u672A\u77E5\u81EA\u52A8\u91CD\u53D1\u8865\u8DD1\u3002"
17849
+ }
17850
+ });
17851
+ }
17852
+ return data;
17853
+ }
17854
+ async function resetTenant(http, tenantId) {
17855
+ const { data: envelope2 } = await http.post("/api/models/DataPackage/action/resetTenant", {
17856
+ tenantId,
17857
+ confirmation: `RESET_TENANT:${tenantId}`
17858
+ }, { __skipRetry: true, maxRedirects: 0 });
17859
+ const receipt = envelope2?.data;
17860
+ const text3 = (value) => typeof value === "string" && value.trim().length > 0;
17861
+ const nonPg = receipt?.nonPgSurface;
17862
+ if (!envelope2 || envelope2.error != null || envelope2.success === false || !receipt || Array.isArray(receipt) || receipt.tenantId !== tenantId || !text3(receipt.runId) || receipt.state !== "FACTORY_BASELINE" || receipt.stateScope !== "POSTGRESQL" || !["deletedRows", "touchedTables", "reconciledComponents", "restoredRows"].every((key) => Number.isSafeInteger(receipt[key]) && receipt[key] >= 0) || !["pgVerified", "overallVerified", "journalReconciledMarked"].every((key) => typeof receipt[key] === "boolean") || !nonPg || !text3(nonPg.status) || !text3(nonPg.reason) || !text3(nonPg.nextStep) || !Array.isArray(nonPg.unhandledSurfaces) || !nonPg.unhandledSurfaces.length || !nonPg.unhandledSurfaces.every(text3)) {
17863
+ throw new CliError({
17864
+ code: "PROTOCOL_UNSUPPORTED" /* PROTOCOL_UNSUPPORTED */,
17865
+ message: "\u91CD\u7F6E\u63A5\u53E3\u672A\u8FD4\u56DE\u5B8C\u6574\u4E14\u5339\u914D\u76EE\u6807\u7684\u73B0\u5F79\u56DE\u6267\uFF0C\u7ED3\u679C\u672A\u786E\u8BA4\uFF1B\u672A\u5C06\u7F3A\u503C\u8865\u6210\u96F6\u6216\u6210\u529F\u3002",
17866
+ context: {
17867
+ reasonCode: "TENANT_RESET_RECEIPT_UNKNOWN",
17868
+ // 坐标来自未确认回执,只供追查;保留原值,绝不据此声明成功。
17869
+ details: {
17870
+ ...envelope2?.error ? { error: envelope2.error } : {},
17871
+ ...receipt !== void 0 ? { unverifiedReceipt: receipt } : {}
17872
+ },
17873
+ nextStep: "\u4E0D\u8981\u76F2\u76EE\u91CD\u8DD1\u91CD\u7F6E\uFF1B\u6838\u67E5\u670D\u52A1\u7AEF\u91CD\u7F6E\u6D41\u6C34\u4E0E\u5F53\u524D\u79DF\u6237\u72B6\u6001\u3002"
16942
17874
  }
16943
- },
16944
- "x-hcm-authoring": {
16945
- "topLevel": "closed",
16946
- "errCode": "META_UNKNOWN_AUTHORING_KEY",
16947
- "retiredTopLevelKeys": {}
17875
+ });
17876
+ }
17877
+ return receipt;
17878
+ }
17879
+
17880
+ // src/meta/tenant-meta.ts
17881
+ async function listTenantMeta(http, opts = {}) {
17882
+ const resp = await http.get("/api/tenant-meta/list", { params: opts });
17883
+ const body = resp.data;
17884
+ const payload = body?.data ?? body;
17885
+ const items = Array.isArray(payload) ? payload : payload?.items ?? payload?.list ?? payload?.records ?? [];
17886
+ const total = typeof body?.total === "number" ? body.total : payload?.total;
17887
+ return { items, total, raw: payload };
17888
+ }
17889
+ async function getTenantMeta(http, path25) {
17890
+ const resp = await http.get("/api/tenant-meta/meta", { params: { path: path25 } });
17891
+ const payload = resp.data?.data ?? resp.data;
17892
+ if (typeof payload === "string") return payload;
17893
+ return String(payload?.content ?? "");
17894
+ }
17895
+ async function saveTenantMeta(http, path25, content) {
17896
+ const resp = await http.put("/api/tenant-meta/meta", { content }, { params: { path: path25 } });
17897
+ return resp.data?.data ?? resp.data;
17898
+ }
17899
+ async function deleteTenantMeta(http, path25) {
17900
+ const resp = await http.delete("/api/tenant-meta/meta", { params: { path: path25 } });
17901
+ return resp.data?.data ?? resp.data;
17902
+ }
17903
+
17904
+ // src/meta/column-slots.ts
17905
+ var WORKSPACE_KEY_HEADER = "X-Workspace-Key";
17906
+ var COLUMN_SLOTS_PATH = "/api/tenant-extension/column-slots";
17907
+ var COLUMN_SLOT_SQL_PATH = "/api/tenant-extension/column-slots/sql";
17908
+ var COLUMN_SLOT_SQL_KEYS = [
17909
+ "countSlot",
17910
+ "flexToSlotBatched",
17911
+ "flexToSlot",
17912
+ "verifyFlexToSlot",
17913
+ "slotToFlex",
17914
+ "removeFlexKey",
17915
+ "clearSlot",
17916
+ "moveFromSlot",
17917
+ "verifyMoveFromSlot",
17918
+ "clearFromSlot"
17919
+ ];
17920
+ var COLUMN_SLOT_REBIND_SQL_KEYS = ["moveFromSlot", "verifyMoveFromSlot", "clearFromSlot"];
17921
+ function headers(opts) {
17922
+ return opts.workspaceKey ? { [WORKSPACE_KEY_HEADER]: opts.workspaceKey } : void 0;
17923
+ }
17924
+ function isRecord3(value) {
17925
+ return typeof value === "object" && value !== null && !Array.isArray(value);
17926
+ }
17927
+ function unexpected(path25, body) {
17928
+ return new CliError({
17929
+ code: "PROTOCOL_UNSUPPORTED" /* PROTOCOL_UNSUPPORTED */,
17930
+ message: `${path25} \u8FD4\u56DE\u4E86 2xx\uFF0C\u4F46\u54CD\u5E94\u91CC\u6CA1\u6709\u7EA6\u5B9A\u7684 data \u7ED3\u6784\uFF1B\u6CA1\u6709\u628A\u7F3A\u7684\u90E8\u5206\u8865\u6210\u7A7A\u5217\u8868`,
17931
+ context: {
17932
+ reasonCode: "COLUMN_SLOT_RESPONSE_UNRECOGNIZED",
17933
+ details: body,
17934
+ nextStep: "\u7528 `hcm version` \u6838\u5BF9\u540E\u7AEF\u7248\u672C\u662F\u5426\u542B\u5217\u69FD\u767B\u8BB0\u8868\uFF08ADR-452\uFF09\uFF1B\u7248\u672C\u5BF9\u5F97\u4E0A\u5C31\u628A\u8FD9\u6BB5\u54CD\u5E94\u62A5\u7ED9 CLI \u7EF4\u62A4\u8005"
16948
17935
  }
17936
+ });
17937
+ }
17938
+ async function getColumnSlots(http, model, opts = {}) {
17939
+ const resp = await http.get(COLUMN_SLOTS_PATH, { params: { model }, headers: headers(opts) });
17940
+ const data = resp.data?.data;
17941
+ if (!isRecord3(data) || !Array.isArray(data.slots) || !Array.isArray(data.occupied)) {
17942
+ throw unexpected(COLUMN_SLOTS_PATH, resp.data);
16949
17943
  }
16950
- };
17944
+ return data;
17945
+ }
17946
+ async function getColumnSlotSql(http, params, opts = {}) {
17947
+ const query2 = { model: params.model, field: params.field };
17948
+ if (params.slot) query2.slot = params.slot;
17949
+ if (params.fromSlot) query2.fromSlot = params.fromSlot;
17950
+ const resp = await http.get(COLUMN_SLOT_SQL_PATH, { params: query2, headers: headers(opts) });
17951
+ const data = resp.data?.data;
17952
+ if (!isRecord3(data) || !isRecord3(data.sql)) {
17953
+ throw unexpected(COLUMN_SLOT_SQL_PATH, resp.data);
17954
+ }
17955
+ return data;
17956
+ }
17957
+
17958
+ // src/meta/validate-meta.ts
17959
+ import yaml8 from "js-yaml";
16951
17960
 
16952
17961
  // src/meta/generated/layout-class-catalog.ts
16953
17962
  var LAYOUT_CLASS_CATALOG = {
@@ -18908,25 +19917,25 @@ function extractFieldRows(metas) {
18908
19917
  key,
18909
19918
  // 🔴 中文名的键是 `name`,**不是 `label`**(实测 2676/2676 个字段没有一个带 label)。
18910
19919
  // 本仓字段命名规范也是「名称字段统一用 name,禁止 label」。
18911
- name: str(rec2.name),
18912
- type: str(rec2.type),
19920
+ name: str2(rec2.name),
19921
+ type: str2(rec2.type),
18913
19922
  // 🔴 必填的键是 `isRequired`,**不是 `required`**(实测 required 出现 0 次)。
18914
19923
  // 缺省一律显式 false,不用 null——null 会把「没这属性」和「值是假」混成一件事。
18915
19924
  isRequired: Boolean(rec2.isRequired ?? false),
18916
19925
  isFlex: Boolean(rec2.isFlex ?? false),
18917
19926
  // `columnDefinition` 是实测存在的存储侧信息(14% 的字段有);原计划的 `storage` 键**不存在**。
18918
- columnDefinition: str(rec2.columnDefinition),
19927
+ columnDefinition: str2(rec2.columnDefinition),
18919
19928
  // 🔴 顾问真正会 grep 的是业务话术:字段级 synonyms 与 description。
18920
19929
  // 它们稀疏但**恒发**(空就是 [] / "")——「有这一列且为空」与「没这一列」是两个值。
18921
19930
  synonyms: Array.isArray(rec2.synonyms) ? rec2.synonyms.filter(Boolean).map(String) : [],
18922
- description: str(rec2.description),
19931
+ description: str2(rec2.description),
18923
19932
  enums: enumRows(rec2)
18924
19933
  });
18925
19934
  });
18926
19935
  }
18927
19936
  return { rows, dropped };
18928
19937
  }
18929
- function str(v) {
19938
+ function str2(v) {
18930
19939
  return v === void 0 || v === null || v === false ? "" : String(v);
18931
19940
  }
18932
19941
  function writeFieldsIndex(layout, rows) {
@@ -18965,7 +19974,7 @@ function actionsPath(modelKey, state = "") {
18965
19974
  if (!state) return base;
18966
19975
  return `${base}?${new URLSearchParams({ state }).toString()}`;
18967
19976
  }
18968
- function isRecord3(v) {
19977
+ function isRecord4(v) {
18969
19978
  return Boolean(v) && typeof v === "object" && !Array.isArray(v);
18970
19979
  }
18971
19980
  function keyOrNull(key) {
@@ -19007,7 +20016,7 @@ async function collectActionGates(probe, modelKeys2, state = "") {
19007
20016
  continue;
19008
20017
  }
19009
20018
  const body = out.body;
19010
- if (!isRecord3(body) || !Array.isArray(body.actions)) {
20019
+ if (!isRecord4(body) || !Array.isArray(body.actions)) {
19011
20020
  unavailable.push({
19012
20021
  modelKey: model,
19013
20022
  status: out.status,
@@ -19023,13 +20032,13 @@ async function collectActionGates(probe, modelKeys2, state = "") {
19023
20032
  else statesEchoed.add(echoed);
19024
20033
  for (const action3 of body.actions) {
19025
20034
  actionsSeen += 1;
19026
- if (!isRecord3(action3)) {
20035
+ if (!isRecord4(action3)) {
19027
20036
  reject(rejected, model, null, "malformed-action");
19028
20037
  continue;
19029
20038
  }
19030
20039
  const cands = Array.isArray(action3.candidates) ? action3.candidates : [];
19031
20040
  for (const c of cands) {
19032
- if (isRecord3(c) && typeof c.source === "string" && c.source) sources.add(c.source);
20041
+ if (isRecord4(c) && typeof c.source === "string" && c.source) sources.add(c.source);
19033
20042
  }
19034
20043
  const effectClass = classifyEffect(action3.effect);
19035
20044
  if (effectClass !== "absent") actionsWithEffect += 1;
@@ -19073,7 +20082,7 @@ async function collectActionGates(probe, modelKeys2, state = "") {
19073
20082
  reject(rejected, model, key, "no-candidates");
19074
20083
  continue;
19075
20084
  }
19076
- if (!cands.every((c) => isRecord3(c))) {
20085
+ if (!cands.every((c) => isRecord4(c))) {
19077
20086
  reject(rejected, model, key, "malformed-candidate");
19078
20087
  continue;
19079
20088
  }
@@ -19396,7 +20405,7 @@ var badSection = (t) => `\u4F20\u5165\u7684 mutation \u6BB5\u4E0D\u662F\u5BF9\u8
19396
20405
  var badCell = (op, t) => `\u4F20\u5165\u7684 mutation \u91CC ${op} \u8FD9\u4E00\u9879\u4E0D\u662F\u5BF9\u8C61\uFF08${t}\uFF09\uFF0C\u65E0\u6CD5\u5224\u8BFB`;
19397
20406
  var missingCell = (op) => `\u4F20\u5165\u7684 mutation \u91CC\u6CA1\u6709 ${op} \u8FD9\u4E00\u9879`;
19398
20407
  var WORDING3 = 'writable=false \u7684\u4E24\u79CD\u539F\u56E0\uFF1Aderived:<kind>\uFF08\u6D3E\u751F\u5B57\u6BB5\uFF0C\u670D\u52A1\u7AEF\u7B97\u51FA\u6765\u7684\uFF09\u3001readonly\uFF08\u5143\u6570\u636E\u58F0\u660E\u53EA\u8BFB\uFF09\u3002autoGenerate=true \u7684\u5B57\u6BB5\uFF08\u5DE5\u53F7 / \u7EC4\u7EC7 / \u5C97\u4F4D / \u6CD5\u4EBA\u7F16\u7801\u7B49\uFF09**\u4E0D\u662F**\u4E0D\u53EF\u5199\uFF1A\u670D\u52A1\u7AEF\u53EA\u5728\u5B57\u6BB5\u4E3A\u7A7A\u65F6\u751F\u6210\uFF0C\u8C03\u7528\u65B9\u624B\u5DE5\u6307\u5B9A\u7684\u503C\u4F18\u5148 \u2014\u2014 \u7531\u72EC\u7ACB\u6807\u8BB0 `autoGeneratedIfAbsent` \u70B9\u540D\uFF08\u4E0D\u9001\u5219\u751F\u6210\u3001\u9001\u5219\u91C7\u7EB3\uFF09\uFF0C\u4E0D\u518D\u8FDB notWritableReason\u3002\u{1F534} writable=true **\u53EA\u8868\u793A\u5143\u6570\u636E\u6CA1\u58F0\u660E\u8FD9\u4E24\u79CD\u4E0D\u53EF\u5199**\uFF0C\u4E0D\u8868\u793A\u8FD9\u4E2A\u5B57\u6BB5\u8BE5\u7531\u987E\u95EE\u586B \u2014\u2014 \u5B9E\u6D4B createById / updateById \u8FD9 1476 \u4E2A\u5BA1\u8BA1\u5B57\u6BB5\u56DB\u4E2A\u6807\u5FD7\u5168\u662F false\uFF0C\u7167\u6837\u662F writable=true\uFF0C\u5B83\u4EEC\u7531 ref.auditBackref=true \u70B9\u540D\uFF08topology \u628A\u540C\u4E00\u6279\u8FB9\u6392\u9664\u51FA\u4F9D\u8D56\u56FE\uFF0C\u8FD9\u91CC\u4E0D\u6392\u9664\uFF1Amapping \u662F\u5B57\u6BB5\u6E05\u5355\uFF0C\u4E0D\u662F\u4F9D\u8D56\u56FE\uFF09\u3002ref.valueDomain \u53EA\u5728\u76EE\u6807\u662F\u7801\u8868\uFF08DYNAMIC / CO_*\uFF09\u65F6\u7ED9\u51FA\uFF1B\u6307\u5411\u4E1A\u52A1\u6A21\u578B\u65F6\u4E3A null \u2014\u2014 \u5B9E\u6D4B 234 \u4E2A\u58F0\u660E\u51FA\u6765\u7684\u5F15\u7528\u76EE\u6807\u91CC\uFF0C230 \u4E2A\u5728\u540D\u518C\u4E2D\uFF1A\u5176\u4E2D 32 \u4E2A\u662F\u7801\u8868\u3001198 \u4E2A\u662F\u4E1A\u52A1\u6A21\u578B\uFF08User 1564 / OrgUnit 292 / Employee 199 \u2026\uFF09\u8981\u6309\u4E1A\u52A1\u952E\u73B0\u67E5\uFF1B\u53E6\u6709 4 \u4E2A\u60AC\u7A7A\u76EE\u6807\uFF08\u58F0\u660E\u4E86\u5F15\u7528\u4F46\u4E0D\u5728 /api/system/models \u540D\u518C\u91CC\uFF0C\u89C1 topology.json \u7684 dangling\uFF09\u3002valuedomain \u91CC\u6CA1\u6709\u4E1A\u52A1\u6A21\u578B\u7684\u5BF9\u7167\u8868\uFF0C\u6307\u4E00\u4E2A\u4E0D\u5B58\u5728\u7684\u6587\u4EF6\u6BD4\u4E0D\u6307\u66F4\u7CDF\uFF1A\u987E\u95EE\u4F1A\u4EE5\u4E3A\u90A3\u4EFD\u5BF9\u7167\u8868\u53EA\u662F\u8FD8\u6CA1\u751F\u6210\u3002ref.labelFieldSource=unknown \u8868\u793A\u4EA7\u54C1\u6CA1\u58F0\u660E\u663E\u793A\u5B57\u6BB5\u540D\uFF08\u5B9E\u6D4B\u8FDB\u56FE\u7684 2923 \u6761\u8FB9\u91CC 1366 \u6761\u6CA1\u58F0\u660E\uFF09\uFF0C**\u4E0D\u662F**\u300C\u9ED8\u8BA4\u7528 name\u300D\u2014\u2014 \u90A3 1366 \u6761\u6307\u5411 224 \u4E2A\u5728\u518C\u76EE\u6807\uFF0C\u5176\u4E2D 60 \u4E2A\uFF0827%\uFF0C\u76EE\u6807\u6A21\u578B\u53E3\u5F84\uFF09\u8FDE name \u5B57\u6BB5\u90FD\u6CA1\u6709\uFF0C\u6309\u8FB9\u7B97 152 \u6761\uFF0811%\uFF0C\u5B57\u6BB5\u53E3\u5F84\uFF09\u843D\u5728\u5B83\u4EEC\u8EAB\u4E0A\u3002mutation.allowed \u6052\u4E3A\u4E09\u4E2A\u503C\u4E4B\u4E00\uFF1Atrue / false / "unknown"\u3002"unknown" \u8868\u793A\u8BE5\u6A21\u578B\u8FD9\u4E00\u9879\u6CA1\u67E5\u5230\uFF0C**\u4E0D\u662F**\u300C\u5141\u8BB8\u300D\uFF1B\u5177\u4F53\u662F\u54EA\u4E00\u79CD\u6CA1\u67E5\u5230\u770B reason\uFF08\u670D\u52A1\u7AEF\u4FA7\uFF1A\u6CA1\u5E94\u7B54 / \u54CD\u5E94\u7F3A\u8FD9\u4E00\u9879 / allowed \u4E0D\u662F\u5E03\u5C14\uFF1B\u5DE5\u5177\u4FA7\uFF1A\u5E76\u53D1\u6279\u6B21\u91CC\u6CA1\u62FF\u5230\u8FD9\u4E2A\u6A21\u578B\u7684\u7ED3\u679C\uFF1B\u8C03\u7528\u65B9\u4FA7\uFF1A\u672C\u8F6E\u6CA1\u67E5 / \u4F20\u5165\u7684 mutation \u6BB5\u4E0D\u662F\u5BF9\u8C61 / \u4F20\u5165\u7684\u8FD9\u4E00\u9879\u4E0D\u662F\u5BF9\u8C61 / \u4F20\u5165\u7684\u91CC\u6CA1\u6709\u8FD9\u4E00\u9879 \u2014\u2014 \u516B\u79CD\u6210\u56E0\u63AA\u8F9E\u5404\u4E0D\u76F8\u540C\uFF0C\u300C\u4F20\u5165\u7684\u300D\u5F00\u5934\u7684\u662F\u62FC\u8FD9\u4EFD\u57FA\u7EBF\u7684\u4EBA\u641E\u9519\u4E86\uFF0C\u4E0D\u662F\u670D\u52A1\u7AEF\uFF09\u3002enumCount \u6570\u7684\u662F\u8BE5\u5B57\u6BB5\u5019\u9009\u503C\u7684**\u5143\u7D20\u4E2A\u6570**\uFF0C\u4E0E index/fields.jsonl \u91CC\u8BE5\u5B57\u6BB5\u7684 enums \u884C\u6570\u76F8\u7B49\u3002';
19399
- function isRecord4(v) {
20408
+ function isRecord5(v) {
19400
20409
  return Boolean(v) && typeof v === "object" && !Array.isArray(v);
19401
20410
  }
19402
20411
  function typeName2(v) {
@@ -19421,7 +20430,7 @@ async function collectMutation(probe, modelKeys2) {
19421
20430
  continue;
19422
20431
  }
19423
20432
  const body = out.error === "ok" ? out.body : null;
19424
- if (!isRecord4(body)) {
20433
+ if (!isRecord5(body)) {
19425
20434
  const reason = `\u672A\u5E94\u7B54\uFF08HTTP ${out.status} / ${out.error}\uFF09`;
19426
20435
  problems.push(`${key}: mutation-capability ${reason}`);
19427
20436
  mutation[key] = Object.fromEntries(MUTATION_OPS.map((op) => [op, { allowed: "unknown", reason }]));
@@ -19430,7 +20439,7 @@ async function collectMutation(probe, modelKeys2) {
19430
20439
  const entry = {};
19431
20440
  for (const op of MUTATION_OPS) {
19432
20441
  const cell = body[op];
19433
- if (!isRecord4(cell) || !("allowed" in cell)) {
20442
+ if (!isRecord5(cell) || !("allowed" in cell)) {
19434
20443
  entry[op] = { allowed: "unknown", reason: `\u54CD\u5E94\u91CC\u6CA1\u6709 ${op} \u8FD9\u4E00\u9879` };
19435
20444
  problems.push(`${key}: mutation-capability \u54CD\u5E94\u7F3A ${op}`);
19436
20445
  continue;
@@ -19451,14 +20460,14 @@ function mutationSection(entry) {
19451
20460
  if (entry === void 0 || entry === null) {
19452
20461
  return Object.fromEntries(MUTATION_OPS.map((op) => [op, { allowed: "unknown", reason: NOT_QUERIED }]));
19453
20462
  }
19454
- if (!isRecord4(entry)) {
20463
+ if (!isRecord5(entry)) {
19455
20464
  const reason = badSection(typeName2(entry));
19456
20465
  return Object.fromEntries(MUTATION_OPS.map((op) => [op, { allowed: "unknown", reason }]));
19457
20466
  }
19458
20467
  const section = {};
19459
20468
  for (const op of MUTATION_OPS) {
19460
20469
  const cell = entry[op];
19461
- if (isRecord4(cell)) {
20470
+ if (isRecord5(cell)) {
19462
20471
  section[op] = cell;
19463
20472
  } else if (op in entry) {
19464
20473
  section[op] = { allowed: "unknown", reason: badCell(op, typeName2(cell)) };
@@ -19471,7 +20480,7 @@ function mutationSection(entry) {
19471
20480
  function writability(field) {
19472
20481
  const derived = field.derived;
19473
20482
  if (derived) {
19474
- const kind = isRecord4(derived) ? derived.kind : null;
20483
+ const kind = isRecord5(derived) ? derived.kind : null;
19475
20484
  return { writable: false, reason: `derived:${typeof kind === "string" && kind ? kind : "unknown"}` };
19476
20485
  }
19477
20486
  if (field.isReadonly) return { writable: false, reason: "readonly" };
@@ -19486,7 +20495,7 @@ function buildMapping(metas, edges, mutation, codeTables = []) {
19486
20495
  const { fields, problem: problem6 } = metaFields(metas[modelKey]);
19487
20496
  const rows = [];
19488
20497
  for (const f of fields) {
19489
- if (!isRecord4(f)) continue;
20498
+ if (!isRecord5(f)) continue;
19490
20499
  const key = f.key;
19491
20500
  if (typeof key !== "string" || !key) continue;
19492
20501
  const { writable, reason } = writability(f);
@@ -19529,7 +20538,7 @@ function buildMapping(metas, edges, mutation, codeTables = []) {
19529
20538
  // 「爬过且这个模型确实没有字段」必须与「没爬过」(文件不存在)区分开。
19530
20539
  crawled: true,
19531
20540
  wording: WORDING3,
19532
- mutation: mutationSection(isRecord4(mutation) ? mutation[modelKey] : mutation),
20541
+ mutation: mutationSection(isRecord5(mutation) ? mutation[modelKey] : mutation),
19533
20542
  fieldCount: rows.length,
19534
20543
  // 🔴 `null` = 载荷判读正常(fieldCount=0 就是「这个模型确实没字段」);
19535
20544
  // 非 null = **爬过、但判不出字段**,此时 fieldCount=0 不代表「没字段」。
@@ -19541,8 +20550,8 @@ function buildMapping(metas, edges, mutation, codeTables = []) {
19541
20550
  }
19542
20551
  function allowedIn(sheet, op) {
19543
20552
  const section = sheet.mutation;
19544
- const cell = isRecord4(section) ? section[op] : void 0;
19545
- return isRecord4(cell) ? cell.allowed : "unknown";
20553
+ const cell = isRecord5(section) ? section[op] : void 0;
20554
+ return isRecord5(cell) ? cell.allowed : "unknown";
19546
20555
  }
19547
20556
  var PATH_SEPARATORS = ["/", String.fromCharCode(92)];
19548
20557
  function unsafeKeyReason(modelKey) {
@@ -19724,7 +20733,7 @@ function writeModelsMd(layout, text3) {
19724
20733
  // src/fde/recon/pointer-audit.ts
19725
20734
  import { existsSync as existsSync3 } from "fs";
19726
20735
  import * as path10 from "path";
19727
- function isRecord5(v) {
20736
+ function isRecord6(v) {
19728
20737
  return Boolean(v) && typeof v === "object" && !Array.isArray(v);
19729
20738
  }
19730
20739
  function auditValueDomainPointers(layout, sheets) {
@@ -19733,7 +20742,7 @@ function auditValueDomainPointers(layout, sheets) {
19733
20742
  for (const sheet of sheets) {
19734
20743
  for (const field of sheet.fields) {
19735
20744
  const ref = field.ref;
19736
- const pointer = isRecord5(ref) ? ref.valueDomain : null;
20745
+ const pointer = isRecord6(ref) ? ref.valueDomain : null;
19737
20746
  if (typeof pointer !== "string" || pointer === "") continue;
19738
20747
  if (!seen.has(pointer)) {
19739
20748
  seen.set(pointer, existsSync3(path10.join(layout.dir, pointer)));
@@ -19824,18 +20833,18 @@ var WORDING4 = "rows = \u672C\u8F6E\u4EE5\u5F53\u524D\u767B\u5F55\u8EAB\u4EFD\u8
19824
20833
  function listPath(modelKey) {
19825
20834
  return `/api/models/${modelKey}/list/dsl`;
19826
20835
  }
19827
- function isRecord6(v) {
20836
+ function isRecord7(v) {
19828
20837
  return Boolean(v) && typeof v === "object" && !Array.isArray(v);
19829
20838
  }
19830
20839
  function readContent(body) {
19831
- if (!isRecord6(body)) return { rows: null, total: null, nonDict: 0 };
20840
+ if (!isRecord7(body)) return { rows: null, total: null, nonDict: 0 };
19832
20841
  const rows = body.content;
19833
20842
  const total = body.totalElements;
19834
20843
  if (!Array.isArray(rows)) return { rows: null, total: null, nonDict: 0 };
19835
20844
  if (typeof total !== "number" || !Number.isInteger(total) || total < 0) {
19836
20845
  return { rows: null, total: null, nonDict: 0 };
19837
20846
  }
19838
- const kept = rows.filter((r) => isRecord6(r));
20847
+ const kept = rows.filter((r) => isRecord7(r));
19839
20848
  return { rows: kept, total, nonDict: rows.length - kept.length };
19840
20849
  }
19841
20850
  async function collectCodeTables(probe, modelEntries2, opts = {}) {
@@ -19848,7 +20857,7 @@ async function collectCodeTables(probe, modelEntries2, opts = {}) {
19848
20857
  const problems = [];
19849
20858
  const keys = [];
19850
20859
  for (const entry of modelEntries2) {
19851
- if (!isRecord6(entry) || entry.type !== DYNAMIC_TYPE) continue;
20860
+ if (!isRecord7(entry) || entry.type !== DYNAMIC_TYPE) continue;
19852
20861
  const key = entry.modelKey;
19853
20862
  if (typeof key !== "string" || !key) {
19854
20863
  problems.push(`\u540D\u518C\u91CC\u6709\u4E00\u6761 type=DYNAMIC \u7684\u6761\u76EE\u4F46 modelKey \u4E0D\u53EF\u7528\uFF08${JSON.stringify(key)}\uFF09\uFF0C\u5DF2\u8DF3\u8FC7`);
@@ -19982,12 +20991,12 @@ function collectEnumDomains(metas) {
19982
20991
  for (const modelKey of Object.keys(metas).sort()) {
19983
20992
  const { fields } = metaFields(metas[modelKey]);
19984
20993
  for (const field of fields) {
19985
- if (!isRecord6(field)) continue;
20994
+ if (!isRecord7(field)) continue;
19986
20995
  const fieldKey = field.key;
19987
20996
  if (typeof fieldKey !== "string" || !fieldKey) continue;
19988
20997
  const enums = field.enums;
19989
20998
  if (!Array.isArray(enums) || enums.length === 0) continue;
19990
- const kept = enums.filter(isRecord6).map((e) => ({ ...e }));
20999
+ const kept = enums.filter(isRecord7).map((e) => ({ ...e }));
19991
21000
  rows.push({
19992
21001
  model: modelKey,
19993
21002
  field: fieldKey,
@@ -19998,7 +21007,7 @@ function collectEnumDomains(metas) {
19998
21007
  // —— 否则「这个字段的枚举少了一项」这件事没有任何出处。
19999
21008
  // 实测 3179 条全是对象,这一档从未观测到;**恒发空列表**而不是条件出键:
20000
21009
  // 「有这一列且为空」与「没这一列」是两个值,后者读起来像「没检查过」。
20001
- nonDictElements: enums.filter((e) => !isRecord6(e)).map((e) => JSON.stringify(e) ?? String(e))
21010
+ nonDictElements: enums.filter((e) => !isRecord7(e)).map((e) => JSON.stringify(e) ?? String(e))
20002
21011
  });
20003
21012
  }
20004
21013
  }
@@ -20043,7 +21052,7 @@ function writeValuedomain(layout, codeTables, enums, opts = {}) {
20043
21052
  roundId: opts.roundId ?? null,
20044
21053
  // 🔴 `identity || {}` 会把「调用方没传身份」和「身份是空的」压成同一个值,
20045
21054
  // 而它们的下一步不同(前者去补工具的登录,后者去问服务端为什么不给 user)。
20046
- identity: isRecord6(opts.identity) ? opts.identity : null,
21055
+ identity: isRecord7(opts.identity) ? opts.identity : null,
20047
21056
  codeTableCount: Object.keys(codeTables).length,
20048
21057
  enumFieldCount: enums.length,
20049
21058
  // 🔴 名册里一共看到几条。上游名册加载失败给出空数组时,产物会与
@@ -20113,7 +21122,7 @@ function parseRoundStamp(stamp2) {
20113
21122
  function newRoundId(started) {
20114
21123
  return `${roundStamp(started)}-${randomBytes3(4).toString("hex")}`;
20115
21124
  }
20116
- function isRecord7(v) {
21125
+ function isRecord8(v) {
20117
21126
  return Boolean(v) && typeof v === "object" && !Array.isArray(v);
20118
21127
  }
20119
21128
  function readJsonSoft(file) {
@@ -20132,8 +21141,8 @@ function readJsonSoft(file) {
20132
21141
  }
20133
21142
  function readCrawledAt(layout) {
20134
21143
  const body = readJsonSoft(path11.join(layout.dir, KIT_CRAWLED_AT_FILE));
20135
- const models = isRecord7(body) ? body.models : null;
20136
- return isRecord7(models) ? models : {};
21144
+ const models = isRecord8(body) ? body.models : null;
21145
+ return isRecord8(models) ? models : {};
20137
21146
  }
20138
21147
  function writeCrawledAt(layout, freshKeys, carriedKeys, roundId, started) {
20139
21148
  const previous = readCrawledAt(layout);
@@ -20181,14 +21190,14 @@ function productRoundId(root, rel) {
20181
21190
  const p = path11.join(root, rel);
20182
21191
  if (!existsSync4(p)) return ["missing", null];
20183
21192
  const body = readJsonSoft(p);
20184
- if (body === void 0 || !isRecord7(body)) return ["unreadable", null];
21193
+ if (body === void 0 || !isRecord8(body)) return ["unreadable", null];
20185
21194
  const rid = body.roundId;
20186
21195
  if (typeof rid !== "string" || !rid) return ["unstamped", null];
20187
21196
  return ["stamped", rid];
20188
21197
  }
20189
21198
  function inspectRound(root) {
20190
21199
  const raw = readJsonSoft(path11.join(root, KIT_CRAWLED_AT_FILE));
20191
- const ledger = isRecord7(raw) ? raw : {};
21200
+ const ledger = isRecord8(raw) ? raw : {};
20192
21201
  const rid = ledger.roundId;
20193
21202
  const roundId = typeof rid === "string" && rid ? rid : null;
20194
21203
  const rawWritten = ledger.productsWrittenThisRound;
@@ -20293,7 +21302,7 @@ function renderRound(result) {
20293
21302
  }
20294
21303
  var SCHEMA_RECRAWL_NEXT = "\u4E0B\u4E00\u6B65\uFF1A\u8DD1\u4E00\u6B21**\u5168\u91CF** `hcm chiron recon`\uFF08\u628A `--model` \u53BB\u6389\uFF09\uFF0C\u6574\u4EFD\u57FA\u7EBF\u624D\u90FD\u51FA\u81EA\u672C\u7248 kit\u3002";
20295
21304
  function carriedGatesSchemaProblem(oldGates) {
20296
- if (!isRecord7(oldGates)) {
21305
+ if (!isRecord8(oldGates)) {
20297
21306
  const shape = Array.isArray(oldGates) ? "list" : oldGates === null ? "null" : typeof oldGates;
20298
21307
  return `gates.json: \u4E0A\u4E00\u8F6E\u7684\u95F8\u8868\u8F7D\u8377\u662F ${shape} \u4E0D\u662F\u5BF9\u8C61\uFF0C\u65E2\u8BFB\u4E0D\u51FA schema \u7248\u672C\u3001\u4E5F\u4E00\u6761\u95F8\u90FD\u6CBF\u7528\u4E0D\u4E86\uFF08\u672C\u8F6E\u7684 gates \u6570\u7EC4\u91CC\u53EA\u6709\u8FD9\u4E00\u8F6E\u771F\u722C\u5230\u7684\uFF09\u3002${SCHEMA_RECRAWL_NEXT}`;
20299
21308
  }
@@ -20334,7 +21343,7 @@ function collectCarryOver(layout, freshMetas) {
20334
21343
  problems.push(`${name}: \u8BFB\u4E0D\u56DE\u4E0A\u4E00\u8F6E\u7684 meta\uFF08${e.message}\uFF09\uFF0C\u8BE5\u6A21\u578B\u8FD9\u6B21\u4E0D\u8FDB\u7D22\u5F15`);
20335
21344
  continue;
20336
21345
  }
20337
- if (isRecord7(body)) carriedMetas[key] = body;
21346
+ if (isRecord8(body)) carriedMetas[key] = body;
20338
21347
  else {
20339
21348
  problems.push(
20340
21349
  `${name}: \u4E0A\u4E00\u8F6E\u7684 meta \u8F7D\u8377\u662F ${Array.isArray(body) ? "list" : body === null ? "null" : typeof body} \u4E0D\u662F\u5BF9\u8C61\uFF0C\u8BE5\u6A21\u578B\u8FD9\u6B21\u4E0D\u8FDB\u7D22\u5F15`
@@ -20349,9 +21358,9 @@ function collectCarryOver(layout, freshMetas) {
20349
21358
  const stale = carriedGatesSchemaProblem(oldGates);
20350
21359
  if (stale) problems.push(stale);
20351
21360
  }
20352
- const oldList = isRecord7(oldGates) && Array.isArray(oldGates.gates) ? oldGates.gates : [];
21361
+ const oldList = isRecord8(oldGates) && Array.isArray(oldGates.gates) ? oldGates.gates : [];
20353
21362
  for (const g of oldList) {
20354
- if (isRecord7(g) && !(String(g.model) in freshMetas)) carriedGates.push(g);
21363
+ if (isRecord8(g) && !(String(g.model) in freshMetas)) carriedGates.push(g);
20355
21364
  }
20356
21365
  return { carriedMetas, carriedGates, problems };
20357
21366
  }
@@ -20475,7 +21484,7 @@ async function runRecon(probe, layout, opts = {}) {
20475
21484
  products.push(...mappingPaths.map((p) => relOf(layout, p)));
20476
21485
  const sheetsWritten = Math.max(mappingPaths.length - 1, 0);
20477
21486
  let previous = readJsonSoft(path11.join(layout.dir, "fingerprint.json"));
20478
- if (!isRecord7(previous)) previous = null;
21487
+ if (!isRecord8(previous)) previous = null;
20479
21488
  const current = await computeFingerprint(probe);
20480
21489
  products.push(relOf(layout, layout.writeJson("fingerprint.json", current)));
20481
21490
  const drift = previous === null ? null : compareFingerprint(previous, current);
@@ -25585,7 +26594,7 @@ var STEP_SEND = "send";
25585
26594
  var STEP_READBACK = "readback";
25586
26595
  var STEP_NOTHING = "nothing";
25587
26596
  var STEP_STOP = "stop";
25588
- var NEXT_STEP = {
26597
+ var NEXT_STEP2 = {
25589
26598
  // 用字符串 `'null'` 当键会与一个真叫 "null" 的状态撞;这里用 `Map` 的等价写法:
25590
26599
  // 键就是 `String(status)`,而 `STATUSES` 里没有 `"null"` 这个值(值域守卫钉着)。
25591
26600
  null: STEP_SEND,
@@ -25944,7 +26953,7 @@ var Journal = class _Journal {
25944
26953
  * (已建好 / 已跳过 / **中毒了要人处理**),单看任何一个都读不出来。
25945
26954
  */
25946
26955
  nextStep(model, key) {
25947
- return NEXT_STEP[String(this.statusOf(model, key))];
26956
+ return NEXT_STEP2[String(this.statusOf(model, key))];
25948
26957
  }
25949
26958
  /** 这一行要不要**先按业务键回读**再决定 —— 只有 `unknown` 是 true。 */
25950
26959
  needsReadback(model, key) {
@@ -27819,7 +28828,7 @@ function indent(text3) {
27819
28828
  function verifyAttention(delivery, recon) {
27820
28829
  const agreeing = new Set(AGREEING_VERDICTS);
27821
28830
  return [
27822
- delivery.rows.filter((row) => NEXT_STEP[row.status] !== STEP_NOTHING),
28831
+ delivery.rows.filter((row) => NEXT_STEP2[row.status] !== STEP_NOTHING),
27823
28832
  [...delivery.plannedWithoutRecord ?? []],
27824
28833
  (recon.findings ?? []).filter((f) => !agreeing.has(f.verdict))
27825
28834
  ];
@@ -27901,7 +28910,7 @@ function verifyText(delivery, recon) {
27901
28910
  lines.push(` \u8981\u4EBA\u770B\u7684 ${rows.length} \u884C\uFF08\u4E0B\u4E00\u6B65\u4E0D\u662F\u300C\u4E0D\u5FC5\u518D\u52A8\u300D\u7684\u90A3\u4E9B\uFF09${rows.length ? "\uFF1A" : "\u3002"}`);
27902
28911
  for (const row of rows) {
27903
28912
  lines.push(
27904
- ` - ${row.model} ${JSON.stringify(row.businessKey)} status=${row.status} \u4E0B\u4E00\u6B65=${NEXT_STEP[row.status]}`
28913
+ ` - ${row.model} ${JSON.stringify(row.businessKey)} status=${row.status} \u4E0B\u4E00\u6B65=${NEXT_STEP2[row.status]}`
27905
28914
  );
27906
28915
  }
27907
28916
  if (delivery.plannedWithoutRecord === null) {
@@ -28199,7 +29208,7 @@ var EXACT_KEY_RANK = 1;
28199
29208
  var WEAKEST_RANK = Object.keys(DIMENSION_RANK).length;
28200
29209
  var VISIBLE_DIMENSIONS = /* @__PURE__ */ new Set(["name", "key", "model"]);
28201
29210
  var asList = (v) => v === null || v === void 0 ? [] : Array.isArray(v) ? v : [v];
28202
- var str2 = (v) => v === null || v === void 0 ? "" : String(v);
29211
+ var str3 = (v) => v === null || v === void 0 ? "" : String(v);
28203
29212
  var bytes = (s) => Buffer.byteLength(s, "utf-8");
28204
29213
  function loadRows(text3) {
28205
29214
  const rows = [];
@@ -28225,19 +29234,19 @@ function matchedDimensions(row, term) {
28225
29234
  const t = term.toLowerCase();
28226
29235
  const dims = [];
28227
29236
  for (const dim of ["name", "key", "model"]) {
28228
- if (str2(row[dim]).toLowerCase().includes(t)) dims.push(dim);
29237
+ if (str3(row[dim]).toLowerCase().includes(t)) dims.push(dim);
28229
29238
  }
28230
- if (asList(row.synonyms).some((s) => str2(s).toLowerCase().includes(t))) dims.push("synonyms");
28231
- if (str2(row.description).toLowerCase().includes(t)) dims.push("description");
29239
+ if (asList(row.synonyms).some((s) => str3(s).toLowerCase().includes(t))) dims.push("synonyms");
29240
+ if (str3(row.description).toLowerCase().includes(t)) dims.push("description");
28232
29241
  const labels = [];
28233
29242
  const values = [];
28234
29243
  for (const e of asList(row.enums)) {
28235
29244
  if (e && typeof e === "object" && !Array.isArray(e)) {
28236
29245
  const o = e;
28237
- values.push(str2(o.value));
28238
- labels.push(str2(o.label));
29246
+ values.push(str3(o.value));
29247
+ labels.push(str3(o.label));
28239
29248
  } else {
28240
- values.push(str2(e));
29249
+ values.push(str3(e));
28241
29250
  }
28242
29251
  }
28243
29252
  if (labels.some((x) => x.toLowerCase().includes(t))) dims.push("enumLabel");
@@ -28246,8 +29255,8 @@ function matchedDimensions(row, term) {
28246
29255
  }
28247
29256
  function hitRank(row, dims, term) {
28248
29257
  const t = term.toLowerCase();
28249
- if (dims.includes("name") && str2(row.name).toLowerCase() === t) return EXACT_NAME_RANK;
28250
- if (dims.includes("key") && str2(row.key).toLowerCase() === t) return EXACT_KEY_RANK;
29258
+ if (dims.includes("name") && str3(row.name).toLowerCase() === t) return EXACT_NAME_RANK;
29259
+ if (dims.includes("key") && str3(row.key).toLowerCase() === t) return EXACT_KEY_RANK;
28251
29260
  let best = WEAKEST_RANK;
28252
29261
  for (const d of dims) best = Math.min(best, DIMENSION_RANK[d] ?? WEAKEST_RANK);
28253
29262
  return best;
@@ -28274,16 +29283,16 @@ function enumTail(row) {
28274
29283
  const o = e;
28275
29284
  const synth = o[KIT_VALUE_SOURCE] !== void 0 && o[KIT_VALUE_SOURCE] !== null;
28276
29285
  if (synth) hasSynth = true;
28277
- shown.push(`${str2(o.value)}${synth ? SYNTH_MARK : ""}`);
29286
+ shown.push(`${str3(o.value)}${synth ? SYNTH_MARK : ""}`);
28278
29287
  } else {
28279
- shown.push(str2(e));
29288
+ shown.push(str3(e));
28280
29289
  }
28281
29290
  }
28282
29291
  const more = items.length > ENUM_SHOW ? `\u2026\u5171 ${items.length} \u4E2A` : "";
28283
29292
  return { tail: ` {${shown.join("/")}${more}}`, hasSynth };
28284
29293
  }
28285
29294
  function matchNote(hit) {
28286
- const dims = asList(hit[KIT_MATCHED_ON]).map(str2);
29295
+ const dims = asList(hit[KIT_MATCHED_ON]).map(str3);
28287
29296
  if (dims.length === 0) return "";
28288
29297
  if (dims.some((d) => VISIBLE_DIMENSIONS.has(d))) return "";
28289
29298
  return " \u2190\u547D\u4E2D\u4E8E" + dims.map((d) => DIMENSION_LABELS[d] ?? d).join("/");
@@ -28305,7 +29314,7 @@ function renderFind(hits, term, total, options = {}) {
28305
29314
  let valueShown = false;
28306
29315
  for (const h of hits) {
28307
29316
  const { tail, hasSynth } = enumTail(h);
28308
- const line = `- ${str2(h.name)} \u2192 \`${str2(h.model)}\`.\`${str2(h.key)}\` [${str2(h.type)}]${h.isRequired ? "\u5FC5\u586B" : ""}${tail}${matchNote(h)}
29317
+ const line = `- ${str3(h.name)} \u2192 \`${str3(h.model)}\`.\`${str3(h.key)}\` [${str3(h.type)}]${h.isRequired ? "\u5FC5\u586B" : ""}${tail}${matchNote(h)}
28309
29318
  `;
28310
29319
  const hint = options.hints ? options.hints.line(h.model, h.key) : "";
28311
29320
  const block = line + hint;
@@ -29625,6 +30634,12 @@ function redactUrlCredentials(url) {
29625
30634
  }
29626
30635
  var METHOD_REPO_DISPLAY = process.env.HCM_METHOD_REPO_URL?.trim() ? redactUrlCredentials(METHOD_REPO_URL) : METHOD_REPO_SLUG;
29627
30636
  var repoIssueUrl = (repo, number) => `${CNB_ORIGIN}/${repo}/-/issues/${number}`;
30637
+ var DEFAULT_GITLAB_ORIGIN = "https://git.hcmcloud.io";
30638
+ var GITLAB_ORIGIN = trimSlash(env("HCM_GITLAB_ORIGIN", DEFAULT_GITLAB_ORIGIN));
30639
+ var hostOf = (origin) => (origin.replace(/^[a-z][a-z0-9+.-]*:\/\//i, "").split("/")[0] ?? "").toLowerCase();
30640
+ var GITLAB_HOST = hostOf(GITLAB_ORIGIN);
30641
+ var GITLAB_REF_HOSTS = [...new Set([hostOf(DEFAULT_GITLAB_ORIGIN), GITLAB_HOST].filter(Boolean))];
30642
+ var gitlabIssueUrl = (repo, number) => `${GITLAB_ORIGIN}/${repo}/-/issues/${number}`;
29628
30643
  var CNB_FAVICON_URL = `${CNB_ORIGIN}/favicon.ico`;
29629
30644
 
29630
30645
  // src/jira/client.ts
@@ -29993,12 +31008,26 @@ async function createJiraClient(opts = {}) {
29993
31008
  }
29994
31009
 
29995
31010
  // src/jira/refs.ts
29996
- var REF_RE = /hcm\/(hcm_nx_(?:core|cli|cloud))(?:#|\/-\/issues\/)(\d+)/g;
31011
+ var escapeRe = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
31012
+ var HOST = `(?:${GITLAB_REF_HOSTS.map(escapeRe).join("|")})`;
31013
+ var GITLAB_REF_RE = new RegExp(`${HOST}\\/hcm\\/(hcm_nx_(?:core|cloud))(?:#|\\/-\\/(?:issues|work_items)\\/)(\\d+)`, "g");
31014
+ var CNB_REF_RE = new RegExp(`(?<!${HOST}\\/)hcm\\/(hcm_nx_(?:core|cli|cloud))(?:#|\\/-\\/issues\\/)(\\d+)`, "g");
31015
+ var refId = (r) => forgeOf(r) === "gitlab" ? `${GITLAB_HOST}/${r.repo}#${r.number}` : `${r.repo}#${r.number}`;
31016
+ var refUrl = (r) => forgeOf(r) === "gitlab" ? gitlabIssueUrl(r.repo, r.number) : repoIssueUrl(r.repo, r.number);
31017
+ function forgeOf(r) {
31018
+ if (r.forge === "gitlab" || r.forge === "cnb") return r.forge;
31019
+ throw new Error(`RepoRef.forge \u53EA\u80FD\u662F gitlab \u6216 cnb\uFF0C${r.repo}#${r.number} \u7ED9\u7684\u662F ${String(r.forge)}\uFF1A\u7528 linkedRepoRefs \u7684\u7ED3\u679C\uFF0C\u6216\u6784\u9020\u65F6\u5199\u660E forge`);
31020
+ }
31021
+ var JIRA_LINK_RE = /\[([^|\]\n]*)\|([^\]\n]+)\]/g;
31022
+ var isRefTarget = (target) => new RegExp(GITLAB_REF_RE.source).test(target) || new RegExp(CNB_REF_RE.source).test(target);
29997
31023
  function linkedRepoRefs(text3) {
31024
+ const t = String(text3 ?? "").replace(JIRA_LINK_RE, (whole, _label, target) => isRefTarget(target) ? target : whole);
31025
+ const hits = [
31026
+ ...[...t.matchAll(GITLAB_REF_RE)].map((m) => ({ at: m.index ?? 0, ref: { repo: `hcm/${m[1]}`, number: m[2], forge: "gitlab" } })),
31027
+ ...[...t.matchAll(CNB_REF_RE)].map((m) => ({ at: m.index ?? 0, ref: { repo: `hcm/${m[1]}`, number: m[2], forge: "cnb" } }))
31028
+ ].sort((a, b) => a.at - b.at);
29998
31029
  const out = /* @__PURE__ */ new Map();
29999
- for (const m of String(text3 ?? "").matchAll(REF_RE)) {
30000
- out.set(`hcm/${m[1]}#${m[2]}`, { repo: `hcm/${m[1]}`, number: m[2] });
30001
- }
31030
+ for (const h of hits) if (!out.has(refId(h.ref))) out.set(refId(h.ref), h.ref);
30002
31031
  return [...out.values()];
30003
31032
  }
30004
31033
  function parseRef(raw, project, casesSlug = CASES_REPO_SLUG) {
@@ -30086,6 +31115,7 @@ export {
30086
31115
  DEFAULT_ARTIFACT_CATEGORY,
30087
31116
  DEFAULT_SESSION_TTL_SECONDS,
30088
31117
  PREMISE_CODES4 as DELIVERY_PREMISE_CODES,
31118
+ DESCRIPTIVE_KEY_RE,
30089
31119
  DEV_MODE_PATH,
30090
31120
  DIMENSION_LABELS,
30091
31121
  DRY_RUN_NOTE,
@@ -30107,6 +31137,9 @@ export {
30107
31137
  FORCE_STALE_FLAG,
30108
31138
  FORCE_STALE_FLAG_TEXT,
30109
31139
  GATE_COMPONENTS,
31140
+ GITLAB_HOST,
31141
+ GITLAB_ORIGIN,
31142
+ GITLAB_REF_HOSTS,
30110
31143
  HANDSHAKE_AUTH_ERROR_HEADER,
30111
31144
  HANDSHAKE_CONVERSATION_QUERY_PARAM,
30112
31145
  HANDSHAKE_TOKEN_QUERY_PARAM,
@@ -30167,7 +31200,7 @@ export {
30167
31200
  MODEL_META_PATH,
30168
31201
  MappingError,
30169
31202
  NETWORK_GATES,
30170
- NEXT_STEP,
31203
+ NEXT_STEP2 as NEXT_STEP,
30171
31204
  NON_BMP_RULE_NOTE,
30172
31205
  NOT_COVERED_LAYER1,
30173
31206
  NOT_COVERED_LAYER2,
@@ -30195,6 +31228,7 @@ export {
30195
31228
  REASON_BASELINE_ROUND_NOT_COMPLETE,
30196
31229
  VERDICTS2 as RECONCILE_VERDICTS,
30197
31230
  RECOVERY_WORDS,
31231
+ REDACTED_SOURCE_ID,
30198
31232
  REJECTED_BEFORE_ROUTING_CODE,
30199
31233
  REQUIRED_SECTIONS,
30200
31234
  RESPOND_TIMEOUT_MS,
@@ -30273,6 +31307,8 @@ export {
30273
31307
  assertSafeSkillFilePath,
30274
31308
  assertSafeSkillId,
30275
31309
  assertUsableEndpoint,
31310
+ assessActionVerification,
31311
+ assessWriteVerification,
30276
31312
  baselineRoundPremise,
30277
31313
  bootstrapTenant,
30278
31314
  buildAnswer,
@@ -30298,6 +31334,7 @@ export {
30298
31334
  clearModelCache,
30299
31335
  cliAuthorizationExpired,
30300
31336
  collectMiniPushWrites,
31337
+ columnSlotsToFlex,
30301
31338
  commandsFor,
30302
31339
  compareFingerprint,
30303
31340
  computeFingerprint,
@@ -30343,6 +31380,7 @@ export {
30343
31380
  exitCodeFor,
30344
31381
  explainJacksonError,
30345
31382
  extractNextSteps,
31383
+ fetchActionVerification,
30346
31384
  fetchConversationTimeline,
30347
31385
  fetchConversationTimelineStrict,
30348
31386
  fetchInstallRun,
@@ -30353,6 +31391,8 @@ export {
30353
31391
  fetchSkillMarkdown,
30354
31392
  fetchSkillReference,
30355
31393
  fieldByName,
31394
+ fieldContractKeys,
31395
+ fieldContractKind,
30356
31396
  filterByStage,
30357
31397
  find,
30358
31398
  findEnvByEndpoint,
@@ -30375,6 +31415,7 @@ export {
30375
31415
  getScriptTask,
30376
31416
  getSettingDomain,
30377
31417
  getTenantMeta,
31418
+ gitlabIssueUrl,
30378
31419
  globalConfigFile,
30379
31420
  guessMimeType,
30380
31421
  handshakeRejectedError,
@@ -30386,6 +31427,7 @@ export {
30386
31427
  identityDir,
30387
31428
  identityKnown,
30388
31429
  identityMetaFile,
31430
+ importExitCode,
30389
31431
  inferMiniWritableTemplateOptionsFromModel,
30390
31432
  initMiniAppProject,
30391
31433
  inspectRound,
@@ -30487,9 +31529,13 @@ export {
30487
31529
  rebind,
30488
31530
  rebindPayload,
30489
31531
  reconcileTenant,
31532
+ redactDescriptiveUuids,
31533
+ refId,
31534
+ refUrl,
30490
31535
  refreshToken,
30491
31536
  releasePendingImpersonationSessions,
30492
31537
  remove,
31538
+ removeActionsUsingScripts,
30493
31539
  renameIdentity,
30494
31540
  renderEnvYaml,
30495
31541
  renderFind,
@@ -30541,12 +31587,17 @@ export {
30541
31587
  shelfPartition,
30542
31588
  snakeToCamel,
30543
31589
  startImpersonation,
31590
+ stripDefinitionIds,
31591
+ stripUnknownFieldKeys,
31592
+ stripUnknownFieldKeysForPath,
31593
+ stripVerifyEchoKeys,
30544
31594
  tenantSegment,
30545
31595
  toAcceptLanguage,
30546
31596
  toJson,
30547
31597
  toOrigin,
30548
31598
  toPrincipal,
30549
31599
  toTable,
31600
+ toWorkspacePreflightIssue,
30550
31601
  toYaml,
30551
31602
  truncateDisplay,
30552
31603
  unbindPayload,