@hcmai/sdk 0.25.2 → 0.26.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
@@ -285,7 +285,7 @@ function fromAxiosError(err, profile) {
285
285
  const respDetails = body?.details;
286
286
  const respReason = nonBlankString(body?.reason);
287
287
  const respNote = nonBlankString(body?.note);
288
- const respNextStep = nonBlankString(body?.next_step) ?? nonBlankString(body?.nextStep);
288
+ const respNextStep = nonBlankString(body?.next_step) ?? nonBlankString(body?.nextStep) ?? (isRecord(respDetails) ? nonBlankString(respDetails.nextStep) ?? nonBlankString(respDetails.next_step) : void 0);
289
289
  const respRetryable = body?.retryable;
290
290
  const conflictDiagnosis = status === 409 ? diagnoseWorkspaceConflict(respCode) : void 0;
291
291
  const localDiagnosis = respCode === REJECTED_BEFORE_ROUTING_CODE ? diagnoseRejectedBeforeRouting(err.config?.url, err.config?.baseURL) : conflictDiagnosis;
@@ -1680,6 +1680,13 @@ function isUnaryOperator(op) {
1680
1680
  function normalizeOrders(sort) {
1681
1681
  if (sort === void 0) return void 0;
1682
1682
  return sort.map((item) => {
1683
+ if (!isPlainObject(item)) throw new Error("sort item must be an object");
1684
+ const allowedKeys = /* @__PURE__ */ new Set(["field", "direction", "dir", "order", "desc", "nulls"]);
1685
+ const unknown = Object.keys(item).filter((key) => !allowedKeys.has(key));
1686
+ if (unknown.length) throw new Error(`sort item has unsupported attributes: ${unknown.join(", ")}`);
1687
+ if (item.nulls !== void 0 && item.nulls !== "FIRST" && item.nulls !== "LAST") {
1688
+ throw new Error("sort nulls must be FIRST or LAST");
1689
+ }
1683
1690
  const field = item.field;
1684
1691
  if (typeof field !== "string" || field.trim() === "") {
1685
1692
  throw new Error("sort item requires non-empty field");
@@ -1689,7 +1696,7 @@ function normalizeOrders(sort) {
1689
1696
  if (direction !== "asc" && direction !== "desc") {
1690
1697
  throw new Error(`sort direction must be asc or desc; got "${rawDirection}"`);
1691
1698
  }
1692
- return { field, direction };
1699
+ return { field, direction, ...item.nulls !== void 0 ? { nulls: item.nulls } : {} };
1693
1700
  });
1694
1701
  }
1695
1702
  function isPlainObject(value) {
@@ -6485,12 +6492,12 @@ async function checkMiniSmokeTarget(target, fetcher, timeoutMs, accessToken, wor
6485
6492
  const controller = new AbortController();
6486
6493
  const timeout = setTimeout(() => controller.abort(), timeoutMs);
6487
6494
  try {
6488
- const headers = target.kind !== "preview" ? {
6495
+ const headers2 = target.kind !== "preview" ? {
6489
6496
  ...accessToken ? { Authorization: `Bearer ${accessToken}` } : {},
6490
6497
  ...workspaceKey ? { "X-Workspace-Key": workspaceKey } : {}
6491
6498
  } : void 0;
6492
6499
  const response = await fetcher(target.url, {
6493
- ...headers ? { headers } : {},
6500
+ ...headers2 ? { headers: headers2 } : {},
6494
6501
  method: "GET",
6495
6502
  signal: controller.signal
6496
6503
  });
@@ -7522,11 +7529,64 @@ async function deleteTenantMeta(http, path24) {
7522
7529
  return resp.data?.data ?? resp.data;
7523
7530
  }
7524
7531
 
7532
+ // src/meta/column-slots.ts
7533
+ var WORKSPACE_KEY_HEADER = "X-Workspace-Key";
7534
+ var COLUMN_SLOTS_PATH = "/api/tenant-extension/column-slots";
7535
+ var COLUMN_SLOT_SQL_PATH = "/api/tenant-extension/column-slots/sql";
7536
+ var COLUMN_SLOT_SQL_KEYS = [
7537
+ "countSlot",
7538
+ "flexToSlot",
7539
+ "verifyFlexToSlot",
7540
+ "slotToFlex",
7541
+ "removeFlexKey",
7542
+ "clearSlot",
7543
+ "moveFromSlot",
7544
+ "verifyMoveFromSlot",
7545
+ "clearFromSlot"
7546
+ ];
7547
+ var COLUMN_SLOT_REBIND_SQL_KEYS = ["moveFromSlot", "verifyMoveFromSlot", "clearFromSlot"];
7548
+ function headers(opts) {
7549
+ return opts.workspaceKey ? { [WORKSPACE_KEY_HEADER]: opts.workspaceKey } : void 0;
7550
+ }
7551
+ function isRecord2(value) {
7552
+ return typeof value === "object" && value !== null && !Array.isArray(value);
7553
+ }
7554
+ function unexpected(path24, body) {
7555
+ return new CliError({
7556
+ code: "PROTOCOL_UNSUPPORTED" /* PROTOCOL_UNSUPPORTED */,
7557
+ message: `${path24} \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`,
7558
+ context: {
7559
+ reasonCode: "COLUMN_SLOT_RESPONSE_UNRECOGNIZED",
7560
+ details: body,
7561
+ 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"
7562
+ }
7563
+ });
7564
+ }
7565
+ async function getColumnSlots(http, model, opts = {}) {
7566
+ const resp = await http.get(COLUMN_SLOTS_PATH, { params: { model }, headers: headers(opts) });
7567
+ const data = resp.data?.data;
7568
+ if (!isRecord2(data) || !Array.isArray(data.slots) || !Array.isArray(data.occupied)) {
7569
+ throw unexpected(COLUMN_SLOTS_PATH, resp.data);
7570
+ }
7571
+ return data;
7572
+ }
7573
+ async function getColumnSlotSql(http, params, opts = {}) {
7574
+ const query2 = { model: params.model, field: params.field };
7575
+ if (params.slot) query2.slot = params.slot;
7576
+ if (params.fromSlot) query2.fromSlot = params.fromSlot;
7577
+ const resp = await http.get(COLUMN_SLOT_SQL_PATH, { params: query2, headers: headers(opts) });
7578
+ const data = resp.data?.data;
7579
+ if (!isRecord2(data) || !isRecord2(data.sql)) {
7580
+ throw unexpected(COLUMN_SLOT_SQL_PATH, resp.data);
7581
+ }
7582
+ return data;
7583
+ }
7584
+
7525
7585
  // src/meta/validate-meta.ts
7526
7586
  import yaml9 from "js-yaml";
7527
7587
 
7528
7588
  // src/meta/generated/meta-schemas.ts
7529
- var META_SCHEMA_SOURCE_COMMIT = "854122924e6f279a1cad32a98cd5b15ec0167160";
7589
+ var META_SCHEMA_SOURCE_COMMIT = "6b872a5b3749147cd4fed9dd1a1598e5876c8c76";
7530
7590
  var META_SCHEMAS = {
7531
7591
  list: {
7532
7592
  "$schema": "https://json-schema.org/draft/2020-12/schema",
@@ -7993,6 +8053,33 @@ var META_SCHEMAS = {
7993
8053
  "Map(String,String)": {
7994
8054
  "type": "object"
7995
8055
  },
8056
+ "DefaultSortItem": {
8057
+ "type": "object",
8058
+ "properties": {
8059
+ "field": {
8060
+ "type": "string",
8061
+ "minLength": 1
8062
+ },
8063
+ "order": {
8064
+ "type": "string",
8065
+ "pattern": "^([aA][sS][cC]|[dD][eE][sS][cC])$"
8066
+ },
8067
+ "nulls": {
8068
+ "type": "string",
8069
+ "enum": ["FIRST", "LAST"]
8070
+ },
8071
+ "key": {
8072
+ "type": "string"
8073
+ },
8074
+ "__remove": {
8075
+ "type": "boolean"
8076
+ },
8077
+ "__replace": {
8078
+ "type": "boolean"
8079
+ }
8080
+ },
8081
+ "additionalProperties": false
8082
+ },
7996
8083
  "MobileCardSlot": {
7997
8084
  "oneOf": [{
7998
8085
  "type": "string",
@@ -8374,6 +8461,10 @@ var META_SCHEMAS = {
8374
8461
  "type": "string",
8375
8462
  "enum": ["qrcode"],
8376
8463
  "description": "qrcode\uFF1A\u503C\u662F\u94FE\u63A5\u65F6\u540C\u65F6\u753B\u4E8C\u7EF4\u7801\uFF08ADR-413 \u7AEF\u81EA\u68C0\u5165\u53E3\u9996\u7528\uFF09\u3002"
8464
+ },
8465
+ "copyable": {
8466
+ "type": "boolean",
8467
+ "description": "true\uFF1A\u503C\u5355\u72EC\u6210\u5757\uFF08\u7B49\u5BBD\u5B57\u4F53\uFF09\uFF0C\u65C1\u8FB9\u7ED9\u300C\u590D\u5236\u300D\uFF0C\u590D\u5236\u7684\u662F\u503C\u672C\u8EAB\u3001\u4E0D\u542B\u6807\u7B7E\uFF1B\u7F3A\u7701 false\uFF0C\u6E32\u67D3\u4E0D\u53D8\uFF08#5296 \u5D4C\u5165\u5E94\u7528\u7B7E\u540D\u5BC6\u94A5\u9996\u7528\uFF09\u3002"
8377
8468
  }
8378
8469
  },
8379
8470
  "required": ["key", "label"]
@@ -8857,10 +8948,10 @@ var META_SCHEMAS = {
8857
8948
  "additionalProperties": false
8858
8949
  },
8859
8950
  "defaultSort": {
8860
- "description": "\u9ED8\u8BA4\u6392\u5E8F;\u5F62\u5982 [{field:'name',order:'asc'},...]\u3002\u5220\u9664\u8BF7\u7528 {__remove:true}",
8951
+ "description": "\u9ED8\u8BA4\u6392\u5E8F;\u5F62\u5982 [{field:'name',order:'asc',nulls:'LAST'},...]\uFF0Cnulls \u53EF\u9009 FIRST/LAST\uFF0C\u7F3A\u7701\u4FDD\u7559\u65E2\u6709\u987A\u5E8F\u3002\u5220\u9664\u8BF7\u7528 {__remove:true}",
8861
8952
  "type": "array",
8862
8953
  "items": {
8863
- "$ref": "#/$defs/Map(String,String)"
8954
+ "$ref": "#/$defs/DefaultSortItem"
8864
8955
  }
8865
8956
  },
8866
8957
  "description": {
@@ -11066,6 +11157,13 @@ var META_SCHEMAS = {
11066
11157
  "items": {
11067
11158
  "type": "object",
11068
11159
  "properties": {
11160
+ "channels": {
11161
+ "type": "array",
11162
+ "items": {
11163
+ "type": "string",
11164
+ "enum": ["INTERACTIVE", "AI", "FLOW"]
11165
+ }
11166
+ },
11069
11167
  "confirm": {
11070
11168
  "type": "string",
11071
11169
  "enum": ["DEFAULT", "REQUIRED", "SKIP"]
@@ -15178,21 +15276,21 @@ async function runBatch(items, request) {
15178
15276
  }));
15179
15277
  return Object.fromEntries(pairs);
15180
15278
  }
15181
- function toOutcome(status, data, headers) {
15279
+ function toOutcome(status, data, headers2) {
15182
15280
  const cls = classifyStatus(status);
15183
- if (status === 204) return { status, body: null, error: "ok", headers };
15281
+ if (status === 204) return { status, body: null, error: "ok", headers: headers2 };
15184
15282
  const empty = data === void 0 || data === null || typeof data === "string" && data.trim() === "";
15185
15283
  if (empty) {
15186
- return { status, body: null, error: cls === "ok" ? "bad-response" : cls, headers };
15284
+ return { status, body: null, error: cls === "ok" ? "bad-response" : cls, headers: headers2 };
15187
15285
  }
15188
15286
  if (typeof data === "string") {
15189
15287
  try {
15190
- return { status, body: JSON.parse(data), error: cls, headers };
15288
+ return { status, body: JSON.parse(data), error: cls, headers: headers2 };
15191
15289
  } catch {
15192
- return { status, body: null, error: cls === "ok" ? "bad-response" : cls, headers };
15290
+ return { status, body: null, error: cls === "ok" ? "bad-response" : cls, headers: headers2 };
15193
15291
  }
15194
15292
  }
15195
- return { status, body: data, error: cls, headers };
15293
+ return { status, body: data, error: cls, headers: headers2 };
15196
15294
  }
15197
15295
  function httpProbe(http, capabilities) {
15198
15296
  async function once(fn) {
@@ -15207,18 +15305,18 @@ function httpProbe(http, capabilities) {
15207
15305
  return { status: -1, body: null, error: local ? "bad-response" : "network", headers: {}, ...detail ? { detail } : {} };
15208
15306
  }
15209
15307
  }
15210
- const headers = { [CAPABILITIES_HEADER]: capabilities };
15308
+ const headers2 = { [CAPABILITIES_HEADER]: capabilities };
15211
15309
  const probe = {
15212
15310
  capabilities,
15213
15311
  get(path24, params) {
15214
15312
  return once(
15215
- () => http.get(buildUrl(path24, params), { headers, validateStatus: () => true })
15313
+ () => http.get(buildUrl(path24, params), { headers: headers2, validateStatus: () => true })
15216
15314
  );
15217
15315
  },
15218
15316
  post(path24, body) {
15219
15317
  return once(
15220
15318
  () => http.post(path24, body, {
15221
- headers: { ...headers, "content-type": "application/json" },
15319
+ headers: { ...headers2, "content-type": "application/json" },
15222
15320
  validateStatus: () => true
15223
15321
  })
15224
15322
  );
@@ -15530,7 +15628,7 @@ function actionsPath(modelKey, state = "") {
15530
15628
  if (!state) return base;
15531
15629
  return `${base}?${new URLSearchParams({ state }).toString()}`;
15532
15630
  }
15533
- function isRecord2(v) {
15631
+ function isRecord3(v) {
15534
15632
  return Boolean(v) && typeof v === "object" && !Array.isArray(v);
15535
15633
  }
15536
15634
  function keyOrNull(key) {
@@ -15572,7 +15670,7 @@ async function collectActionGates(probe, modelKeys2, state = "") {
15572
15670
  continue;
15573
15671
  }
15574
15672
  const body = out.body;
15575
- if (!isRecord2(body) || !Array.isArray(body.actions)) {
15673
+ if (!isRecord3(body) || !Array.isArray(body.actions)) {
15576
15674
  unavailable.push({
15577
15675
  modelKey: model,
15578
15676
  status: out.status,
@@ -15588,13 +15686,13 @@ async function collectActionGates(probe, modelKeys2, state = "") {
15588
15686
  else statesEchoed.add(echoed);
15589
15687
  for (const action3 of body.actions) {
15590
15688
  actionsSeen += 1;
15591
- if (!isRecord2(action3)) {
15689
+ if (!isRecord3(action3)) {
15592
15690
  reject(rejected, model, null, "malformed-action");
15593
15691
  continue;
15594
15692
  }
15595
15693
  const cands = Array.isArray(action3.candidates) ? action3.candidates : [];
15596
15694
  for (const c of cands) {
15597
- if (isRecord2(c) && typeof c.source === "string" && c.source) sources.add(c.source);
15695
+ if (isRecord3(c) && typeof c.source === "string" && c.source) sources.add(c.source);
15598
15696
  }
15599
15697
  const effectClass = classifyEffect(action3.effect);
15600
15698
  if (effectClass !== "absent") actionsWithEffect += 1;
@@ -15638,7 +15736,7 @@ async function collectActionGates(probe, modelKeys2, state = "") {
15638
15736
  reject(rejected, model, key, "no-candidates");
15639
15737
  continue;
15640
15738
  }
15641
- if (!cands.every((c) => isRecord2(c))) {
15739
+ if (!cands.every((c) => isRecord3(c))) {
15642
15740
  reject(rejected, model, key, "malformed-candidate");
15643
15741
  continue;
15644
15742
  }
@@ -15961,7 +16059,7 @@ var badSection = (t) => `\u4F20\u5165\u7684 mutation \u6BB5\u4E0D\u662F\u5BF9\u8
15961
16059
  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`;
15962
16060
  var missingCell = (op) => `\u4F20\u5165\u7684 mutation \u91CC\u6CA1\u6709 ${op} \u8FD9\u4E00\u9879`;
15963
16061
  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';
15964
- function isRecord3(v) {
16062
+ function isRecord4(v) {
15965
16063
  return Boolean(v) && typeof v === "object" && !Array.isArray(v);
15966
16064
  }
15967
16065
  function typeName2(v) {
@@ -15986,7 +16084,7 @@ async function collectMutation(probe, modelKeys2) {
15986
16084
  continue;
15987
16085
  }
15988
16086
  const body = out.error === "ok" ? out.body : null;
15989
- if (!isRecord3(body)) {
16087
+ if (!isRecord4(body)) {
15990
16088
  const reason = `\u672A\u5E94\u7B54\uFF08HTTP ${out.status} / ${out.error}\uFF09`;
15991
16089
  problems.push(`${key}: mutation-capability ${reason}`);
15992
16090
  mutation[key] = Object.fromEntries(MUTATION_OPS.map((op) => [op, { allowed: "unknown", reason }]));
@@ -15995,7 +16093,7 @@ async function collectMutation(probe, modelKeys2) {
15995
16093
  const entry = {};
15996
16094
  for (const op of MUTATION_OPS) {
15997
16095
  const cell = body[op];
15998
- if (!isRecord3(cell) || !("allowed" in cell)) {
16096
+ if (!isRecord4(cell) || !("allowed" in cell)) {
15999
16097
  entry[op] = { allowed: "unknown", reason: `\u54CD\u5E94\u91CC\u6CA1\u6709 ${op} \u8FD9\u4E00\u9879` };
16000
16098
  problems.push(`${key}: mutation-capability \u54CD\u5E94\u7F3A ${op}`);
16001
16099
  continue;
@@ -16016,14 +16114,14 @@ function mutationSection(entry) {
16016
16114
  if (entry === void 0 || entry === null) {
16017
16115
  return Object.fromEntries(MUTATION_OPS.map((op) => [op, { allowed: "unknown", reason: NOT_QUERIED }]));
16018
16116
  }
16019
- if (!isRecord3(entry)) {
16117
+ if (!isRecord4(entry)) {
16020
16118
  const reason = badSection(typeName2(entry));
16021
16119
  return Object.fromEntries(MUTATION_OPS.map((op) => [op, { allowed: "unknown", reason }]));
16022
16120
  }
16023
16121
  const section = {};
16024
16122
  for (const op of MUTATION_OPS) {
16025
16123
  const cell = entry[op];
16026
- if (isRecord3(cell)) {
16124
+ if (isRecord4(cell)) {
16027
16125
  section[op] = cell;
16028
16126
  } else if (op in entry) {
16029
16127
  section[op] = { allowed: "unknown", reason: badCell(op, typeName2(cell)) };
@@ -16036,7 +16134,7 @@ function mutationSection(entry) {
16036
16134
  function writability(field) {
16037
16135
  const derived = field.derived;
16038
16136
  if (derived) {
16039
- const kind = isRecord3(derived) ? derived.kind : null;
16137
+ const kind = isRecord4(derived) ? derived.kind : null;
16040
16138
  return { writable: false, reason: `derived:${typeof kind === "string" && kind ? kind : "unknown"}` };
16041
16139
  }
16042
16140
  if (field.isReadonly) return { writable: false, reason: "readonly" };
@@ -16051,7 +16149,7 @@ function buildMapping(metas, edges, mutation, codeTables = []) {
16051
16149
  const { fields, problem: problem6 } = metaFields(metas[modelKey]);
16052
16150
  const rows = [];
16053
16151
  for (const f of fields) {
16054
- if (!isRecord3(f)) continue;
16152
+ if (!isRecord4(f)) continue;
16055
16153
  const key = f.key;
16056
16154
  if (typeof key !== "string" || !key) continue;
16057
16155
  const { writable, reason } = writability(f);
@@ -16094,7 +16192,7 @@ function buildMapping(metas, edges, mutation, codeTables = []) {
16094
16192
  // 「爬过且这个模型确实没有字段」必须与「没爬过」(文件不存在)区分开。
16095
16193
  crawled: true,
16096
16194
  wording: WORDING3,
16097
- mutation: mutationSection(isRecord3(mutation) ? mutation[modelKey] : mutation),
16195
+ mutation: mutationSection(isRecord4(mutation) ? mutation[modelKey] : mutation),
16098
16196
  fieldCount: rows.length,
16099
16197
  // 🔴 `null` = 载荷判读正常(fieldCount=0 就是「这个模型确实没字段」);
16100
16198
  // 非 null = **爬过、但判不出字段**,此时 fieldCount=0 不代表「没字段」。
@@ -16106,8 +16204,8 @@ function buildMapping(metas, edges, mutation, codeTables = []) {
16106
16204
  }
16107
16205
  function allowedIn(sheet, op) {
16108
16206
  const section = sheet.mutation;
16109
- const cell = isRecord3(section) ? section[op] : void 0;
16110
- return isRecord3(cell) ? cell.allowed : "unknown";
16207
+ const cell = isRecord4(section) ? section[op] : void 0;
16208
+ return isRecord4(cell) ? cell.allowed : "unknown";
16111
16209
  }
16112
16210
  var PATH_SEPARATORS = ["/", String.fromCharCode(92)];
16113
16211
  function unsafeKeyReason(modelKey) {
@@ -16289,7 +16387,7 @@ function writeModelsMd(layout, text3) {
16289
16387
  // src/fde/recon/pointer-audit.ts
16290
16388
  import { existsSync as existsSync4 } from "fs";
16291
16389
  import * as path9 from "path";
16292
- function isRecord4(v) {
16390
+ function isRecord5(v) {
16293
16391
  return Boolean(v) && typeof v === "object" && !Array.isArray(v);
16294
16392
  }
16295
16393
  function auditValueDomainPointers(layout, sheets) {
@@ -16298,7 +16396,7 @@ function auditValueDomainPointers(layout, sheets) {
16298
16396
  for (const sheet of sheets) {
16299
16397
  for (const field of sheet.fields) {
16300
16398
  const ref = field.ref;
16301
- const pointer = isRecord4(ref) ? ref.valueDomain : null;
16399
+ const pointer = isRecord5(ref) ? ref.valueDomain : null;
16302
16400
  if (typeof pointer !== "string" || pointer === "") continue;
16303
16401
  if (!seen.has(pointer)) {
16304
16402
  seen.set(pointer, existsSync4(path9.join(layout.dir, pointer)));
@@ -16389,18 +16487,18 @@ var WORDING4 = "rows = \u672C\u8F6E\u4EE5\u5F53\u524D\u767B\u5F55\u8EAB\u4EFD\u8
16389
16487
  function listPath(modelKey) {
16390
16488
  return `/api/models/${modelKey}/list/dsl`;
16391
16489
  }
16392
- function isRecord5(v) {
16490
+ function isRecord6(v) {
16393
16491
  return Boolean(v) && typeof v === "object" && !Array.isArray(v);
16394
16492
  }
16395
16493
  function readContent(body) {
16396
- if (!isRecord5(body)) return { rows: null, total: null, nonDict: 0 };
16494
+ if (!isRecord6(body)) return { rows: null, total: null, nonDict: 0 };
16397
16495
  const rows = body.content;
16398
16496
  const total = body.totalElements;
16399
16497
  if (!Array.isArray(rows)) return { rows: null, total: null, nonDict: 0 };
16400
16498
  if (typeof total !== "number" || !Number.isInteger(total) || total < 0) {
16401
16499
  return { rows: null, total: null, nonDict: 0 };
16402
16500
  }
16403
- const kept = rows.filter((r) => isRecord5(r));
16501
+ const kept = rows.filter((r) => isRecord6(r));
16404
16502
  return { rows: kept, total, nonDict: rows.length - kept.length };
16405
16503
  }
16406
16504
  async function collectCodeTables(probe, modelEntries2, opts = {}) {
@@ -16413,7 +16511,7 @@ async function collectCodeTables(probe, modelEntries2, opts = {}) {
16413
16511
  const problems = [];
16414
16512
  const keys = [];
16415
16513
  for (const entry of modelEntries2) {
16416
- if (!isRecord5(entry) || entry.type !== DYNAMIC_TYPE) continue;
16514
+ if (!isRecord6(entry) || entry.type !== DYNAMIC_TYPE) continue;
16417
16515
  const key = entry.modelKey;
16418
16516
  if (typeof key !== "string" || !key) {
16419
16517
  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`);
@@ -16547,12 +16645,12 @@ function collectEnumDomains(metas) {
16547
16645
  for (const modelKey of Object.keys(metas).sort()) {
16548
16646
  const { fields } = metaFields(metas[modelKey]);
16549
16647
  for (const field of fields) {
16550
- if (!isRecord5(field)) continue;
16648
+ if (!isRecord6(field)) continue;
16551
16649
  const fieldKey = field.key;
16552
16650
  if (typeof fieldKey !== "string" || !fieldKey) continue;
16553
16651
  const enums = field.enums;
16554
16652
  if (!Array.isArray(enums) || enums.length === 0) continue;
16555
- const kept = enums.filter(isRecord5).map((e) => ({ ...e }));
16653
+ const kept = enums.filter(isRecord6).map((e) => ({ ...e }));
16556
16654
  rows.push({
16557
16655
  model: modelKey,
16558
16656
  field: fieldKey,
@@ -16563,7 +16661,7 @@ function collectEnumDomains(metas) {
16563
16661
  // —— 否则「这个字段的枚举少了一项」这件事没有任何出处。
16564
16662
  // 实测 3179 条全是对象,这一档从未观测到;**恒发空列表**而不是条件出键:
16565
16663
  // 「有这一列且为空」与「没这一列」是两个值,后者读起来像「没检查过」。
16566
- nonDictElements: enums.filter((e) => !isRecord5(e)).map((e) => JSON.stringify(e) ?? String(e))
16664
+ nonDictElements: enums.filter((e) => !isRecord6(e)).map((e) => JSON.stringify(e) ?? String(e))
16567
16665
  });
16568
16666
  }
16569
16667
  }
@@ -16608,7 +16706,7 @@ function writeValuedomain(layout, codeTables, enums, opts = {}) {
16608
16706
  roundId: opts.roundId ?? null,
16609
16707
  // 🔴 `identity || {}` 会把「调用方没传身份」和「身份是空的」压成同一个值,
16610
16708
  // 而它们的下一步不同(前者去补工具的登录,后者去问服务端为什么不给 user)。
16611
- identity: isRecord5(opts.identity) ? opts.identity : null,
16709
+ identity: isRecord6(opts.identity) ? opts.identity : null,
16612
16710
  codeTableCount: Object.keys(codeTables).length,
16613
16711
  enumFieldCount: enums.length,
16614
16712
  // 🔴 名册里一共看到几条。上游名册加载失败给出空数组时,产物会与
@@ -16678,7 +16776,7 @@ function parseRoundStamp(stamp2) {
16678
16776
  function newRoundId(started) {
16679
16777
  return `${roundStamp(started)}-${randomBytes3(4).toString("hex")}`;
16680
16778
  }
16681
- function isRecord6(v) {
16779
+ function isRecord7(v) {
16682
16780
  return Boolean(v) && typeof v === "object" && !Array.isArray(v);
16683
16781
  }
16684
16782
  function readJsonSoft(file) {
@@ -16697,8 +16795,8 @@ function readJsonSoft(file) {
16697
16795
  }
16698
16796
  function readCrawledAt(layout) {
16699
16797
  const body = readJsonSoft(path10.join(layout.dir, KIT_CRAWLED_AT_FILE));
16700
- const models = isRecord6(body) ? body.models : null;
16701
- return isRecord6(models) ? models : {};
16798
+ const models = isRecord7(body) ? body.models : null;
16799
+ return isRecord7(models) ? models : {};
16702
16800
  }
16703
16801
  function writeCrawledAt(layout, freshKeys, carriedKeys, roundId, started) {
16704
16802
  const previous = readCrawledAt(layout);
@@ -16746,14 +16844,14 @@ function productRoundId(root, rel) {
16746
16844
  const p = path10.join(root, rel);
16747
16845
  if (!existsSync5(p)) return ["missing", null];
16748
16846
  const body = readJsonSoft(p);
16749
- if (body === void 0 || !isRecord6(body)) return ["unreadable", null];
16847
+ if (body === void 0 || !isRecord7(body)) return ["unreadable", null];
16750
16848
  const rid = body.roundId;
16751
16849
  if (typeof rid !== "string" || !rid) return ["unstamped", null];
16752
16850
  return ["stamped", rid];
16753
16851
  }
16754
16852
  function inspectRound(root) {
16755
16853
  const raw = readJsonSoft(path10.join(root, KIT_CRAWLED_AT_FILE));
16756
- const ledger = isRecord6(raw) ? raw : {};
16854
+ const ledger = isRecord7(raw) ? raw : {};
16757
16855
  const rid = ledger.roundId;
16758
16856
  const roundId = typeof rid === "string" && rid ? rid : null;
16759
16857
  const rawWritten = ledger.productsWrittenThisRound;
@@ -16858,7 +16956,7 @@ function renderRound(result) {
16858
16956
  }
16859
16957
  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";
16860
16958
  function carriedGatesSchemaProblem(oldGates) {
16861
- if (!isRecord6(oldGates)) {
16959
+ if (!isRecord7(oldGates)) {
16862
16960
  const shape = Array.isArray(oldGates) ? "list" : oldGates === null ? "null" : typeof oldGates;
16863
16961
  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}`;
16864
16962
  }
@@ -16899,7 +16997,7 @@ function collectCarryOver(layout, freshMetas) {
16899
16997
  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`);
16900
16998
  continue;
16901
16999
  }
16902
- if (isRecord6(body)) carriedMetas[key] = body;
17000
+ if (isRecord7(body)) carriedMetas[key] = body;
16903
17001
  else {
16904
17002
  problems.push(
16905
17003
  `${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`
@@ -16914,9 +17012,9 @@ function collectCarryOver(layout, freshMetas) {
16914
17012
  const stale = carriedGatesSchemaProblem(oldGates);
16915
17013
  if (stale) problems.push(stale);
16916
17014
  }
16917
- const oldList = isRecord6(oldGates) && Array.isArray(oldGates.gates) ? oldGates.gates : [];
17015
+ const oldList = isRecord7(oldGates) && Array.isArray(oldGates.gates) ? oldGates.gates : [];
16918
17016
  for (const g of oldList) {
16919
- if (isRecord6(g) && !(String(g.model) in freshMetas)) carriedGates.push(g);
17017
+ if (isRecord7(g) && !(String(g.model) in freshMetas)) carriedGates.push(g);
16920
17018
  }
16921
17019
  return { carriedMetas, carriedGates, problems };
16922
17020
  }
@@ -17040,7 +17138,7 @@ async function runRecon(probe, layout, opts = {}) {
17040
17138
  products.push(...mappingPaths.map((p) => relOf(layout, p)));
17041
17139
  const sheetsWritten = Math.max(mappingPaths.length - 1, 0);
17042
17140
  let previous = readJsonSoft(path10.join(layout.dir, "fingerprint.json"));
17043
- if (!isRecord6(previous)) previous = null;
17141
+ if (!isRecord7(previous)) previous = null;
17044
17142
  const current = await computeFingerprint(probe);
17045
17143
  products.push(relOf(layout, layout.writeJson("fingerprint.json", current)));
17046
17144
  const drift = previous === null ? null : compareFingerprint(previous, current);
@@ -18905,7 +19003,7 @@ function stamp(note, model, file) {
18905
19003
  async function scanSources(mapping, baseDir, options = {}) {
18906
19004
  const read = options.readTableImpl ?? readTable;
18907
19005
  const base = baseDir ?? path14.dirname(mapping.path);
18908
- const headers = /* @__PURE__ */ new Map();
19006
+ const headers2 = /* @__PURE__ */ new Map();
18909
19007
  const rows = /* @__PURE__ */ new Map();
18910
19008
  const notes = [];
18911
19009
  const problems = [];
@@ -18948,12 +19046,12 @@ async function scanSources(mapping, baseDir, options = {}) {
18948
19046
  for (const note of rawNotes) notes.push(stamp(note, mm.model, file));
18949
19047
  if (result === null) continue;
18950
19048
  takenBy.set(mm.model, mm.source.file);
18951
- headers.set(mm.model, result.header);
19049
+ headers2.set(mm.model, result.header);
18952
19050
  rows.set(mm.model, result.rows);
18953
19051
  }
18954
- return { headers, rows, notes, problems };
19052
+ return { headers: headers2, rows, notes, problems };
18955
19053
  }
18956
- function validateMapping(mapping, headers) {
19054
+ function validateMapping(mapping, headers2) {
18957
19055
  const declaredKeys = /* @__PURE__ */ new Map();
18958
19056
  for (const mm of mapping.models) {
18959
19057
  const fields = mm.businessKey ? [...mm.businessKey.fields] : [];
@@ -18989,16 +19087,16 @@ function validateMapping(mapping, headers) {
18989
19087
  );
18990
19088
  }
18991
19089
  mapping.models.forEach((mm, index) => {
18992
- problems.push(...validateModel(mm, headers, duplicated.has(mm.model), index, declaredKeys));
19090
+ problems.push(...validateModel(mm, headers2, duplicated.has(mm.model), index, declaredKeys));
18993
19091
  });
18994
19092
  return problems;
18995
19093
  }
18996
- function validateModel(mm, headers, duplicated, index, declaredKeys) {
19094
+ function validateModel(mm, headers2, duplicated, index, declaredKeys) {
18997
19095
  const out = [];
18998
19096
  out.push(...checkOnExisting(mm));
18999
19097
  out.push(...checkSourceRef(mm));
19000
19098
  const keyState = checkBusinessKey(mm, out);
19001
- const header = headers.get(mm.model);
19099
+ const header = headers2.get(mm.model);
19002
19100
  const headerUsable = header !== void 0 && header.length > 0;
19003
19101
  if (!headerUsable) {
19004
19102
  out.push(
@@ -26637,6 +26735,8 @@ export {
26637
26735
  CODE_UNBIND_READBACK_UNREADABLE,
26638
26736
  CODE_UNBIND_REFUSED,
26639
26737
  CODE_WORDS,
26738
+ COLUMN_SLOT_REBIND_SQL_KEYS,
26739
+ COLUMN_SLOT_SQL_KEYS,
26640
26740
  CONTROL_BUFFER_LIMIT,
26641
26741
  CREDENTIAL_STORE_MODES,
26642
26742
  CliError,
@@ -26812,6 +26912,7 @@ export {
26812
26912
  WAIVER_REPLAY,
26813
26913
  WARNED_ROUND_STATES,
26814
26914
  WORKSPACES_PATH,
26915
+ WORKSPACE_KEY_HEADER,
26815
26916
  WORK_DIRNAME,
26816
26917
  WRITE_RECOVERY_WORDS,
26817
26918
  WorkLayout,
@@ -26925,6 +27026,8 @@ export {
26925
27026
  formatRows,
26926
27027
  fromAxiosError,
26927
27028
  getCacheStats,
27029
+ getColumnSlotSql,
27030
+ getColumnSlots,
26928
27031
  getMiniStatus,
26929
27032
  getScriptTask,
26930
27033
  getSettingDomain,