vps-work 2.5.1 → 2.7.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.
Files changed (125) hide show
  1. package/.well-known/skills/index.json +14 -4
  2. package/README.md +1 -0
  3. package/USAGE.md +22 -0
  4. package/dist/vps-work.cjs +824 -546
  5. package/package.json +1 -1
  6. package/skills/vps-documents/references/api.md +4 -0
  7. package/skills/vps-okr/SKILL.md +12 -2
  8. package/skills/vps-okr-management-assistant/SKILL.md +2 -0
  9. package/skills/vps-store-management/references/store-reception.md +14 -2
  10. package/dist/packages/vps-work/src/bin/vps-work.js +0 -271
  11. package/dist/packages/vps-work/src/commands/agent/index.js +0 -264
  12. package/dist/packages/vps-work/src/commands/approval/index.js +0 -7
  13. package/dist/packages/vps-work/src/commands/approval/shortcuts.js +0 -259
  14. package/dist/packages/vps-work/src/commands/attendance/applications.js +0 -21
  15. package/dist/packages/vps-work/src/commands/attendance/index.js +0 -9
  16. package/dist/packages/vps-work/src/commands/attendance/scheduling.js +0 -183
  17. package/dist/packages/vps-work/src/commands/attendance/shortcuts.js +0 -131
  18. package/dist/packages/vps-work/src/commands/auth/check.js +0 -34
  19. package/dist/packages/vps-work/src/commands/auth/index.js +0 -21
  20. package/dist/packages/vps-work/src/commands/auth/list.js +0 -50
  21. package/dist/packages/vps-work/src/commands/auth/scopes.js +0 -17
  22. package/dist/packages/vps-work/src/commands/auth/status.js +0 -127
  23. package/dist/packages/vps-work/src/commands/auth/tenants.js +0 -35
  24. package/dist/packages/vps-work/src/commands/auth/use.js +0 -40
  25. package/dist/packages/vps-work/src/commands/calendar/index.js +0 -7
  26. package/dist/packages/vps-work/src/commands/calendar/shortcuts.js +0 -598
  27. package/dist/packages/vps-work/src/commands/catalog.js +0 -29
  28. package/dist/packages/vps-work/src/commands/cli-install.js +0 -70
  29. package/dist/packages/vps-work/src/commands/collab-invoke.js +0 -19
  30. package/dist/packages/vps-work/src/commands/corporate/index.js +0 -204
  31. package/dist/packages/vps-work/src/commands/creative/index.js +0 -369
  32. package/dist/packages/vps-work/src/commands/documents/index.js +0 -991
  33. package/dist/packages/vps-work/src/commands/drive/index.js +0 -435
  34. package/dist/packages/vps-work/src/commands/exec.js +0 -46
  35. package/dist/packages/vps-work/src/commands/hr/business.js +0 -22
  36. package/dist/packages/vps-work/src/commands/hr/data-view-shortcuts.js +0 -519
  37. package/dist/packages/vps-work/src/commands/hr/index.js +0 -15
  38. package/dist/packages/vps-work/src/commands/hr/job-responsibilities.js +0 -266
  39. package/dist/packages/vps-work/src/commands/hr/payslip.js +0 -45
  40. package/dist/packages/vps-work/src/commands/hr/shortcuts.js +0 -146
  41. package/dist/packages/vps-work/src/commands/im/im-message-payload.js +0 -150
  42. package/dist/packages/vps-work/src/commands/im/index.js +0 -7
  43. package/dist/packages/vps-work/src/commands/im/shortcuts.js +0 -856
  44. package/dist/packages/vps-work/src/commands/knowledge/index.js +0 -36
  45. package/dist/packages/vps-work/src/commands/login.js +0 -52
  46. package/dist/packages/vps-work/src/commands/logout.js +0 -12
  47. package/dist/packages/vps-work/src/commands/mail/email.js +0 -132
  48. package/dist/packages/vps-work/src/commands/mail/index.js +0 -9
  49. package/dist/packages/vps-work/src/commands/mail/shortcuts.js +0 -43
  50. package/dist/packages/vps-work/src/commands/meeting/index.js +0 -7
  51. package/dist/packages/vps-work/src/commands/meeting/shortcuts.js +0 -120
  52. package/dist/packages/vps-work/src/commands/odoo-invoke.js +0 -21
  53. package/dist/packages/vps-work/src/commands/odoo-leaf-registry.js +0 -13
  54. package/dist/packages/vps-work/src/commands/office/index.js +0 -59
  55. package/dist/packages/vps-work/src/commands/okr/index.js +0 -7
  56. package/dist/packages/vps-work/src/commands/okr/shortcuts.js +0 -75
  57. package/dist/packages/vps-work/src/commands/org-structure.js +0 -347
  58. package/dist/packages/vps-work/src/commands/popup/index.js +0 -147
  59. package/dist/packages/vps-work/src/commands/product/abnormal-statistics.js +0 -250
  60. package/dist/packages/vps-work/src/commands/product/data-view-shortcuts.js +0 -253
  61. package/dist/packages/vps-work/src/commands/product/index.js +0 -11
  62. package/dist/packages/vps-work/src/commands/purchase/index.js +0 -45
  63. package/dist/packages/vps-work/src/commands/reauth.js +0 -127
  64. package/dist/packages/vps-work/src/commands/report/index.js +0 -7
  65. package/dist/packages/vps-work/src/commands/report/missing-daily-reports.js +0 -9
  66. package/dist/packages/vps-work/src/commands/report/shortcuts.js +0 -251
  67. package/dist/packages/vps-work/src/commands/sales/index.js +0 -11
  68. package/dist/packages/vps-work/src/commands/sales/period-params.js +0 -75
  69. package/dist/packages/vps-work/src/commands/sales/shortcuts-personnel.js +0 -124
  70. package/dist/packages/vps-work/src/commands/sales/shortcuts.js +0 -800
  71. package/dist/packages/vps-work/src/commands/shortcut-common.js +0 -88
  72. package/dist/packages/vps-work/src/commands/shortcut-params.js +0 -22
  73. package/dist/packages/vps-work/src/commands/skill/index.js +0 -136
  74. package/dist/packages/vps-work/src/commands/skill/personal.js +0 -167
  75. package/dist/packages/vps-work/src/commands/store/index.js +0 -82
  76. package/dist/packages/vps-work/src/commands/task/index.js +0 -7
  77. package/dist/packages/vps-work/src/commands/task/task-center.js +0 -595
  78. package/dist/packages/vps-work/src/commands/tools/index.js +0 -127
  79. package/dist/packages/vps-work/src/commands/vemory/index.js +0 -7
  80. package/dist/packages/vps-work/src/commands/vemory/shortcuts.js +0 -53
  81. package/dist/packages/vps-work/src/commands/vertu-aisales.js +0 -30
  82. package/dist/packages/vps-work/src/commands/vertu-erp.js +0 -30
  83. package/dist/packages/vps-work/src/core/aisales-mcp-client.js +0 -35
  84. package/dist/packages/vps-work/src/core/auth.js +0 -240
  85. package/dist/packages/vps-work/src/core/cli-bin.js +0 -11
  86. package/dist/packages/vps-work/src/core/cli-root-help.js +0 -190
  87. package/dist/packages/vps-work/src/core/client.js +0 -158
  88. package/dist/packages/vps-work/src/core/config.js +0 -183
  89. package/dist/packages/vps-work/src/core/corporate-client.js +0 -52
  90. package/dist/packages/vps-work/src/core/creative-attachment-download.js +0 -48
  91. package/dist/packages/vps-work/src/core/documents-client.js +0 -57
  92. package/dist/packages/vps-work/src/core/endpoints.js +0 -46
  93. package/dist/packages/vps-work/src/core/erp-mcp-client.js +0 -11
  94. package/dist/packages/vps-work/src/core/errors.js +0 -107
  95. package/dist/packages/vps-work/src/core/execute-catalog-client.js +0 -42
  96. package/dist/packages/vps-work/src/core/hermes-client.js +0 -70
  97. package/dist/packages/vps-work/src/core/im-attachment-download.js +0 -109
  98. package/dist/packages/vps-work/src/core/im-client.js +0 -64
  99. package/dist/packages/vps-work/src/core/keychain.js +0 -58
  100. package/dist/packages/vps-work/src/core/mail-client.js +0 -82
  101. package/dist/packages/vps-work/src/core/mcp-client.js +0 -129
  102. package/dist/packages/vps-work/src/core/office-client.js +0 -25
  103. package/dist/packages/vps-work/src/core/office-files.js +0 -82
  104. package/dist/packages/vps-work/src/core/paths.js +0 -70
  105. package/dist/packages/vps-work/src/core/public-result.js +0 -43
  106. package/dist/packages/vps-work/src/core/sales-invoice-attachments-client.js +0 -75
  107. package/dist/packages/vps-work/src/core/sales-query-client.js +0 -452
  108. package/dist/packages/vps-work/src/core/skill-catalog.js +0 -158
  109. package/dist/packages/vps-work/src/core/skill-key.js +0 -19
  110. package/dist/packages/vps-work/src/core/v-drive-store.js +0 -392
  111. package/dist/packages/vps-work/src/core/vertu-agent-env.js +0 -32
  112. package/dist/packages/vps-work/src/core/vps-auth-scopes.js +0 -73
  113. package/dist/packages/vps-work/src/core/vps-service-auth.js +0 -382
  114. package/dist/packages/vps-work/src/core/vps-service-config.js +0 -83
  115. package/dist/packages/vps-work/src/core/vps-service-http.js +0 -187
  116. package/dist/packages/vps-work/src/utils/at-file.js +0 -34
  117. package/dist/packages/vps-work/src/utils/cli-option-helpers.js +0 -52
  118. package/dist/packages/vps-work/src/utils/frontmatter.js +0 -26
  119. package/dist/packages/vps-work/src/utils/normalize-argv.js +0 -51
  120. package/dist/packages/vps-work/src/utils/parse-json-arg.js +0 -85
  121. package/dist/packages/vps-work/src/utils/prompt.js +0 -46
  122. package/dist/packages/vps-work/src/utils/read-text.js +0 -44
  123. package/dist/packages/vps-work/src/utils/schema-to-options.js +0 -307
  124. package/dist/packages/vps-work/src/utils/unwrap-envelope.js +0 -31
  125. package/dist/shared/im-org-tree/index.js +0 -200
package/dist/vps-work.cjs CHANGED
@@ -1154,7 +1154,7 @@ var require_command = __commonJS({
1154
1154
  "use strict";
1155
1155
  var EventEmitter = require("events").EventEmitter;
1156
1156
  var childProcess = require("child_process");
1157
- var path3 = require("path");
1157
+ var path4 = require("path");
1158
1158
  var fs = require("fs");
1159
1159
  var process4 = require("process");
1160
1160
  var { Argument: Argument2, humanReadableArgName } = require_argument();
@@ -2154,9 +2154,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
2154
2154
  let launchWithNode = false;
2155
2155
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
2156
2156
  function findFile(baseDir, baseName) {
2157
- const localBin = path3.resolve(baseDir, baseName);
2157
+ const localBin = path4.resolve(baseDir, baseName);
2158
2158
  if (fs.existsSync(localBin)) return localBin;
2159
- if (sourceExt.includes(path3.extname(baseName))) return void 0;
2159
+ if (sourceExt.includes(path4.extname(baseName))) return void 0;
2160
2160
  const foundExt = sourceExt.find(
2161
2161
  (ext) => fs.existsSync(`${localBin}${ext}`)
2162
2162
  );
@@ -2174,17 +2174,17 @@ Expecting one of '${allowedValues.join("', '")}'`);
2174
2174
  } catch {
2175
2175
  resolvedScriptPath = this._scriptPath;
2176
2176
  }
2177
- executableDir = path3.resolve(
2178
- path3.dirname(resolvedScriptPath),
2177
+ executableDir = path4.resolve(
2178
+ path4.dirname(resolvedScriptPath),
2179
2179
  executableDir
2180
2180
  );
2181
2181
  }
2182
2182
  if (executableDir) {
2183
2183
  let localFile = findFile(executableDir, executableFile);
2184
2184
  if (!localFile && !subcommand._executableFile && this._scriptPath) {
2185
- const legacyName = path3.basename(
2185
+ const legacyName = path4.basename(
2186
2186
  this._scriptPath,
2187
- path3.extname(this._scriptPath)
2187
+ path4.extname(this._scriptPath)
2188
2188
  );
2189
2189
  if (legacyName !== this._name) {
2190
2190
  localFile = findFile(
@@ -2195,7 +2195,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2195
2195
  }
2196
2196
  executableFile = localFile || executableFile;
2197
2197
  }
2198
- launchWithNode = sourceExt.includes(path3.extname(executableFile));
2198
+ launchWithNode = sourceExt.includes(path4.extname(executableFile));
2199
2199
  let proc;
2200
2200
  if (process4.platform !== "win32") {
2201
2201
  if (launchWithNode) {
@@ -3042,7 +3042,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
3042
3042
  * @return {Command}
3043
3043
  */
3044
3044
  nameFromFilename(filename) {
3045
- this._name = path3.basename(filename, path3.extname(filename));
3045
+ this._name = path4.basename(filename, path4.extname(filename));
3046
3046
  return this;
3047
3047
  }
3048
3048
  /**
@@ -3056,9 +3056,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
3056
3056
  * @param {string} [path]
3057
3057
  * @return {(string|null|Command)}
3058
3058
  */
3059
- executableDir(path4) {
3060
- if (path4 === void 0) return this._executableDir;
3061
- this._executableDir = path4;
3059
+ executableDir(path5) {
3060
+ if (path5 === void 0) return this._executableDir;
3061
+ this._executableDir = path5;
3062
3062
  return this;
3063
3063
  }
3064
3064
  /**
@@ -3075,9 +3075,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
3075
3075
  helpWidth: context.helpWidth,
3076
3076
  outputHasColors: context.hasColors
3077
3077
  });
3078
- const text3 = helper.formatHelp(this, helper);
3079
- if (context.hasColors) return text3;
3080
- return this._outputConfiguration.stripColor(text3);
3078
+ const text4 = helper.formatHelp(this, helper);
3079
+ if (context.hasColors) return text4;
3080
+ return this._outputConfiguration.stripColor(text4);
3081
3081
  }
3082
3082
  /**
3083
3083
  * @typedef HelpContext
@@ -3231,7 +3231,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
3231
3231
  * @param {(string | Function)} text - string to add, or a function returning a string
3232
3232
  * @return {Command} `this` command for chaining
3233
3233
  */
3234
- addHelpText(position, text3) {
3234
+ addHelpText(position, text4) {
3235
3235
  const allowedValues = ["beforeAll", "before", "after", "afterAll"];
3236
3236
  if (!allowedValues.includes(position)) {
3237
3237
  throw new Error(`Unexpected value for position to addHelpText.
@@ -3240,10 +3240,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
3240
3240
  const helpEvent = `${position}Help`;
3241
3241
  this.on(helpEvent, (context) => {
3242
3242
  let helpStr;
3243
- if (typeof text3 === "function") {
3244
- helpStr = text3({ error: context.error, command: context.command });
3243
+ if (typeof text4 === "function") {
3244
+ helpStr = text4({ error: context.error, command: context.command });
3245
3245
  } else {
3246
- helpStr = text3;
3246
+ helpStr = text4;
3247
3247
  }
3248
3248
  if (helpStr) {
3249
3249
  context.write(`${helpStr}
@@ -4375,16 +4375,16 @@ var require_util = __commonJS({
4375
4375
  function isStream(obj) {
4376
4376
  return obj && typeof obj === "object" && typeof obj.pipe === "function" && typeof obj.on === "function";
4377
4377
  }
4378
- function isBlobLike(object) {
4379
- if (object === null) {
4378
+ function isBlobLike(object2) {
4379
+ if (object2 === null) {
4380
4380
  return false;
4381
- } else if (object instanceof Blob) {
4381
+ } else if (object2 instanceof Blob) {
4382
4382
  return true;
4383
- } else if (typeof object !== "object") {
4383
+ } else if (typeof object2 !== "object") {
4384
4384
  return false;
4385
4385
  } else {
4386
- const sTag = object[Symbol.toStringTag];
4387
- return (sTag === "Blob" || sTag === "File") && ("stream" in object && typeof object.stream === "function" || "arrayBuffer" in object && typeof object.arrayBuffer === "function");
4386
+ const sTag = object2[Symbol.toStringTag];
4387
+ return (sTag === "Blob" || sTag === "File") && ("stream" in object2 && typeof object2.stream === "function" || "arrayBuffer" in object2 && typeof object2.arrayBuffer === "function");
4388
4388
  }
4389
4389
  }
4390
4390
  function pathHasQueryOrFragment(url) {
@@ -4439,14 +4439,14 @@ var require_util = __commonJS({
4439
4439
  }
4440
4440
  const port = url.port != null ? url.port : url.protocol === "https:" ? 443 : 80;
4441
4441
  let origin = url.origin != null ? url.origin : `${url.protocol || ""}//${url.hostname || ""}:${port}`;
4442
- let path3 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`;
4442
+ let path4 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`;
4443
4443
  if (origin[origin.length - 1] === "/") {
4444
4444
  origin = origin.slice(0, origin.length - 1);
4445
4445
  }
4446
- if (path3 && path3[0] !== "/") {
4447
- path3 = `/${path3}`;
4446
+ if (path4 && path4[0] !== "/") {
4447
+ path4 = `/${path4}`;
4448
4448
  }
4449
- return new URL(`${origin}${path3}`);
4449
+ return new URL(`${origin}${path4}`);
4450
4450
  }
4451
4451
  if (!isHttpOrHttpsPrefixed(url.origin || url.protocol)) {
4452
4452
  throw new InvalidArgumentError2("Invalid URL protocol: the URL must start with `http:` or `https:`.");
@@ -4674,8 +4674,8 @@ var require_util = __commonJS({
4674
4674
  }
4675
4675
  );
4676
4676
  }
4677
- function isFormDataLike(object) {
4678
- return object && typeof object === "object" && typeof object.append === "function" && typeof object.delete === "function" && typeof object.get === "function" && typeof object.getAll === "function" && typeof object.has === "function" && typeof object.set === "function" && object[Symbol.toStringTag] === "FormData";
4677
+ function isFormDataLike(object2) {
4678
+ return object2 && typeof object2 === "object" && typeof object2.append === "function" && typeof object2.delete === "function" && typeof object2.get === "function" && typeof object2.getAll === "function" && typeof object2.has === "function" && typeof object2.set === "function" && object2[Symbol.toStringTag] === "FormData";
4679
4679
  }
4680
4680
  function addAbortListener(signal, listener) {
4681
4681
  if ("addEventListener" in signal) {
@@ -5267,9 +5267,9 @@ var require_diagnostics = __commonJS({
5267
5267
  "undici:client:sendHeaders",
5268
5268
  (evt) => {
5269
5269
  const {
5270
- request: { method, path: path3, origin }
5270
+ request: { method, path: path4, origin }
5271
5271
  } = evt;
5272
- debugLog("sending request to %s %s%s", method, origin, path3);
5272
+ debugLog("sending request to %s %s%s", method, origin, path4);
5273
5273
  }
5274
5274
  );
5275
5275
  }
@@ -5287,14 +5287,14 @@ var require_diagnostics = __commonJS({
5287
5287
  "undici:request:headers",
5288
5288
  (evt) => {
5289
5289
  const {
5290
- request: { method, path: path3, origin },
5290
+ request: { method, path: path4, origin },
5291
5291
  response: { statusCode }
5292
5292
  } = evt;
5293
5293
  debugLog(
5294
5294
  "received response to %s %s%s - HTTP %d",
5295
5295
  method,
5296
5296
  origin,
5297
- path3,
5297
+ path4,
5298
5298
  statusCode
5299
5299
  );
5300
5300
  }
@@ -5303,23 +5303,23 @@ var require_diagnostics = __commonJS({
5303
5303
  "undici:request:trailers",
5304
5304
  (evt) => {
5305
5305
  const {
5306
- request: { method, path: path3, origin }
5306
+ request: { method, path: path4, origin }
5307
5307
  } = evt;
5308
- debugLog("trailers received from %s %s%s", method, origin, path3);
5308
+ debugLog("trailers received from %s %s%s", method, origin, path4);
5309
5309
  }
5310
5310
  );
5311
5311
  diagnosticsChannel.subscribe(
5312
5312
  "undici:request:error",
5313
5313
  (evt) => {
5314
5314
  const {
5315
- request: { method, path: path3, origin },
5315
+ request: { method, path: path4, origin },
5316
5316
  error
5317
5317
  } = evt;
5318
5318
  debugLog(
5319
5319
  "request to %s %s%s errored - %s",
5320
5320
  method,
5321
5321
  origin,
5322
- path3,
5322
+ path4,
5323
5323
  error.message
5324
5324
  );
5325
5325
  }
@@ -5422,7 +5422,7 @@ var require_request = __commonJS({
5422
5422
  var kHandler = /* @__PURE__ */ Symbol("handler");
5423
5423
  var Request = class {
5424
5424
  constructor(origin, {
5425
- path: path3,
5425
+ path: path4,
5426
5426
  method,
5427
5427
  body,
5428
5428
  headers: headers3,
@@ -5439,11 +5439,11 @@ var require_request = __commonJS({
5439
5439
  maxRedirections,
5440
5440
  typeOfService
5441
5441
  }, handler) {
5442
- if (typeof path3 !== "string") {
5442
+ if (typeof path4 !== "string") {
5443
5443
  throw new InvalidArgumentError2("path must be a string");
5444
- } else if (path3[0] !== "/" && !(path3.startsWith("http://") || path3.startsWith("https://")) && method !== "CONNECT") {
5444
+ } else if (path4[0] !== "/" && !(path4.startsWith("http://") || path4.startsWith("https://")) && method !== "CONNECT") {
5445
5445
  throw new InvalidArgumentError2("path must be an absolute URL or start with a slash");
5446
- } else if (invalidPathRegex.test(path3)) {
5446
+ } else if (invalidPathRegex.test(path4)) {
5447
5447
  throw new InvalidArgumentError2("invalid request path");
5448
5448
  }
5449
5449
  if (typeof method !== "string") {
@@ -5518,7 +5518,7 @@ var require_request = __commonJS({
5518
5518
  this.completed = false;
5519
5519
  this.aborted = false;
5520
5520
  this.upgrade = upgrade || null;
5521
- this.path = query2 ? serializePathWithQuery(path3, query2) : path3;
5521
+ this.path = query2 ? serializePathWithQuery(path4, query2) : path4;
5522
5522
  this.origin = origin;
5523
5523
  this.protocol = getProtocolFromUrlString(origin);
5524
5524
  this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
@@ -8310,8 +8310,8 @@ var require_util2 = __commonJS({
8310
8310
  }
8311
8311
  return "allowed";
8312
8312
  }
8313
- function isErrorLike(object) {
8314
- return object instanceof Error || (object?.constructor?.name === "Error" || object?.constructor?.name === "DOMException");
8313
+ function isErrorLike(object2) {
8314
+ return object2 instanceof Error || (object2?.constructor?.name === "Error" || object2?.constructor?.name === "DOMException");
8315
8315
  }
8316
8316
  function isValidReasonPhrase(statusText) {
8317
8317
  for (let i = 0; i < statusText.length; ++i) {
@@ -8654,7 +8654,7 @@ var require_util2 = __commonJS({
8654
8654
  return new FastIterableIterator(target, kind2);
8655
8655
  };
8656
8656
  }
8657
- function iteratorMixin(name, object, kInternalIterator, keyIndex = 0, valueIndex = 1) {
8657
+ function iteratorMixin(name, object2, kInternalIterator, keyIndex = 0, valueIndex = 1) {
8658
8658
  const makeIterator = createIterator(name, kInternalIterator, keyIndex, valueIndex);
8659
8659
  const properties = {
8660
8660
  keys: {
@@ -8662,7 +8662,7 @@ var require_util2 = __commonJS({
8662
8662
  enumerable: true,
8663
8663
  configurable: true,
8664
8664
  value: function keys() {
8665
- webidl.brandCheck(this, object);
8665
+ webidl.brandCheck(this, object2);
8666
8666
  return makeIterator(this, "key");
8667
8667
  }
8668
8668
  },
@@ -8671,7 +8671,7 @@ var require_util2 = __commonJS({
8671
8671
  enumerable: true,
8672
8672
  configurable: true,
8673
8673
  value: function values() {
8674
- webidl.brandCheck(this, object);
8674
+ webidl.brandCheck(this, object2);
8675
8675
  return makeIterator(this, "value");
8676
8676
  }
8677
8677
  },
@@ -8680,7 +8680,7 @@ var require_util2 = __commonJS({
8680
8680
  enumerable: true,
8681
8681
  configurable: true,
8682
8682
  value: function entries() {
8683
- webidl.brandCheck(this, object);
8683
+ webidl.brandCheck(this, object2);
8684
8684
  return makeIterator(this, "key+value");
8685
8685
  }
8686
8686
  },
@@ -8689,7 +8689,7 @@ var require_util2 = __commonJS({
8689
8689
  enumerable: true,
8690
8690
  configurable: true,
8691
8691
  value: function forEach(callbackfn, thisArg = globalThis) {
8692
- webidl.brandCheck(this, object);
8692
+ webidl.brandCheck(this, object2);
8693
8693
  webidl.argumentLengthCheck(arguments, 1, `${name}.forEach`);
8694
8694
  if (typeof callbackfn !== "function") {
8695
8695
  throw new TypeError(
@@ -8702,7 +8702,7 @@ var require_util2 = __commonJS({
8702
8702
  }
8703
8703
  }
8704
8704
  };
8705
- return Object.defineProperties(object.prototype, {
8705
+ return Object.defineProperties(object2.prototype, {
8706
8706
  ...properties,
8707
8707
  [Symbol.iterator]: {
8708
8708
  writable: true,
@@ -9555,13 +9555,13 @@ var require_body = __commonJS({
9555
9555
  stream.cancel("Response object has been garbage collected").catch(noop);
9556
9556
  }
9557
9557
  });
9558
- function extractBody(object, keepalive = false) {
9558
+ function extractBody(object2, keepalive = false) {
9559
9559
  let stream = null;
9560
9560
  let controller = null;
9561
- if (webidl.is.ReadableStream(object)) {
9562
- stream = object;
9563
- } else if (webidl.is.Blob(object)) {
9564
- stream = object.stream();
9561
+ if (webidl.is.ReadableStream(object2)) {
9562
+ stream = object2;
9563
+ } else if (webidl.is.Blob(object2)) {
9564
+ stream = object2.stream();
9565
9565
  } else {
9566
9566
  stream = new ReadableStream({
9567
9567
  pull() {
@@ -9579,15 +9579,15 @@ var require_body = __commonJS({
9579
9579
  let source = null;
9580
9580
  let length = null;
9581
9581
  let type = null;
9582
- if (typeof object === "string") {
9583
- source = object;
9582
+ if (typeof object2 === "string") {
9583
+ source = object2;
9584
9584
  type = "text/plain;charset=UTF-8";
9585
- } else if (webidl.is.URLSearchParams(object)) {
9586
- source = object.toString();
9585
+ } else if (webidl.is.URLSearchParams(object2)) {
9586
+ source = object2.toString();
9587
9587
  type = "application/x-www-form-urlencoded;charset=UTF-8";
9588
- } else if (webidl.is.BufferSource(object)) {
9589
- source = webidl.util.getCopyOfBytesHeldByBufferSource(object);
9590
- } else if (webidl.is.FormData(object)) {
9588
+ } else if (webidl.is.BufferSource(object2)) {
9589
+ source = webidl.util.getCopyOfBytesHeldByBufferSource(object2);
9590
+ } else if (webidl.is.FormData(object2)) {
9591
9591
  const boundary = `----formdata-undici-0${`${random(1e11)}`.padStart(11, "0")}`;
9592
9592
  const prefix = `--${boundary}\r
9593
9593
  Content-Disposition: form-data`;
@@ -9597,7 +9597,7 @@ Content-Disposition: form-data`;
9597
9597
  const rn = new Uint8Array([13, 10]);
9598
9598
  length = 0;
9599
9599
  let hasUnknownSizeValue = false;
9600
- for (const [name, value] of object) {
9600
+ for (const [name, value] of object2) {
9601
9601
  if (typeof value === "string") {
9602
9602
  const chunk2 = textEncoder.encode(prefix + `; name="${formdataEscape(normalizeLinefeeds(name))}"\r
9603
9603
  \r
@@ -9625,7 +9625,7 @@ Content-Type: ${value.type || "application/octet-stream"}\r
9625
9625
  if (hasUnknownSizeValue) {
9626
9626
  length = null;
9627
9627
  }
9628
- source = object;
9628
+ source = object2;
9629
9629
  action2 = async function* () {
9630
9630
  for (const part of blobParts) {
9631
9631
  if (part.stream) {
@@ -9636,22 +9636,22 @@ Content-Type: ${value.type || "application/octet-stream"}\r
9636
9636
  }
9637
9637
  };
9638
9638
  type = `multipart/form-data; boundary=${boundary}`;
9639
- } else if (webidl.is.Blob(object)) {
9640
- source = object;
9641
- length = object.size;
9642
- if (object.type) {
9643
- type = object.type;
9639
+ } else if (webidl.is.Blob(object2)) {
9640
+ source = object2;
9641
+ length = object2.size;
9642
+ if (object2.type) {
9643
+ type = object2.type;
9644
9644
  }
9645
- } else if (typeof object[Symbol.asyncIterator] === "function") {
9645
+ } else if (typeof object2[Symbol.asyncIterator] === "function") {
9646
9646
  if (keepalive) {
9647
9647
  throw new TypeError("keepalive");
9648
9648
  }
9649
- if (util2.isDisturbed(object) || object.locked) {
9649
+ if (util2.isDisturbed(object2) || object2.locked) {
9650
9650
  throw new TypeError(
9651
9651
  "Response body object should not be disturbed or locked"
9652
9652
  );
9653
9653
  }
9654
- stream = webidl.is.ReadableStream(object) ? object : ReadableStreamFrom(object);
9654
+ stream = webidl.is.ReadableStream(object2) ? object2 : ReadableStreamFrom(object2);
9655
9655
  }
9656
9656
  if (typeof source === "string" || isUint8Array(source)) {
9657
9657
  action2 = () => {
@@ -9680,12 +9680,12 @@ Content-Type: ${value.type || "application/octet-stream"}\r
9680
9680
  const body = { stream, source, length };
9681
9681
  return [body, type];
9682
9682
  }
9683
- function safelyExtractBody(object, keepalive = false) {
9684
- if (webidl.is.ReadableStream(object)) {
9685
- assert(!util2.isDisturbed(object), "The body has already been consumed.");
9686
- assert(!object.locked, "The stream is locked.");
9683
+ function safelyExtractBody(object2, keepalive = false) {
9684
+ if (webidl.is.ReadableStream(object2)) {
9685
+ assert(!util2.isDisturbed(object2), "The body has already been consumed.");
9686
+ assert(!object2.locked, "The stream is locked.");
9687
9687
  }
9688
- return extractBody(object, keepalive);
9688
+ return extractBody(object2, keepalive);
9689
9689
  }
9690
9690
  function cloneBody(body) {
9691
9691
  const { 0: out1, 1: out2 } = body.stream.tee();
@@ -9757,14 +9757,14 @@ Content-Type: ${value.type || "application/octet-stream"}\r
9757
9757
  function mixinBody(prototype, getInternalState) {
9758
9758
  Object.assign(prototype.prototype, bodyMixinMethods(prototype, getInternalState));
9759
9759
  }
9760
- function consumeBody(object, convertBytesToJSValue, instance, getInternalState) {
9760
+ function consumeBody(object2, convertBytesToJSValue, instance, getInternalState) {
9761
9761
  try {
9762
- webidl.brandCheck(object, instance);
9762
+ webidl.brandCheck(object2, instance);
9763
9763
  } catch (e) {
9764
9764
  return Promise.reject(e);
9765
9765
  }
9766
- object = getInternalState(object);
9767
- if (bodyUnusable(object)) {
9766
+ object2 = getInternalState(object2);
9767
+ if (bodyUnusable(object2)) {
9768
9768
  return Promise.reject(new TypeError("Body is unusable: Body has already been read"));
9769
9769
  }
9770
9770
  const promise = createDeferredPromise();
@@ -9776,15 +9776,15 @@ Content-Type: ${value.type || "application/octet-stream"}\r
9776
9776
  errorSteps(e);
9777
9777
  }
9778
9778
  };
9779
- if (object.body == null) {
9779
+ if (object2.body == null) {
9780
9780
  successSteps(Buffer.allocUnsafe(0));
9781
9781
  return promise.promise;
9782
9782
  }
9783
- fullyReadBody(object.body, successSteps, errorSteps);
9783
+ fullyReadBody(object2.body, successSteps, errorSteps);
9784
9784
  return promise.promise;
9785
9785
  }
9786
- function bodyUnusable(object) {
9787
- const body = object.body;
9786
+ function bodyUnusable(object2) {
9787
+ const body = object2.body;
9788
9788
  return body != null && (body.stream.locked || util2.isDisturbed(body.stream));
9789
9789
  }
9790
9790
  function bodyMimeType(requestOrResponse) {
@@ -10557,7 +10557,7 @@ var require_client_h1 = __commonJS({
10557
10557
  return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT";
10558
10558
  }
10559
10559
  function writeH1(client, request14) {
10560
- const { method, path: path3, host, upgrade, blocking, reset } = request14;
10560
+ const { method, path: path4, host, upgrade, blocking, reset } = request14;
10561
10561
  let { body, headers: headers3, contentLength } = request14;
10562
10562
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
10563
10563
  if (util2.isFormDataLike(body)) {
@@ -10626,7 +10626,7 @@ var require_client_h1 = __commonJS({
10626
10626
  if (socket.setTypeOfService) {
10627
10627
  socket.setTypeOfService(request14.typeOfService);
10628
10628
  }
10629
- let header = `${method} ${path3} HTTP/1.1\r
10629
+ let header = `${method} ${path4} HTTP/1.1\r
10630
10630
  `;
10631
10631
  if (typeof host === "string") {
10632
10632
  header += `host: ${host}\r
@@ -11279,7 +11279,7 @@ var require_client_h2 = __commonJS({
11279
11279
  function writeH2(client, request14) {
11280
11280
  const requestTimeout = request14.bodyTimeout ?? client[kBodyTimeout];
11281
11281
  const session = client[kHTTP2Session];
11282
- const { method, path: path3, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request14;
11282
+ const { method, path: path4, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request14;
11283
11283
  let { body } = request14;
11284
11284
  if (upgrade != null && upgrade !== "websocket") {
11285
11285
  util2.errorRequest(client, request14, new InvalidArgumentError2(`Custom upgrade "${upgrade}" not supported over HTTP/2`));
@@ -11347,7 +11347,7 @@ var require_client_h2 = __commonJS({
11347
11347
  }
11348
11348
  headers3[HTTP2_HEADER_METHOD] = "CONNECT";
11349
11349
  headers3[HTTP2_HEADER_PROTOCOL] = "websocket";
11350
- headers3[HTTP2_HEADER_PATH] = path3;
11350
+ headers3[HTTP2_HEADER_PATH] = path4;
11351
11351
  if (protocol === "ws:" || protocol === "wss:") {
11352
11352
  headers3[HTTP2_HEADER_SCHEME] = protocol === "ws:" ? "http" : "https";
11353
11353
  } else {
@@ -11388,7 +11388,7 @@ var require_client_h2 = __commonJS({
11388
11388
  stream.setTimeout(requestTimeout);
11389
11389
  return true;
11390
11390
  }
11391
- headers3[HTTP2_HEADER_PATH] = path3;
11391
+ headers3[HTTP2_HEADER_PATH] = path4;
11392
11392
  headers3[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
11393
11393
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
11394
11394
  if (body && typeof body.read === "function") {
@@ -13690,10 +13690,10 @@ var require_proxy_agent = __commonJS({
13690
13690
  };
13691
13691
  const {
13692
13692
  origin,
13693
- path: path3 = "/",
13693
+ path: path4 = "/",
13694
13694
  headers: headers3 = {}
13695
13695
  } = opts;
13696
- opts.path = origin + path3;
13696
+ opts.path = origin + path4;
13697
13697
  if (!("host" in headers3) && !("Host" in headers3)) {
13698
13698
  const { host } = new URL(origin);
13699
13699
  headers3.host = host;
@@ -15756,20 +15756,20 @@ var require_mock_utils = __commonJS({
15756
15756
  }
15757
15757
  return normalizedQp;
15758
15758
  }
15759
- function safeUrl(path3) {
15760
- if (typeof path3 !== "string") {
15761
- return path3;
15759
+ function safeUrl(path4) {
15760
+ if (typeof path4 !== "string") {
15761
+ return path4;
15762
15762
  }
15763
- const pathSegments = path3.split("?", 3);
15763
+ const pathSegments = path4.split("?", 3);
15764
15764
  if (pathSegments.length !== 2) {
15765
- return path3;
15765
+ return path4;
15766
15766
  }
15767
15767
  const qp = new URLSearchParams(pathSegments.pop());
15768
15768
  qp.sort();
15769
15769
  return [...pathSegments, qp.toString()].join("?");
15770
15770
  }
15771
- function matchKey(mockDispatch2, { path: path3, method, body, headers: headers3 }) {
15772
- const pathMatch = matchValue(mockDispatch2.path, path3);
15771
+ function matchKey(mockDispatch2, { path: path4, method, body, headers: headers3 }) {
15772
+ const pathMatch = matchValue(mockDispatch2.path, path4);
15773
15773
  const methodMatch = matchValue(mockDispatch2.method, method);
15774
15774
  const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
15775
15775
  const headersMatch = matchHeaders(mockDispatch2, headers3);
@@ -15794,8 +15794,8 @@ var require_mock_utils = __commonJS({
15794
15794
  const basePath = key.query ? serializePathWithQuery(key.path, key.query) : key.path;
15795
15795
  const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
15796
15796
  const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
15797
- let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path3, ignoreTrailingSlash }) => {
15798
- return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path3)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path3), resolvedPath);
15797
+ let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path4, ignoreTrailingSlash }) => {
15798
+ return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path4)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path4), resolvedPath);
15799
15799
  });
15800
15800
  if (matchedMockDispatches.length === 0) {
15801
15801
  throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
@@ -15834,19 +15834,19 @@ var require_mock_utils = __commonJS({
15834
15834
  mockDispatches.splice(index, 1);
15835
15835
  }
15836
15836
  }
15837
- function removeTrailingSlash(path3) {
15838
- while (path3.endsWith("/")) {
15839
- path3 = path3.slice(0, -1);
15837
+ function removeTrailingSlash(path4) {
15838
+ while (path4.endsWith("/")) {
15839
+ path4 = path4.slice(0, -1);
15840
15840
  }
15841
- if (path3.length === 0) {
15842
- path3 = "/";
15841
+ if (path4.length === 0) {
15842
+ path4 = "/";
15843
15843
  }
15844
- return path3;
15844
+ return path4;
15845
15845
  }
15846
15846
  function buildKey(opts) {
15847
- const { path: path3, method, body, headers: headers3, query: query2 } = opts;
15847
+ const { path: path4, method, body, headers: headers3, query: query2 } = opts;
15848
15848
  return {
15849
- path: path3,
15849
+ path: path4,
15850
15850
  method,
15851
15851
  body,
15852
15852
  headers: headers3,
@@ -16536,10 +16536,10 @@ var require_pending_interceptors_formatter = __commonJS({
16536
16536
  }
16537
16537
  format(pendingInterceptors) {
16538
16538
  const withPrettyHeaders = pendingInterceptors.map(
16539
- ({ method, path: path3, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
16539
+ ({ method, path: path4, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
16540
16540
  Method: method,
16541
16541
  Origin: origin,
16542
- Path: path3,
16542
+ Path: path4,
16543
16543
  "Status code": statusCode,
16544
16544
  Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
16545
16545
  Invocations: timesInvoked,
@@ -16621,9 +16621,9 @@ var require_mock_agent = __commonJS({
16621
16621
  const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters];
16622
16622
  const dispatchOpts = { ...opts };
16623
16623
  if (acceptNonStandardSearchParameters && dispatchOpts.path) {
16624
- const [path3, searchParams] = dispatchOpts.path.split("?");
16624
+ const [path4, searchParams] = dispatchOpts.path.split("?");
16625
16625
  const normalizedSearchParams = normalizeSearchParams(searchParams, acceptNonStandardSearchParameters);
16626
- dispatchOpts.path = `${path3}?${normalizedSearchParams}`;
16626
+ dispatchOpts.path = `${path4}?${normalizedSearchParams}`;
16627
16627
  }
16628
16628
  return this[kAgent].dispatch(dispatchOpts, handler);
16629
16629
  }
@@ -16827,7 +16827,7 @@ var require_snapshot_utils = __commonJS({
16827
16827
  var require_snapshot_recorder = __commonJS({
16828
16828
  "node_modules/undici/lib/mock/snapshot-recorder.js"(exports2, module2) {
16829
16829
  "use strict";
16830
- var { writeFile: writeFile5, readFile: readFile8, mkdir: mkdir7 } = require("fs/promises");
16830
+ var { writeFile: writeFile5, readFile: readFile9, mkdir: mkdir7 } = require("fs/promises");
16831
16831
  var { dirname: dirname9, resolve: resolve12 } = require("path");
16832
16832
  var { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = require("timers");
16833
16833
  var { InvalidArgumentError: InvalidArgumentError2, UndiciError } = require_errors();
@@ -17024,12 +17024,12 @@ var require_snapshot_recorder = __commonJS({
17024
17024
  * @return {Promise<void>} - Resolves when snapshots are loaded
17025
17025
  */
17026
17026
  async loadSnapshots(filePath) {
17027
- const path3 = filePath || this.#snapshotPath;
17028
- if (!path3) {
17027
+ const path4 = filePath || this.#snapshotPath;
17028
+ if (!path4) {
17029
17029
  throw new InvalidArgumentError2("Snapshot path is required");
17030
17030
  }
17031
17031
  try {
17032
- const data = await readFile8(resolve12(path3), "utf8");
17032
+ const data = await readFile9(resolve12(path4), "utf8");
17033
17033
  const parsed = JSON.parse(data);
17034
17034
  if (Array.isArray(parsed)) {
17035
17035
  this.#snapshots.clear();
@@ -17043,7 +17043,7 @@ var require_snapshot_recorder = __commonJS({
17043
17043
  if (error.code === "ENOENT") {
17044
17044
  this.#snapshots.clear();
17045
17045
  } else {
17046
- throw new UndiciError(`Failed to load snapshots from ${path3}`, { cause: error });
17046
+ throw new UndiciError(`Failed to load snapshots from ${path4}`, { cause: error });
17047
17047
  }
17048
17048
  }
17049
17049
  }
@@ -17054,11 +17054,11 @@ var require_snapshot_recorder = __commonJS({
17054
17054
  * @returns {Promise<void>} - Resolves when snapshots are saved
17055
17055
  */
17056
17056
  async saveSnapshots(filePath) {
17057
- const path3 = filePath || this.#snapshotPath;
17058
- if (!path3) {
17057
+ const path4 = filePath || this.#snapshotPath;
17058
+ if (!path4) {
17059
17059
  throw new InvalidArgumentError2("Snapshot path is required");
17060
17060
  }
17061
- const resolvedPath = resolve12(path3);
17061
+ const resolvedPath = resolve12(path4);
17062
17062
  await mkdir7(dirname9(resolvedPath), { recursive: true });
17063
17063
  const data = Array.from(this.#snapshots.entries()).map(([hash, snapshot]) => ({
17064
17064
  hash,
@@ -17683,15 +17683,15 @@ var require_redirect_handler = __commonJS({
17683
17683
  return;
17684
17684
  }
17685
17685
  const { origin, pathname, search } = util2.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
17686
- const path3 = search ? `${pathname}${search}` : pathname;
17687
- const redirectUrlString = `${origin}${path3}`;
17686
+ const path4 = search ? `${pathname}${search}` : pathname;
17687
+ const redirectUrlString = `${origin}${path4}`;
17688
17688
  for (const historyUrl of this.history) {
17689
17689
  if (historyUrl.toString() === redirectUrlString) {
17690
17690
  throw new InvalidArgumentError2(`Redirect loop detected. Cannot redirect to ${origin}. This typically happens when using a Client or Pool with cross-origin redirects. Use an Agent for cross-origin redirects.`);
17691
17691
  }
17692
17692
  }
17693
17693
  this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
17694
- this.opts.path = path3;
17694
+ this.opts.path = path4;
17695
17695
  this.opts.origin = origin;
17696
17696
  this.opts.query = null;
17697
17697
  }
@@ -18246,17 +18246,17 @@ var require_dns = __commonJS({
18246
18246
  const timestamp = Date.now();
18247
18247
  const records2 = { records: { 4: null, 6: null } };
18248
18248
  let minTTL = this.#maxTTL;
18249
- for (const record4 of addresses2) {
18250
- record4.timestamp = timestamp;
18251
- if (typeof record4.ttl === "number") {
18252
- record4.ttl = Math.min(record4.ttl, this.#maxTTL);
18253
- minTTL = Math.min(minTTL, record4.ttl);
18249
+ for (const record5 of addresses2) {
18250
+ record5.timestamp = timestamp;
18251
+ if (typeof record5.ttl === "number") {
18252
+ record5.ttl = Math.min(record5.ttl, this.#maxTTL);
18253
+ minTTL = Math.min(minTTL, record5.ttl);
18254
18254
  } else {
18255
- record4.ttl = this.#maxTTL;
18255
+ record5.ttl = this.#maxTTL;
18256
18256
  }
18257
- const familyRecords = records2.records[record4.family] ?? { ips: [] };
18258
- familyRecords.ips.push(record4);
18259
- records2.records[record4.family] = familyRecords;
18257
+ const familyRecords = records2.records[record5.family] ?? { ips: [] };
18258
+ familyRecords.ips.push(record5);
18259
+ records2.records[record5.family] = familyRecords;
18260
18260
  }
18261
18261
  this.storage.set(origin.hostname, records2, { ttl: minTTL });
18262
18262
  }
@@ -21188,10 +21188,10 @@ var require_headers = __commonJS({
21188
21188
  while (j > i && isHTTPWhiteSpaceCharCode(potentialValue.charCodeAt(i))) ++i;
21189
21189
  return i === 0 && j === potentialValue.length ? potentialValue : potentialValue.substring(i, j);
21190
21190
  }
21191
- function fill(headers3, object) {
21192
- if (Array.isArray(object)) {
21193
- for (let i = 0; i < object.length; ++i) {
21194
- const header = object[i];
21191
+ function fill(headers3, object2) {
21192
+ if (Array.isArray(object2)) {
21193
+ for (let i = 0; i < object2.length; ++i) {
21194
+ const header = object2[i];
21195
21195
  if (header.length !== 2) {
21196
21196
  throw webidl.errors.exception({
21197
21197
  header: "Headers constructor",
@@ -21200,10 +21200,10 @@ var require_headers = __commonJS({
21200
21200
  }
21201
21201
  appendHeader(headers3, header[0], header[1]);
21202
21202
  }
21203
- } else if (typeof object === "object" && object !== null) {
21204
- const keys = Object.keys(object);
21203
+ } else if (typeof object2 === "object" && object2 !== null) {
21204
+ const keys = Object.keys(object2);
21205
21205
  for (let i = 0; i < keys.length; ++i) {
21206
- appendHeader(headers3, keys[i], object[keys[i]]);
21206
+ appendHeader(headers3, keys[i], object2[keys[i]]);
21207
21207
  }
21208
21208
  } else {
21209
21209
  throw webidl.errors.conversionFailed({
@@ -23898,11 +23898,11 @@ var require_fetch = __commonJS({
23898
23898
  function dispatch({ body }) {
23899
23899
  const url = requestCurrentURL(request14);
23900
23900
  const agent = fetchParams.controller.dispatcher;
23901
- const path3 = url.pathname + url.search;
23901
+ const path4 = url.pathname + url.search;
23902
23902
  const hasTrailingQuestionMark = url.search.length === 0 && url.href[url.href.length - url.hash.length - 1] === "?";
23903
23903
  return new Promise((resolve12, reject) => agent.dispatch(
23904
23904
  {
23905
- path: hasTrailingQuestionMark ? `${path3}?` : path3,
23905
+ path: hasTrailingQuestionMark ? `${path4}?` : path4,
23906
23906
  origin: url.origin,
23907
23907
  method: request14.method,
23908
23908
  body: agent.isMockActive ? request14.body && (request14.body.source || request14.body.stream) : body,
@@ -24849,9 +24849,9 @@ var require_util4 = __commonJS({
24849
24849
  }
24850
24850
  }
24851
24851
  }
24852
- function validateCookiePath(path3) {
24853
- for (let i = 0; i < path3.length; ++i) {
24854
- const code = path3.charCodeAt(i);
24852
+ function validateCookiePath(path4) {
24853
+ for (let i = 0; i < path4.length; ++i) {
24854
+ const code = path4.charCodeAt(i);
24855
24855
  if (code < 32 || // exclude CTLs (0-31)
24856
24856
  code === 127 || // DEL
24857
24857
  code === 59) {
@@ -25944,15 +25944,15 @@ var require_connection = __commonJS({
25944
25944
  });
25945
25945
  return controller;
25946
25946
  }
25947
- function closeWebSocketConnection(object, code, reason, validate = false) {
25947
+ function closeWebSocketConnection(object2, code, reason, validate = false) {
25948
25948
  code ??= null;
25949
25949
  reason ??= "";
25950
25950
  if (validate) validateCloseCodeAndReason(code, reason);
25951
- if (isClosed(object.readyState) || isClosing(object.readyState)) {
25952
- } else if (!isEstablished(object.readyState)) {
25953
- failWebsocketConnection(object);
25954
- object.readyState = states.CLOSING;
25955
- } else if (!object.closeState.has(sentCloseFrameState.SENT) && !object.closeState.has(sentCloseFrameState.RECEIVED)) {
25951
+ if (isClosed(object2.readyState) || isClosing(object2.readyState)) {
25952
+ } else if (!isEstablished(object2.readyState)) {
25953
+ failWebsocketConnection(object2);
25954
+ object2.readyState = states.CLOSING;
25955
+ } else if (!object2.closeState.has(sentCloseFrameState.SENT) && !object2.closeState.has(sentCloseFrameState.RECEIVED)) {
25956
25956
  const frame = new WebsocketFrameSend();
25957
25957
  if (reason.length !== 0 && code === null) {
25958
25958
  code = 1e3;
@@ -25970,11 +25970,11 @@ var require_connection = __commonJS({
25970
25970
  } else {
25971
25971
  frame.frameData = emptyBuffer;
25972
25972
  }
25973
- object.socket.write(frame.createFrame(opcodes.CLOSE));
25974
- object.closeState.add(sentCloseFrameState.SENT);
25975
- object.readyState = states.CLOSING;
25973
+ object2.socket.write(frame.createFrame(opcodes.CLOSE));
25974
+ object2.closeState.add(sentCloseFrameState.SENT);
25975
+ object2.readyState = states.CLOSING;
25976
25976
  } else {
25977
- object.readyState = states.CLOSING;
25977
+ object2.readyState = states.CLOSING;
25978
25978
  }
25979
25979
  }
25980
25980
  function failWebsocketConnection(handler, code, reason, cause) {
@@ -28021,11 +28021,11 @@ var require_undici = __commonJS({
28021
28021
  if (typeof opts.path !== "string") {
28022
28022
  throw new InvalidArgumentError2("invalid opts.path");
28023
28023
  }
28024
- let path3 = opts.path;
28024
+ let path4 = opts.path;
28025
28025
  if (!opts.path.startsWith("/")) {
28026
- path3 = `/${path3}`;
28026
+ path4 = `/${path4}`;
28027
28027
  }
28028
- url = new URL(util2.parseOrigin(url).origin + path3);
28028
+ url = new URL(util2.parseOrigin(url).origin + path4);
28029
28029
  } else {
28030
28030
  if (!opts) {
28031
28031
  opts = typeof url === "object" ? url : {};
@@ -28994,8 +28994,8 @@ var require_conversions = __commonJS({
28994
28994
  return [r, g, b];
28995
28995
  };
28996
28996
  convert.rgb.hex = function(args) {
28997
- const integer = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
28998
- const string = integer.toString(16).toUpperCase();
28997
+ const integer2 = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
28998
+ const string = integer2.toString(16).toUpperCase();
28999
28999
  return "000000".substring(string.length) + string;
29000
29000
  };
29001
29001
  convert.hex.rgb = function(args) {
@@ -29009,10 +29009,10 @@ var require_conversions = __commonJS({
29009
29009
  return char + char;
29010
29010
  }).join("");
29011
29011
  }
29012
- const integer = parseInt(colorString, 16);
29013
- const r = integer >> 16 & 255;
29014
- const g = integer >> 8 & 255;
29015
- const b = integer & 255;
29012
+ const integer2 = parseInt(colorString, 16);
29013
+ const r = integer2 >> 16 & 255;
29014
+ const g = integer2 >> 8 & 255;
29015
+ const b = integer2 & 255;
29016
29016
  return [r, g, b];
29017
29017
  };
29018
29018
  convert.rgb.hcg = function(rgb) {
@@ -29175,8 +29175,8 @@ var require_conversions = __commonJS({
29175
29175
  };
29176
29176
  convert.gray.hex = function(gray) {
29177
29177
  const val = Math.round(gray[0] / 100 * 255) & 255;
29178
- const integer = (val << 16) + (val << 8) + val;
29179
- const string = integer.toString(16).toUpperCase();
29178
+ const integer2 = (val << 16) + (val << 8) + val;
29179
+ const string = integer2.toString(16).toUpperCase();
29180
29180
  return "000000".substring(string.length) + string;
29181
29181
  };
29182
29182
  convert.rgb.gray = function(rgb) {
@@ -29229,15 +29229,15 @@ var require_route = __commonJS({
29229
29229
  };
29230
29230
  }
29231
29231
  function wrapConversion(toModel, graph) {
29232
- const path3 = [graph[toModel].parent, toModel];
29232
+ const path4 = [graph[toModel].parent, toModel];
29233
29233
  let fn = conversions[graph[toModel].parent][toModel];
29234
29234
  let cur = graph[toModel].parent;
29235
29235
  while (graph[cur].parent) {
29236
- path3.unshift(graph[cur].parent);
29236
+ path4.unshift(graph[cur].parent);
29237
29237
  fn = link2(conversions[graph[cur].parent][cur], fn);
29238
29238
  cur = graph[cur].parent;
29239
29239
  }
29240
- fn.conversion = path3;
29240
+ fn.conversion = path4;
29241
29241
  return fn;
29242
29242
  }
29243
29243
  module2.exports = function(fromModel) {
@@ -29337,11 +29337,11 @@ var require_ansi_styles = __commonJS({
29337
29337
  };
29338
29338
  var ansi2ansi = (n) => n;
29339
29339
  var rgb2rgb = (r, g, b) => [r, g, b];
29340
- var setLazyProperty = (object, property, get) => {
29341
- Object.defineProperty(object, property, {
29340
+ var setLazyProperty = (object2, property, get) => {
29341
+ Object.defineProperty(object2, property, {
29342
29342
  get: () => {
29343
29343
  const value = get();
29344
- Object.defineProperty(object, property, {
29344
+ Object.defineProperty(object2, property, {
29345
29345
  value,
29346
29346
  enumerable: true,
29347
29347
  configurable: true
@@ -35064,16 +35064,16 @@ var require_iso2022 = __commonJS({
35064
35064
  let misses = 0;
35065
35065
  let shifts = 0;
35066
35066
  let confidence;
35067
- const text3 = det.inputBytes;
35067
+ const text4 = det.inputBytes;
35068
35068
  const textLen = det.inputLen;
35069
35069
  scanInput: for (i = 0; i < textLen; i++) {
35070
- if (text3[i] == 27) {
35070
+ if (text4[i] == 27) {
35071
35071
  checkEscapes: for (escN = 0; escN < this.escapeSequences.length; escN++) {
35072
35072
  const seq = this.escapeSequences[escN];
35073
35073
  if (textLen - i < seq.length)
35074
35074
  continue checkEscapes;
35075
35075
  for (j = 1; j < seq.length; j++)
35076
- if (seq[j] != text3[i + j])
35076
+ if (seq[j] != text4[i + j])
35077
35077
  continue checkEscapes;
35078
35078
  hits++;
35079
35079
  i += seq.length - 1;
@@ -35081,7 +35081,7 @@ var require_iso2022 = __commonJS({
35081
35081
  }
35082
35082
  misses++;
35083
35083
  }
35084
- if (text3[i] == 14 || text3[i] == 15)
35084
+ if (text4[i] == 14 || text4[i] == 15)
35085
35085
  shifts++;
35086
35086
  }
35087
35087
  if (hits == 0)
@@ -39210,17 +39210,17 @@ var require_visit = __commonJS({
39210
39210
  visit.BREAK = BREAK;
39211
39211
  visit.SKIP = SKIP;
39212
39212
  visit.REMOVE = REMOVE;
39213
- function visit_(key, node, visitor, path3) {
39214
- const ctrl = callVisitor(key, node, visitor, path3);
39213
+ function visit_(key, node, visitor, path4) {
39214
+ const ctrl = callVisitor(key, node, visitor, path4);
39215
39215
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
39216
- replaceNode(key, path3, ctrl);
39217
- return visit_(key, ctrl, visitor, path3);
39216
+ replaceNode(key, path4, ctrl);
39217
+ return visit_(key, ctrl, visitor, path4);
39218
39218
  }
39219
39219
  if (typeof ctrl !== "symbol") {
39220
39220
  if (identity.isCollection(node)) {
39221
- path3 = Object.freeze(path3.concat(node));
39221
+ path4 = Object.freeze(path4.concat(node));
39222
39222
  for (let i = 0; i < node.items.length; ++i) {
39223
- const ci = visit_(i, node.items[i], visitor, path3);
39223
+ const ci = visit_(i, node.items[i], visitor, path4);
39224
39224
  if (typeof ci === "number")
39225
39225
  i = ci - 1;
39226
39226
  else if (ci === BREAK)
@@ -39231,13 +39231,13 @@ var require_visit = __commonJS({
39231
39231
  }
39232
39232
  }
39233
39233
  } else if (identity.isPair(node)) {
39234
- path3 = Object.freeze(path3.concat(node));
39235
- const ck = visit_("key", node.key, visitor, path3);
39234
+ path4 = Object.freeze(path4.concat(node));
39235
+ const ck = visit_("key", node.key, visitor, path4);
39236
39236
  if (ck === BREAK)
39237
39237
  return BREAK;
39238
39238
  else if (ck === REMOVE)
39239
39239
  node.key = null;
39240
- const cv = visit_("value", node.value, visitor, path3);
39240
+ const cv = visit_("value", node.value, visitor, path4);
39241
39241
  if (cv === BREAK)
39242
39242
  return BREAK;
39243
39243
  else if (cv === REMOVE)
@@ -39258,17 +39258,17 @@ var require_visit = __commonJS({
39258
39258
  visitAsync.BREAK = BREAK;
39259
39259
  visitAsync.SKIP = SKIP;
39260
39260
  visitAsync.REMOVE = REMOVE;
39261
- async function visitAsync_(key, node, visitor, path3) {
39262
- const ctrl = await callVisitor(key, node, visitor, path3);
39261
+ async function visitAsync_(key, node, visitor, path4) {
39262
+ const ctrl = await callVisitor(key, node, visitor, path4);
39263
39263
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
39264
- replaceNode(key, path3, ctrl);
39265
- return visitAsync_(key, ctrl, visitor, path3);
39264
+ replaceNode(key, path4, ctrl);
39265
+ return visitAsync_(key, ctrl, visitor, path4);
39266
39266
  }
39267
39267
  if (typeof ctrl !== "symbol") {
39268
39268
  if (identity.isCollection(node)) {
39269
- path3 = Object.freeze(path3.concat(node));
39269
+ path4 = Object.freeze(path4.concat(node));
39270
39270
  for (let i = 0; i < node.items.length; ++i) {
39271
- const ci = await visitAsync_(i, node.items[i], visitor, path3);
39271
+ const ci = await visitAsync_(i, node.items[i], visitor, path4);
39272
39272
  if (typeof ci === "number")
39273
39273
  i = ci - 1;
39274
39274
  else if (ci === BREAK)
@@ -39279,13 +39279,13 @@ var require_visit = __commonJS({
39279
39279
  }
39280
39280
  }
39281
39281
  } else if (identity.isPair(node)) {
39282
- path3 = Object.freeze(path3.concat(node));
39283
- const ck = await visitAsync_("key", node.key, visitor, path3);
39282
+ path4 = Object.freeze(path4.concat(node));
39283
+ const ck = await visitAsync_("key", node.key, visitor, path4);
39284
39284
  if (ck === BREAK)
39285
39285
  return BREAK;
39286
39286
  else if (ck === REMOVE)
39287
39287
  node.key = null;
39288
- const cv = await visitAsync_("value", node.value, visitor, path3);
39288
+ const cv = await visitAsync_("value", node.value, visitor, path4);
39289
39289
  if (cv === BREAK)
39290
39290
  return BREAK;
39291
39291
  else if (cv === REMOVE)
@@ -39312,23 +39312,23 @@ var require_visit = __commonJS({
39312
39312
  }
39313
39313
  return visitor;
39314
39314
  }
39315
- function callVisitor(key, node, visitor, path3) {
39315
+ function callVisitor(key, node, visitor, path4) {
39316
39316
  if (typeof visitor === "function")
39317
- return visitor(key, node, path3);
39317
+ return visitor(key, node, path4);
39318
39318
  if (identity.isMap(node))
39319
- return visitor.Map?.(key, node, path3);
39319
+ return visitor.Map?.(key, node, path4);
39320
39320
  if (identity.isSeq(node))
39321
- return visitor.Seq?.(key, node, path3);
39321
+ return visitor.Seq?.(key, node, path4);
39322
39322
  if (identity.isPair(node))
39323
- return visitor.Pair?.(key, node, path3);
39323
+ return visitor.Pair?.(key, node, path4);
39324
39324
  if (identity.isScalar(node))
39325
- return visitor.Scalar?.(key, node, path3);
39325
+ return visitor.Scalar?.(key, node, path4);
39326
39326
  if (identity.isAlias(node))
39327
- return visitor.Alias?.(key, node, path3);
39327
+ return visitor.Alias?.(key, node, path4);
39328
39328
  return void 0;
39329
39329
  }
39330
- function replaceNode(key, path3, node) {
39331
- const parent = path3[path3.length - 1];
39330
+ function replaceNode(key, path4, node) {
39331
+ const parent = path4[path4.length - 1];
39332
39332
  if (identity.isCollection(parent)) {
39333
39333
  parent.items[key] = node;
39334
39334
  } else if (identity.isPair(parent)) {
@@ -39936,10 +39936,10 @@ var require_Collection = __commonJS({
39936
39936
  var createNode = require_createNode();
39937
39937
  var identity = require_identity();
39938
39938
  var Node = require_Node();
39939
- function collectionFromPath(schema, path3, value) {
39939
+ function collectionFromPath(schema, path4, value) {
39940
39940
  let v = value;
39941
- for (let i = path3.length - 1; i >= 0; --i) {
39942
- const k = path3[i];
39941
+ for (let i = path4.length - 1; i >= 0; --i) {
39942
+ const k = path4[i];
39943
39943
  if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
39944
39944
  const a = [];
39945
39945
  a[k] = v;
@@ -39958,7 +39958,7 @@ var require_Collection = __commonJS({
39958
39958
  sourceObjects: /* @__PURE__ */ new Map()
39959
39959
  });
39960
39960
  }
39961
- var isEmptyPath = (path3) => path3 == null || typeof path3 === "object" && !!path3[Symbol.iterator]().next().done;
39961
+ var isEmptyPath = (path4) => path4 == null || typeof path4 === "object" && !!path4[Symbol.iterator]().next().done;
39962
39962
  var Collection = class extends Node.NodeBase {
39963
39963
  constructor(type, schema) {
39964
39964
  super(type);
@@ -39988,11 +39988,11 @@ var require_Collection = __commonJS({
39988
39988
  * be a Pair instance or a `{ key, value }` object, which may not have a key
39989
39989
  * that already exists in the map.
39990
39990
  */
39991
- addIn(path3, value) {
39992
- if (isEmptyPath(path3))
39991
+ addIn(path4, value) {
39992
+ if (isEmptyPath(path4))
39993
39993
  this.add(value);
39994
39994
  else {
39995
- const [key, ...rest] = path3;
39995
+ const [key, ...rest] = path4;
39996
39996
  const node = this.get(key, true);
39997
39997
  if (identity.isCollection(node))
39998
39998
  node.addIn(rest, value);
@@ -40006,8 +40006,8 @@ var require_Collection = __commonJS({
40006
40006
  * Removes a value from the collection.
40007
40007
  * @returns `true` if the item was found and removed.
40008
40008
  */
40009
- deleteIn(path3) {
40010
- const [key, ...rest] = path3;
40009
+ deleteIn(path4) {
40010
+ const [key, ...rest] = path4;
40011
40011
  if (rest.length === 0)
40012
40012
  return this.delete(key);
40013
40013
  const node = this.get(key, true);
@@ -40021,8 +40021,8 @@ var require_Collection = __commonJS({
40021
40021
  * scalar values from their surrounding node; to disable set `keepScalar` to
40022
40022
  * `true` (collections are always returned intact).
40023
40023
  */
40024
- getIn(path3, keepScalar) {
40025
- const [key, ...rest] = path3;
40024
+ getIn(path4, keepScalar) {
40025
+ const [key, ...rest] = path4;
40026
40026
  const node = this.get(key, true);
40027
40027
  if (rest.length === 0)
40028
40028
  return !keepScalar && identity.isScalar(node) ? node.value : node;
@@ -40040,8 +40040,8 @@ var require_Collection = __commonJS({
40040
40040
  /**
40041
40041
  * Checks if the collection includes a value with the key `key`.
40042
40042
  */
40043
- hasIn(path3) {
40044
- const [key, ...rest] = path3;
40043
+ hasIn(path4) {
40044
+ const [key, ...rest] = path4;
40045
40045
  if (rest.length === 0)
40046
40046
  return this.has(key);
40047
40047
  const node = this.get(key, true);
@@ -40051,8 +40051,8 @@ var require_Collection = __commonJS({
40051
40051
  * Sets a value in this collection. For `!!set`, `value` needs to be a
40052
40052
  * boolean to add/remove the item from the set.
40053
40053
  */
40054
- setIn(path3, value) {
40055
- const [key, ...rest] = path3;
40054
+ setIn(path4, value) {
40055
+ const [key, ...rest] = path4;
40056
40056
  if (rest.length === 0) {
40057
40057
  this.set(key, value);
40058
40058
  } else {
@@ -40096,14 +40096,14 @@ var require_foldFlowLines = __commonJS({
40096
40096
  var FOLD_FLOW = "flow";
40097
40097
  var FOLD_BLOCK = "block";
40098
40098
  var FOLD_QUOTED = "quoted";
40099
- function foldFlowLines(text3, indent, mode = "flow", { indentAtStart, lineWidth = 80, minContentWidth = 20, onFold, onOverflow } = {}) {
40099
+ function foldFlowLines(text4, indent, mode = "flow", { indentAtStart, lineWidth = 80, minContentWidth = 20, onFold, onOverflow } = {}) {
40100
40100
  if (!lineWidth || lineWidth < 0)
40101
- return text3;
40101
+ return text4;
40102
40102
  if (lineWidth < minContentWidth)
40103
40103
  minContentWidth = 0;
40104
40104
  const endStep = Math.max(1 + minContentWidth, 1 + lineWidth - indent.length);
40105
- if (text3.length <= endStep)
40106
- return text3;
40105
+ if (text4.length <= endStep)
40106
+ return text4;
40107
40107
  const folds = [];
40108
40108
  const escapedFolds = {};
40109
40109
  let end = lineWidth - indent.length;
@@ -40120,14 +40120,14 @@ var require_foldFlowLines = __commonJS({
40120
40120
  let escStart = -1;
40121
40121
  let escEnd = -1;
40122
40122
  if (mode === FOLD_BLOCK) {
40123
- i = consumeMoreIndentedLines(text3, i, indent.length);
40123
+ i = consumeMoreIndentedLines(text4, i, indent.length);
40124
40124
  if (i !== -1)
40125
40125
  end = i + endStep;
40126
40126
  }
40127
- for (let ch; ch = text3[i += 1]; ) {
40127
+ for (let ch; ch = text4[i += 1]; ) {
40128
40128
  if (mode === FOLD_QUOTED && ch === "\\") {
40129
40129
  escStart = i;
40130
- switch (text3[i + 1]) {
40130
+ switch (text4[i + 1]) {
40131
40131
  case "x":
40132
40132
  i += 3;
40133
40133
  break;
@@ -40144,12 +40144,12 @@ var require_foldFlowLines = __commonJS({
40144
40144
  }
40145
40145
  if (ch === "\n") {
40146
40146
  if (mode === FOLD_BLOCK)
40147
- i = consumeMoreIndentedLines(text3, i, indent.length);
40147
+ i = consumeMoreIndentedLines(text4, i, indent.length);
40148
40148
  end = i + indent.length + endStep;
40149
40149
  split = void 0;
40150
40150
  } else {
40151
40151
  if (ch === " " && prev && prev !== " " && prev !== "\n" && prev !== " ") {
40152
- const next = text3[i + 1];
40152
+ const next = text4[i + 1];
40153
40153
  if (next && next !== " " && next !== "\n" && next !== " ")
40154
40154
  split = i;
40155
40155
  }
@@ -40161,12 +40161,12 @@ var require_foldFlowLines = __commonJS({
40161
40161
  } else if (mode === FOLD_QUOTED) {
40162
40162
  while (prev === " " || prev === " ") {
40163
40163
  prev = ch;
40164
- ch = text3[i += 1];
40164
+ ch = text4[i += 1];
40165
40165
  overflow = true;
40166
40166
  }
40167
40167
  const j = i > escEnd + 1 ? i - 2 : escStart - 1;
40168
40168
  if (escapedFolds[j])
40169
- return text3;
40169
+ return text4;
40170
40170
  folds.push(j);
40171
40171
  escapedFolds[j] = true;
40172
40172
  end = j + endStep;
@@ -40181,39 +40181,39 @@ var require_foldFlowLines = __commonJS({
40181
40181
  if (overflow && onOverflow)
40182
40182
  onOverflow();
40183
40183
  if (folds.length === 0)
40184
- return text3;
40184
+ return text4;
40185
40185
  if (onFold)
40186
40186
  onFold();
40187
- let res = text3.slice(0, folds[0]);
40187
+ let res = text4.slice(0, folds[0]);
40188
40188
  for (let i2 = 0; i2 < folds.length; ++i2) {
40189
40189
  const fold = folds[i2];
40190
- const end2 = folds[i2 + 1] || text3.length;
40190
+ const end2 = folds[i2 + 1] || text4.length;
40191
40191
  if (fold === 0)
40192
40192
  res = `
40193
- ${indent}${text3.slice(0, end2)}`;
40193
+ ${indent}${text4.slice(0, end2)}`;
40194
40194
  else {
40195
40195
  if (mode === FOLD_QUOTED && escapedFolds[fold])
40196
- res += `${text3[fold]}\\`;
40196
+ res += `${text4[fold]}\\`;
40197
40197
  res += `
40198
- ${indent}${text3.slice(fold + 1, end2)}`;
40198
+ ${indent}${text4.slice(fold + 1, end2)}`;
40199
40199
  }
40200
40200
  }
40201
40201
  return res;
40202
40202
  }
40203
- function consumeMoreIndentedLines(text3, i, indent) {
40203
+ function consumeMoreIndentedLines(text4, i, indent) {
40204
40204
  let end = i;
40205
40205
  let start = i + 1;
40206
- let ch = text3[start];
40206
+ let ch = text4[start];
40207
40207
  while (ch === " " || ch === " ") {
40208
40208
  if (i < start + indent) {
40209
- ch = text3[++i];
40209
+ ch = text4[++i];
40210
40210
  } else {
40211
40211
  do {
40212
- ch = text3[++i];
40212
+ ch = text4[++i];
40213
40213
  } while (ch && ch !== "\n");
40214
40214
  end = i;
40215
40215
  start = i + 1;
40216
- ch = text3[start];
40216
+ ch = text4[start];
40217
40217
  }
40218
40218
  }
40219
40219
  return end;
@@ -42564,9 +42564,9 @@ var require_Document = __commonJS({
42564
42564
  this.contents.add(value);
42565
42565
  }
42566
42566
  /** Adds a value to the document. */
42567
- addIn(path3, value) {
42567
+ addIn(path4, value) {
42568
42568
  if (assertCollection(this.contents))
42569
- this.contents.addIn(path3, value);
42569
+ this.contents.addIn(path4, value);
42570
42570
  }
42571
42571
  /**
42572
42572
  * Create a new `Alias` node, ensuring that the target `node` has the required anchor.
@@ -42641,14 +42641,14 @@ var require_Document = __commonJS({
42641
42641
  * Removes a value from the document.
42642
42642
  * @returns `true` if the item was found and removed.
42643
42643
  */
42644
- deleteIn(path3) {
42645
- if (Collection.isEmptyPath(path3)) {
42644
+ deleteIn(path4) {
42645
+ if (Collection.isEmptyPath(path4)) {
42646
42646
  if (this.contents == null)
42647
42647
  return false;
42648
42648
  this.contents = null;
42649
42649
  return true;
42650
42650
  }
42651
- return assertCollection(this.contents) ? this.contents.deleteIn(path3) : false;
42651
+ return assertCollection(this.contents) ? this.contents.deleteIn(path4) : false;
42652
42652
  }
42653
42653
  /**
42654
42654
  * Returns item at `key`, or `undefined` if not found. By default unwraps
@@ -42663,10 +42663,10 @@ var require_Document = __commonJS({
42663
42663
  * scalar values from their surrounding node; to disable set `keepScalar` to
42664
42664
  * `true` (collections are always returned intact).
42665
42665
  */
42666
- getIn(path3, keepScalar) {
42667
- if (Collection.isEmptyPath(path3))
42666
+ getIn(path4, keepScalar) {
42667
+ if (Collection.isEmptyPath(path4))
42668
42668
  return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
42669
- return identity.isCollection(this.contents) ? this.contents.getIn(path3, keepScalar) : void 0;
42669
+ return identity.isCollection(this.contents) ? this.contents.getIn(path4, keepScalar) : void 0;
42670
42670
  }
42671
42671
  /**
42672
42672
  * Checks if the document includes a value with the key `key`.
@@ -42677,10 +42677,10 @@ var require_Document = __commonJS({
42677
42677
  /**
42678
42678
  * Checks if the document includes a value at `path`.
42679
42679
  */
42680
- hasIn(path3) {
42681
- if (Collection.isEmptyPath(path3))
42680
+ hasIn(path4) {
42681
+ if (Collection.isEmptyPath(path4))
42682
42682
  return this.contents !== void 0;
42683
- return identity.isCollection(this.contents) ? this.contents.hasIn(path3) : false;
42683
+ return identity.isCollection(this.contents) ? this.contents.hasIn(path4) : false;
42684
42684
  }
42685
42685
  /**
42686
42686
  * Sets a value in this document. For `!!set`, `value` needs to be a
@@ -42697,13 +42697,13 @@ var require_Document = __commonJS({
42697
42697
  * Sets a value in this document. For `!!set`, `value` needs to be a
42698
42698
  * boolean to add/remove the item from the set.
42699
42699
  */
42700
- setIn(path3, value) {
42701
- if (Collection.isEmptyPath(path3)) {
42700
+ setIn(path4, value) {
42701
+ if (Collection.isEmptyPath(path4)) {
42702
42702
  this.contents = value;
42703
42703
  } else if (this.contents == null) {
42704
- this.contents = Collection.collectionFromPath(this.schema, Array.from(path3), value);
42704
+ this.contents = Collection.collectionFromPath(this.schema, Array.from(path4), value);
42705
42705
  } else if (assertCollection(this.contents)) {
42706
- this.contents.setIn(path3, value);
42706
+ this.contents.setIn(path4, value);
42707
42707
  }
42708
42708
  }
42709
42709
  /**
@@ -44660,9 +44660,9 @@ var require_cst_visit = __commonJS({
44660
44660
  visit.BREAK = BREAK;
44661
44661
  visit.SKIP = SKIP;
44662
44662
  visit.REMOVE = REMOVE;
44663
- visit.itemAtPath = (cst, path3) => {
44663
+ visit.itemAtPath = (cst, path4) => {
44664
44664
  let item = cst;
44665
- for (const [field, index] of path3) {
44665
+ for (const [field, index] of path4) {
44666
44666
  const tok = item?.[field];
44667
44667
  if (tok && "items" in tok) {
44668
44668
  item = tok.items[index];
@@ -44671,23 +44671,23 @@ var require_cst_visit = __commonJS({
44671
44671
  }
44672
44672
  return item;
44673
44673
  };
44674
- visit.parentCollection = (cst, path3) => {
44675
- const parent = visit.itemAtPath(cst, path3.slice(0, -1));
44676
- const field = path3[path3.length - 1][0];
44674
+ visit.parentCollection = (cst, path4) => {
44675
+ const parent = visit.itemAtPath(cst, path4.slice(0, -1));
44676
+ const field = path4[path4.length - 1][0];
44677
44677
  const coll = parent?.[field];
44678
44678
  if (coll && "items" in coll)
44679
44679
  return coll;
44680
44680
  throw new Error("Parent collection not found");
44681
44681
  };
44682
- function _visit(path3, item, visitor) {
44683
- let ctrl = visitor(item, path3);
44682
+ function _visit(path4, item, visitor) {
44683
+ let ctrl = visitor(item, path4);
44684
44684
  if (typeof ctrl === "symbol")
44685
44685
  return ctrl;
44686
44686
  for (const field of ["key", "value"]) {
44687
44687
  const token = item[field];
44688
44688
  if (token && "items" in token) {
44689
44689
  for (let i = 0; i < token.items.length; ++i) {
44690
- const ci = _visit(Object.freeze(path3.concat([[field, i]])), token.items[i], visitor);
44690
+ const ci = _visit(Object.freeze(path4.concat([[field, i]])), token.items[i], visitor);
44691
44691
  if (typeof ci === "number")
44692
44692
  i = ci - 1;
44693
44693
  else if (ci === BREAK)
@@ -44698,10 +44698,10 @@ var require_cst_visit = __commonJS({
44698
44698
  }
44699
44699
  }
44700
44700
  if (typeof ctrl === "function" && field === "key")
44701
- ctrl = ctrl(item, path3);
44701
+ ctrl = ctrl(item, path4);
44702
44702
  }
44703
44703
  }
44704
- return typeof ctrl === "function" ? ctrl(item, path3) : ctrl;
44704
+ return typeof ctrl === "function" ? ctrl(item, path4) : ctrl;
44705
44705
  }
44706
44706
  exports2.visit = visit;
44707
44707
  }
@@ -46503,12 +46503,15 @@ var VertuError = class extends Error {
46503
46503
  hint;
46504
46504
  /** 由服务端 HTTP 响应触发时的状态码;本地校验类错误为 undefined。 */
46505
46505
  statusCode;
46506
+ /** Machine-readable business error from the service or response validation. */
46507
+ code;
46506
46508
  constructor(message, options = {}) {
46507
46509
  super(message);
46508
46510
  this.name = "VertuError";
46509
46511
  this.exitCode = options.exitCode ?? 1;
46510
46512
  this.hint = options.hint;
46511
46513
  this.statusCode = options.statusCode;
46514
+ this.code = options.code;
46512
46515
  if (options.cause !== void 0) {
46513
46516
  this.cause = options.cause;
46514
46517
  }
@@ -46516,13 +46519,11 @@ var VertuError = class extends Error {
46516
46519
  };
46517
46520
  var RemoteError = class extends VertuError {
46518
46521
  status;
46519
- code;
46520
46522
  data;
46521
46523
  constructor(message, options = {}) {
46522
- super(message, { hint: options.hint, exitCode: options.exitCode });
46524
+ super(message, { hint: options.hint, exitCode: options.exitCode, code: options.code });
46523
46525
  this.name = "RemoteError";
46524
46526
  this.status = options.status;
46525
- this.code = options.code;
46526
46527
  this.data = options.data;
46527
46528
  }
46528
46529
  };
@@ -46755,12 +46756,12 @@ function readMacKeychainAgentKeySync(serviceBaseUrl, appId) {
46755
46756
  }
46756
46757
  }
46757
46758
  function readVpsServiceConnectionSync() {
46758
- const path3 = vpsServiceConfigFilePath();
46759
- if (!(0, import_node_fs2.existsSync)(path3)) {
46759
+ const path4 = vpsServiceConfigFilePath();
46760
+ if (!(0, import_node_fs2.existsSync)(path4)) {
46760
46761
  return {};
46761
46762
  }
46762
46763
  try {
46763
- const parsed = JSON.parse((0, import_node_fs2.readFileSync)(path3, "utf8"));
46764
+ const parsed = JSON.parse((0, import_node_fs2.readFileSync)(path4, "utf8"));
46764
46765
  const baseUrl4 = parsed.baseUrl?.trim() || void 0;
46765
46766
  const agentAppId = parsed.agentAppId?.trim() || void 0;
46766
46767
  return {
@@ -46842,6 +46843,127 @@ function vpsServiceAuthHeaders(serviceBaseUrl) {
46842
46843
  return headers3;
46843
46844
  }
46844
46845
 
46846
+ // src/core/store-reception-result.ts
46847
+ var COUNTS = ["walkin_groups", "walkin_people", "added_groups", "deal_groups", "wechat_add_count", "effective_customers", "effective_added", "touch_count", "use_count"];
46848
+ var AMOUNTS = ["deal_amount", "deal_amount_natural_flow", "deal_amount_after_sales", "deal_amount_appointment", "deal_amount_offline_referral", "deal_amount_other"];
46849
+ var RATES = ["group_add_rate_pct", "deal_rate_pct", "wechat_add_rate_pct", "effective_add_rate_pct", "touch_rate_pct", "use_rate_pct"];
46850
+ var text = (value) => typeof value === "string" ? value.trim() : "";
46851
+ function object(value) {
46852
+ return value && typeof value === "object" && !Array.isArray(value) ? value : null;
46853
+ }
46854
+ function expectedDates(params, now) {
46855
+ const start = text(params.start_date), end = text(params.end_date);
46856
+ if (start || end) return [start || end, end || start];
46857
+ const period = text(params.period) || "this_month";
46858
+ if (/^\d{4}-\d{2}-\d{2}$/.test(period)) return [period, period];
46859
+ const parts = new Intl.DateTimeFormat("en-CA", { timeZone: "Asia/Shanghai", year: "numeric", month: "2-digit", day: "2-digit" }).formatToParts(now);
46860
+ const part = (name) => Number(parts.find((p) => p.type === name)?.value);
46861
+ const y = part("year"), m = part("month"), d = part("day");
46862
+ const day = (year, month, date2) => new Date(Date.UTC(year, month - 1, date2));
46863
+ const fmt = (date2) => date2.toISOString().slice(0, 10);
46864
+ const today = day(y, m, d), weekday = (today.getUTCDay() + 6) % 7;
46865
+ let first, last = today;
46866
+ switch (period) {
46867
+ case "today":
46868
+ first = today;
46869
+ break;
46870
+ case "yesterday":
46871
+ first = last = day(y, m, d - 1);
46872
+ break;
46873
+ case "this_week":
46874
+ first = day(y, m, d - weekday);
46875
+ break;
46876
+ case "last_week":
46877
+ first = day(y, m, d - weekday - 7);
46878
+ last = day(y, m, d - weekday - 1);
46879
+ break;
46880
+ case "this_month":
46881
+ first = day(y, m, 1);
46882
+ break;
46883
+ case "last_month":
46884
+ first = day(y, m - 1, 1);
46885
+ last = day(y, m, 0);
46886
+ break;
46887
+ case "this_quarter":
46888
+ first = day(y, Math.floor((m - 1) / 3) * 3 + 1, 1);
46889
+ break;
46890
+ case "last_quarter":
46891
+ first = day(y, Math.floor((m - 1) / 3) * 3 - 2, 1);
46892
+ last = day(y, Math.floor((m - 1) / 3) * 3 + 1, 0);
46893
+ break;
46894
+ case "this_year":
46895
+ first = day(y, 1, 1);
46896
+ break;
46897
+ case "last_year":
46898
+ first = day(y - 1, 1, 1);
46899
+ last = day(y - 1, 12, 31);
46900
+ break;
46901
+ case "last_n_days": {
46902
+ const days = Number(params.days ?? 7);
46903
+ if (!Number.isInteger(days) || days < 1 || days > 3660) return null;
46904
+ first = day(y, m, d - days + 1);
46905
+ break;
46906
+ }
46907
+ default:
46908
+ return null;
46909
+ }
46910
+ return [fmt(first), fmt(last)];
46911
+ }
46912
+ function assertStoreReceptionResult(value, params, now = /* @__PURE__ */ new Date()) {
46913
+ const fail = () => {
46914
+ throw new VertuError("\u95E8\u5E97\u63A5\u5F85\u7ED3\u679C\u5C1A\u672A\u6838\u5B9E\uFF0C\u4E0D\u80FD\u6309\u96F6\u63A5\u5F85\u751F\u6210\u62A5\u8868", { statusCode: 503, code: "STORE_RECEPTION_RESULT_UNVERIFIED" });
46915
+ };
46916
+ const result = object(value), scope = object(result?.organization_scope), summary = object(result?.summary), filter = object(result?.filter), breakdowns = object(result?.breakdowns);
46917
+ if (!result || result.success !== true || !scope || scope.status !== "ok" || typeof scope.department_count !== "number" || !Number.isInteger(scope.department_count) || scope.department_count <= 0 || scope.region_count !== 4 || !summary || !filter || !breakdowns || !Array.isArray(result.rows)) return fail();
46918
+ const validRow = (row, roundingRows = 1) => {
46919
+ if (typeof row.region !== "string" || !row.region || typeof row.store !== "string" || !row.store) return false;
46920
+ for (const key of COUNTS) if (typeof row[key] !== "number" || !Number.isSafeInteger(row[key]) || Number(row[key]) < 0) return false;
46921
+ for (const key of [...AMOUNTS, ...RATES]) if (typeof row[key] !== "number" || !Number.isFinite(row[key])) return false;
46922
+ if (Math.abs(AMOUNTS.slice(1).reduce((sum, key) => sum + Number(row[key]), 0) - Number(row.deal_amount)) > 0.03 * roundingRows + 1e-7) return false;
46923
+ if (Number(row.added_groups) > Number(row.walkin_groups) || Number(row.deal_groups) > Number(row.walkin_groups) || Number(row.effective_added) > Number(row.effective_customers)) return false;
46924
+ for (const [key, numerator, denominator] of [["group_add_rate_pct", "added_groups", "walkin_groups"], ["deal_rate_pct", "deal_groups", "walkin_groups"], ["wechat_add_rate_pct", "wechat_add_count", "walkin_people"], ["effective_add_rate_pct", "effective_added", "effective_customers"], ["touch_rate_pct", "touch_count", "walkin_people"], ["use_rate_pct", "use_count", "walkin_people"]]) {
46925
+ const n = Number(row[numerator]), d = Number(row[denominator]);
46926
+ const expected2 = d > 0 ? Math.round((n * 100 / d + Number.EPSILON) * 100) / 100 : 0;
46927
+ if (Math.abs(Number(row[key]) - expected2) > 1e-5) return false;
46928
+ }
46929
+ return RATES.every((key) => Number(row[key]) >= 0);
46930
+ };
46931
+ if (!validRow(summary, Math.max(result.rows.length, 1))) return fail();
46932
+ const rows2 = [];
46933
+ for (const item of result.rows) {
46934
+ const row = object(item);
46935
+ if (!row || !validRow(row) || Number(row.walkin_groups) <= 0) return fail();
46936
+ rows2.push(row);
46937
+ }
46938
+ const empty = rows2.length === 0;
46939
+ if (result.data_status !== (empty ? "empty" : "ok")) return fail();
46940
+ for (const key of [...COUNTS, ...AMOUNTS]) {
46941
+ const total = rows2.reduce((sum, row) => sum + Number(row[key]), 0);
46942
+ if (Math.abs(total - Number(summary[key])) > 1e-5) return fail();
46943
+ }
46944
+ if (empty && RATES.some((key) => summary[key] !== 0)) return fail();
46945
+ for (const [dimension, items] of Object.entries(breakdowns)) {
46946
+ if (!Array.isArray(items)) return fail();
46947
+ for (const item of items) {
46948
+ const entry = object(item);
46949
+ if (!entry || typeof entry.name !== "string" || typeof entry.count !== "number" || !Number.isSafeInteger(entry.count) || entry.count < 0) return fail();
46950
+ if (dimension === "intended_products" && (typeof entry.amount_sum !== "number" || !Number.isFinite(entry.amount_sum))) return fail();
46951
+ }
46952
+ if (empty && items.some((item) => item.count !== 0 || item.amount_sum !== void 0 && item.amount_sum !== 0)) return fail();
46953
+ if (["reception_type", "time_period", "state"].includes(dimension) && items.reduce((sum, item) => sum + Number(item.count), 0) !== summary.walkin_groups) return fail();
46954
+ }
46955
+ if (!empty && ["reception_type", "time_period", "state"].some((key) => !Array.isArray(breakdowns[key]))) return fail();
46956
+ const expected = expectedDates(params, now);
46957
+ if (!expected || filter.start_date !== expected[0] || filter.end_date !== expected[1]) return fail();
46958
+ for (const date2 of expected) {
46959
+ const parsed = /* @__PURE__ */ new Date(`${date2}T00:00:00Z`);
46960
+ if (!Number.isFinite(parsed.getTime()) || parsed.toISOString().slice(0, 10) !== date2) return fail();
46961
+ }
46962
+ if (expected[0] > expected[1] || filter.source !== (text(params.source) || "store")) return fail();
46963
+ if (filter.department_id !== (params.department_id === void 0 ? null : Number(params.department_id))) return fail();
46964
+ if (filter.region !== (text(params.region) || null) || filter.store !== (text(params.store) || null) || filter.employee_name !== (text(params.employee_name) || text(params.employee) || null)) return fail();
46965
+ }
46966
+
46845
46967
  // src/core/sales-query-client.ts
46846
46968
  var DAILY_SALES_LOCAL = "vps-daily-sales-report";
46847
46969
  var DAILY_SALES_SERVER = "odoo-daily-sales-report";
@@ -46862,10 +46984,10 @@ var DEALER_OPS = "vps-dealer-ops";
46862
46984
  var DEFAULT_VPS_SERVICE_BASE_URL = "https://vps-service.vertu.cn";
46863
46985
  var dotenvCache2 = null;
46864
46986
  function readVpsServiceConnectionSync2() {
46865
- const path3 = vpsServiceConfigFilePath();
46866
- if ((0, import_node_fs3.existsSync)(path3)) {
46987
+ const path4 = vpsServiceConfigFilePath();
46988
+ if ((0, import_node_fs3.existsSync)(path4)) {
46867
46989
  try {
46868
- const parsed = JSON.parse((0, import_node_fs3.readFileSync)(path3, "utf8"));
46990
+ const parsed = JSON.parse((0, import_node_fs3.readFileSync)(path4, "utf8"));
46869
46991
  return {
46870
46992
  baseUrl: parsed.baseUrl?.trim() || void 0,
46871
46993
  apiKey: parsed.apiKey?.trim() || void 0,
@@ -47022,11 +47144,11 @@ function vpsServiceRequestLabel(skillKey, scriptKey) {
47022
47144
  return "Vertu \u6570\u636E\u67E5\u8BE2";
47023
47145
  }
47024
47146
  async function parseJsonBody(res, requestLabel) {
47025
- const text3 = await res.body.text();
47147
+ const text4 = await res.body.text();
47026
47148
  try {
47027
- return JSON.parse(text3);
47149
+ return JSON.parse(text4);
47028
47150
  } catch {
47029
- const preview3 = text3.replace(/\s+/g, " ").trim().slice(0, 240);
47151
+ const preview3 = text4.replace(/\s+/g, " ").trim().slice(0, 240);
47030
47152
  const detail = preview3 ? `\uFF1A${preview3}` : "";
47031
47153
  throw new VertuError(`${requestLabel} \u8FD4\u56DE\u975E JSON\uFF08HTTP ${res.statusCode}\uFF09${detail}`);
47032
47154
  }
@@ -47058,13 +47180,14 @@ async function tryVpsServiceExecute(skillKey, scriptKey, params, serviceBaseUrl)
47058
47180
  if (res.statusCode >= 400) {
47059
47181
  const errMsg = data && typeof data === "object" && "error" in data ? publicBusinessErrorMessage(data.error) : `HTTP ${res.statusCode}`;
47060
47182
  throw new VertuError(
47061
- `${requestLabel} \u5931\u8D25\uFF1A${errMsg}${errMsg === "Unauthorized" ? `\uFF08Agent/Bot/Hermes \u8BF7\u68C0\u67E5\u5BBF\u4E3B\u6CE8\u5165\u7684 app_key\uFF1B\u4EC5\u4EBA\u5DE5\u7528\u6237\u53EF\u4EA4\u4E92\u6267\u884C \`vps-work auth login\`\uFF09` : ""}`
47183
+ `${requestLabel} \u5931\u8D25\uFF1A${errMsg}${errMsg === "Unauthorized" ? `\uFF08Agent/Bot/Hermes \u8BF7\u68C0\u67E5\u5BBF\u4E3B\u6CE8\u5165\u7684 app_key\uFF1B\u4EC5\u4EBA\u5DE5\u7528\u6237\u53EF\u4EA4\u4E92\u6267\u884C \`vps-work auth login\`\uFF09` : ""}`,
47184
+ { statusCode: res.statusCode, code: data && typeof data === "object" && "code" in data && typeof data.code === "string" ? data.code : void 0 }
47062
47185
  );
47063
47186
  }
47064
- if (data && typeof data === "object" && "result" in data) {
47065
- return publicBusinessResult(data.result);
47066
- }
47067
- return publicBusinessResult(data);
47187
+ if (data && typeof data === "object" && "ok" in data && data.ok === false) throw new VertuError("\u4E1A\u52A1\u67E5\u8BE2\u672A\u6210\u529F\uFF0C\u4E0D\u80FD\u751F\u6210\u62A5\u8868", { statusCode: res.statusCode, code: "VPS_EXECUTE_FAILED" });
47188
+ const result = publicBusinessResult(data && typeof data === "object" && "result" in data ? data.result : data);
47189
+ if (skillKey === STORE_MANAGEMENT && scriptKey === "store_reception_summary") assertStoreReceptionResult(result, params);
47190
+ return result;
47068
47191
  }
47069
47192
  async function executeVpsServiceScript(skillKey, scriptKey, params, serviceBaseUrl) {
47070
47193
  const base = resolveVpsServiceUrl(serviceBaseUrl);
@@ -47085,17 +47208,17 @@ async function executeVpsServiceScript(skillKey, scriptKey, params, serviceBaseU
47085
47208
  const data = await parseJsonBody(res, requestLabel);
47086
47209
  if (res.statusCode >= 400) {
47087
47210
  const errMsg = data && typeof data === "object" && "error" in data ? publicBusinessErrorMessage(data.error) : `HTTP ${res.statusCode}`;
47088
- throw new VertuError(`${requestLabel} \u5931\u8D25\uFF1A${errMsg}`);
47089
- }
47090
- if (data && typeof data === "object" && "result" in data) {
47091
- return publicBusinessResult(data.result);
47211
+ throw new VertuError(`${requestLabel} \u5931\u8D25\uFF1A${errMsg}`, { statusCode: res.statusCode, code: data && typeof data === "object" && "code" in data && typeof data.code === "string" ? data.code : void 0 });
47092
47212
  }
47093
- return publicBusinessResult(data);
47213
+ if (data && typeof data === "object" && "ok" in data && data.ok === false) throw new VertuError("\u4E1A\u52A1\u67E5\u8BE2\u672A\u6210\u529F\uFF0C\u4E0D\u80FD\u751F\u6210\u62A5\u8868", { statusCode: res.statusCode, code: "VPS_EXECUTE_FAILED" });
47214
+ const result = publicBusinessResult(data && typeof data === "object" && "result" in data ? data.result : data);
47215
+ if (skillKey === STORE_MANAGEMENT && scriptKey === "store_reception_summary") assertStoreReceptionResult(result, params);
47216
+ return result;
47094
47217
  }
47095
47218
  async function trySalesQueryExecute(skillKey, scriptKey, params, serviceBaseUrl) {
47096
47219
  return tryVpsServiceExecute(skillKey, scriptKey, params, serviceBaseUrl);
47097
47220
  }
47098
- async function vpsServiceGet(path3, query2, serviceBaseUrl, requestLabel = "Vertu \u670D\u52A1") {
47221
+ async function vpsServiceGet(path4, query2, serviceBaseUrl, requestLabel = "Vertu \u670D\u52A1") {
47099
47222
  const base = resolveVpsServiceUrl(serviceBaseUrl);
47100
47223
  const qs = new URLSearchParams();
47101
47224
  for (const [key, value] of Object.entries(query2)) {
@@ -47104,11 +47227,11 @@ async function vpsServiceGet(path3, query2, serviceBaseUrl, requestLabel = "Vert
47104
47227
  }
47105
47228
  }
47106
47229
  const suffix = qs.toString() ? `?${qs.toString()}` : "";
47107
- const res = await (0, import_undici.request)(`${base}${path3}${suffix}`, {
47230
+ const res = await (0, import_undici.request)(`${base}${path4}${suffix}`, {
47108
47231
  method: "GET",
47109
47232
  headers: serviceHeaders(base, {
47110
47233
  "x-vertu-request-kind": "rest",
47111
- "x-vertu-rest-path": path3
47234
+ "x-vertu-rest-path": path4
47112
47235
  })
47113
47236
  });
47114
47237
  const data = await parseJsonBody(res, requestLabel);
@@ -47123,13 +47246,13 @@ async function vpsServiceGet(path3, query2, serviceBaseUrl, requestLabel = "Vert
47123
47246
  }
47124
47247
  return data;
47125
47248
  }
47126
- async function vpsServicePost(path3, body, serviceBaseUrl, requestLabel = "Vertu \u670D\u52A1") {
47249
+ async function vpsServicePost(path4, body, serviceBaseUrl, requestLabel = "Vertu \u670D\u52A1") {
47127
47250
  const base = resolveVpsServiceUrl(serviceBaseUrl);
47128
- const res = await (0, import_undici.request)(`${base}${path3}`, {
47251
+ const res = await (0, import_undici.request)(`${base}${path4}`, {
47129
47252
  method: "POST",
47130
47253
  headers: serviceHeaders(base, {
47131
47254
  "x-vertu-request-kind": "rest",
47132
- "x-vertu-rest-path": path3
47255
+ "x-vertu-rest-path": path4
47133
47256
  }),
47134
47257
  body: JSON.stringify(body)
47135
47258
  });
@@ -47144,9 +47267,9 @@ async function vpsServicePost(path3, body, serviceBaseUrl, requestLabel = "Vertu
47144
47267
  }
47145
47268
  return data;
47146
47269
  }
47147
- async function vpsServiceMultipartPost(path3, body, serviceBaseUrl, requestLabel = "Vertu \u670D\u52A1") {
47270
+ async function vpsServiceMultipartPost(path4, body, serviceBaseUrl, requestLabel = "Vertu \u670D\u52A1") {
47148
47271
  const base = resolveVpsServiceUrl(serviceBaseUrl);
47149
- const res = await (0, import_undici.request)(`${base}${path3}`, {
47272
+ const res = await (0, import_undici.request)(`${base}${path4}`, {
47150
47273
  method: "POST",
47151
47274
  headers: vpsServiceAuthHeaders(base),
47152
47275
  body
@@ -47212,12 +47335,12 @@ async function runVpsServiceDataView(viewId, filters, optionsOrLimit, serviceBas
47212
47335
  // src/utils/read-text.ts
47213
47336
  var import_promises = require("fs/promises");
47214
47337
  var UTF8_BOM = "\uFEFF";
47215
- async function readUtf8File(path3) {
47216
- const text3 = await (0, import_promises.readFile)(path3, "utf8");
47217
- return stripBom(text3);
47338
+ async function readUtf8File(path4) {
47339
+ const text4 = await (0, import_promises.readFile)(path4, "utf8");
47340
+ return stripBom(text4);
47218
47341
  }
47219
- function stripBom(text3) {
47220
- return text3.startsWith(UTF8_BOM) ? text3.slice(UTF8_BOM.length) : text3;
47342
+ function stripBom(text4) {
47343
+ return text4.startsWith(UTF8_BOM) ? text4.slice(UTF8_BOM.length) : text4;
47221
47344
  }
47222
47345
  async function readStdinText() {
47223
47346
  const stdin = process.stdin;
@@ -47329,7 +47452,7 @@ function printShortcutResult(opts, result) {
47329
47452
  console.log(typeof result === "string" ? result : JSON.stringify(result));
47330
47453
  }
47331
47454
  }
47332
- function previewShortcutRequest(opts, cmd, method, path3, payload = {}) {
47455
+ function previewShortcutRequest(opts, cmd, method, path4, payload = {}) {
47333
47456
  if (!isValidateOnly(opts)) {
47334
47457
  return false;
47335
47458
  }
@@ -47337,7 +47460,7 @@ function previewShortcutRequest(opts, cmd, method, path3, payload = {}) {
47337
47460
  printShortcutResult(opts, {
47338
47461
  validateOnly: true,
47339
47462
  method,
47340
- endpoint: `${baseUrl4}${path3}`,
47463
+ endpoint: `${baseUrl4}${path4}`,
47341
47464
  ...payload
47342
47465
  });
47343
47466
  return true;
@@ -47394,6 +47517,55 @@ function attachSharedShortcutOptions(cmd) {
47394
47517
  ).option("--params-file <path>", "Read --params from file (mutually exclusive with --params)").option("--validate-only", "Preview request payload without executing/querying", false).option("--dry-run", "Alias for --validate-only", false).option("--no-json", "Print plain text instead of formatted JSON");
47395
47518
  }
47396
47519
 
47520
+ // src/commands/manufacturing/index.ts
47521
+ function buildManufacturingCommand() {
47522
+ const parent = new Command("manufacturing").description("\u751F\u4EA7\u5236\u9020\uFF1A\u5168\u4EA7\u54C1\u7EBF\u751F\u4EA7\u8BA2\u5355\u3001\u5DE5\u5E8F\u5DE5\u5355\u3001\u9886\u6599\u4E0E\u9000\u6599\u53EA\u8BFB\u67E5\u8BE2\uFF08\u72EC\u7ACB\u6743\u9650\uFF09");
47523
+ for (const [name, script, operation, description] of [
47524
+ ["+orders", "production_orders", "list", "\u751F\u4EA7\u8BA2\u5355\u5217\u8868"],
47525
+ ["+orders-detail", "production_orders", "detail", "\u751F\u4EA7\u8BA2\u5355\u8BE6\u60C5"],
47526
+ ["+orders-lines", "production_orders", "lines", "\u751F\u4EA7\u8BA2\u5355\u660E\u7EC6\u5206\u9875"],
47527
+ ["+workorders", "workorders", "list", "\u5DE5\u5E8F\u5DE5\u5355\u5217\u8868"],
47528
+ ["+workorders-detail", "workorders", "detail", "\u5DE5\u5E8F\u5DE5\u5355\u8BE6\u60C5"],
47529
+ ["+workorders-lines", "workorders", "lines", "\u5DE5\u5E8F\u5DE5\u5355\u660E\u7EC6\u5206\u9875"],
47530
+ ["+requisitions", "requisitions", "list", "\u9886\u6599\u5355\u5217\u8868"],
47531
+ ["+requisitions-detail", "requisitions", "detail", "\u9886\u6599\u5355\u8BE6\u60C5"],
47532
+ ["+requisitions-lines", "requisitions", "lines", "\u9886\u6599\u5355\u660E\u7EC6\u5206\u9875"],
47533
+ ["+returns", "returns", "list", "\u9000\u6599\u5355\u5217\u8868"],
47534
+ ["+returns-detail", "returns", "detail", "\u9000\u6599\u5355\u8BE6\u60C5"],
47535
+ ["+returns-lines", "returns", "lines", "\u9000\u6599\u5355\u660E\u7EC6\u5206\u9875"]
47536
+ ]) {
47537
+ const cmd = parent.command(name).description(description).option("--document-number <number>", "\u5B8C\u6574\u5355\u53F7\uFF0C\u7CBE\u786E\u5339\u914D");
47538
+ if (operation === "list") cmd.option("--status <status>", "\u6765\u6E90\u7CFB\u7EDF\u72B6\u6001").option("--keyword <text>", "\u5355\u53F7\u5173\u952E\u8BCD").option("--production-id <id>", "\u5173\u8054\u751F\u4EA7\u8BA2\u5355 ID").option("--product-id <id>", "\u4EA7\u54C1\u53D8\u4F53 ID\uFF08\u9886\u9000\u6599\u6309\u7269\u6599\u7B5B\u9009\uFF09").option("--company-id <id>", "\u516C\u53F8 ID").option("--start-date <YYYY-MM-DD>", "\u8D77\u59CB\u65E5\u671F\uFF08\u4E0A\u6D77\u65F6\u533A\uFF0C\u5305\u542B\uFF09").option("--end-date <YYYY-MM-DD>", "\u7ED3\u675F\u65E5\u671F\uFF08\u4E0A\u6D77\u65F6\u533A\uFF0C\u5305\u542B\uFF09");
47539
+ else cmd.option("--id <id>", "ERP \u5355\u636E\u6574\u6570 ID\uFF08\u4E0E\u5B8C\u6574\u5355\u53F7\u4E8C\u9009\u4E00\uFF09");
47540
+ if (operation !== "detail") cmd.option("--limit <n>", "\u6BCF\u9875\u6761\u6570\uFF0C1\u2013100").option("--offset <n>", "\u5206\u9875\u504F\u79FB");
47541
+ attachSharedShortcutOptions(cmd).action(async (opts, command) => {
47542
+ const params = { operation };
47543
+ for (const [key, value] of Object.entries({
47544
+ id: opts.id,
47545
+ production_id: opts.productionId,
47546
+ product_id: opts.productId,
47547
+ document_number: opts.documentNumber,
47548
+ status: opts.status,
47549
+ keyword: opts.keyword,
47550
+ company_id: opts.companyId,
47551
+ start_date: opts.startDate,
47552
+ end_date: opts.endDate,
47553
+ limit: opts.limit,
47554
+ offset: opts.offset
47555
+ })) if (value !== void 0) params[key] = value;
47556
+ const payload = await mergeShortcutParams(params, opts);
47557
+ const baseUrl4 = resolveShortcutVpsServiceUrl(opts, command);
47558
+ if (isValidateOnly(opts)) {
47559
+ console.log(JSON.stringify({ validateOnly: true, source: "vps-service-execute", endpoint: `${baseUrl4}/v1/execute`, skill_key: "vps-manufacturing", script_key: script, params: payload }, null, 2));
47560
+ return;
47561
+ }
47562
+ const result = await executeVpsServiceScript("vps-manufacturing", script, payload, baseUrl4);
47563
+ console.log(typeof result === "string" && opts.json === false ? result : JSON.stringify(result, null, 2));
47564
+ });
47565
+ }
47566
+ return parent;
47567
+ }
47568
+
47397
47569
  // src/commands/purchase/index.ts
47398
47570
  function buildPurchaseCommand() {
47399
47571
  const parent = new Command("purchase").description("\u91C7\u8D2D\u7533\u8BF7\u3001\u91C7\u8D2D\u8BA2\u5355\u53CA\u660E\u7EC6\u53EA\u8BFB\u67E5\u8BE2\uFF08\u72EC\u7ACB\u6743\u9650\uFF09");
@@ -47924,11 +48096,11 @@ var defaultTheme = {
47924
48096
  style: {
47925
48097
  answer: import_yoctocolors_cjs.default.cyan,
47926
48098
  message: import_yoctocolors_cjs.default.bold,
47927
- error: (text3) => import_yoctocolors_cjs.default.red(`> ${text3}`),
47928
- defaultAnswer: (text3) => import_yoctocolors_cjs.default.dim(`(${text3})`),
48099
+ error: (text4) => import_yoctocolors_cjs.default.red(`> ${text4}`),
48100
+ defaultAnswer: (text4) => import_yoctocolors_cjs.default.dim(`(${text4})`),
47929
48101
  help: import_yoctocolors_cjs.default.dim,
47930
48102
  highlight: import_yoctocolors_cjs.default.cyan,
47931
- key: (text3) => import_yoctocolors_cjs.default.cyan(import_yoctocolors_cjs.default.bold(`<${text3}>`))
48103
+ key: (text4) => import_yoctocolors_cjs.default.cyan(import_yoctocolors_cjs.default.bold(`<${text4}>`))
47932
48104
  }
47933
48105
  };
47934
48106
 
@@ -48588,9 +48760,9 @@ var checkboxTheme = {
48588
48760
  cursor: esm_default.pointer
48589
48761
  },
48590
48762
  style: {
48591
- disabledChoice: (text3) => import_yoctocolors_cjs3.default.dim(`- ${text3}`),
48763
+ disabledChoice: (text4) => import_yoctocolors_cjs3.default.dim(`- ${text4}`),
48592
48764
  renderSelectedChoices: (selectedChoices) => selectedChoices.map((choice) => choice.short).join(", "),
48593
- description: (text3) => import_yoctocolors_cjs3.default.cyan(text3),
48765
+ description: (text4) => import_yoctocolors_cjs3.default.cyan(text4),
48594
48766
  keysHelpTip: (keys) => keys.map(([key, action2]) => `${import_yoctocolors_cjs3.default.bold(key)} ${import_yoctocolors_cjs3.default.dim(action2)}`).join(import_yoctocolors_cjs3.default.dim(" \u2022 "))
48595
48767
  },
48596
48768
  helpMode: "always",
@@ -48813,8 +48985,8 @@ var RemoveFileError = class extends Error {
48813
48985
  };
48814
48986
 
48815
48987
  // node_modules/@inquirer/external-editor/dist/esm/index.js
48816
- function editAsync(text3 = "", callback, fileOptions) {
48817
- const editor = new ExternalEditor(text3, fileOptions);
48988
+ function editAsync(text4 = "", callback, fileOptions) {
48989
+ const editor = new ExternalEditor(text4, fileOptions);
48818
48990
  editor.runAsync((err, result) => {
48819
48991
  if (err) {
48820
48992
  setImmediate(callback, err, void 0);
@@ -48864,8 +49036,8 @@ var ExternalEditor = class {
48864
49036
  console.log("DEPRECATED: last_exit_status. Use lastExitStatus moving forward.");
48865
49037
  return this.lastExitStatus;
48866
49038
  }
48867
- constructor(text3 = "", fileOptions) {
48868
- this.text = text3;
49039
+ constructor(text4 = "", fileOptions) {
49040
+ this.text = text4;
48869
49041
  if (fileOptions) {
48870
49042
  this.fileOptions = fileOptions;
48871
49043
  }
@@ -49507,9 +49679,9 @@ var import_yoctocolors_cjs6 = __toESM(require_yoctocolors_cjs(), 1);
49507
49679
  var searchTheme = {
49508
49680
  icon: { cursor: esm_default.pointer },
49509
49681
  style: {
49510
- disabled: (text3) => import_yoctocolors_cjs6.default.dim(`- ${text3}`),
49511
- searchTerm: (text3) => import_yoctocolors_cjs6.default.cyan(text3),
49512
- description: (text3) => import_yoctocolors_cjs6.default.cyan(text3),
49682
+ disabled: (text4) => import_yoctocolors_cjs6.default.dim(`- ${text4}`),
49683
+ searchTerm: (text4) => import_yoctocolors_cjs6.default.cyan(text4),
49684
+ description: (text4) => import_yoctocolors_cjs6.default.cyan(text4),
49513
49685
  keysHelpTip: (keys) => keys.map(([key, action2]) => `${import_yoctocolors_cjs6.default.bold(key)} ${import_yoctocolors_cjs6.default.dim(action2)}`).join(import_yoctocolors_cjs6.default.dim(" \u2022 "))
49514
49686
  },
49515
49687
  helpMode: "always"
@@ -49678,8 +49850,8 @@ var import_yoctocolors_cjs7 = __toESM(require_yoctocolors_cjs(), 1);
49678
49850
  var selectTheme = {
49679
49851
  icon: { cursor: esm_default.pointer },
49680
49852
  style: {
49681
- disabled: (text3) => import_yoctocolors_cjs7.default.dim(`- ${text3}`),
49682
- description: (text3) => import_yoctocolors_cjs7.default.cyan(text3),
49853
+ disabled: (text4) => import_yoctocolors_cjs7.default.dim(`- ${text4}`),
49854
+ description: (text4) => import_yoctocolors_cjs7.default.cyan(text4),
49683
49855
  keysHelpTip: (keys) => keys.map(([key, action2]) => `${import_yoctocolors_cjs7.default.bold(key)} ${import_yoctocolors_cjs7.default.dim(action2)}`).join(import_yoctocolors_cjs7.default.dim(" \u2022 "))
49684
49856
  },
49685
49857
  helpMode: "always",
@@ -50058,10 +50230,10 @@ var util;
50058
50230
  return obj[e];
50059
50231
  });
50060
50232
  };
50061
- util2.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object) => {
50233
+ util2.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object2) => {
50062
50234
  const keys = [];
50063
- for (const key in object) {
50064
- if (Object.prototype.hasOwnProperty.call(object, key)) {
50235
+ for (const key in object2) {
50236
+ if (Object.prototype.hasOwnProperty.call(object2, key)) {
50065
50237
  keys.push(key);
50066
50238
  }
50067
50239
  }
@@ -50392,8 +50564,8 @@ function getErrorMap() {
50392
50564
 
50393
50565
  // node_modules/zod/v3/helpers/parseUtil.js
50394
50566
  var makeIssue = (params) => {
50395
- const { data, path: path3, errorMaps, issueData } = params;
50396
- const fullPath = [...path3, ...issueData.path || []];
50567
+ const { data, path: path4, errorMaps, issueData } = params;
50568
+ const fullPath = [...path4, ...issueData.path || []];
50397
50569
  const fullIssue = {
50398
50570
  ...issueData,
50399
50571
  path: fullPath
@@ -50509,11 +50681,11 @@ var errorUtil;
50509
50681
 
50510
50682
  // node_modules/zod/v3/types.js
50511
50683
  var ParseInputLazyPath = class {
50512
- constructor(parent, value, path3, key) {
50684
+ constructor(parent, value, path4, key) {
50513
50685
  this._cachedPath = [];
50514
50686
  this.parent = parent;
50515
50687
  this.data = value;
50516
- this._path = path3;
50688
+ this._path = path4;
50517
50689
  this._key = key;
50518
50690
  }
50519
50691
  get path() {
@@ -53969,12 +54141,12 @@ var VpsServiceConfigSchema = external_exports.object({
53969
54141
  apiKey: external_exports.string().optional()
53970
54142
  });
53971
54143
  var EMPTY_VPS_SERVICE_CONFIG = { version: 1 };
53972
- async function tryRestrictPermissions(path3) {
54144
+ async function tryRestrictPermissions(path4) {
53973
54145
  if (process.platform === "win32") {
53974
54146
  return;
53975
54147
  }
53976
54148
  try {
53977
- await (0, import_promises2.chmod)(path3, 384);
54149
+ await (0, import_promises2.chmod)(path4, 384);
53978
54150
  } catch {
53979
54151
  }
53980
54152
  }
@@ -54009,9 +54181,9 @@ async function migrateLegacySalesQueryBlock() {
54009
54181
  }
54010
54182
  }
54011
54183
  async function readVpsServiceConfig() {
54012
- const path3 = vpsServiceConfigFilePath();
54184
+ const path4 = vpsServiceConfigFilePath();
54013
54185
  try {
54014
- const raw = await readUtf8File(path3);
54186
+ const raw = await readUtf8File(path4);
54015
54187
  return VpsServiceConfigSchema.parse(JSON.parse(raw));
54016
54188
  } catch (err) {
54017
54189
  if (err.code !== "ENOENT") {
@@ -54025,12 +54197,12 @@ async function readVpsServiceConfig() {
54025
54197
  }
54026
54198
  }
54027
54199
  async function writeVpsServiceConfig(config) {
54028
- const path3 = vpsServiceConfigFilePath();
54029
- await (0, import_promises2.mkdir)((0, import_node_path4.dirname)(path3), { recursive: true });
54200
+ const path4 = vpsServiceConfigFilePath();
54201
+ await (0, import_promises2.mkdir)((0, import_node_path4.dirname)(path4), { recursive: true });
54030
54202
  const payload = VpsServiceConfigSchema.parse(config);
54031
- await (0, import_promises2.writeFile)(path3, `${JSON.stringify(payload, null, 2)}
54203
+ await (0, import_promises2.writeFile)(path4, `${JSON.stringify(payload, null, 2)}
54032
54204
  `, { encoding: "utf8", mode: 384 });
54033
- await tryRestrictPermissions(path3);
54205
+ await tryRestrictPermissions(path4);
54034
54206
  }
54035
54207
 
54036
54208
  // src/core/vps-service-auth.ts
@@ -54129,10 +54301,10 @@ async function loginVpsServiceWithPassword(serviceBaseUrl, login, password) {
54129
54301
  headers: headers3,
54130
54302
  body: JSON.stringify({ login, password })
54131
54303
  });
54132
- const text3 = await res.body.text();
54304
+ const text4 = await res.body.text();
54133
54305
  let data;
54134
54306
  try {
54135
- data = JSON.parse(text3);
54307
+ data = JSON.parse(text4);
54136
54308
  } catch {
54137
54309
  throw new VertuError(`Vertu \u767B\u5F55\u5931\u8D25\uFF1A\u975E JSON \u54CD\u5E94\uFF08HTTP ${res.statusCode}\uFF09`);
54138
54310
  }
@@ -54170,10 +54342,10 @@ async function fetchVpsServiceMe(serviceBaseUrl, sessionToken) {
54170
54342
  ...expectedUserId && /^[1-9]\d*$/.test(expectedUserId) ? { "x-vertu-expected-user-id": expectedUserId } : {}
54171
54343
  }
54172
54344
  });
54173
- const text3 = await res.body.text();
54345
+ const text4 = await res.body.text();
54174
54346
  let data;
54175
54347
  try {
54176
- data = JSON.parse(text3);
54348
+ data = JSON.parse(text4);
54177
54349
  } catch {
54178
54350
  throw new VertuError(`Vertu \u8EAB\u4EFD\u67E5\u8BE2\u5931\u8D25\uFF1A\u975E JSON \u54CD\u5E94\uFF08HTTP ${res.statusCode}\uFF09`);
54179
54351
  }
@@ -54199,10 +54371,10 @@ async function bindVpsServiceAgentCredential(serviceBaseUrl, sessionToken, appId
54199
54371
  },
54200
54372
  body: JSON.stringify({ app_id: appId })
54201
54373
  });
54202
- const text3 = await res.body.text();
54374
+ const text4 = await res.body.text();
54203
54375
  let data;
54204
54376
  try {
54205
- data = JSON.parse(text3);
54377
+ data = JSON.parse(text4);
54206
54378
  } catch {
54207
54379
  throw new VertuError(`Agent \u7ED1\u5B9A\u5931\u8D25\uFF1A\u975E JSON\uFF08HTTP ${res.statusCode}\uFF09`);
54208
54380
  }
@@ -54306,10 +54478,10 @@ async function logoutVpsServiceRemote() {
54306
54478
  } catch {
54307
54479
  }
54308
54480
  }
54309
- function parseJsonObject(text3, statusCode, label) {
54481
+ function parseJsonObject(text4, statusCode, label) {
54310
54482
  let data;
54311
54483
  try {
54312
- data = JSON.parse(text3);
54484
+ data = JSON.parse(text4);
54313
54485
  } catch {
54314
54486
  throw new VertuError(`${label}\u5931\u8D25\uFF1A\u975E JSON\uFF08HTTP ${statusCode}\uFF09`);
54315
54487
  }
@@ -54461,10 +54633,10 @@ async function fetchVpsUserScopes(serviceBaseUrl, scopeCheck) {
54461
54633
  ...headers3
54462
54634
  }
54463
54635
  });
54464
- const text3 = await res.body.text();
54636
+ const text4 = await res.body.text();
54465
54637
  let data;
54466
54638
  try {
54467
- data = JSON.parse(text3);
54639
+ data = JSON.parse(text4);
54468
54640
  } catch {
54469
54641
  throw new VertuError(`\u67E5\u8BE2 scope \u5931\u8D25\uFF1A\u975E JSON\uFF08HTTP ${res.statusCode}\uFF09`);
54470
54642
  }
@@ -54482,6 +54654,9 @@ function userHasVpsScope(scopes, required4) {
54482
54654
  if (!scope) {
54483
54655
  return false;
54484
54656
  }
54657
+ if (scope === "logistics.customs.all:read" || scope === "manufacturing.all:read" || scope === "okr.scoring:write") {
54658
+ return scopes.includes(scope);
54659
+ }
54485
54660
  if (scope === "hr.payslip.dept:read") {
54486
54661
  return scopes.includes(scope) || scopes.includes("hr.payslip.dept:*");
54487
54662
  }
@@ -54491,6 +54666,7 @@ function userHasVpsScope(scopes, required4) {
54491
54666
  if (scope === "sales.pii:read") {
54492
54667
  return scopes.includes(scope) || scopes.includes("sales.pii:*");
54493
54668
  }
54669
+ if (scope === "sales.group_customers:read") return scopes.includes(scope);
54494
54670
  if (scope === "sales.customer_region.all:read") {
54495
54671
  return scopes.includes(scope) || scopes.includes("sales.customer_region.all:*");
54496
54672
  }
@@ -54800,14 +54976,14 @@ function headers(baseUrl4) {
54800
54976
  };
54801
54977
  }
54802
54978
  async function parseJson(res) {
54803
- const text3 = await res.body.text();
54979
+ const text4 = await res.body.text();
54804
54980
  try {
54805
- return text3.trim() ? JSON.parse(text3) : {};
54981
+ return text4.trim() ? JSON.parse(text4) : {};
54806
54982
  } catch {
54807
54983
  throw new VertuError(`Vertu \u670D\u52A1\u8FD4\u56DE\u975E JSON\uFF08HTTP ${res.statusCode}\uFF09`);
54808
54984
  }
54809
54985
  }
54810
- function buildPath(path3, query2) {
54986
+ function buildPath(path4, query2) {
54811
54987
  const search = new URLSearchParams();
54812
54988
  for (const [key, value] of Object.entries(query2 ?? {})) {
54813
54989
  if (value === void 0 || value === null || value === "") {
@@ -54816,11 +54992,11 @@ function buildPath(path3, query2) {
54816
54992
  search.set(key, String(value));
54817
54993
  }
54818
54994
  const q = search.toString();
54819
- return q ? `${path3}?${q}` : path3;
54995
+ return q ? `${path4}?${q}` : path4;
54820
54996
  }
54821
- async function imRequest(method, path3, opts = {}) {
54997
+ async function imRequest(method, path4, opts = {}) {
54822
54998
  const base = resolveVpsServiceUrl(opts.baseUrl);
54823
- const res = await (0, import_undici4.request)(`${base}${buildPath(path3, opts.query)}`, {
54999
+ const res = await (0, import_undici4.request)(`${base}${buildPath(path4, opts.query)}`, {
54824
55000
  method,
54825
55001
  headers: headers(base),
54826
55002
  body: opts.body === void 0 ? void 0 : JSON.stringify(opts.body)
@@ -54875,14 +55051,14 @@ function collaborationTurnFromHistory(out, requestId) {
54875
55051
  if (!metadata || typeof metadata !== "object" || Array.isArray(metadata)) continue;
54876
55052
  const envelope = metadata[HARNESS_COLLABORATION_KIND];
54877
55053
  if (!envelope || typeof envelope !== "object" || Array.isArray(envelope)) continue;
54878
- const record4 = envelope;
54879
- const turn = Number(record4.turn);
54880
- if (record4.request_id !== requestId || record4.type !== "request" && record4.type !== "response" || !Number.isInteger(turn) || turn <= 0) continue;
55054
+ const record5 = envelope;
55055
+ const turn = Number(record5.turn);
55056
+ if (record5.request_id !== requestId || record5.type !== "request" && record5.type !== "response" || !Number.isInteger(turn) || turn <= 0) continue;
54881
55057
  return {
54882
55058
  body: typeof message.body === "string" ? message.body : "",
54883
55059
  messageId: typeof message.id === "string" ? message.id : "",
54884
55060
  turn,
54885
- type: record4.type
55061
+ type: record5.type
54886
55062
  };
54887
55063
  }
54888
55064
  return null;
@@ -55364,21 +55540,21 @@ function headers2() {
55364
55540
  };
55365
55541
  }
55366
55542
  async function parseJson2(res) {
55367
- const text3 = await res.body.text();
55543
+ const text4 = await res.body.text();
55368
55544
  try {
55369
- return text3.trim() ? JSON.parse(text3) : {};
55545
+ return text4.trim() ? JSON.parse(text4) : {};
55370
55546
  } catch {
55371
55547
  throw new VertuError(`Hermes \u670D\u52A1\u8FD4\u56DE\u975E JSON\uFF08HTTP ${res.statusCode}\uFF09`);
55372
55548
  }
55373
55549
  }
55374
- async function hermesRequest(method, path3, opts = {}) {
55550
+ async function hermesRequest(method, path4, opts = {}) {
55375
55551
  const base = resolveHermesAgentAdminUrl(opts.baseUrl);
55376
55552
  const target = new URL(base);
55377
55553
  const trusted = new URL(resolveHermesAgentAdminUrl());
55378
55554
  if (target.origin !== trusted.origin || target.username || target.password || target.search || target.hash || target.pathname !== "/") {
55379
55555
  throw new VertuError("Hermes \u8BF7\u6C42\u76EE\u6807\u4E0D\u53D7\u4FE1\u4EFB\uFF1B\u8BF7\u7531\u5BBF\u4E3B\u914D\u7F6E\u670D\u52A1\u5730\u5740\uFF0C\u4E0D\u80FD\u901A\u8FC7\u4E34\u65F6\u53C2\u6570\u8F6C\u53D1\u51ED\u636E\u3002");
55380
55556
  }
55381
- const res = await (0, import_undici5.request)(`${base}${path3}`, {
55557
+ const res = await (0, import_undici5.request)(`${base}${path4}`, {
55382
55558
  method,
55383
55559
  headers: headers2(),
55384
55560
  body: opts.body === void 0 ? void 0 : JSON.stringify(opts.body)
@@ -55435,9 +55611,9 @@ function resolveImAttachmentDownloadPath(serviceBaseUrl, input) {
55435
55611
  }
55436
55612
  return parsed.pathname;
55437
55613
  }
55438
- async function responseError(status, text3) {
55614
+ async function responseError(status, text4) {
55439
55615
  try {
55440
- const payload = JSON.parse(text3);
55616
+ const payload = JSON.parse(text4);
55441
55617
  if (payload.error) return new VertuError(`\u804A\u5929\u9644\u4EF6\u4E0B\u8F7D\u5931\u8D25\uFF1A${String(payload.error)}`);
55442
55618
  } catch {
55443
55619
  }
@@ -55469,8 +55645,8 @@ async function downloadImAttachment(input) {
55469
55645
  });
55470
55646
  }
55471
55647
  if (response.statusCode >= 400) {
55472
- const text3 = await response.body.text();
55473
- throw await responseError(response.statusCode, text3);
55648
+ const text4 = await response.body.text();
55649
+ throw await responseError(response.statusCode, text4);
55474
55650
  }
55475
55651
  if (response.statusCode < 200 || response.statusCode >= 300) {
55476
55652
  await response.body.dump();
@@ -55775,17 +55951,17 @@ function printUsersPlain(users) {
55775
55951
  \u5458\u5DE5\u540D\u5355\uFF08${users.length} \u4EBA\uFF09`);
55776
55952
  const byDepartment = /* @__PURE__ */ new Map();
55777
55953
  for (const user of users) {
55778
- const path3 = user.department_path || user.department_name || "\u672A\u5206\u914D\u90E8\u95E8";
55779
- const rows2 = byDepartment.get(path3) ?? [];
55954
+ const path4 = user.department_path || user.department_name || "\u672A\u5206\u914D\u90E8\u95E8";
55955
+ const rows2 = byDepartment.get(path4) ?? [];
55780
55956
  rows2.push(user);
55781
- byDepartment.set(path3, rows2);
55957
+ byDepartment.set(path4, rows2);
55782
55958
  }
55783
- for (const [path3, rows2] of [...byDepartment.entries()].sort(([a], [b]) => a.localeCompare(b, "zh-CN"))) {
55959
+ for (const [path4, rows2] of [...byDepartment.entries()].sort(([a], [b]) => a.localeCompare(b, "zh-CN"))) {
55784
55960
  const names = rows2.map((user) => {
55785
55961
  const name = user.employee_name || user.login;
55786
55962
  return user.job_title ? `${name}\uFF08${user.job_title}\uFF09` : name;
55787
55963
  }).sort((a, b) => a.localeCompare(b, "zh-CN"));
55788
- console.log(`- ${path3}\uFF08${rows2.length}\uFF09\uFF1A${names.join("\u3001")}`);
55964
+ console.log(`- ${path4}\uFF08${rows2.length}\uFF09\uFF1A${names.join("\u3001")}`);
55789
55965
  }
55790
55966
  }
55791
55967
  async function fetchOrgUsers(baseUrlValue, departmentPath) {
@@ -56343,8 +56519,8 @@ function attachImShortcuts(parent) {
56343
56519
  500,
56344
56520
  1e4
56345
56521
  );
56346
- const path3 = `/v1/im/audit/attachments/${encodeURIComponent(attachmentId)}/content`;
56347
- let out = await imRequest("POST", path3, {
56522
+ const path4 = `/v1/im/audit/attachments/${encodeURIComponent(attachmentId)}/content`;
56523
+ let out = await imRequest("POST", path4, {
56348
56524
  baseUrl: baseUrl2(opts, cmd),
56349
56525
  body: { access_reason: accessReason }
56350
56526
  });
@@ -56352,7 +56528,7 @@ function attachImShortcuts(parent) {
56352
56528
  const deadline = Date.now() + waitSeconds * 1e3;
56353
56529
  while ((document.status === "pending" || document.status === "processing") && Date.now() < deadline) {
56354
56530
  await (0, import_promises7.setTimeout)(Math.min(pollIntervalMs, Math.max(1, deadline - Date.now())));
56355
- out = await imRequest("GET", path3, {
56531
+ out = await imRequest("GET", path4, {
56356
56532
  baseUrl: baseUrl2(opts, cmd),
56357
56533
  query: {
56358
56534
  access_reason: accessReason,
@@ -56778,8 +56954,8 @@ function attachImShortcuts(parent) {
56778
56954
  parent.command("+bots").description("\u6211\u7684\u673A\u5668\u4EBA\u5217\u8868").option("--include-public", "\u540C\u65F6\u5217\u51FA\u5176\u4ED6\u4EBA\u7684\u516C\u5F00\u673A\u5668\u4EBA")
56779
56955
  ).action(
56780
56956
  async (opts, cmd) => {
56781
- const path3 = opts.includePublic ? "/v1/im/user-robots?include_public=true" : "/v1/im/user-robots";
56782
- print(opts, await imRequest("GET", path3, { baseUrl: baseUrl2(opts, cmd) }));
56957
+ const path4 = opts.includePublic ? "/v1/im/user-robots?include_public=true" : "/v1/im/user-robots";
56958
+ print(opts, await imRequest("GET", path4, { baseUrl: baseUrl2(opts, cmd) }));
56783
56959
  }
56784
56960
  );
56785
56961
  attachSharedShortcutOptions(
@@ -56879,8 +57055,8 @@ var import_node_path7 = require("path");
56879
57055
  var import_promises9 = require("stream/promises");
56880
57056
  var import_undici7 = __toESM(require_undici(), 1);
56881
57057
  var timeout = 30 * 6e4;
56882
- function mailUrl(path3, scope, query2 = {}) {
56883
- const url = new URL(`${resolveVpsServiceUrl(scope.baseUrl).replace(/\/$/, "")}/v1/mail${path3}`);
57058
+ function mailUrl(path4, scope, query2 = {}) {
57059
+ const url = new URL(`${resolveVpsServiceUrl(scope.baseUrl).replace(/\/$/, "")}/v1/mail${path4}`);
56884
57060
  for (const [key, value] of Object.entries(query2)) {
56885
57061
  if (value !== void 0 && value !== "") url.searchParams.set(key, String(value));
56886
57062
  }
@@ -56888,10 +57064,10 @@ function mailUrl(path3, scope, query2 = {}) {
56888
57064
  return url.toString();
56889
57065
  }
56890
57066
  async function jsonResponse(res) {
56891
- const text3 = await res.body.text();
57067
+ const text4 = await res.body.text();
56892
57068
  let data;
56893
57069
  try {
56894
- data = text3 ? JSON.parse(text3) : {};
57070
+ data = text4 ? JSON.parse(text4) : {};
56895
57071
  } catch {
56896
57072
  throw new VertuError(`\u90AE\u7BB1\u670D\u52A1\u8FD4\u56DE\u975E JSON\uFF08HTTP ${res.statusCode}\uFF09`);
56897
57073
  }
@@ -56902,8 +57078,8 @@ async function jsonResponse(res) {
56902
57078
  }
56903
57079
  return data;
56904
57080
  }
56905
- async function mailRequest(method, path3, scope, body, query2) {
56906
- const url = mailUrl(path3, scope, query2);
57081
+ async function mailRequest(method, path4, scope, body, query2) {
57082
+ const url = mailUrl(path4, scope, query2);
56907
57083
  return jsonResponse(await (0, import_undici7.request)(url, {
56908
57084
  method,
56909
57085
  headersTimeout: timeout,
@@ -56962,9 +57138,9 @@ function addresses(values = []) {
56962
57138
  return { email };
56963
57139
  });
56964
57140
  }
56965
- function preview(opts, method, path3, body, query2) {
57141
+ function preview(opts, method, path4, body, query2) {
56966
57142
  if (!opts.dryRun && !opts.validateOnly) return false;
56967
- printImResult(opts.json, { validateOnly: true, method, endpoint: mailUrl(path3, opts, query2), ...body ? { body } : {} });
57143
+ printImResult(opts.json, { validateOnly: true, method, endpoint: mailUrl(path4, opts, query2), ...body ? { body } : {} });
56968
57144
  return true;
56969
57145
  }
56970
57146
  function attachEmailCommands(parent) {
@@ -56976,7 +57152,7 @@ function attachEmailCommands(parent) {
56976
57152
  }
56977
57153
  return opts;
56978
57154
  };
56979
- for (const [name, path3, description] of [
57155
+ for (const [name, path4, description] of [
56980
57156
  ["+account", "/account", "\u67E5\u770B\u5F53\u524D\u90AE\u7BB1\u53CA\u6743\u9650"],
56981
57157
  ["+mailboxes", "/shared-mailboxes", "\u5217\u51FA\u53EF\u89C1\u7684\u90E8\u95E8\u90AE\u7BB1\u53CA\u6210\u5458\u89D2\u8272"],
56982
57158
  ["+folders", "/folders", "\u5217\u51FA\u6587\u4EF6\u5939\u3001\u90AE\u4EF6\u6570\u4E0E\u672A\u8BFB\u6570"],
@@ -56984,8 +57160,8 @@ function attachEmailCommands(parent) {
56984
57160
  ]) {
56985
57161
  command(name, description).action(async (_, cmd) => {
56986
57162
  const opts = options(cmd);
56987
- if (preview(opts, "GET", path3)) return;
56988
- printImResult(opts.json, await mailRequest("GET", path3, opts));
57163
+ if (preview(opts, "GET", path4)) return;
57164
+ printImResult(opts.json, await mailRequest("GET", path4, opts));
56989
57165
  });
56990
57166
  }
56991
57167
  command("+messages", "\u67E5\u8BE2\u5DF2\u6536\u53D6\u7684\u90AE\u4EF6\uFF0C\u652F\u6301\u641C\u7D22\u3001\u6587\u4EF6\u5939\u4E0E\u6E38\u6807\u7FFB\u9875").option("--folder-id <id>", "\u6587\u4EF6\u5939 ID\uFF08\u89C1 +folders\uFF09").option("--search <text>", "\u641C\u7D22\u6587\u5B57").option("--limit <n>", "\u6BCF\u9875\u6570\u91CF\uFF0C1\u2013100", "50").option("--cursor <cursor>", "\u4E0A\u4E00\u9875 next_cursor").option("--unread-only", "\u53EA\u67E5\u8BE2\u672A\u8BFB\u90AE\u4EF6").action(async (_, cmd) => {
@@ -57000,15 +57176,15 @@ function attachEmailCommands(parent) {
57000
57176
  ["+submission", "submissions", "\u67E5\u8BE2\u53D1\u9001\u63D0\u4EA4\u72B6\u6001"]
57001
57177
  ]) {
57002
57178
  command(name, description).requiredOption("--id <id>", "\u90AE\u4EF6\u6216\u53D1\u9001\u63D0\u4EA4 ID").action(async (_, cmd) => {
57003
- const opts = options(cmd), path3 = `/${resource}/${encodeURIComponent(opts.id)}`;
57004
- if (preview(opts, "GET", path3)) return;
57005
- printImResult(opts.json, await mailRequest("GET", path3, opts));
57179
+ const opts = options(cmd), path4 = `/${resource}/${encodeURIComponent(opts.id)}`;
57180
+ if (preview(opts, "GET", path4)) return;
57181
+ printImResult(opts.json, await mailRequest("GET", path4, opts));
57006
57182
  });
57007
57183
  }
57008
57184
  command("+mark-read", "\u6807\u8BB0\u90AE\u4EF6\u5DF2\u8BFB\uFF08\u53EA\u8BFB\u6210\u5458\u4E0D\u53EF\u7528\uFF09").requiredOption("--id <id>", "\u90AE\u4EF6 ID").action(async (_, cmd) => {
57009
- const opts = options(cmd), path3 = `/messages/${encodeURIComponent(opts.id)}`;
57010
- if (preview(opts, "PATCH", path3, { unread: false })) return;
57011
- printImResult(opts.json, await mailRequest("PATCH", path3, opts, { unread: false }));
57185
+ const opts = options(cmd), path4 = `/messages/${encodeURIComponent(opts.id)}`;
57186
+ if (preview(opts, "PATCH", path4, { unread: false })) return;
57187
+ printImResult(opts.json, await mailRequest("PATCH", path4, opts, { unread: false }));
57012
57188
  });
57013
57189
  for (const draft of [false, true]) {
57014
57190
  const c = command(draft ? "+draft" : "+send-email", draft ? "\u4FDD\u5B58\u90AE\u4EF6\u8349\u7A3F\uFF0C\u4E0D\u53D1\u9001" : "\u53D1\u9001\u771F\u5B9E\u7535\u5B50\u90AE\u4EF6\uFF08\u4FDD\u7559 +send \u7684 IM \u79C1\u4FE1\u517C\u5BB9\u884C\u4E3A\uFF09").requiredOption("--to <email>", "\u6536\u4EF6\u5730\u5740\uFF0C\u53EF\u91CD\u590D\u6216\u9017\u53F7\u5206\u9694", collect, []).option("--cc <email>", "\u6284\u9001\u5730\u5740\uFF0C\u53EF\u91CD\u590D", collect, []).option("--bcc <email>", "\u5BC6\u9001\u5730\u5740\uFF0C\u53EF\u91CD\u590D", collect, []).requiredOption("--subject <text>", "\u90AE\u4EF6\u4E3B\u9898").option("--body <text>", "\u7EAF\u6587\u672C\u6B63\u6587").option("--body-file <path>", "\u4ECE UTF-8 \u6587\u4EF6\u8BFB\u53D6\u6B63\u6587\uFF08\u4E0E --body \u4E92\u65A5\uFF09").option("--body-html-file <path>", "\u4ECE UTF-8 \u6587\u4EF6\u8BFB\u53D6 HTML \u6B63\u6587\uFF0C\u4FDD\u7559\u7EAF\u6587\u672C\u6B63\u6587\u4F5C\u4E3A\u540E\u5907").option("--attachment-id <id>", "+upload \u8FD4\u56DE\u7684\u9644\u4EF6 ID\uFF0C\u53EF\u91CD\u590D\uFF1B\u987B\u5C5E\u4E8E\u540C\u4E00\u90AE\u7BB1", collect, []);
@@ -57028,10 +57204,10 @@ function attachEmailCommands(parent) {
57028
57204
  attachment_ids: opts.attachmentId,
57029
57205
  ...!draft ? { client_request_id: opts.requestId, identity_id: opts.identityId, reply_to_message_id: opts.replyTo } : {}
57030
57206
  };
57031
- const path3 = draft ? "/drafts" : "/messages/send";
57032
- if (preview(opts, "POST", path3, body)) return;
57207
+ const path4 = draft ? "/drafts" : "/messages/send";
57208
+ if (preview(opts, "POST", path4, body)) return;
57033
57209
  try {
57034
- printImResult(opts.json, await mailRequest("POST", path3, opts, body));
57210
+ printImResult(opts.json, await mailRequest("POST", path4, opts, body));
57035
57211
  } catch (e) {
57036
57212
  throw new VertuError(`${e instanceof Error ? e.message : String(e)}${draft ? "" : `\uFF1B\u53D1\u9001\u7ED3\u679C\u53EF\u80FD\u5F85\u786E\u8BA4\uFF0C\u8BF7\u4F7F\u7528\u539F request-id ${opts.requestId} \u548C\u76F8\u540C\u5185\u5BB9\u91CD\u8BD5\uFF0C\u4E0D\u8981\u6539\u7528\u65B0\u7F16\u53F7\u3002`}`);
57037
57213
  }
@@ -57043,8 +57219,8 @@ function attachEmailCommands(parent) {
57043
57219
  printImResult(opts.json, await uploadMailFile(opts.file, opts));
57044
57220
  });
57045
57221
  command("+download", "\u6D41\u5F0F\u4E0B\u8F7D\u90AE\u4EF6\u9644\u4EF6\uFF1B\u76EE\u6807\u6587\u4EF6\u5DF2\u5B58\u5728\u65F6\u62D2\u7EDD\u8986\u76D6").requiredOption("--id <blob-id>", "+read \u8FD4\u56DE\u7684\u9644\u4EF6 blob_id").requiredOption("--output <path>", "\u672C\u5730\u8F93\u51FA\u8DEF\u5F84").action(async (_, cmd) => {
57046
- const opts = options(cmd), path3 = `/attachments/${encodeURIComponent(opts.id)}`;
57047
- if (preview(opts, "GET", path3, { output: opts.output })) return;
57222
+ const opts = options(cmd), path4 = `/attachments/${encodeURIComponent(opts.id)}`;
57223
+ if (preview(opts, "GET", path4, { output: opts.output })) return;
57048
57224
  printImResult(opts.json, await downloadMailFile(opts.id, opts.output, opts));
57049
57225
  });
57050
57226
  }
@@ -57099,6 +57275,74 @@ function buildMailCommand() {
57099
57275
  return mail;
57100
57276
  }
57101
57277
 
57278
+ // ../../shared/okr/cli-scoring.ts
57279
+ function record(value, keys) {
57280
+ if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error("\u53C2\u6570\u5FC5\u987B\u662F\u5BF9\u8C61");
57281
+ const row = value;
57282
+ for (const key of Object.keys(row)) if (!keys.includes(key)) throw new Error(`\u4E0D\u652F\u6301\u7684\u53C2\u6570\uFF1A${key}`);
57283
+ return row;
57284
+ }
57285
+ function integer(value, name, min = 1) {
57286
+ if (typeof value !== "number" && !(typeof value === "string" && /^\d+$/.test(value))) throw new Error(`${name} \u5FC5\u987B\u662F\u6574\u6570`);
57287
+ const n = Number(value);
57288
+ if (!Number.isSafeInteger(n) || n < min) throw new Error(`${name} \u5FC5\u987B\u662F\u5927\u4E8E\u7B49\u4E8E ${min} \u7684\u5B89\u5168\u6574\u6570`);
57289
+ return n;
57290
+ }
57291
+ function parseCliOkrScore(value) {
57292
+ const row = record(value, ["key_result_id", "score_level", "score", "comment", "expected_revision", "acting_department_id"]);
57293
+ if (typeof row.score_level !== "string" || !["self", "primary", "secondary"].includes(row.score_level)) throw new Error("score_level \u5FC5\u987B\u662F self\u3001primary \u6216 secondary");
57294
+ if (typeof row.score !== "number" && !(typeof row.score === "string" && /^\d+(\.\d+)?$/.test(row.score))) throw new Error("score \u5FC5\u987B\u662F 0\u2013100 \u7684\u6570\u5B57");
57295
+ const score = Number(row.score);
57296
+ if (!Number.isFinite(score) || score < 0 || score > 100) throw new Error("score \u5FC5\u987B\u662F 0\u2013100 \u7684\u6570\u5B57");
57297
+ if (typeof row.comment !== "string" || !row.comment.trim() || row.comment.length > 1e4) throw new Error("comment \u5FC5\u987B\u586B\u5199\u8BC4\u5206\u4F9D\u636E\uFF0C\u6700\u591A 10000 \u5B57\u7B26");
57298
+ return {
57299
+ key_result_id: integer(row.key_result_id, "key_result_id"),
57300
+ score_level: row.score_level,
57301
+ score,
57302
+ comment: row.comment,
57303
+ expected_revision: integer(row.expected_revision, "expected_revision", 0),
57304
+ ...row.acting_department_id === void 0 ? {} : { acting_department_id: integer(row.acting_department_id, "acting_department_id") }
57305
+ };
57306
+ }
57307
+ function parseCliOkrScoreContext(value) {
57308
+ const row = record(value, ["period", "owner_type", "owner_id", "acting_department_id"]);
57309
+ if (typeof row.period !== "string" || !/^\d{4}-(0[1-9]|1[0-2])$/.test(row.period)) throw new Error("period \u5FC5\u987B\u662F YYYY-MM");
57310
+ if (row.owner_type !== "person" && row.owner_type !== "department") throw new Error("owner_type \u5FC5\u987B\u662F person \u6216 department");
57311
+ return {
57312
+ period: row.period,
57313
+ owner_type: row.owner_type,
57314
+ owner_id: integer(row.owner_id, "owner_id"),
57315
+ ...row.acting_department_id === void 0 ? {} : { acting_department_id: integer(row.acting_department_id, "acting_department_id") }
57316
+ };
57317
+ }
57318
+
57319
+ // src/commands/okr/scoring.ts
57320
+ var path3 = "/v1/okr/scoring";
57321
+ function attachOkrScoring(okr) {
57322
+ attachSharedShortcutOptions(okr.command("+score-context").description("\u8BFB\u53D6\u6B63\u5F0F\u8BC4\u5206\u4F9D\u636E\u3001\u8BC4\u5206\u72B6\u6001\u548C revision\uFF08\u9700\u72EC\u7ACB okr.scoring:write\uFF09").requiredOption("--period <YYYY-MM>", "\u8BC4\u5206\u5468\u671F").requiredOption("--owner-type <type>", "person \u6216 department").requiredOption("--owner-id <id>", "\u8BC4\u5206\u5BF9\u8C61 ID").option("--acting-department-id <id>", "\u5DF2\u6709\u6388\u6743\u7684\u4EE3\u7406\u90E8\u95E8")).action(async (opts, cmd) => {
57323
+ const query2 = { ...parseCliOkrScoreContext(await mergeShortcutParams({
57324
+ period: opts.period,
57325
+ owner_type: opts.ownerType,
57326
+ owner_id: opts.ownerId,
57327
+ ...opts.actingDepartmentId === void 0 ? {} : { acting_department_id: opts.actingDepartmentId }
57328
+ }, opts)) };
57329
+ if (previewShortcutRequest(opts, cmd, "GET", path3, { query: query2 })) return;
57330
+ printImResult(opts.json, await imRequest("GET", path3, { baseUrl: resolveShortcutVpsServiceUrl(opts, cmd), query: query2 }));
57331
+ });
57332
+ attachSharedShortcutOptions(okr.command("+score").description("\u63D0\u4EA4\u6B63\u5F0F OKR \u5206\u6570\uFF1B\u9ED8\u8BA4\u4EC5\u9884\u89C8\uFF0C--yes \u63D0\u4EA4\uFF1B\u51B2\u7A81\u6216\u7ED3\u679C\u4E0D\u660E\u65F6\u5148\u8BFB\u53D6\u6838\u5B9E\uFF0C\u7981\u6B62\u76F2\u91CD\u8BD5").requiredOption("--key-result-id <id>", "\u6B63\u5F0F KR ID").requiredOption("--level <level>", "self\u3001primary \u6216 secondary").requiredOption("--score <score>", "0\u2013100").requiredOption("--comment <text>", "\u8BC4\u5206\u4F9D\u636E").requiredOption("--expected-revision <revision>", "\u8BFB\u53D6\u5230\u7684\u672C\u7EA7\u8BC4\u5206\u7248\u672C\uFF1B\u5C1A\u65E0\u672C\u7EA7\u8BC4\u5206\u4E3A 0").option("--acting-department-id <id>", "\u5DF2\u6709\u6388\u6743\u7684\u4EE3\u7406\u90E8\u95E8").option("--yes", "\u786E\u8BA4\u63D0\u4EA4\u672C\u6B21\u8BC4\u5206", false)).action(async (opts, cmd) => {
57333
+ const body = { ...parseCliOkrScore(await mergeShortcutParams({
57334
+ key_result_id: opts.keyResultId,
57335
+ score_level: opts.level,
57336
+ score: opts.score,
57337
+ comment: opts.comment,
57338
+ expected_revision: opts.expectedRevision,
57339
+ ...opts.actingDepartmentId === void 0 ? {} : { acting_department_id: opts.actingDepartmentId }
57340
+ }, opts)) };
57341
+ if (previewShortcutRequest({ ...opts, validateOnly: opts.validateOnly || !opts.yes }, cmd, "POST", path3, { body })) return;
57342
+ printImResult(opts.json, await imRequest("POST", path3, { baseUrl: resolveShortcutVpsServiceUrl(opts, cmd), body }));
57343
+ });
57344
+ }
57345
+
57102
57346
  // src/commands/okr/shortcuts.ts
57103
57347
  var OKR_SKILL = "vps-okr-management-assistant";
57104
57348
  function requireOkrPeriod(opts) {
@@ -57175,9 +57419,10 @@ function attachOkrShortcuts(parent) {
57175
57419
  // src/commands/okr/index.ts
57176
57420
  function buildOkrCommand() {
57177
57421
  const okr = new Command("okr").description(
57178
- "OKR\uFF08\u6309\u5468\u671F\u8BFB\u53D6\u6B63\u5F0F\u5173\u7CFB\u8868\u6216\u5386\u53F2\u8868\uFF0C\u542B\u7EC4\u7EC7\u6811\uFF09\uFF1A+dept-okr\u3001+employee-okr \u7B49\u3002"
57422
+ "OKR\uFF08\u6309\u5468\u671F\u8BFB\u53D6\u6B63\u5F0F\u5173\u7CFB\u8868\u6216\u5386\u53F2\u8868\uFF0C\u542B\u7EC4\u7EC7\u6811\uFF09\uFF1A+dept-okr\u3001+employee-okr\uFF1B\u72EC\u7ACB\u6388\u6743\u6253\u5206\uFF1A+score-context\u3001+score\u3002"
57179
57423
  );
57180
57424
  attachOkrShortcuts(okr);
57425
+ attachOkrScoring(okr);
57181
57426
  return okr;
57182
57427
  }
57183
57428
 
@@ -57378,9 +57623,9 @@ function attachReportShortcuts(parent) {
57378
57623
  if (typeof body.tomorrow !== "string" || body.tomorrow.trim().length === 0) {
57379
57624
  throw new VertuError("--tomorrow is required.");
57380
57625
  }
57381
- const path3 = "/v1/daily-report/submit-existing-progress";
57382
- if (previewShortcutRequest(opts, cmd, "POST", path3, { body })) return;
57383
- const result = await imRequest("POST", path3, {
57626
+ const path4 = "/v1/daily-report/submit-existing-progress";
57627
+ if (previewShortcutRequest(opts, cmd, "POST", path4, { body })) return;
57628
+ const result = await imRequest("POST", path4, {
57384
57629
  baseUrl: resolveBaseUrl(opts, cmd),
57385
57630
  body
57386
57631
  });
@@ -57428,12 +57673,12 @@ function buildReportCommand() {
57428
57673
  }
57429
57674
 
57430
57675
  // src/commands/attendance/scheduling.ts
57431
- function text(value, flag) {
57676
+ function text2(value, flag) {
57432
57677
  if (typeof value !== "string" || !value.trim()) throw new VertuError(`${flag} must not be empty.`);
57433
57678
  return value.trim();
57434
57679
  }
57435
57680
  function date(value, flag) {
57436
- const result = text(value, flag);
57681
+ const result = text2(value, flag);
57437
57682
  const parsed = /* @__PURE__ */ new Date(`${result}T00:00:00.000Z`);
57438
57683
  if (!/^\d{4}-\d{2}-\d{2}$/.test(result) || Number.isNaN(parsed.getTime()) || parsed.toISOString().slice(0, 10) !== result) {
57439
57684
  throw new VertuError(`${flag} must be a valid YYYY-MM-DD date.`);
@@ -57465,8 +57710,8 @@ function normalizeRange(input) {
57465
57710
  return result;
57466
57711
  }
57467
57712
  function normalizePlan(input, apply) {
57468
- const ruleID = text(input.rule_id, "rule_id");
57469
- const mode = input.mode === void 0 ? "fill_missing" : text(input.mode, "mode");
57713
+ const ruleID = text2(input.rule_id, "rule_id");
57714
+ const mode = input.mode === void 0 ? "fill_missing" : text2(input.mode, "mode");
57470
57715
  if (!["fill_missing", "replace"].includes(mode)) throw new VertuError("mode must be fill_missing or replace.");
57471
57716
  if (!Array.isArray(input.items) || input.items.length < 1 || input.items.length > 5e3) throw new VertuError("items must contain 1 to 5000 schedule entries.");
57472
57717
  const keys = /* @__PURE__ */ new Set();
@@ -57477,8 +57722,8 @@ function normalizePlan(input, apply) {
57477
57722
  const item = raw;
57478
57723
  const employeeID = positive(item.employee_id, `items[${index}].employee_id`);
57479
57724
  const workDate = date(item.work_date, `items[${index}].work_date`);
57480
- const shiftTemplateID = text(item.shift_template_id, `items[${index}].shift_template_id`);
57481
- const remark = item.remark === void 0 ? void 0 : text(item.remark, `items[${index}].remark`);
57725
+ const shiftTemplateID = text2(item.shift_template_id, `items[${index}].shift_template_id`);
57726
+ const remark = item.remark === void 0 ? void 0 : text2(item.remark, `items[${index}].remark`);
57482
57727
  const key = `${employeeID}:${workDate}`;
57483
57728
  if (keys.has(key)) throw new VertuError(`Duplicate schedule entry for ${key}.`);
57484
57729
  keys.add(key);
@@ -57492,8 +57737,8 @@ function normalizePlan(input, apply) {
57492
57737
  if (rangeDays > 93) throw new VertuError("A schedule plan cannot span more than 93 days.");
57493
57738
  const result = { ...input, rule_id: ruleID, mode, items };
57494
57739
  if (apply) {
57495
- result.preview_token = text(input.preview_token, "preview_token");
57496
- result.client_request_id = text(input.client_request_id, "client_request_id");
57740
+ result.preview_token = text2(input.preview_token, "preview_token");
57741
+ result.client_request_id = text2(input.client_request_id, "client_request_id");
57497
57742
  } else {
57498
57743
  delete result.preview_token;
57499
57744
  delete result.client_request_id;
@@ -57508,10 +57753,10 @@ async function basePlan(opts) {
57508
57753
  const shorthandUsed = Boolean(opts.employeeIds || opts.fromDate || opts.toDate || opts.shiftTemplateId);
57509
57754
  if (items !== void 0 && shorthandUsed) throw new VertuError("--items/--items-file cannot be combined with range shorthand options.");
57510
57755
  if (items === void 0 && shorthandUsed) {
57511
- const employeeIDs = text(opts.employeeIds, "--employee-ids").split(",").map((value) => positive(value.trim(), "--employee-ids"));
57756
+ const employeeIDs = text2(opts.employeeIds, "--employee-ids").split(",").map((value) => positive(value.trim(), "--employee-ids"));
57512
57757
  const from = date(opts.fromDate, "--from-date");
57513
57758
  const to = date(opts.toDate, "--to-date");
57514
- const shift = text(opts.shiftTemplateId, "--shift-template-id");
57759
+ const shift = text2(opts.shiftTemplateId, "--shift-template-id");
57515
57760
  const days = (Date.parse(`${to}T00:00:00Z`) - Date.parse(`${from}T00:00:00Z`)) / 864e5 + 1;
57516
57761
  if (days < 1 || days > 93) throw new VertuError("The schedule date range must contain 1 to 93 days.");
57517
57762
  items = [];
@@ -57528,38 +57773,38 @@ async function basePlan(opts) {
57528
57773
  function baseURL(opts, cmd) {
57529
57774
  return opts.baseUrl ?? cmd.optsWithGlobals().baseUrl;
57530
57775
  }
57531
- function preview2(opts, cmd, method, path3, payload) {
57776
+ function preview2(opts, cmd, method, path4, payload) {
57532
57777
  if (opts.validateOnly !== true && opts.dryRun !== true) return false;
57533
- printImResult(opts.json, { validateOnly: true, method, endpoint: `${resolveVpsServiceUrl(baseURL(opts, cmd))}${path3}`, ...payload });
57778
+ printImResult(opts.json, { validateOnly: true, method, endpoint: `${resolveVpsServiceUrl(baseURL(opts, cmd))}${path4}`, ...payload });
57534
57779
  return true;
57535
57780
  }
57536
57781
  function attachAttendanceSchedulingShortcuts(parent) {
57537
57782
  attachSharedShortcutOptions(parent.command("+schedule-rules").description("\u67E5\u8BE2\u5F53\u524D\u7528\u6237\u53EF\u6267\u884C\u6392\u73ED\u7684\u8003\u52E4\u89C4\u5219")).action(async (opts, cmd) => {
57538
- const path3 = "/v1/attendance/scheduling/rules";
57539
- if (preview2(opts, cmd, "GET", path3, {})) return;
57540
- printImResult(opts.json, await imRequest("GET", path3, { baseUrl: baseURL(opts, cmd) }));
57783
+ const path4 = "/v1/attendance/scheduling/rules";
57784
+ if (preview2(opts, cmd, "GET", path4, {})) return;
57785
+ printImResult(opts.json, await imRequest("GET", path4, { baseUrl: baseURL(opts, cmd) }));
57541
57786
  });
57542
57787
  attachSharedShortcutOptions(parent.command("+schedule-shifts").description("\u67E5\u8BE2\u89C4\u5219\u4E0B\u53EF\u7528\u548C\u4E0D\u53EF\u7528\u73ED\u6B21").requiredOption("--rule-id <id>").option("--availability <value>", "all|available|unavailable", "all")).action(async (opts, cmd) => {
57543
57788
  const params = await mergeShortcutParams({ availability: opts.availability }, opts);
57544
- const ruleID = text(params.rule_id ?? opts.ruleId, "rule_id");
57545
- const availability = text(params.availability ?? "all", "availability");
57789
+ const ruleID = text2(params.rule_id ?? opts.ruleId, "rule_id");
57790
+ const availability = text2(params.availability ?? "all", "availability");
57546
57791
  if (!["all", "available", "unavailable"].includes(availability)) throw new VertuError("availability must be all, available, or unavailable.");
57547
- const path3 = `/v1/attendance/scheduling/rules/${encodeURIComponent(ruleID)}/shifts`;
57792
+ const path4 = `/v1/attendance/scheduling/rules/${encodeURIComponent(ruleID)}/shifts`;
57548
57793
  const query2 = { availability };
57549
- if (preview2(opts, cmd, "GET", path3, { query: query2 })) return;
57550
- printImResult(opts.json, await imRequest("GET", path3, { baseUrl: baseURL(opts, cmd), query: query2 }));
57794
+ if (preview2(opts, cmd, "GET", path4, { query: query2 })) return;
57795
+ printImResult(opts.json, await imRequest("GET", path4, { baseUrl: baseURL(opts, cmd), query: query2 }));
57551
57796
  });
57552
57797
  for (const [name, description] of [["+schedule-members", "\u67E5\u8BE2\u89C4\u5219\u4E0B\u4EBA\u5458\u53CA\u6392\u73ED\u4E8B\u5B9E"], ["+schedules", "\u67E5\u8BE2\u89C4\u5219\u4E0B\u6392\u73ED\u8BE6\u60C5"]]) {
57553
57798
  attachSharedShortcutOptions(parent.command(name).description(description).requiredOption("--rule-id <id>").requiredOption("--from-date <ymd>").requiredOption("--to-date <ymd>").option("--employee-id <id>").option("--department-id <id>").option("--query <text>").option("--page <n>", "\u9875\u7801", "1").option("--page-size <n>", "\u6BCF\u9875\u4EBA\u6570\uFF0C\u6700\u5927 200", "100")).action(async (opts, cmd) => {
57554
57799
  const merged = await mergeShortcutParams({ rule_id: opts.ruleId, from_date: opts.fromDate, to_date: opts.toDate, employee_id: opts.employeeId, department_id: opts.departmentId, query: opts.query, page: opts.page, page_size: opts.pageSize }, opts);
57555
- const ruleID = text(merged.rule_id, "rule_id");
57800
+ const ruleID = text2(merged.rule_id, "rule_id");
57556
57801
  delete merged.rule_id;
57557
57802
  Object.keys(merged).forEach((key) => merged[key] === void 0 && delete merged[key]);
57558
57803
  const query2 = normalizeRange(merged);
57559
57804
  const segment = name === "+schedules" ? "schedules" : "members";
57560
- const path3 = `/v1/attendance/scheduling/rules/${encodeURIComponent(ruleID)}/${segment}`;
57561
- if (preview2(opts, cmd, "GET", path3, { query: query2 })) return;
57562
- printImResult(opts.json, await imRequest("GET", path3, { baseUrl: baseURL(opts, cmd), query: query2 }));
57805
+ const path4 = `/v1/attendance/scheduling/rules/${encodeURIComponent(ruleID)}/${segment}`;
57806
+ if (preview2(opts, cmd, "GET", path4, { query: query2 })) return;
57807
+ printImResult(opts.json, await imRequest("GET", path4, { baseUrl: baseURL(opts, cmd), query: query2 }));
57563
57808
  });
57564
57809
  }
57565
57810
  for (const [name, action2] of [["+schedule-preview", "preview"], ["+schedule-apply", "apply"]]) {
@@ -57567,9 +57812,9 @@ function attachAttendanceSchedulingShortcuts(parent) {
57567
57812
  if (action2 === "apply") command.requiredOption("--preview-token <token>").requiredOption("--client-request-id <id>");
57568
57813
  attachSharedShortcutOptions(command).action(async (opts, cmd) => {
57569
57814
  const body = normalizePlan(await mergeShortcutParams(await basePlan(opts), opts), action2 === "apply");
57570
- const path3 = `/v1/attendance/scheduling/plans/${action2}`;
57571
- if (preview2(opts, cmd, "POST", path3, { body })) return;
57572
- printImResult(opts.json, await imRequest("POST", path3, { baseUrl: baseURL(opts, cmd), body }));
57815
+ const path4 = `/v1/attendance/scheduling/plans/${action2}`;
57816
+ if (preview2(opts, cmd, "POST", path4, { body })) return;
57817
+ printImResult(opts.json, await imRequest("POST", path4, { baseUrl: baseURL(opts, cmd), body }));
57573
57818
  });
57574
57819
  }
57575
57820
  }
@@ -58041,9 +58286,9 @@ function attachTaskCenterTaskWrite(parent) {
58041
58286
  }
58042
58287
  putOkrContributionWeight(body, opts.okrContributionWeight);
58043
58288
  const merged = await mergeShortcutParams(body, opts);
58044
- const path3 = `/v1/task-center/tasks/${encodeURIComponent(taskId)}`;
58045
- if (previewShortcutRequest(opts, cmd, "PATCH", path3, { body: merged })) return;
58046
- const result = await imRequest("PATCH", path3, {
58289
+ const path4 = `/v1/task-center/tasks/${encodeURIComponent(taskId)}`;
58290
+ if (previewShortcutRequest(opts, cmd, "PATCH", path4, { body: merged })) return;
58291
+ const result = await imRequest("PATCH", path4, {
58047
58292
  baseUrl: resolveBaseUrl2(opts, cmd),
58048
58293
  body: merged
58049
58294
  });
@@ -58053,10 +58298,10 @@ function attachTaskCenterTaskWrite(parent) {
58053
58298
  parent.command("+tc-task-delete").description("\u4EFB\u52A1\u4E2D\u5FC3\uFF1A\u5F52\u6863\u4EFB\u52A1\uFF08\u53EF\u6062\u590D\uFF0C\u4E0D\u7269\u7406\u5220\u9664\uFF09").requiredOption("--task-id <id>", "\u4EFB\u52A1 UUID")
58054
58299
  ).action(async (opts, cmd) => {
58055
58300
  rejectDeleteParams(opts);
58056
- const path3 = `/v1/task-center/tasks/${encodeURIComponent(requireId(opts.taskId, "--task-id"))}`;
58301
+ const path4 = `/v1/task-center/tasks/${encodeURIComponent(requireId(opts.taskId, "--task-id"))}`;
58057
58302
  const body = { status: "archived" };
58058
- if (previewShortcutRequest(opts, cmd, "PATCH", path3, { body })) return;
58059
- printImResult(opts.json, await imRequest("PATCH", path3, {
58303
+ if (previewShortcutRequest(opts, cmd, "PATCH", path4, { body })) return;
58304
+ printImResult(opts.json, await imRequest("PATCH", path4, {
58060
58305
  baseUrl: resolveBaseUrl2(opts, cmd),
58061
58306
  body
58062
58307
  }));
@@ -58101,10 +58346,10 @@ function attachTaskCenterTodoWrite(parent) {
58101
58346
  parent.command("+tc-todo-delete").description("\u4EFB\u52A1\u4E2D\u5FC3\uFF1A\u5F52\u6863\u5F85\u529E\uFF08\u53EF\u6062\u590D\uFF0C\u4E0D\u7269\u7406\u5220\u9664\uFF09").requiredOption("--todo-id <id>", "\u5F85\u529E UUID")
58102
58347
  ).action(async (opts, cmd) => {
58103
58348
  rejectDeleteParams(opts);
58104
- const path3 = `/v1/task-center/todos/${encodeURIComponent(requireId(opts.todoId, "--todo-id"))}`;
58349
+ const path4 = `/v1/task-center/todos/${encodeURIComponent(requireId(opts.todoId, "--todo-id"))}`;
58105
58350
  const body = { status: "archived" };
58106
- if (previewShortcutRequest(opts, cmd, "PATCH", path3, { body })) return;
58107
- printImResult(opts.json, await imRequest("PATCH", path3, {
58351
+ if (previewShortcutRequest(opts, cmd, "PATCH", path4, { body })) return;
58352
+ printImResult(opts.json, await imRequest("PATCH", path4, {
58108
58353
  baseUrl: resolveBaseUrl2(opts, cmd),
58109
58354
  body
58110
58355
  }));
@@ -58166,7 +58411,7 @@ function attachTaskCenterProjectAndOkr(parent) {
58166
58411
  attachSharedShortcutOptions(
58167
58412
  parent.command("+tc-project-update").description("\u4EFB\u52A1\u4E2D\u5FC3\uFF1A\u66F4\u65B0\u9879\u76EE\uFF08PATCH\uFF09").requiredOption("--project-id <id>", "\u9879\u76EE UUID").option("--name <text>", "\u9879\u76EE\u540D\u79F0").option("--project-type <text>", "\u9879\u76EE\u7C7B\u578B").option("--description <text>", "\u9879\u76EE\u63CF\u8FF0").option("--goal <text>", "\u9879\u76EE\u76EE\u6807").option("--priority <n>", "0-3").option("--progress <n>", "0-100").option("--status <name>", "not_started|in_progress|paused|completed|cancelled|archived").option("--owner-user-id <id>", "\u8D1F\u8D23\u4EBA res.users id").option("--start-date <ymd>", "YYYY-MM-DD").option("--deadline <ymd>", "YYYY-MM-DD")
58168
58413
  ).action(async (opts, cmd) => {
58169
- const path3 = `/v1/task-center/projects/${encodeURIComponent(requireId(opts.projectId, "--project-id"))}`;
58414
+ const path4 = `/v1/task-center/projects/${encodeURIComponent(requireId(opts.projectId, "--project-id"))}`;
58170
58415
  const body = {};
58171
58416
  putString2(body, "name", opts.name);
58172
58417
  putString2(body, "project_type", opts.projectType);
@@ -58180,8 +58425,8 @@ function attachTaskCenterProjectAndOkr(parent) {
58180
58425
  putString2(body, "deadline", opts.deadline);
58181
58426
  const merged = await mergeShortcutParams(body, opts);
58182
58427
  requireUpdateBody(merged);
58183
- if (previewShortcutRequest(opts, cmd, "PATCH", path3, { body: merged })) return;
58184
- printImResult(opts.json, await imRequest("PATCH", path3, {
58428
+ if (previewShortcutRequest(opts, cmd, "PATCH", path4, { body: merged })) return;
58429
+ printImResult(opts.json, await imRequest("PATCH", path4, {
58185
58430
  baseUrl: resolveBaseUrl2(opts, cmd),
58186
58431
  body: merged
58187
58432
  }));
@@ -58190,9 +58435,9 @@ function attachTaskCenterProjectAndOkr(parent) {
58190
58435
  parent.command("+tc-project-delete").description("\u4EFB\u52A1\u4E2D\u5FC3\uFF1A\u5F52\u6863\u9879\u76EE\uFF08\u53EF\u6062\u590D\uFF0C\u4E0D\u7269\u7406\u5220\u9664\uFF09").requiredOption("--project-id <id>", "\u9879\u76EE UUID")
58191
58436
  ).action(async (opts, cmd) => {
58192
58437
  rejectDeleteParams(opts);
58193
- const path3 = `/v1/task-center/projects/${encodeURIComponent(requireId(opts.projectId, "--project-id"))}`;
58194
- if (previewShortcutRequest(opts, cmd, "DELETE", path3)) return;
58195
- printImResult(opts.json, await imRequest("DELETE", path3, {
58438
+ const path4 = `/v1/task-center/projects/${encodeURIComponent(requireId(opts.projectId, "--project-id"))}`;
58439
+ if (previewShortcutRequest(opts, cmd, "DELETE", path4)) return;
58440
+ printImResult(opts.json, await imRequest("DELETE", path4, {
58196
58441
  baseUrl: resolveBaseUrl2(opts, cmd)
58197
58442
  }));
58198
58443
  });
@@ -58380,8 +58625,8 @@ function printResult(opts, result) {
58380
58625
  console.log(typeof result === "string" ? result : JSON.stringify(result));
58381
58626
  }
58382
58627
  function outputRows(value) {
58383
- const record4 = asRecord2(value);
58384
- const rows2 = record4 ? record4.rows : void 0;
58628
+ const record5 = asRecord2(value);
58629
+ const rows2 = record5 ? record5.rows : void 0;
58385
58630
  return Array.isArray(rows2) ? rows2.filter((row) => asRecord2(row) !== null) : [];
58386
58631
  }
58387
58632
  function isValidateOnly2(opts) {
@@ -58412,31 +58657,31 @@ function findIdentityRecord(payload) {
58412
58657
  continue;
58413
58658
  }
58414
58659
  seen.add(current);
58415
- const record4 = asRecord2(current);
58416
- if (!record4) {
58660
+ const record5 = asRecord2(current);
58661
+ if (!record5) {
58417
58662
  continue;
58418
58663
  }
58419
- if ("employee_id" in record4 || "employeeId" in record4 || "manager_id" in record4 || "managerEmployeeId" in record4 || "user_id" in record4 || "employee" in record4 || "manager" in record4) {
58420
- return record4;
58664
+ if ("employee_id" in record5 || "employeeId" in record5 || "manager_id" in record5 || "managerEmployeeId" in record5 || "user_id" in record5 || "employee" in record5 || "manager" in record5) {
58665
+ return record5;
58421
58666
  }
58422
58667
  for (const key of ["result", "data", "payload", "context", "user", "userinfo"]) {
58423
- if (key in record4) {
58424
- queue.push(record4[key]);
58668
+ if (key in record5) {
58669
+ queue.push(record5[key]);
58425
58670
  }
58426
58671
  }
58427
58672
  }
58428
58673
  return {};
58429
58674
  }
58430
58675
  function extractHrIdentity(payload) {
58431
- const record4 = findIdentityRecord(payload);
58432
- const employee = asRecord2(record4.employee);
58433
- const manager = asRecord2(record4.manager);
58676
+ const record5 = findIdentityRecord(payload);
58677
+ const employee = asRecord2(record5.employee);
58678
+ const manager = asRecord2(record5.manager);
58434
58679
  return {
58435
- employeeId: numberValue(record4.employee_id) ?? numberValue(record4.employeeId) ?? numberValue(employee?.id),
58436
- employeeName: stringValue(record4.employee_name) ?? stringValue(record4.employeeName) ?? stringValue(employee?.name) ?? stringValue(record4.name),
58437
- managerEmployeeId: numberValue(record4.manager_id) ?? numberValue(record4.manager_employee_id) ?? numberValue(record4.managerEmployeeId) ?? numberValue(manager?.id),
58438
- managerName: stringValue(record4.manager_name) ?? stringValue(record4.managerName) ?? stringValue(manager?.name),
58439
- managerUserId: numberValue(record4.manager_user_id) ?? numberValue(record4.managerUserId) ?? numberValue(manager?.user_id) ?? numberValue(manager?.userId)
58680
+ employeeId: numberValue(record5.employee_id) ?? numberValue(record5.employeeId) ?? numberValue(employee?.id),
58681
+ employeeName: stringValue(record5.employee_name) ?? stringValue(record5.employeeName) ?? stringValue(employee?.name) ?? stringValue(record5.name),
58682
+ managerEmployeeId: numberValue(record5.manager_id) ?? numberValue(record5.manager_employee_id) ?? numberValue(record5.managerEmployeeId) ?? numberValue(manager?.id),
58683
+ managerName: stringValue(record5.manager_name) ?? stringValue(record5.managerName) ?? stringValue(manager?.name),
58684
+ managerUserId: numberValue(record5.manager_user_id) ?? numberValue(record5.managerUserId) ?? numberValue(manager?.user_id) ?? numberValue(manager?.userId)
58440
58685
  };
58441
58686
  }
58442
58687
  async function fetchCurrentHrIdentity(opts, cmd) {
@@ -58536,8 +58781,8 @@ function dataViewRows(value) {
58536
58781
  return outputRows(value);
58537
58782
  }
58538
58783
  function dataViewTotalRows(value) {
58539
- const record4 = asRecord2(value);
58540
- const pagination = asRecord2(record4?.pagination);
58784
+ const record5 = asRecord2(value);
58785
+ const pagination = asRecord2(record5?.pagination);
58541
58786
  return numberValue(pagination?.total_rows) ?? 0;
58542
58787
  }
58543
58788
  function addHeadcountOptions(cmd) {
@@ -58904,8 +59149,8 @@ function asRecord3(value) {
58904
59149
  return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
58905
59150
  }
58906
59151
  function rows(value) {
58907
- const record4 = asRecord3(value);
58908
- const raw = record4 ? record4.rows : void 0;
59152
+ const record5 = asRecord3(value);
59153
+ const raw = record5 ? record5.rows : void 0;
58909
59154
  return Array.isArray(raw) ? raw.filter((row) => asRecord3(row) !== null) : [];
58910
59155
  }
58911
59156
  function num(value) {
@@ -59315,9 +59560,9 @@ function asRecord4(value) {
59315
59560
  return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
59316
59561
  }
59317
59562
  function remoteMessage(value, fallback) {
59318
- const record4 = asRecord4(value);
59563
+ const record5 = asRecord4(value);
59319
59564
  for (const key of ["message", "error", "statusText"]) {
59320
- const candidate = record4?.[key];
59565
+ const candidate = record5?.[key];
59321
59566
  if (typeof candidate === "string" && candidate.trim()) return candidate.trim();
59322
59567
  }
59323
59568
  return fallback;
@@ -59910,9 +60155,9 @@ function attachSalesPersonnelShortcuts(parent) {
59910
60155
  var import_promises13 = require("fs/promises");
59911
60156
  var import_node_path10 = require("path");
59912
60157
  var import_undici9 = __toESM(require_undici(), 1);
59913
- async function errorMessage(status, text3) {
60158
+ async function errorMessage(status, text4) {
59914
60159
  try {
59915
- const payload = JSON.parse(text3);
60160
+ const payload = JSON.parse(text4);
59916
60161
  return new VertuError(payload.error ? String(payload.error) : `HTTP ${status}`);
59917
60162
  } catch {
59918
60163
  return new VertuError(`Invoice attachment request failed: HTTP ${status}`);
@@ -59935,10 +60180,10 @@ async function listSalesInvoiceAttachments(baseUrl4, orderNo) {
59935
60180
  method: "GET",
59936
60181
  headers: serviceHeaders2({ accept: "application/json" })
59937
60182
  });
59938
- const text3 = await response.body.text();
59939
- if (response.statusCode >= 400) throw await errorMessage(response.statusCode, text3);
60183
+ const text4 = await response.body.text();
60184
+ if (response.statusCode >= 400) throw await errorMessage(response.statusCode, text4);
59940
60185
  try {
59941
- const payload = JSON.parse(text3);
60186
+ const payload = JSON.parse(text4);
59942
60187
  if (!payload.result) throw new Error("missing result");
59943
60188
  return payload.result;
59944
60189
  } catch {
@@ -60015,6 +60260,16 @@ function addAgentFilter(params, opts) {
60015
60260
  }
60016
60261
  function attachSalesShortcuts(parent) {
60017
60262
  const skill = dailySalesSkillKey();
60263
+ attachSharedShortcutOptions(
60264
+ parent.command("+group-customers").description("\u56E2\u5355\u5BA2\u6237\u5B8C\u6574\u540D\u5355\uFF08\u9ED8\u8BA4\u8FC7\u53BB\u4E00\u5E74\uFF1B\u540C\u5355\u81F3\u5C113\u4EF6\u5355\u4EF7\u9AD8\u4E8E5000\u5143\u7684\u5546\u54C1\uFF09").option("--start-date <date>", "\u5F00\u59CB\u65E5\u671F YYYY-MM-DD").option("--end-date <date>", "\u7ED3\u675F\u65E5\u671F YYYY-MM-DD\uFF08\u542B\u5F53\u5929\uFF09").option("--period <name>", "\u5DF2\u6709\u9500\u552E\u65F6\u95F4\u8303\u56F4\uFF0C\u5982 this_year / last_n_days").option("--days <n>", "period=last_n_days \u7684\u5929\u6570").option("--min-quantity <n>", "\u7B26\u5408\u5355\u4EF7\u6761\u4EF6\u7684\u5546\u54C1\u4EF6\u6570\u4E0B\u9650\uFF08\u542B\uFF09", "3").option("--min-unit-price <amount>", "\u4EBA\u6C11\u5E01\u6210\u4EA4\u5355\u4EF7\u4E0B\u9650\uFF08\u4E0D\u542B\uFF09", "5000").option("--page <n>", "\u5BA2\u6237\u540D\u5355\u9875\u7801", "1").option("--limit <n>", "\u6BCF\u9875\u5BA2\u6237\u6570\uFF0C\u6700\u591A1000", "100")
60265
+ ).action(async (opts, cmd) => {
60266
+ const p = buildSalesPeriodParams(opts);
60267
+ p.min_quantity = parseOptionalInt(opts.minQuantity, "--min-quantity");
60268
+ p.min_unit_price = parseOptionalFloat(opts.minUnitPrice, "--min-unit-price");
60269
+ p.page = parseOptionalInt(opts.page, "--page");
60270
+ if (Number(p.min_quantity) < 1 || Number(p.min_unit_price) < 0 || Number(p.page) < 1) throw new VertuError("\u4EF6\u6570\u548C\u9875\u7801\u5FC5\u987B\u5927\u4E8E0\uFF0C\u5355\u4EF7\u4E0D\u80FD\u4E3A\u8D1F\u6570\u3002");
60271
+ await runSkillShortcutExecute(skill, "group_customers", p, opts, cmd);
60272
+ });
60018
60273
  attachSharedShortcutOptions(
60019
60274
  parent.command("+order-finance").alias("+finance-detail").description("\u6309\u9500\u552E\u5355\u53F7\u6C47\u603B\u8BA2\u5355\u3001\u5F00\u7968\u7533\u8BF7\u3001\u6B63\u5F0F\u53D1\u7968\u548C\u5173\u8054\u4F1A\u8BA1\u51ED\u8BC1").requiredOption("--order-no <no>", "\u9500\u552E\u5355\u53F7\uFF0C\u7CBE\u786E\u5339\u914D").option("--invoice-no <no>", "\u53D1\u7968/\u51ED\u8BC1\u53F7\u5305\u542B\u5339\u914D")
60020
60275
  ).action(async (opts, cmd) => {
@@ -60973,8 +61228,8 @@ function printMutationPreview(opts, method, endpoint, body) {
60973
61228
  });
60974
61229
  }
60975
61230
  function decorateEvents(payload, scope, range, calendarId) {
60976
- const record4 = asRecord5(payload) ?? {};
60977
- const calendars = recordArray(record4.calendars);
61231
+ const record5 = asRecord5(payload) ?? {};
61232
+ const calendars = recordArray(record5.calendars);
60978
61233
  const calendarNames = new Map(
60979
61234
  calendars.flatMap((calendar) => {
60980
61235
  const id = typeof calendar.id === "string" ? calendar.id : "";
@@ -60984,7 +61239,7 @@ function decorateEvents(payload, scope, range, calendarId) {
60984
61239
  if (calendarId && !calendarNames.has(calendarId)) {
60985
61240
  throw new VertuError(`\u65E5\u5386\u4E0D\u5B58\u5728\u6216\u65E0\u6743\u67E5\u770B\uFF1A${calendarId}`);
60986
61241
  }
60987
- const rows2 = recordArray(record4.events).filter((event) => !calendarId || event.calendar_id === calendarId).map((event) => ({
61242
+ const rows2 = recordArray(record5.events).filter((event) => !calendarId || event.calendar_id === calendarId).map((event) => ({
60988
61243
  ...event,
60989
61244
  calendar_name: typeof event.calendar_id === "string" ? calendarNames.get(event.calendar_id) ?? null : null
60990
61245
  }));
@@ -61002,14 +61257,14 @@ function decorateEvents(payload, scope, range, calendarId) {
61002
61257
  };
61003
61258
  }
61004
61259
  function positiveUserId(raw, flag) {
61005
- const text3 = raw?.trim();
61006
- if (!text3) {
61260
+ const text4 = raw?.trim();
61261
+ if (!text4) {
61007
61262
  return void 0;
61008
61263
  }
61009
- if (!/^\d+$/.test(text3)) {
61264
+ if (!/^\d+$/.test(text4)) {
61010
61265
  throw new VertuError(`${flag} \u9700\u4E3A\u6B63\u6574\u6570\u3002`);
61011
61266
  }
61012
- const value = Number(text3);
61267
+ const value = Number(text4);
61013
61268
  if (!Number.isSafeInteger(value) || value <= 0) {
61014
61269
  throw new VertuError(`${flag} \u9700\u4E3A\u6B63\u6574\u6570\u3002`);
61015
61270
  }
@@ -61622,17 +61877,17 @@ function num2(raw, flag) {
61622
61877
  function int(raw, flag) {
61623
61878
  return parseOptionalInt(raw, flag);
61624
61879
  }
61625
- async function postCreative(opts, cmd, path3, body, label) {
61880
+ async function postCreative(opts, cmd, path4, body, label) {
61626
61881
  const baseUrl4 = resolveShortcutVpsServiceUrl(opts, cmd);
61627
61882
  if (opts.validateOnly === true || opts.dryRun === true) {
61628
61883
  printResult5(opts, {
61629
61884
  validateOnly: true,
61630
- endpoint: `${baseUrl4}${path3}`,
61885
+ endpoint: `${baseUrl4}${path4}`,
61631
61886
  payload: body
61632
61887
  });
61633
61888
  return;
61634
61889
  }
61635
- await printCreativeResult(opts, await vpsServicePost(path3, body, baseUrl4, label), baseUrl4);
61890
+ await printCreativeResult(opts, await vpsServicePost(path4, body, baseUrl4, label), baseUrl4);
61636
61891
  }
61637
61892
  async function pollVideoTask(opts, baseUrl4, model, taskId) {
61638
61893
  const timeoutSec = parseOptionalInt(opts.waitTimeout, "--wait-timeout") ?? 600;
@@ -61666,9 +61921,9 @@ async function pollVideoTask(opts, baseUrl4, model, taskId) {
61666
61921
  function attachCreativeShortcuts(parent) {
61667
61922
  attachSharedShortcutOptions(parent.command("+download").description("\u901A\u8FC7\u5F53\u524D\u8D26\u53F7\u4E0B\u8F7D\u521B\u610F\u7D20\u6750\u5230\u5DE5\u4F5C\u533A\uFF0C\u4E91\u7535\u8111\u65E0\u9700\u516C\u7F51 DNS").option("--url <url>", "VPS \u521B\u610F\u7D20\u6750\u5730\u5740").option("--storage-key <key>", "\u751F\u6210\u7ED3\u679C\u4E2D\u7684 storage_key").requiredOption("--output <path>", "\u4FDD\u5B58\u8DEF\u5F84\uFF0C\u4E0D\u8986\u76D6\u5DF2\u6709\u6587\u4EF6")).action(async (opts, cmd) => {
61668
61923
  const base = resolveShortcutVpsServiceUrl(opts, cmd);
61669
- const path3 = creativeDownloadPath(base, opts);
61924
+ const path4 = creativeDownloadPath(base, opts);
61670
61925
  if (opts.validateOnly || opts.dryRun) {
61671
- printResult5(opts, { validateOnly: true, endpoint: new URL(path3, base).href, output: opts.output });
61926
+ printResult5(opts, { validateOnly: true, endpoint: new URL(path4, base).href, output: opts.output });
61672
61927
  return;
61673
61928
  }
61674
61929
  printResult5(opts, await downloadCreativeAttachment(base, opts));
@@ -61804,9 +62059,9 @@ function attachCreativeShortcuts(parent) {
61804
62059
  // src/core/corporate-client.ts
61805
62060
  var import_promises16 = require("fs/promises");
61806
62061
  var import_undici11 = __toESM(require_undici(), 1);
61807
- async function errorMessage2(status, text3) {
62062
+ async function errorMessage2(status, text4) {
61808
62063
  try {
61809
- const payload = JSON.parse(text3);
62064
+ const payload = JSON.parse(text4);
61810
62065
  return new VertuError(payload.error ? String(payload.error) : `HTTP ${status}`);
61811
62066
  } catch {
61812
62067
  return new VertuError(`Corporate request failed: HTTP ${status}`);
@@ -61822,10 +62077,10 @@ async function runCorporateQuery(baseUrl4, payload) {
61822
62077
  },
61823
62078
  body: JSON.stringify(payload)
61824
62079
  });
61825
- const text3 = await response.body.text();
61826
- if (response.statusCode >= 400) throw await errorMessage2(response.statusCode, text3);
62080
+ const text4 = await response.body.text();
62081
+ if (response.statusCode >= 400) throw await errorMessage2(response.statusCode, text4);
61827
62082
  try {
61828
- return JSON.parse(text3);
62083
+ return JSON.parse(text4);
61829
62084
  } catch {
61830
62085
  throw new VertuError("Corporate query returned invalid JSON.");
61831
62086
  }
@@ -62051,7 +62306,7 @@ var import_node_crypto6 = require("crypto");
62051
62306
 
62052
62307
  // src/core/documents-client.ts
62053
62308
  var import_undici12 = __toESM(require_undici(), 1);
62054
- function buildPath2(path3, query2) {
62309
+ function buildPath2(path4, query2) {
62055
62310
  const search = new URLSearchParams();
62056
62311
  for (const [key, value] of Object.entries(query2 ?? {})) {
62057
62312
  if (value !== void 0 && value !== null && value !== "") {
@@ -62059,23 +62314,23 @@ function buildPath2(path3, query2) {
62059
62314
  }
62060
62315
  }
62061
62316
  const encoded = search.toString();
62062
- return encoded ? `${path3}?${encoded}` : path3;
62317
+ return encoded ? `${path4}?${encoded}` : path4;
62063
62318
  }
62064
62319
  function errorMessage3(payload, statusCode) {
62065
62320
  if (typeof payload === "object" && payload !== null) {
62066
- const record4 = payload;
62067
- if (typeof record4["error"] === "string") {
62068
- return record4["error"];
62321
+ const record5 = payload;
62322
+ if (typeof record5["error"] === "string") {
62323
+ return record5["error"];
62069
62324
  }
62070
- if (typeof record4["message"] === "string") {
62071
- return record4["message"];
62325
+ if (typeof record5["message"] === "string") {
62326
+ return record5["message"];
62072
62327
  }
62073
62328
  }
62074
62329
  return `HTTP ${statusCode}`;
62075
62330
  }
62076
- async function documentsRequest(method, path3, opts = {}) {
62331
+ async function documentsRequest(method, path4, opts = {}) {
62077
62332
  const baseUrl4 = resolveVpsServiceUrl(opts.baseUrl);
62078
- const response = await (0, import_undici12.request)(`${baseUrl4}${buildPath2(path3, opts.query)}`, {
62333
+ const response = await (0, import_undici12.request)(`${baseUrl4}${buildPath2(path4, opts.query)}`, {
62079
62334
  method,
62080
62335
  headers: {
62081
62336
  accept: "application/json",
@@ -62084,10 +62339,10 @@ async function documentsRequest(method, path3, opts = {}) {
62084
62339
  },
62085
62340
  body: opts.body === void 0 ? void 0 : JSON.stringify(opts.body)
62086
62341
  });
62087
- const text3 = await response.body.text();
62342
+ const text4 = await response.body.text();
62088
62343
  let payload = {};
62089
62344
  try {
62090
- payload = text3.trim() ? JSON.parse(text3) : {};
62345
+ payload = text4.trim() ? JSON.parse(text4) : {};
62091
62346
  } catch {
62092
62347
  throw new VertuError(`\u6587\u6863\u670D\u52A1\u8FD4\u56DE\u975E JSON\uFF08HTTP ${response.statusCode}\uFF09`);
62093
62348
  }
@@ -62275,13 +62530,13 @@ function parseSharePermission(value) {
62275
62530
  }
62276
62531
  throw new VertuError("--permission \u9700\u4E3A request\u3001view \u6216 edit\u3002");
62277
62532
  }
62278
- function record(value, message) {
62533
+ function record2(value, message) {
62279
62534
  if (typeof value !== "object" || value === null || Array.isArray(value)) {
62280
62535
  throw new VertuError(message);
62281
62536
  }
62282
62537
  return value;
62283
62538
  }
62284
- function text2(recordValue, ...keys) {
62539
+ function text3(recordValue, ...keys) {
62285
62540
  for (const key of keys) {
62286
62541
  const value = recordValue[key];
62287
62542
  if (typeof value === "string" && value.trim()) {
@@ -63093,25 +63348,25 @@ Notes:
63093
63348
  ).action(async (opts) => {
63094
63349
  const docId = required(opts.docId, "--doc-id");
63095
63350
  const permission = parseSharePermission(opts.permission);
63096
- const detail = record(
63351
+ const detail = record2(
63097
63352
  await documentsRequest("GET", documentPath(docId), { baseUrl: opts.baseUrl }),
63098
63353
  "\u6587\u6863\u8BE6\u60C5\u54CD\u5E94\u65E0\u6548\u3002"
63099
63354
  );
63100
- const doc = record(detail.doc, "\u6587\u6863\u8BE6\u60C5\u7F3A\u5C11 doc\u3002");
63101
- const title = text2(doc, "title") || "\u672A\u547D\u540D\u6587\u6863";
63355
+ const doc = record2(detail.doc, "\u6587\u6863\u8BE6\u60C5\u7F3A\u5C11 doc\u3002");
63356
+ const title = text3(doc, "title") || "\u672A\u547D\u540D\u6587\u6863";
63102
63357
  const type = documentType(doc.type);
63103
- let shareToken = text2(doc, "shareToken", "share_token");
63104
- let shareMode = text2(doc, "shareMode", "share_mode") || null;
63358
+ let shareToken = text3(doc, "shareToken", "share_token");
63359
+ let shareMode = text3(doc, "shareMode", "share_mode") || null;
63105
63360
  if (permission !== "request") {
63106
63361
  shareMode = permission === "edit" ? "login-edit" : "login-view";
63107
- const share = record(
63362
+ const share = record2(
63108
63363
  await documentsRequest("POST", documentPath(docId, "/share"), {
63109
63364
  baseUrl: opts.baseUrl,
63110
63365
  body: { mode: shareMode }
63111
63366
  }),
63112
63367
  "\u6587\u6863\u5171\u4EAB\u54CD\u5E94\u65E0\u6548\u3002"
63113
63368
  );
63114
- shareToken = text2(share, "token") || shareToken;
63369
+ shareToken = text3(share, "token") || shareToken;
63115
63370
  }
63116
63371
  const channelId2 = opts.channelId?.trim() || firstEnv3("VERTU_AGENT_CHANNEL_ID");
63117
63372
  const agentSlug = firstEnv3("VERTU_AGENT_SLUG", "HERMES_AGENT_SLUG");
@@ -63128,7 +63383,7 @@ Notes:
63128
63383
  card: "document_share",
63129
63384
  document_id: docId,
63130
63385
  title,
63131
- creator_name: text2(doc, "creatorName", "creator_name") || "\u6587\u6863\u6210\u5458",
63386
+ creator_name: text3(doc, "creatorName", "creator_name") || "\u6587\u6863\u6210\u5458",
63132
63387
  share_url: shareToken ? `vertu://documents/share/${shareToken}` : "",
63133
63388
  excerpt: documentExcerpt(doc.content),
63134
63389
  document_type: type,
@@ -63157,13 +63412,13 @@ Notes:
63157
63412
  `/v1/im/channels/${encodeURIComponent(channelId2)}/messages`,
63158
63413
  { baseUrl: opts.baseUrl, body: message }
63159
63414
  );
63160
- const deliveryRecord = record(delivery, "IM \u6295\u9012\u54CD\u5E94\u65E0\u6548\u3002");
63415
+ const deliveryRecord = record2(delivery, "IM \u6295\u9012\u54CD\u5E94\u65E0\u6548\u3002");
63161
63416
  printDocumentsResult(opts.json, {
63162
63417
  ok: true,
63163
63418
  document: { id: docId, title, type },
63164
63419
  permission,
63165
63420
  share_mode: shareMode,
63166
- channel_id: text2(deliveryRecord, "channel_id") || channelId2 || null,
63421
+ channel_id: text3(deliveryRecord, "channel_id") || channelId2 || null,
63167
63422
  message: deliveryRecord.message ?? null
63168
63423
  });
63169
63424
  });
@@ -63201,29 +63456,29 @@ var import_promises17 = require("fs/promises");
63201
63456
  var import_node_module = require("module");
63202
63457
  var import_node_path12 = require("path");
63203
63458
  function officeRuntime() {
63204
- const path3 = (0, import_node_path12.join)(packageRootDir(), "dist/office-runtime.cjs");
63459
+ const path4 = (0, import_node_path12.join)(packageRootDir(), "dist/office-runtime.cjs");
63205
63460
  try {
63206
- return (0, import_node_module.createRequire)(path3)(path3);
63461
+ return (0, import_node_module.createRequire)(path4)(path4);
63207
63462
  } catch (error) {
63208
63463
  throw new Error(`Office runtime \u65E0\u6CD5\u52A0\u8F7D\uFF0C\u8BF7\u91CD\u65B0\u5B89\u88C5\u5B8C\u6574 vps-work \u5305\uFF08\u6E90\u7801\u5F00\u53D1\u5148 npm run build\uFF09\u3002${String(error)}`);
63209
63464
  }
63210
63465
  }
63211
- function officeFormat(path3) {
63212
- const format = (0, import_node_path12.extname)(path3).slice(1).toLowerCase();
63466
+ function officeFormat(path4) {
63467
+ const format = (0, import_node_path12.extname)(path4).slice(1).toLowerCase();
63213
63468
  if (!["docx", "xlsx", "pptx", "md"].includes(format)) throw new Error("\u652F\u6301 .docx / .xlsx / .pptx / .md\u3002");
63214
63469
  return format;
63215
63470
  }
63216
63471
  function officeVersion(bytes) {
63217
63472
  return (0, import_node_crypto7.createHash)("sha256").update(bytes).digest("hex");
63218
63473
  }
63219
- async function readOfficeFile(path3) {
63220
- const file = await (0, import_promises17.realpath)(path3);
63474
+ async function readOfficeFile(path4) {
63475
+ const file = await (0, import_promises17.realpath)(path4);
63221
63476
  const bytes = await (0, import_promises17.readFile)(file);
63222
63477
  const format = officeFormat(file);
63223
63478
  return { file, format, version: officeVersion(bytes), content: await officeRuntime().readDocument(format, bytes) };
63224
63479
  }
63225
- async function writeAtomic(path3, bytes, expected) {
63226
- const file = expected === void 0 ? (0, import_node_path12.resolve)(path3) : await (0, import_promises17.realpath)(path3);
63480
+ async function writeAtomic(path4, bytes, expected) {
63481
+ const file = expected === void 0 ? (0, import_node_path12.resolve)(path4) : await (0, import_promises17.realpath)(path4);
63227
63482
  const lock = `${file}.vps-office.lock`;
63228
63483
  const handle = await (0, import_promises17.open)(lock, "wx", 384).catch(() => {
63229
63484
  throw new Error(`\u6587\u4EF6\u6B63\u5728\u4FEE\u6539\u6216\u5B58\u5728\u672A\u6E05\u7406\u9501\uFF1A${lock}`);
@@ -63250,15 +63505,15 @@ async function writeAtomic(path3, bytes, expected) {
63250
63505
  await (0, import_promises17.rm)(lock, { force: true });
63251
63506
  }
63252
63507
  }
63253
- async function createOfficeFile(path3, spec) {
63254
- const format = officeFormat(path3);
63508
+ async function createOfficeFile(path4, spec) {
63509
+ const format = officeFormat(path4);
63255
63510
  const bytes = await officeRuntime().createDocument(format, spec);
63256
63511
  await officeRuntime().readDocument(format, bytes);
63257
- await writeAtomic(path3, bytes);
63258
- return { file: (0, import_node_path12.resolve)(path3), format, version: officeVersion(bytes), size: bytes.length };
63512
+ await writeAtomic(path4, bytes);
63513
+ return { file: (0, import_node_path12.resolve)(path4), format, version: officeVersion(bytes), size: bytes.length };
63259
63514
  }
63260
- async function applyOfficeFile(path3, changes, expected, output, dryRun = false) {
63261
- const file = await (0, import_promises17.realpath)(path3);
63515
+ async function applyOfficeFile(path4, changes, expected, output, dryRun = false) {
63516
+ const file = await (0, import_promises17.realpath)(path4);
63262
63517
  const format = officeFormat(file);
63263
63518
  if (output && officeFormat(output) !== format) throw new Error("\u8F93\u51FA\u6587\u4EF6\u6269\u5C55\u540D\u5FC5\u987B\u4E0E\u6E90\u6587\u4EF6\u76F8\u540C\u3002");
63264
63519
  const original = await (0, import_promises17.readFile)(file);
@@ -63273,10 +63528,10 @@ async function applyOfficeFile(path3, changes, expected, output, dryRun = false)
63273
63528
  var import_promises18 = require("fs/promises");
63274
63529
  var import_node_path13 = require("path");
63275
63530
  async function officeRequest(action2, body = {}, connectionFile) {
63276
- const path3 = connectionFile ?? process.env.VPS_OFFICE_CONNECTION_FILE ?? (0, import_node_path13.join)(homeDir(), "office.json");
63531
+ const path4 = connectionFile ?? process.env.VPS_OFFICE_CONNECTION_FILE ?? (0, import_node_path13.join)(homeDir(), "office.json");
63277
63532
  let config;
63278
63533
  try {
63279
- config = JSON.parse(await (0, import_promises18.readFile)(path3, "utf8"));
63534
+ config = JSON.parse(await (0, import_promises18.readFile)(path4, "utf8"));
63280
63535
  } catch {
63281
63536
  throw new Error("\u672A\u53D1\u73B0\u672C\u673A VPS Office\u3002\u8BF7\u542F\u52A8\u65B0\u7248 VPS \u684C\u9762\u7AEF\uFF0C\u6216\u8BBE\u7F6E VPS_OFFICE_CONNECTION_FILE\u3002");
63282
63537
  }
@@ -63296,8 +63551,8 @@ async function officeRequest(action2, body = {}, connectionFile) {
63296
63551
 
63297
63552
  // src/commands/office/index.ts
63298
63553
  var print4 = (value) => console.log(JSON.stringify(value, null, 2));
63299
- async function jsonFile(path3) {
63300
- return JSON.parse(path3 === "-" ? await readStdinText() : await readUtf8File(path3));
63554
+ async function jsonFile(path4) {
63555
+ return JSON.parse(path4 === "-" ? await readStdinText() : await readUtf8File(path4));
63301
63556
  }
63302
63557
  function buildOfficeCommand() {
63303
63558
  const office = new Command("office").description("VPS Office\uFF1A\u672C\u5730\u6587\u4EF6\u751F\u6210\u3001\u7ED3\u6784\u5316\u8BFB\u5199\u548C\u684C\u9762\u7F16\u8F91\u4F1A\u8BDD");
@@ -63768,7 +64023,7 @@ function parentId(value) {
63768
64023
  const normalized = value?.trim();
63769
64024
  return !normalized || normalized === "root" ? null : normalized;
63770
64025
  }
63771
- function record2(value, message = "V\u76D8\u670D\u52A1\u8FD4\u56DE\u683C\u5F0F\u65E0\u6548\u3002") {
64026
+ function record3(value, message = "V\u76D8\u670D\u52A1\u8FD4\u56DE\u683C\u5F0F\u65E0\u6548\u3002") {
63772
64027
  if (!value || typeof value !== "object" || Array.isArray(value)) throw new VertuError(message);
63773
64028
  return value;
63774
64029
  }
@@ -63776,7 +64031,7 @@ function records(value) {
63776
64031
  return Array.isArray(value) ? value.filter((item) => Boolean(item) && typeof item === "object" && !Array.isArray(item)) : [];
63777
64032
  }
63778
64033
  function itemFrom(value) {
63779
- return record2(record2(value).item, "V\u76D8\u670D\u52A1\u672A\u8FD4\u56DE\u9879\u76EE\u3002");
64034
+ return record3(record3(value).item, "V\u76D8\u670D\u52A1\u672A\u8FD4\u56DE\u9879\u76EE\u3002");
63780
64035
  }
63781
64036
  function print5(payload) {
63782
64037
  console.log(JSON.stringify(payload, null, 2));
@@ -63829,13 +64084,13 @@ function mimeType2(name) {
63829
64084
  return types[(0, import_node_path16.extname)(name).toLowerCase()] ?? "application/octet-stream";
63830
64085
  }
63831
64086
  async function driveGet(opts, view) {
63832
- return record2(await imRequest("GET", "/v1/v-drive", {
64087
+ return record3(await imRequest("GET", "/v1/v-drive", {
63833
64088
  baseUrl: opts.baseUrl,
63834
64089
  query: view ? { view } : void 0
63835
64090
  }));
63836
64091
  }
63837
64092
  async function driveAction(opts, action2, body = {}) {
63838
- return record2(await imRequest("POST", "/v1/v-drive", {
64093
+ return record3(await imRequest("POST", "/v1/v-drive", {
63839
64094
  baseUrl: opts.baseUrl,
63840
64095
  body: { action: action2, ...body }
63841
64096
  }));
@@ -63880,7 +64135,7 @@ async function uploadContent(opts, input) {
63880
64135
  body,
63881
64136
  size,
63882
64137
  "application/octet-stream",
63883
- initialized.part_headers ? record2(initialized.part_headers) : {}
64138
+ initialized.part_headers ? record3(initialized.part_headers) : {}
63884
64139
  );
63885
64140
  }
63886
64141
  } else {
@@ -63890,7 +64145,7 @@ async function uploadContent(opts, input) {
63890
64145
  Buffer.isBuffer(input.body) ? input.body : (0, import_node_fs8.createReadStream)(input.body),
63891
64146
  input.size,
63892
64147
  input.type,
63893
- initialized.headers ? record2(initialized.headers) : {}
64148
+ initialized.headers ? record3(initialized.headers) : {}
63894
64149
  );
63895
64150
  }
63896
64151
  } catch (error) {
@@ -63904,9 +64159,9 @@ async function uploadContent(opts, input) {
63904
64159
  storage_key: storageKey
63905
64160
  });
63906
64161
  }
63907
- async function uploadFile(opts, path3, targetParentId) {
63908
- const source = (0, import_node_path16.resolve)(path3);
63909
- if (!(0, import_node_fs8.existsSync)(source) || !(0, import_node_fs8.statSync)(source).isFile()) throw new VertuError(`\u6E90\u6587\u4EF6\u4E0D\u5B58\u5728\uFF1A${path3}`);
64162
+ async function uploadFile(opts, path4, targetParentId) {
64163
+ const source = (0, import_node_path16.resolve)(path4);
64164
+ if (!(0, import_node_fs8.existsSync)(source) || !(0, import_node_fs8.statSync)(source).isFile()) throw new VertuError(`\u6E90\u6587\u4EF6\u4E0D\u5B58\u5728\uFF1A${path4}`);
63910
64165
  const size = (0, import_node_fs8.statSync)(source).size;
63911
64166
  const name = (0, import_node_path16.basename)(source);
63912
64167
  if (size === 0) {
@@ -63955,13 +64210,13 @@ function scopedItems(items, parent, recursive, query2) {
63955
64210
  return inScope && (!normalizedQuery || String(item.name ?? "").toLocaleLowerCase().includes(normalizedQuery));
63956
64211
  });
63957
64212
  }
63958
- function migrationState(path3) {
63959
- if (!(0, import_node_fs8.existsSync)(path3)) return { items: {}, spaces: {} };
64213
+ function migrationState(path4) {
64214
+ if (!(0, import_node_fs8.existsSync)(path4)) return { items: {}, spaces: {} };
63960
64215
  try {
63961
- const parsed = JSON.parse((0, import_node_fs8.readFileSync)(path3, "utf8"));
64216
+ const parsed = JSON.parse((0, import_node_fs8.readFileSync)(path4, "utf8"));
63962
64217
  return { items: parsed.items ?? {}, spaces: parsed.spaces ?? {} };
63963
64218
  } catch {
63964
- throw new VertuError(`\u8FC1\u79FB\u72B6\u6001\u6587\u4EF6\u65E0\u6CD5\u89E3\u6790\uFF1A${path3}`);
64219
+ throw new VertuError(`\u8FC1\u79FB\u72B6\u6001\u6587\u4EF6\u65E0\u6CD5\u89E3\u6790\uFF1A${path4}`);
63965
64220
  }
63966
64221
  }
63967
64222
  async function migrateLocalVDrive(opts) {
@@ -63970,7 +64225,7 @@ async function migrateLocalVDrive(opts) {
63970
64225
  let spaces = [];
63971
64226
  const legacyIndexPath = (0, import_node_path16.join)(local.root, "index.json");
63972
64227
  if ((0, import_node_fs8.existsSync)(legacyIndexPath)) {
63973
- const parsed = record2(JSON.parse((0, import_node_fs8.readFileSync)(legacyIndexPath, "utf8")), "\u65E7 V\u76D8\u7D22\u5F15\u65E0\u6CD5\u89E3\u6790\u3002");
64228
+ const parsed = record3(JSON.parse((0, import_node_fs8.readFileSync)(legacyIndexPath, "utf8")), "\u65E7 V\u76D8\u7D22\u5F15\u65E0\u6CD5\u89E3\u6790\u3002");
63974
64229
  spaces = records(parsed.spaces).map((space) => ({
63975
64230
  id: String(space.id ?? ""),
63976
64231
  name: String(space.name ?? "\u56E2\u961F\u5171\u4EAB\u7A7A\u95F4"),
@@ -64018,7 +64273,7 @@ async function migrateLocalVDrive(opts) {
64018
64273
  members: space.members.filter((member) => Boolean(member) && typeof member === "object" && !Array.isArray(member) && member.role !== "owner"),
64019
64274
  security: space.security
64020
64275
  });
64021
- const createdSpace = result.space && typeof result.space === "object" ? record2(result.space) : records(result.spaces).find((candidate) => candidate.name === space.name && !Object.values(state.spaces).includes(String(candidate.id ?? "")));
64276
+ const createdSpace = result.space && typeof result.space === "object" ? record3(result.space) : records(result.spaces).find((candidate) => candidate.name === space.name && !Object.values(state.spaces).includes(String(candidate.id ?? "")));
64022
64277
  if (!createdSpace) throw new VertuError("V\u76D8\u670D\u52A1\u672A\u8FD4\u56DE\u65B0\u5EFA\u5171\u4EAB\u7A7A\u95F4\u3002");
64023
64278
  state.spaces[space.id] = String(createdSpace.id);
64024
64279
  migratedSpaces += 1;
@@ -64752,10 +65007,10 @@ async function fetchExecuteCatalog(serviceBaseUrl, domain) {
64752
65007
  ...vpsServiceAuthHeaders(base)
64753
65008
  }
64754
65009
  });
64755
- const text3 = await res.body.text();
65010
+ const text4 = await res.body.text();
64756
65011
  let data;
64757
65012
  try {
64758
- data = JSON.parse(text3);
65013
+ data = JSON.parse(text4);
64759
65014
  } catch {
64760
65015
  throw new VertuError(`\u8BFB\u53D6\u547D\u4EE4\u76EE\u5F55\u5931\u8D25\uFF1A\u975E JSON\uFF08HTTP ${res.statusCode}\uFF09`);
64761
65016
  }
@@ -64802,6 +65057,27 @@ function buildCatalogCommand() {
64802
65057
  });
64803
65058
  }
64804
65059
 
65060
+ // src/commands/service-account.ts
65061
+ var import_promises22 = require("fs/promises");
65062
+ function buildServiceAccountCommand() {
65063
+ const command = new Command("service-account").description("\u72EC\u7ACB\u670D\u52A1\u53F7\u540E\u53F0\uFF1A\u521B\u5EFA\u3001\u7F16\u8F91\u8349\u7A3F\u3001\u53D1\u5E03\u56FE\u6587/\u89C6\u9891\u53CA\u63A8\u9001");
65064
+ command.option("--service-account-url <url>", "\u72EC\u7ACB\u670D\u52A1\u5730\u5740", "https://vps-mp.vertu.cn");
65065
+ for (const [name, description] of Object.entries({ accounts: "\u5217\u51FA\u53EF\u7BA1\u7406\u670D\u52A1\u53F7", configure: "\u521B\u5EFA/\u914D\u7F6E\u670D\u52A1\u53F7\u548C\u53D1\u5E03\u4EBA\u5458", draft: "\u521B\u5EFA\u6216\u66F4\u65B0\u8349\u7A3F", publish: "\u53D1\u5E03\u5E76\u63A8\u9001\uFF08\u9ED8\u8BA4\u4EC5\u81EA\u5DF1\uFF09", articles: "\u67E5\u8BE2\u5185\u5BB9\u4E0E\u6295\u9012\u72B6\u6001", withdraw: "\u64A4\u56DE\u5185\u5BB9" })) {
65066
+ command.command(name).description(description).option("--json <json>", "JSON \u53C2\u6570").option("--file <path>", "\u4ECE JSON \u6587\u4EF6\u8BFB\u53D6\u53C2\u6570").action(async (opts, cmd) => {
65067
+ if (opts.json && opts.file) throw Error("--json \u548C --file \u4E0D\u80FD\u540C\u65F6\u4F7F\u7528");
65068
+ const base = String(cmd.optsWithGlobals().serviceAccountUrl).replace(/\/$/, "");
65069
+ if (new URL(base).origin !== "https://vps-mp.vertu.cn" && !isTrustedVpsServiceCredentialTarget(base)) throw Error("\u670D\u52A1\u5730\u5740\u672A\u7ECF\u4FE1\u4EFB\u914D\u7F6E\uFF0C\u62D2\u7EDD\u8F6C\u53D1 VPS \u51ED\u8BC1");
65070
+ const params = opts.file ? JSON.parse(await (0, import_promises22.readFile)(opts.file, "utf8")) : opts.json ? JSON.parse(opts.json) : {};
65071
+ const headers3 = vpsServiceAuthHeaders(resolveVpsServiceUrl());
65072
+ const response = await fetch(base + "/api/service-accounts", { method: "POST", headers: { ...headers3, "Content-Type": "application/json" }, body: JSON.stringify({ ...params, operation: name }), redirect: "error", signal: AbortSignal.timeout(6e4) });
65073
+ const result = await response.json();
65074
+ if (!response.ok) throw Error(result.error || `HTTP ${response.status}`);
65075
+ console.log(JSON.stringify(result, null, 2));
65076
+ });
65077
+ }
65078
+ return command;
65079
+ }
65080
+
64805
65081
  // src/commands/exec.ts
64806
65082
  function parseParamAssignments(raw) {
64807
65083
  const out = {};
@@ -64848,13 +65124,13 @@ function buildExecCommand() {
64848
65124
  // src/core/mcp-client.ts
64849
65125
  var PROTOCOL = "2025-03-26";
64850
65126
  var MAX_RESPONSE_BYTES = 8 * 1024 * 1024;
64851
- var record3 = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
65127
+ var record4 = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
64852
65128
  function rpcResult(value, id) {
64853
- const rpc = record3(value);
65129
+ const rpc = record4(value);
64854
65130
  if (rpc.id !== id) return void 0;
64855
65131
  if (rpc.error) throw new VertuError("MCP \u8BF7\u6C42\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u5DE5\u5177\u53C2\u6570\u548C\u670D\u52A1\u7AEF\u6388\u6743\u3002");
64856
65132
  if (!("result" in rpc)) throw new VertuError("MCP \u8FD4\u56DE\u4E86\u65E0\u6548\u54CD\u5E94\u3002");
64857
- return record3(rpc.result);
65133
+ return record4(rpc.result);
64858
65134
  }
64859
65135
  async function readResult(response, id) {
64860
65136
  const reader = response.body?.getReader();
@@ -64941,7 +65217,7 @@ async function runMcp(endpoint, authorizationHeaders, allowedTools, operation) {
64941
65217
  do {
64942
65218
  const page = await send("tools/list", cursor ? { cursor } : {});
64943
65219
  if (!Array.isArray(page.tools)) throw new VertuError("MCP \u5DE5\u5177\u76EE\u5F55\u65E0\u6548\u3002");
64944
- tools2.push(...page.tools.map(record3).filter((tool) => allowedTools.has(String(tool.name))));
65220
+ tools2.push(...page.tools.map(record4).filter((tool) => allowedTools.has(String(tool.name))));
64945
65221
  cursor = typeof page.nextCursor === "string" && page.nextCursor ? page.nextCursor : void 0;
64946
65222
  if (cursor && (cursors.has(cursor) || cursors.size >= 100)) throw new VertuError("MCP \u5DE5\u5177\u76EE\u5F55\u5206\u9875\u5F02\u5E38\u3002");
64947
65223
  if (cursor) cursors.add(cursor);
@@ -65332,7 +65608,7 @@ function rewriteLongFlag(tok) {
65332
65608
  }
65333
65609
 
65334
65610
  // src/bin/vps-work.ts
65335
- var PKG_VERSION = "2.5.1" ? "2.5.1" : "0.0.0-dev";
65611
+ var PKG_VERSION = "2.7.0" ? "2.7.0" : "0.0.0-dev";
65336
65612
  function smartFlagSuggest(flag, candidates) {
65337
65613
  if (!flag.startsWith("--") || flag.length < 4) return "";
65338
65614
  const word = flag.slice(2);
@@ -65441,6 +65717,7 @@ async function main() {
65441
65717
  program2.addCommand(buildHrCommand());
65442
65718
  program2.addCommand(buildProductCommand());
65443
65719
  program2.addCommand(buildPurchaseCommand());
65720
+ program2.addCommand(buildManufacturingCommand());
65444
65721
  program2.addCommand(buildApprovalCommand());
65445
65722
  program2.addCommand(buildOkrCommand());
65446
65723
  program2.addCommand(buildReportCommand());
@@ -65461,6 +65738,7 @@ async function main() {
65461
65738
  program2.addCommand(buildPopupCommand());
65462
65739
  program2.addCommand(buildCatalogCommand());
65463
65740
  program2.addCommand(buildExecCommand());
65741
+ program2.addCommand(buildServiceAccountCommand());
65464
65742
  program2.addCommand(buildVertuErpCommand());
65465
65743
  program2.addCommand(buildVertuAiSalesCommand());
65466
65744
  program2.addCommand(buildSkillCommand());