weaver-work-cli 0.1.67 → 0.1.69

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 (180) hide show
  1. package/dist/chunks/{archive-WUZKAEZ6.js → archive-VUTREF3P.js} +16 -12
  2. package/dist/chunks/{archive-oa-PN46RTI2.js → archive-oa-VXXO4RTB.js} +4 -4
  3. package/dist/chunks/{asset-ZPC5VWZM.js → asset-45U6TY7I.js} +44 -12
  4. package/dist/chunks/{asset-idle-DHGP3NYY.js → asset-idle-YCRBMTIT.js} +4 -4
  5. package/dist/chunks/{attachment-content-7SDA6WER.js → attachment-content-7BEDNQ3O.js} +3 -3
  6. package/dist/chunks/{blog-JC47AIXK.js → blog-5AML4WMG.js} +4 -4
  7. package/dist/chunks/{caizhilian-IKIHM77A.js → caizhilian-3P7BUNHT.js} +6 -6
  8. package/dist/chunks/{calendar-GZTSJ57Y.js → calendar-2HUXM3CZ.js} +4 -4
  9. package/dist/chunks/{chunk-33ANTJWB.js → chunk-3CBURKSY.js} +5 -5
  10. package/dist/chunks/{chunk-IN6NXQ26.js → chunk-3Q5F4C5B.js} +47 -27
  11. package/dist/chunks/{chunk-XARLZK6C.js → chunk-3TZURS7M.js} +3 -3
  12. package/dist/chunks/{chunk-R6GGDZ2C.js → chunk-4XYRTXRR.js} +1 -1
  13. package/dist/chunks/{chunk-LNWFHNVK.js → chunk-67AN5YJT.js} +379 -55
  14. package/dist/chunks/{chunk-KS6LXSCA.js → chunk-6DH73Q5H.js} +85 -81
  15. package/dist/chunks/{chunk-3W5NMGDS.js → chunk-727VKJQK.js} +2 -2
  16. package/dist/chunks/{chunk-5QYE52LG.js → chunk-7M5OYRK2.js} +18 -9
  17. package/dist/chunks/{chunk-TXXO4TJT.js → chunk-BEYEXCWU.js} +2 -2
  18. package/dist/chunks/{chunk-26FCCU5O.js → chunk-DSBV4GRK.js} +3 -3
  19. package/dist/chunks/{chunk-G7PQWD4L.js → chunk-DVFA3ODS.js} +38 -10
  20. package/dist/chunks/{chunk-HWA2A25Y.js → chunk-E7VWE2XI.js} +3 -3
  21. package/dist/chunks/{chunk-DTJZOAO6.js → chunk-ELF5TPSG.js} +7 -7
  22. package/dist/chunks/{chunk-6ZOSVKMT.js → chunk-ERAE4GHX.js} +1 -1
  23. package/dist/chunks/{chunk-4PYLZORW.js → chunk-FMAZ42HS.js} +12 -12
  24. package/dist/chunks/{chunk-TJN4PIYO.js → chunk-GTAFCAVP.js} +2 -0
  25. package/dist/chunks/{chunk-WSHIOSGM.js → chunk-H2NRTGZR.js} +3 -3
  26. package/dist/chunks/{chunk-4WCVRDC5.js → chunk-HG6INLH6.js} +13 -0
  27. package/dist/chunks/{chunk-FDBAFANU.js → chunk-I5XB4MZT.js} +227 -23
  28. package/dist/chunks/{chunk-RU7ZZQQQ.js → chunk-JAIZY37Z.js} +4 -4
  29. package/dist/chunks/{chunk-ATEXBEPD.js → chunk-LCM5SSGJ.js} +4 -1
  30. package/dist/chunks/{chunk-FJUOUSV3.js → chunk-LRKKKO5A.js} +36 -9
  31. package/dist/chunks/{chunk-HLT6B26P.js → chunk-LSVA7QA6.js} +1 -1
  32. package/dist/chunks/{chunk-6N4JPNFL.js → chunk-MD5CW4B6.js} +1 -1
  33. package/dist/chunks/{chunk-MRYKV5HN.js → chunk-MLJK4KLE.js} +37 -37
  34. package/dist/chunks/{chunk-C4YQJFZV.js → chunk-PAWXVT6H.js} +22 -11
  35. package/dist/chunks/{chunk-Q6D6PSMH.js → chunk-QYDSTYGG.js} +3 -3
  36. package/dist/chunks/{chunk-AFZTMYGC.js → chunk-T24EBWAZ.js} +1 -1
  37. package/dist/chunks/{chunk-6T5X6YWX.js → chunk-U3OO3IZF.js} +3 -3
  38. package/dist/chunks/{chunk-VLY5RTVO.js → chunk-UVWW5ABZ.js} +3 -3
  39. package/dist/chunks/{chunk-NP3ZZFGI.js → chunk-VZUH3LKI.js} +16 -5
  40. package/dist/chunks/{chunk-JU5OPHSY.js → chunk-YR3K53BU.js} +36 -27
  41. package/dist/chunks/{conflict-DYCSX7CN.js → conflict-VKCRXHUV.js} +2 -2
  42. package/dist/chunks/{contract-N5WNHKHI.js → contract-3PMHUASH.js} +202 -25
  43. package/dist/chunks/{cowork-34CBYVQP.js → cowork-FZBTTBYX.js} +4 -4
  44. package/dist/chunks/{create-flow-PABAGCK2.js → create-flow-WYPLBLRK.js} +6 -6
  45. package/dist/chunks/{data-QKWI5325.js → data-2YZ6A6TL.js} +32 -5
  46. package/dist/chunks/{ebuilder-form-ZONRROK4.js → ebuilder-form-AWPTMZBZ.js} +6 -6
  47. package/dist/chunks/{ehr-2CONM7R6.js → ehr-MNPR4TE5.js} +4 -4
  48. package/dist/chunks/{employee-PGMY6NI6.js → employee-QX57HEWS.js} +1 -1
  49. package/dist/chunks/{entry-mode-C2WPJQJM.js → entry-mode-BCJ7RPFC.js} +3 -3
  50. package/dist/chunks/{env-SEEXUXZF.js → env-SCVCHBN2.js} +2 -2
  51. package/dist/chunks/{esb-FQASCY2H.js → esb-GSB5QCEX.js} +6 -6
  52. package/dist/chunks/{factory-WNLDOLJZ.js → factory-CBXYOEBF.js} +1 -1
  53. package/dist/chunks/{fna-FCLVIWAS.js → fna-XBSNUS2V.js} +4 -4
  54. package/dist/chunks/{group-chat-DOS4XWUN.js → group-chat-RFL4U7RF.js} +3 -3
  55. package/dist/chunks/{host-P7G22WNM.js → host-2UMNXX5H.js} +4 -4
  56. package/dist/chunks/{host-XLCBLNJD.js → host-BD44ASOD.js} +4 -4
  57. package/dist/chunks/{host-2ED2KC4X.js → host-NVDG3NC6.js} +4 -4
  58. package/dist/chunks/{host-46NYKDQP.js → host-R7BP3CTI.js} +4 -4
  59. package/dist/chunks/{host-7IPZKIM4.js → host-SYPCA63D.js} +4 -4
  60. package/dist/chunks/{host-2UYZEY2V.js → host-XVWBOSEN.js} +4 -4
  61. package/dist/chunks/{hrm-XKL27NX2.js → hrm-FZUDJAND.js} +20 -14
  62. package/dist/chunks/{im-NDYIMASG.js → im-F5NENPD7.js} +5 -5
  63. package/dist/chunks/{invoice-SMODTN2D.js → invoice-DS6FLU55.js} +44 -7
  64. package/dist/chunks/{jiuchuanhui-3T5X7SB7.js → jiuchuanhui-PY2WEBUH.js} +161 -10
  65. package/dist/chunks/{lazy-dispatch-K25LTKQY.js → lazy-dispatch-F6O2EPGR.js} +7 -7
  66. package/dist/chunks/{mail-P7VMUKQW.js → mail-ZEOSANEJ.js} +4 -4
  67. package/dist/chunks/{meeting-2IWXP5IL.js → meeting-N2AGGLVI.js} +15 -15
  68. package/dist/chunks/{minute-doc-N4OR5OLP.js → minute-doc-C62EZOJH.js} +4 -4
  69. package/dist/chunks/{okr-VZXRQGS4.js → okr-OZUMTMCL.js} +11 -5
  70. package/dist/chunks/{operations-62N6EP3C.js → operations-LQY3FTPH.js} +1 -1
  71. package/dist/chunks/{operations-MI2BSKZX.js → operations-UTUWFJTX.js} +5 -5
  72. package/dist/chunks/{org-NFE7X7FK.js → org-MWWIFNAO.js} +1 -1
  73. package/dist/chunks/{performance-OPEQNW7Y.js → performance-GBKM5G2Y.js} +3 -3
  74. package/dist/chunks/{plan-TJAS4N5X.js → plan-C2NENH42.js} +4 -4
  75. package/dist/chunks/{project-CYBGU6K6.js → project-FAJ2P3UR.js} +4 -4
  76. package/dist/chunks/{reception-3FT2F66K.js → reception-NH6MJFPR.js} +20 -10
  77. package/dist/chunks/{recruit-stage-WPGB5BDJ.js → recruit-stage-DPEFHLSE.js} +7 -4
  78. package/dist/chunks/{registry-JMNOXRST.js → registry-4S3RXXWS.js} +3 -3
  79. package/dist/chunks/{registry-XOUVCSV4.js → registry-7US3QQXV.js} +12 -12
  80. package/dist/chunks/{registry-E5RQJVWN.js → registry-AC33ZZVH.js} +1 -1
  81. package/dist/chunks/{registry-QRMXRSCT.js → registry-FTPUUHWC.js} +5 -5
  82. package/dist/chunks/{registry-ABKBGGGK.js → registry-Y2HWS6JS.js} +4 -4
  83. package/dist/chunks/{room-recommend-TWIEVY44.js → room-recommend-LMNF76YS.js} +4 -4
  84. package/dist/chunks/{schedule-XZ4UUX4E.js → schedule-4QE2THAP.js} +4 -4
  85. package/dist/chunks/{smart-extract-DEBLJPCQ.js → smart-extract-GTYKF5TJ.js} +32 -21
  86. package/dist/chunks/{workflow-D7LBN5MZ.js → workflow-KXYTQZ2H.js} +81 -12
  87. package/dist/core/error-codes.js +1 -1
  88. package/dist/core/host-policy.js +56 -0
  89. package/dist/core/timing.js +227 -0
  90. package/dist/index.js +39 -36
  91. package/dist/internal/e10/auth/commands.js +11 -0
  92. package/dist/internal/e10/auth/error-log.js +13 -0
  93. package/dist/internal/e10/auth/messages.js +10 -0
  94. package/dist/internal/e10/auth/xiaoe.js +12 -2
  95. package/dist/internal/e10/context.js +39 -12
  96. package/dist/internal/e10/network-error.js +28 -0
  97. package/dist/internal/e10/tls-policy.js +260 -0
  98. package/dist/shortcuts/archive/operations/archive-info.js +9 -5
  99. package/dist/shortcuts/asset/manifest.js +42 -4
  100. package/dist/shortcuts/contract/manifest.js +204 -21
  101. package/dist/shortcuts/data/manifest.js +45 -2
  102. package/dist/shortcuts/ebuilder-form/manifest.js +38 -10
  103. package/dist/shortcuts/hrm/index.js +20 -7
  104. package/dist/shortcuts/hrm/operations/employee.js +22 -11
  105. package/dist/shortcuts/hrm/operations/org.js +18 -9
  106. package/dist/shortcuts/hrm/operations/position.js +24 -12
  107. package/dist/shortcuts/hrm/operations/resolve.js +18 -10
  108. package/dist/shortcuts/im/operations/group-read.js +4 -1
  109. package/dist/shortcuts/invoice/manifest.js +44 -1
  110. package/dist/shortcuts/jiuchuanhui/host.js +76 -4
  111. package/dist/shortcuts/jiuchuanhui/manifest.js +106 -2
  112. package/dist/shortcuts/meeting/operations/attachment-content.js +25 -16
  113. package/dist/shortcuts/meeting/operations/eb/member-expand.js +1 -0
  114. package/dist/shortcuts/meeting/operations/invitation.js +1 -1
  115. package/dist/shortcuts/meeting/operations/link.js +20 -17
  116. package/dist/shortcuts/okr/operations/read.js +7 -1
  117. package/dist/shortcuts/reception/host.js +19 -5
  118. package/dist/shortcuts/reception/manifest.js +2 -0
  119. package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +4 -1
  120. package/dist/shortcuts/smart-extract/operations/structure.js +13 -10
  121. package/dist/shortcuts/smart-extract/operations/target.js +15 -7
  122. package/dist/shortcuts/workflow/index.js +55 -5
  123. package/dist/shortcuts/workflow/operations/aiDeepRead/collect.js +26 -2
  124. package/dist/shortcuts/workflow/operations/aiDeepRead/render.js +23 -4
  125. package/dist/shortcuts/workflow/operations/deepRead.js +295 -4
  126. package/dist/shortcuts/workflow/operations/read.js +44 -22
  127. package/dist/shortcuts/workflow/operations/types.js +7 -1
  128. package/dist/shortcuts/workflow/operations/write.js +20 -2
  129. package/dist/shortcuts/workflow/operations.js +19 -1
  130. package/docs/e10-auth.md +48 -1
  131. package/package.json +1 -1
  132. package/scripts/xiaoe_env.py +18 -3
  133. package/skills/weaver-e10-asset-idle/SKILL.md +1 -1
  134. package/skills/weaver-e10-blog/SKILL.md +2 -2
  135. package/skills/weaver-e10-calendar/SKILL.md +1 -1
  136. package/skills/weaver-e10-data/SKILL.md +1 -1
  137. package/skills/weaver-e10-esb/SKILL.md +1 -1
  138. package/skills/weaver-e10-esb/references/source-manifest.json +3 -3
  139. package/skills/weaver-e10-hrm/SKILL.md +1 -1
  140. package/skills/weaver-e10-jiuchuanhui/references/customer.md +1 -0
  141. package/skills/weaver-e10-jucailin/SKILL.md +84 -17
  142. package/skills/weaver-e10-jucailin/agents/openai.yaml +2 -1
  143. package/skills/weaver-e10-jucailin/references/recruit-create.md +7 -8
  144. package/skills/weaver-e10-jucailin/references/recruit-implement-INDEX.md +41 -0
  145. package/skills/weaver-e10-jucailin/references/recruit-implement-consult-sop.md +77 -0
  146. package/skills/weaver-e10-jucailin/references/recruit-implement-guardrails.md +41 -0
  147. package/skills/weaver-e10-jucailin/references/recruit-implement-kb-data-update-channels.md +31 -0
  148. package/skills/weaver-e10-jucailin/references/recruit-implement-kb-form-external.md +43 -0
  149. package/skills/weaver-e10-jucailin/references/recruit-implement-kb-talent-base-form.md +32 -0
  150. package/skills/weaver-e10-jucailin/references/recruit-implement-pattern-external-collect-update-talent.md +93 -0
  151. package/skills/weaver-e10-jucailin/references/recruit-implement-pattern-external-share-edit.md +64 -0
  152. package/skills/weaver-e10-jucailin/references/recruit-read.md +1 -1
  153. package/skills/weaver-e10-jucailin/references/recruit-stage-ops.md +1 -1
  154. package/skills/weaver-e10-jucailin/references/recruit-write.md +4 -11
  155. package/skills/weaver-e10-jucailin/references/safety-boundaries.md +3 -3
  156. package/skills/weaver-e10-mail/SKILL.md +52 -10
  157. package/skills/weaver-e10-mail/references/mail-agent-entry.md +1 -2
  158. package/skills/weaver-e10-meeting/SKILL.md +1 -1
  159. package/skills/weaver-e10-meeting/references/meeting-verification.md +1 -1
  160. package/skills/weaver-e10-okr/SKILL.md +1 -1
  161. package/skills/weaver-e10-okr/references/source-manifest.json +5 -5
  162. package/skills/weaver-e10-plan/SKILL.md +2 -2
  163. package/skills/weaver-e10-plan/references/source-manifest.json +3 -3
  164. package/skills/weaver-e10-qiyecheng/SKILL.md +2 -2
  165. package/skills/weaver-e10-qiyecheng/references/source-manifest.json +3 -3
  166. package/skills/weaver-e10-reception-flow/SKILL.md +53 -16
  167. package/skills/weaver-e10-shared/SKILL.md +4 -9
  168. package/skills/weaver-e10-shared/references/e10-auth-and-session.md +2 -2
  169. package/skills/weaver-e10-shijingran/SKILL.md +14 -6
  170. package/skills/weaver-e10-shijingran/references/source-manifest.json +5 -4
  171. package/skills/weaver-e10-workflow/SKILL.md +11 -11
  172. package/skills/weaver-e10-workflow/aiDeepRead/templates//346/261/207/346/200/273/345/256/241/346/211/271-demo.html +92 -12
  173. package/skills/weaver-e10-workflow/references/source-manifest.json +3 -3
  174. package/skills/weaver-e10-workflow/references/todo-smart-convert.md +6 -4
  175. package/skills/weaver-e10-workflow/references/workflow-agent-entry.md +1 -2
  176. package/skills/weaver-e10-workflow/references/workflow-deep-read.md +44 -8
  177. package/skills/weaver-e10-workflow/tools/todo-summary.cjs +84 -12
  178. package/skills/weaver-e10-yimiaoban/references/source-manifest.json +3 -3
  179. package/skills/weaver-e10-ziguanjia/SKILL.md +1 -1
  180. package/skills/weaver-e10-ziguanjia/references/ziguanjia-agent-entry.md +1 -2
@@ -81,6 +81,19 @@ var NETWORK_ERROR_CODES = /* @__PURE__ */ new Set([
81
81
  "ERR_TLS_CERT_ALTNAME_INVALID",
82
82
  "ERR_SSL_WRONG_VERSION_NUMBER"
83
83
  ]);
84
+ var TLS_TRUST_ERROR_CODES = /* @__PURE__ */ new Set([
85
+ "DEPTH_ZERO_SELF_SIGNED_CERT",
86
+ "SELF_SIGNED_CERT_IN_CHAIN",
87
+ "UNABLE_TO_VERIFY_LEAF_SIGNATURE",
88
+ "UNABLE_TO_GET_ISSUER_CERT",
89
+ "UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
90
+ "CERT_HAS_EXPIRED",
91
+ "CERT_NOT_YET_VALID",
92
+ "CERT_UNTRUSTED",
93
+ "CERT_REVOKED",
94
+ "ERR_TLS_CERT_ALTNAME_INVALID"
95
+ ]);
96
+ var TLS_TRUST_MESSAGE_PATTERN = /certificate verify failed|self[- ]signed certificate|certificate (?:has )?expired|unable to (?:verify|get) (?:the )?(?:leaf|issuer|local issuer)|certificate chain/i;
84
97
  var ABORT_ERROR_CODE = "ABORT_ERR";
85
98
  function asRecord(value) {
86
99
  return value && typeof value === "object" ? value : null;
@@ -111,6 +124,12 @@ function isAbortError(error) {
111
124
  function isNetworkErrorCode(code) {
112
125
  return typeof code === "string" && NETWORK_ERROR_CODES.has(code.toUpperCase());
113
126
  }
127
+ function isTlsTrustErrorCode(code) {
128
+ return typeof code === "string" && TLS_TRUST_ERROR_CODES.has(code.toUpperCase());
129
+ }
130
+ function looksLikeTlsTrustMessage(message) {
131
+ return TLS_TRUST_MESSAGE_PATTERN.test(message);
132
+ }
114
133
  var TRANSPORT_MESSAGE_PATTERN = /fetch failed|socket hang up|other side closed|network|connection (?:refused|reset|closed)|timed? ?out|timeout|certificate|getaddrinfo|dns lookup/i;
115
134
  function looksLikeTransportMessage(message) {
116
135
  return TRANSPORT_MESSAGE_PATTERN.test(message);
@@ -1021,13 +1040,188 @@ var E10AuthSession = class _E10AuthSession {
1021
1040
  }
1022
1041
  };
1023
1042
 
1043
+ // src/internal/e10/tls-policy.ts
1044
+ import { existsSync as existsSync4, readFileSync as readFileSync4 } from "node:fs";
1045
+ import { homedir as homedir2 } from "node:os";
1046
+ import { resolve as resolve5 } from "node:path";
1047
+ import * as tls from "node:tls";
1048
+ var E10_TLS_CA_FILE_ENV = "WEAVER_E10_CA_FILE";
1049
+ var E10_TLS_CA_FILE_ALIASES = ["WEAVER_XIAOE_CA_FILE"];
1050
+ var E10_TLS_INSECURE_ENV = "WEAVER_E10_TLS_INSECURE";
1051
+ var INSECURE_VALUES = /* @__PURE__ */ new Set(["1", "true", "yes", "on"]);
1052
+ var PEM_MARKER = "BEGIN CERTIFICATE";
1053
+ function readE10TlsCaFilePaths(env = process.env) {
1054
+ const raw = [E10_TLS_CA_FILE_ENV, ...E10_TLS_CA_FILE_ALIASES].map((key) => env[key]).filter((value) => typeof value === "string" && value.trim().length > 0).join(",");
1055
+ const paths = [];
1056
+ for (const candidate of raw.split(/[,\n]/u)) {
1057
+ const trimmed = candidate.trim();
1058
+ if (!trimmed) continue;
1059
+ const absolute = resolve5(expandHome(trimmed));
1060
+ if (!paths.includes(absolute)) paths.push(absolute);
1061
+ }
1062
+ return paths;
1063
+ }
1064
+ function expandHome(value) {
1065
+ if (value === "~") return homedir2();
1066
+ if (value.startsWith("~/")) return resolve5(homedir2(), value.slice(2));
1067
+ return value;
1068
+ }
1069
+ function isE10TlsInsecureEnabled(env = process.env) {
1070
+ const raw = env[E10_TLS_INSECURE_ENV];
1071
+ return typeof raw === "string" && INSECURE_VALUES.has(raw.trim().toLowerCase());
1072
+ }
1073
+ function resolveE10TlsPolicy(env = process.env) {
1074
+ const configuredFiles = readE10TlsCaFilePaths(env);
1075
+ const insecureSource = isE10TlsInsecureEnabled(env) ? "flag" : env.NODE_TLS_REJECT_UNAUTHORIZED === "0" ? "node-env" : void 0;
1076
+ if (insecureSource) {
1077
+ return { mode: "insecure", configuredFiles, caFiles: [], ca: [], insecureSource };
1078
+ }
1079
+ if (!configuredFiles.length) {
1080
+ return { mode: "system", configuredFiles: [], caFiles: [], ca: [] };
1081
+ }
1082
+ const ca = [];
1083
+ const caFiles = [];
1084
+ const problems = [];
1085
+ for (const file of configuredFiles) {
1086
+ try {
1087
+ if (!existsSync4(file)) {
1088
+ problems.push(`${file}: \u6587\u4EF6\u4E0D\u5B58\u5728`);
1089
+ continue;
1090
+ }
1091
+ const text = readFileSync4(file, "utf8");
1092
+ if (!text.includes(PEM_MARKER)) {
1093
+ problems.push(`${file}: \u4E0D\u662F PEM \u8BC1\u4E66\uFF08\u7F3A\u5C11 ${PEM_MARKER}\uFF09`);
1094
+ continue;
1095
+ }
1096
+ ca.push(text);
1097
+ caFiles.push(file);
1098
+ } catch (error) {
1099
+ problems.push(`${file}: ${error instanceof Error ? error.message : String(error)}`);
1100
+ }
1101
+ }
1102
+ return {
1103
+ mode: "custom-ca",
1104
+ configuredFiles,
1105
+ caFiles,
1106
+ ca,
1107
+ ...problems.length ? { error: problems.join("\uFF1B") } : {}
1108
+ };
1109
+ }
1110
+ var cachedStatus;
1111
+ var cachedKey = "";
1112
+ function policyKey(policy) {
1113
+ return [policy.mode, policy.caFiles.join(","), policy.ca.length, policy.error || ""].join("|");
1114
+ }
1115
+ var insecureWarningEmitted = false;
1116
+ function applyInsecure(policy) {
1117
+ process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
1118
+ if (policy.insecureSource === "flag" && !insecureWarningEmitted) {
1119
+ insecureWarningEmitted = true;
1120
+ process.stderr.write(
1121
+ "[weaver-work-cli] \u8B66\u544A\uFF1A\u5DF2\u6309 WEAVER_E10_TLS_INSECURE \u5173\u95ED TLS \u8BC1\u4E66\u6821\u9A8C\uFF0C\u4EC5\u7528\u4E8E\u6392\u67E5\u8BC1\u4E66\u95EE\u9898\uFF1B\u6362\u7968\u8BF7\u6C42\u4F1A\u643A\u5E26\u5E73\u53F0\u7968\u636E\uFF0C\u786E\u8BA4\u540E\u8BF7\u7ACB\u5373\u53D6\u6D88\u8BE5\u53D8\u91CF\u3002\n"
1122
+ );
1123
+ }
1124
+ return { ...policy, applied: true };
1125
+ }
1126
+ function applyUncached(policy) {
1127
+ if (policy.mode === "insecure") return applyInsecure(policy);
1128
+ if (policy.mode !== "custom-ca" || !policy.ca.length) {
1129
+ return { ...policy, applied: false, notAppliedReason: "no-custom-ca" };
1130
+ }
1131
+ const runtime = tls;
1132
+ if (typeof runtime.setDefaultCACertificates !== "function") {
1133
+ return { ...policy, applied: false, notAppliedReason: "unsupported-runtime" };
1134
+ }
1135
+ try {
1136
+ const existing = typeof runtime.getCACertificates === "function" ? runtime.getCACertificates("default") : [];
1137
+ runtime.setDefaultCACertificates([...existing, ...policy.ca]);
1138
+ return { ...policy, applied: true };
1139
+ } catch (error) {
1140
+ return applyPerFile(runtime, policy, error);
1141
+ }
1142
+ }
1143
+ function applyPerFile(runtime, policy, batchError) {
1144
+ const setter = runtime.setDefaultCACertificates;
1145
+ let existing = [];
1146
+ try {
1147
+ existing = typeof runtime.getCACertificates === "function" ? runtime.getCACertificates("default") : [];
1148
+ } catch {
1149
+ existing = [];
1150
+ }
1151
+ const acceptedCa = [];
1152
+ const acceptedFiles = [];
1153
+ const rejectedFiles = [];
1154
+ for (let index = 0; index < policy.ca.length; index += 1) {
1155
+ const pem = policy.ca[index];
1156
+ const file = policy.caFiles[index];
1157
+ try {
1158
+ setter([...existing, ...acceptedCa, pem]);
1159
+ acceptedCa.push(pem);
1160
+ if (file) acceptedFiles.push(file);
1161
+ } catch {
1162
+ rejectedFiles.push(file || `#${index + 1}`);
1163
+ }
1164
+ }
1165
+ if (!acceptedCa.length) {
1166
+ return {
1167
+ ...policy,
1168
+ applied: false,
1169
+ notAppliedReason: "failed",
1170
+ applyError: batchError instanceof Error ? batchError.message : String(batchError)
1171
+ };
1172
+ }
1173
+ return {
1174
+ ...policy,
1175
+ caFiles: acceptedFiles,
1176
+ ca: acceptedCa,
1177
+ applied: true,
1178
+ ...rejectedFiles.length ? { error: `\u4EE5\u4E0B CA \u6587\u4EF6\u65E0\u6CD5\u52A0\u5165\u4FE1\u4EFB\u94FE\uFF1A${rejectedFiles.join("\u3001")}` } : {}
1179
+ };
1180
+ }
1181
+ function applyE10TlsPolicy(env = process.env) {
1182
+ const policy = resolveE10TlsPolicy(env);
1183
+ const key = policyKey(policy);
1184
+ if (cachedStatus && cachedKey === key) return cachedStatus;
1185
+ cachedStatus = applyUncached(policy);
1186
+ cachedKey = key;
1187
+ return cachedStatus;
1188
+ }
1189
+ function currentE10TlsPolicyStatus(env = process.env) {
1190
+ const policy = resolveE10TlsPolicy(env);
1191
+ if (cachedStatus && cachedKey === policyKey(policy)) return cachedStatus;
1192
+ return applyE10TlsPolicy(env);
1193
+ }
1194
+ function summarizeE10TlsPolicy(status) {
1195
+ const summary = {
1196
+ mode: status.mode,
1197
+ caFiles: status.caFiles,
1198
+ applied: status.applied
1199
+ };
1200
+ if (!status.applied && status.notAppliedReason) summary.notAppliedReason = status.notAppliedReason;
1201
+ if (status.error) summary.error = status.error;
1202
+ if (status.mode === "insecure" && status.insecureSource) summary.insecureSource = status.insecureSource;
1203
+ return summary;
1204
+ }
1205
+ function e10TlsChildEnv(env = process.env) {
1206
+ const policy = resolveE10TlsPolicy(env);
1207
+ if (policy.mode === "insecure") {
1208
+ return { ...env, [E10_TLS_INSECURE_ENV]: "1" };
1209
+ }
1210
+ if (policy.mode !== "custom-ca" || !policy.caFiles.length) return env;
1211
+ const bundle = policy.caFiles[0];
1212
+ const next = { ...env };
1213
+ if (!next.SSL_CERT_FILE) next.SSL_CERT_FILE = bundle;
1214
+ if (!next.REQUESTS_CA_BUNDLE) next.REQUESTS_CA_BUNDLE = bundle;
1215
+ return next;
1216
+ }
1217
+
1024
1218
  // src/core/package-paths.ts
1025
- import { existsSync as existsSync4, realpathSync } from "node:fs";
1026
- import { dirname as dirname3, join, resolve as resolve5 } from "node:path";
1219
+ import { existsSync as existsSync5, realpathSync } from "node:fs";
1220
+ import { dirname as dirname3, join, resolve as resolve6 } from "node:path";
1027
1221
  import { fileURLToPath, pathToFileURL } from "node:url";
1028
1222
  var cachedRoot;
1029
1223
  function entryDirectory(entry) {
1030
- const absoluteEntry = resolve5(entry);
1224
+ const absoluteEntry = resolve6(entry);
1031
1225
  try {
1032
1226
  return dirname3(realpathSync(absoluteEntry));
1033
1227
  } catch {
@@ -1043,7 +1237,7 @@ function packageRootDir() {
1043
1237
  for (const seed of seeds) {
1044
1238
  let dir = seed;
1045
1239
  for (let depth = 0; depth < 10; depth += 1) {
1046
- if (existsSync4(join(dir, "package.json"))) {
1240
+ if (existsSync5(join(dir, "package.json"))) {
1047
1241
  cachedRoot = dir;
1048
1242
  return dir;
1049
1243
  }
@@ -1084,8 +1278,8 @@ function isXiaoERuntime(options) {
1084
1278
 
1085
1279
  // src/internal/e10/auth/xiaoe.ts
1086
1280
  import { execFile } from "node:child_process";
1087
- import { accessSync, constants as fsConstants, existsSync as existsSync5, readFileSync as readFileSync4, readdirSync as readdirSync2, statSync } from "node:fs";
1088
- import { homedir as homedir2 } from "node:os";
1281
+ import { accessSync, constants as fsConstants, existsSync as existsSync6, readFileSync as readFileSync5, readdirSync as readdirSync2, statSync } from "node:fs";
1282
+ import { homedir as homedir3 } from "node:os";
1089
1283
  import { join as join2 } from "node:path";
1090
1284
  var DEFAULT_E10_LOGIN_BASE_URL = "https://weapp.eteams.cn";
1091
1285
  var DEFAULT_E10_BASE_URL = "https://www.e-cology.com.cn";
@@ -1485,25 +1679,25 @@ function xiaoETokenScriptCandidatePaths(env = process.env) {
1485
1679
  ]);
1486
1680
  }
1487
1681
  const envHome = envString(env, "HOME");
1488
- const nodeHome = envHome ? "" : homedir2();
1682
+ const nodeHome = envHome ? "" : homedir3();
1489
1683
  return uniqueStrings([
1490
1684
  envHome ? join2(envHome, "Library", "Application Support", "xiaoeUserData", "tokens.py") : "",
1491
1685
  nodeHome ? join2(nodeHome, "Library", "Application Support", "xiaoeUserData", "tokens.py") : ""
1492
1686
  ]);
1493
1687
  }
1494
1688
  function xiaoETokenScriptPath(env = process.env) {
1495
- return xiaoETokenScriptCandidatePaths(env).find((path) => existsSync5(path)) || "";
1689
+ return xiaoETokenScriptCandidatePaths(env).find((path) => existsSync6(path)) || "";
1496
1690
  }
1497
1691
  function xiaoEBundledEnvScriptPath() {
1498
1692
  const scriptPath = packagePath("scripts", "xiaoe_env.py");
1499
- return existsSync5(scriptPath) ? scriptPath : "";
1693
+ return existsSync6(scriptPath) ? scriptPath : "";
1500
1694
  }
1501
1695
  function hasXiaoETokenScript(env = process.env, allowLocalDiscovery = true) {
1502
1696
  const explicit = envString(env, XIAOE_TOKEN_SCRIPT_ENV_KEY, XIAOE_TOKEN_SCRIPT_LEGACY_ENV_KEY);
1503
- if (explicit) return existsSync5(explicit);
1697
+ if (explicit) return existsSync6(explicit);
1504
1698
  if (!allowLocalDiscovery) return false;
1505
1699
  const scriptPath = xiaoETokenScriptPath(env);
1506
- return Boolean(scriptPath && existsSync5(scriptPath));
1700
+ return Boolean(scriptPath && existsSync6(scriptPath));
1507
1701
  }
1508
1702
  function isExecutableFile(path) {
1509
1703
  try {
@@ -1515,7 +1709,7 @@ function isExecutableFile(path) {
1515
1709
  }
1516
1710
  }
1517
1711
  function listXiaoEPythonRuntimeDirectories(resourcesRoot) {
1518
- if (!resourcesRoot || !existsSync5(resourcesRoot)) return [];
1712
+ if (!resourcesRoot || !existsSync6(resourcesRoot)) return [];
1519
1713
  try {
1520
1714
  return readdirSync2(resourcesRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory() && /^Python3(?:[-_.]\d[\d.]*)?$/iu.test(entry.name)).map((entry) => join2(resourcesRoot, entry.name)).sort((left, right) => right.localeCompare(left, void 0, { numeric: true }));
1521
1715
  } catch {
@@ -1523,7 +1717,7 @@ function listXiaoEPythonRuntimeDirectories(resourcesRoot) {
1523
1717
  }
1524
1718
  }
1525
1719
  function listExecutablePythonFiles(directory, platform) {
1526
- if (!directory || !existsSync5(directory)) return [];
1720
+ if (!directory || !existsSync6(directory)) return [];
1527
1721
  try {
1528
1722
  const pattern = platform === "win32" ? /^python(?:3(?:\.\d+)*)?\.exe$/iu : /^python3(?:\.\d+)*$/u;
1529
1723
  return readdirSync2(directory, { withFileTypes: true }).filter((entry) => entry.isFile() && pattern.test(entry.name)).map((entry) => join2(directory, entry.name)).filter(isExecutableFile).sort((left, right) => right.localeCompare(left, void 0, { numeric: true }));
@@ -1535,7 +1729,7 @@ function xiaoEClientPythonCandidates(env = process.env, platform = process.platf
1535
1729
  const appRoots = [];
1536
1730
  if (platform === "darwin") {
1537
1731
  const envHome = envString(env, "HOME");
1538
- const nodeHome = homedir2();
1732
+ const nodeHome = homedir3();
1539
1733
  for (const home of uniqueStrings([envHome, nodeHome])) {
1540
1734
  appRoots.push(join2(home, "Applications", "\u667A\u80FD\u5C0Fe.app"));
1541
1735
  }
@@ -1682,12 +1876,14 @@ async function runXiaoETokenScriptOnce(pythonCommand, scriptPath, baseUrl, env)
1682
1876
  ' raise SystemExit("XiaoE credential script produced empty stdout")',
1683
1877
  "print(json.dumps(data, ensure_ascii=False))"
1684
1878
  ].join("\n");
1685
- return await new Promise((resolve7, reject) => {
1879
+ return await new Promise((resolve8, reject) => {
1686
1880
  execFile(
1687
1881
  pythonCommand,
1688
1882
  ["-c", wrapper],
1689
1883
  {
1690
- env,
1884
+ // Python 只认自己的信任链:把 CLI 里的 CA 配置翻译成它能读的变量,
1885
+ // 否则同一个网关会呈现「Node 通了、脚本还在报自签名」的分裂状态。
1886
+ env: e10TlsChildEnv(env),
1691
1887
  timeout: XIAOE_TOKEN_SCRIPT_TIMEOUT_MS,
1692
1888
  maxBuffer: 1024 * 1024
1693
1889
  },
@@ -1711,7 +1907,7 @@ async function runXiaoETokenScriptOnce(pythonCommand, scriptPath, baseUrl, env)
1711
1907
  }
1712
1908
  try {
1713
1909
  const parsed = JSON.parse(text);
1714
- resolve7(parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null);
1910
+ resolve8(parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null);
1715
1911
  } catch {
1716
1912
  reject(new CliError("XiaoE credential script stdout is not valid JSON.", 3 /* AuthError */));
1717
1913
  }
@@ -1720,7 +1916,7 @@ async function runXiaoETokenScriptOnce(pythonCommand, scriptPath, baseUrl, env)
1720
1916
  });
1721
1917
  }
1722
1918
  async function runXiaoEPythonCredentialScript(scriptPath, baseUrl, env) {
1723
- if (!scriptPath || !existsSync5(scriptPath)) return null;
1919
+ if (!scriptPath || !existsSync6(scriptPath)) return null;
1724
1920
  let lastError = null;
1725
1921
  for (const pythonCommand of xiaoETokenScriptPythonCandidates(env)) {
1726
1922
  try {
@@ -1775,11 +1971,11 @@ function xiaoEClientRobotsRoot(env = process.env) {
1775
1971
  const localAppData = envString(env, "LOCALAPPDATA");
1776
1972
  return localAppData ? join2(localAppData, "XiaoE", "Robots") : "";
1777
1973
  }
1778
- const home = envString(env, "HOME") || homedir2();
1974
+ const home = envString(env, "HOME") || homedir3();
1779
1975
  return home ? join2(home, "Library", "Application Support", "XiaoE", "Robots") : "";
1780
1976
  }
1781
1977
  function isFile(path) {
1782
- if (!path || !existsSync5(path)) return false;
1978
+ if (!path || !existsSync6(path)) return false;
1783
1979
  try {
1784
1980
  return statSync(path).isFile();
1785
1981
  } catch {
@@ -1787,7 +1983,7 @@ function isFile(path) {
1787
1983
  }
1788
1984
  }
1789
1985
  function isDirectory(path) {
1790
- if (!path || !existsSync5(path)) return false;
1986
+ if (!path || !existsSync6(path)) return false;
1791
1987
  try {
1792
1988
  return statSync(path).isDirectory();
1793
1989
  } catch {
@@ -1858,7 +2054,7 @@ function hasXiaoEPlatformCredential(env = process.env) {
1858
2054
  function readXiaoEClientCredential(env = process.env) {
1859
2055
  for (const settingsFile of xiaoEClientSettingsCandidateFiles(env)) {
1860
2056
  try {
1861
- const parsed = JSON.parse(readFileSync4(settingsFile, "utf8"));
2057
+ const parsed = JSON.parse(readFileSync5(settingsFile, "utf8"));
1862
2058
  const authToken = readString(parsed, "session_id", "sessionId");
1863
2059
  const erpaUrl = normalizeUrl(readString(parsed, "erpa", "erpa_url", "erpaUrl"));
1864
2060
  if (authToken && erpaUrl) return { authToken, erpaUrl, source: XIAOE_CLIENT_SETTINGS_SOURCE };
@@ -2087,8 +2283,9 @@ async function resolveUserInfo(baseUrl, eteamsId, rawCookie = "", agentType = ""
2087
2283
  if (error instanceof CliError) throw error;
2088
2284
  const causeCode = readErrorCauseCode(error);
2089
2285
  const message = error instanceof Error ? error.message : String(error);
2286
+ const detail = xiaoEErrorChainDetail(error, []) || message;
2090
2287
  throw tagXiaoEError(
2091
- `E10 teamsCheck request failed${causeCode ? ` (${causeCode})` : ""}: ${message}`,
2288
+ `E10 teamsCheck request failed${causeCode ? ` (${causeCode})` : ""}: ${detail}`,
2092
2289
  { errorKind: "network", stage: "teams_check", ...causeCode ? { causeCode } : {} }
2093
2290
  );
2094
2291
  } finally {
@@ -2165,6 +2362,7 @@ async function saveXiaoEUnifiedLogin(input) {
2165
2362
  }
2166
2363
  async function tryXiaoEUnifiedLogin(options = {}) {
2167
2364
  const env = options.env || process.env;
2365
+ const tlsPolicy = applyE10TlsPolicy(env);
2168
2366
  const explicitBaseUrl = normalizeUrl(options.baseUrl || "");
2169
2367
  const baseUrl = resolveXiaoEPreferredBaseUrl({
2170
2368
  explicitBaseUrl,
@@ -2179,6 +2377,7 @@ async function tryXiaoEUnifiedLogin(options = {}) {
2179
2377
  diagnostics.baseUrl = baseUrl;
2180
2378
  diagnostics.platformCredentialDetected = platformCredentialDetected;
2181
2379
  diagnostics.clientType = resolveXiaoEClientType(env);
2380
+ diagnostics.tls = summarizeE10TlsPolicy(tlsPolicy);
2182
2381
  }
2183
2382
  if (!baseUrl && !mayUseTokenScript) {
2184
2383
  noteXiaoEStep(diagnostics, "base_url:missing");
@@ -2307,6 +2506,8 @@ export {
2307
2506
  normalizeGlobalOptions,
2308
2507
  writeWithRetry,
2309
2508
  readErrorCauseCode,
2509
+ isTlsTrustErrorCode,
2510
+ looksLikeTlsTrustMessage,
2310
2511
  getE10AuthRoot,
2311
2512
  resolveAgentHostKey,
2312
2513
  lookupAgentHost,
@@ -2331,6 +2532,9 @@ export {
2331
2532
  extractSessionTicket,
2332
2533
  E10AuthSession,
2333
2534
  isXiaoERuntimeAgent,
2535
+ applyE10TlsPolicy,
2536
+ currentE10TlsPolicyStatus,
2537
+ summarizeE10TlsPolicy,
2334
2538
  XIAOE_AGENT_TYPE,
2335
2539
  summarizeXiaoEFailureKind,
2336
2540
  lastXiaoEFailure,
@@ -4,7 +4,7 @@ import {
4
4
  cacheScopeSuffix,
5
5
  readCache,
6
6
  writeCache
7
- } from "./chunk-6ZOSVKMT.js";
7
+ } from "./chunk-ERAE4GHX.js";
8
8
  import {
9
9
  EB_BASE,
10
10
  SCHEMA_DATETIME_MINUTE,
@@ -13,7 +13,7 @@ import {
13
13
  meetingSuccess,
14
14
  queryBody,
15
15
  schemaOf
16
- } from "./chunk-XARLZK6C.js";
16
+ } from "./chunk-3TZURS7M.js";
17
17
 
18
18
  // src/shortcuts/meeting/operations/eb/usage-cache.ts
19
19
  var USAGE_TTL_MS = 5 * 60 * 1e3;
@@ -88,7 +88,7 @@ async function clearCache(env, key) {
88
88
  try {
89
89
  const { rm } = await import("node:fs/promises");
90
90
  const { join } = await import("node:path");
91
- const { meetingStateDir } = await import("./env-SEEXUXZF.js");
91
+ const { meetingStateDir } = await import("./env-SCVCHBN2.js");
92
92
  await rm(join(meetingStateDir(env.ctx), "cache", `${key}.json`), { force: true });
93
93
  } catch {
94
94
  }
@@ -221,7 +221,7 @@ async function loadFrequentRooms(env, options = {}) {
221
221
  const counts = /* @__PURE__ */ new Map();
222
222
  let requests = 0;
223
223
  try {
224
- const { getMeetingOperation } = await import("./registry-XOUVCSV4.js");
224
+ const { getMeetingOperation } = await import("./registry-7US3QQXV.js");
225
225
  const listOp = getMeetingOperation("meeting.eb.meeting.list");
226
226
  let seen = 0;
227
227
  let total = 0;
@@ -419,7 +419,10 @@ var groupSearch = {
419
419
  createBegin: { type: "integer", description: "\u521B\u5EFA\u65F6\u95F4\u4E0B\u754C\uFF08unix \u79D2\uFF09" },
420
420
  createEnd: { type: "integer", description: "\u521B\u5EFA\u65F6\u95F4\u4E0A\u754C\uFF08unix \u79D2\uFF09" },
421
421
  pageSize: { type: "integer", minimum: 1, maximum: 200, description: "\u6BCF\u9875\u5927\u5C0F\uFF08\u9ED8\u8BA4 100\uFF09" }
422
- }, { description: "\u81F3\u5C11\u63D0\u4F9B\u4E00\u4E2A\u641C\u7D22\u6761\u4EF6" }),
422
+ }, {
423
+ requiredAny: ["name", "type", "members", "owner", "creator", "today", "yesterday", "createBegin", "createEnd"],
424
+ description: "\u81F3\u5C11\u63D0\u4F9B\u4E00\u4E2A\u641C\u7D22\u6761\u4EF6"
425
+ }),
423
426
  handler: async (args, { host }) => {
424
427
  const cond = {};
425
428
  let mask = 0;
@@ -5,21 +5,26 @@ import {
5
5
  E10_XIAOE_HOST_CREDENTIAL_MISSING_MESSAGE,
6
6
  E10_XIAOE_NETWORK_UNAVAILABLE_MESSAGE,
7
7
  E10_XIAOE_RECOVERY_FAILED_MESSAGE,
8
+ E10_XIAOE_TLS_UNTRUSTED_MESSAGE,
8
9
  startFetchTiming
9
- } from "./chunk-TJN4PIYO.js";
10
+ } from "./chunk-GTAFCAVP.js";
10
11
  import {
11
12
  E10AuthSession,
13
+ currentE10TlsPolicyStatus,
12
14
  getActiveProfile,
13
15
  getE10AuthRoot,
14
16
  hasXiaoEEnv,
17
+ isTlsTrustErrorCode,
15
18
  isXiaoERuntimeAgent,
16
19
  lastXiaoEFailure,
20
+ looksLikeTlsTrustMessage,
17
21
  readErrorCauseCode,
18
22
  readProfileConfig,
19
23
  resolveXiaoEPreferredBaseUrl,
24
+ summarizeE10TlsPolicy,
20
25
  summarizeXiaoEFailureKind,
21
26
  tryXiaoEUnifiedLogin
22
- } from "./chunk-FDBAFANU.js";
27
+ } from "./chunk-I5XB4MZT.js";
23
28
  import {
24
29
  CliError,
25
30
  toErrorEnvelope
@@ -197,12 +202,24 @@ function sanitizeError(error, secrets) {
197
202
  ...envelope.details === void 0 ? {} : { details: "<omitted from persistent auth log>" }
198
203
  };
199
204
  }
205
+ function sanitizeTlsPolicy(tls, secrets) {
206
+ const caFiles = tls.caFiles.map((file) => redactSensitiveText(file, secrets));
207
+ return {
208
+ mode: tls.mode,
209
+ caFiles,
210
+ applied: tls.applied,
211
+ ...tls.notAppliedReason ? { notAppliedReason: tls.notAppliedReason } : {},
212
+ ...tls.error ? { error: redactSensitiveText(tls.error, secrets) } : {},
213
+ ...tls.insecureSource ? { insecureSource: tls.insecureSource } : {}
214
+ };
215
+ }
200
216
  function createEntry(input) {
201
217
  const secrets = input.secrets || [];
202
218
  const diagnostics = input.diagnostics;
203
219
  const baseUrl = sanitizeBaseUrl(input.baseUrl || diagnostics?.baseUrl, secrets);
204
220
  const lastError = diagnostics?.lastError ? redactSensitiveText(diagnostics.lastError, secrets) : void 0;
205
221
  const failures = diagnostics?.failures?.map((failure) => sanitizeFailure(failure, secrets));
222
+ const tls = diagnostics?.tls ? sanitizeTlsPolicy(diagnostics.tls, secrets) : void 0;
206
223
  const error = sanitizeError(input.error, secrets);
207
224
  return {
208
225
  schemaVersion: 1,
@@ -216,6 +233,7 @@ function createEntry(input) {
216
233
  attemptedSteps: (diagnostics?.attemptedSteps || []).map((step) => redactSensitiveText(step, secrets)),
217
234
  ...lastError ? { lastError } : {},
218
235
  ...failures?.length ? { failures } : {},
236
+ ...tls ? { tls } : {},
219
237
  ...input.resultSessionExpired ? { resultSessionExpired: true } : {},
220
238
  ...error ? { error } : {}
221
239
  };
@@ -551,12 +569,19 @@ function xiaoEFailureForErrorDetails(failure) {
551
569
  ...failure.httpStatus === void 0 ? {} : { httpStatus: failure.httpStatus }
552
570
  };
553
571
  }
554
- function xiaoERecoveryFailedError(diagnostics, resultSessionExpired = false) {
572
+ function xiaoETlsTrustFailure(diagnostics) {
573
+ const last = lastXiaoEFailure(diagnostics);
574
+ if (!last) return void 0;
575
+ return isTlsTrustErrorCode(last.causeCode) || looksLikeTlsTrustMessage(last.message) ? last : void 0;
576
+ }
577
+ function xiaoERecoveryFailedError(diagnostics, resultSessionExpired = false, env = process.env) {
555
578
  const failureKind = summarizeXiaoEFailureKind(diagnostics);
556
579
  const lastFailure = lastXiaoEFailure(diagnostics);
557
580
  const publicFailures = diagnostics?.failures?.map(xiaoEFailureForErrorDetails);
558
581
  const networkUnavailable = failureKind === "network";
582
+ const tlsUntrusted = networkUnavailable && Boolean(xiaoETlsTrustFailure(diagnostics));
559
583
  const hostCredentialMissing = diagnostics?.clientType === "cloud" && diagnostics.platformCredentialDetected === false && diagnostics.attemptedSteps.includes("platform_token:missing") && diagnostics.attemptedSteps.includes("environment_map:empty");
584
+ const tlsPolicy = tlsUntrusted ? summarizeE10TlsPolicy(currentE10TlsPolicyStatus(env)) : void 0;
560
585
  const details = diagnostics ? {
561
586
  ...diagnostics.baseUrl ? { baseUrl: diagnostics.baseUrl } : {},
562
587
  ...diagnostics.clientType ? { clientType: diagnostics.clientType } : {},
@@ -566,19 +591,21 @@ function xiaoERecoveryFailedError(diagnostics, resultSessionExpired = false) {
566
591
  ...failureKind ? { errorKind: failureKind } : {},
567
592
  ...lastFailure ? { failureStage: lastFailure.stage } : {},
568
593
  ...publicFailures?.length ? { failures: publicFailures } : {},
594
+ ...tlsPolicy ? { tls: tlsPolicy } : {},
595
+ ...tlsPolicy && tlsPolicy.mode === "custom-ca" && !tlsPolicy.applied ? { tlsHint: "configured_ca_not_applied" } : {},
569
596
  ...hostCredentialMissing ? { reason: "host_credential_not_injected" } : {},
570
597
  ...resultSessionExpired ? { resultSessionExpired: true } : {}
571
598
  } : void 0;
572
599
  return Object.assign(
573
600
  new CliError(
574
- networkUnavailable ? E10_XIAOE_NETWORK_UNAVAILABLE_MESSAGE : hostCredentialMissing ? E10_XIAOE_HOST_CREDENTIAL_MISSING_MESSAGE : E10_XIAOE_RECOVERY_FAILED_MESSAGE,
601
+ tlsUntrusted ? E10_XIAOE_TLS_UNTRUSTED_MESSAGE : networkUnavailable ? E10_XIAOE_NETWORK_UNAVAILABLE_MESSAGE : hostCredentialMissing ? E10_XIAOE_HOST_CREDENTIAL_MISSING_MESSAGE : E10_XIAOE_RECOVERY_FAILED_MESSAGE,
575
602
  3 /* AuthError */
576
603
  ),
577
604
  {
578
605
  type: "authentication",
579
- subtype: networkUnavailable ? "xiaoe_network_unavailable" : "xiaoe_credential_unavailable",
580
- // 网络错误是可重试的;凭证缺失/被拒重试也一样失败,不能让调用方空转。
581
- retryable: networkUnavailable,
606
+ subtype: tlsUntrusted ? "xiaoe_tls_untrusted" : networkUnavailable ? "xiaoe_network_unavailable" : "xiaoe_credential_unavailable",
607
+ // 网络错误是可重试的;证书不可信、凭证缺失/被拒重试也一样失败,不能让调用方空转。
608
+ retryable: networkUnavailable && !tlsUntrusted,
582
609
  stage: lastFailure?.stage || "xiaoe_unified_login",
583
610
  ...details ? { details } : {}
584
611
  }
@@ -596,7 +623,7 @@ async function requireE10Session(ctx, load = {}) {
596
623
  session = outcome?.session || null;
597
624
  if (!session || session.isExpired()) {
598
625
  const resultSessionExpired = session?.isExpired() === true;
599
- const error = xiaoERecoveryFailedError(outcome?.diagnostics, resultSessionExpired);
626
+ const error = xiaoERecoveryFailedError(outcome?.diagnostics, resultSessionExpired, ctx.env);
600
627
  if (resultSessionExpired) {
601
628
  await appendXiaoEAuthErrorLog({
602
629
  source: "recovery",
@@ -615,7 +642,7 @@ async function requireE10Session(ctx, load = {}) {
615
642
  const outcome = await recoverXiaoEAuthSessionWithDiagnostics(ctx).catch(() => null);
616
643
  session = outcome?.session || null;
617
644
  if (!session) {
618
- throw xiaoERecoveryFailedError(outcome?.diagnostics);
645
+ throw xiaoERecoveryFailedError(outcome?.diagnostics, false, ctx.env);
619
646
  }
620
647
  }
621
648
  if (!session) {
@@ -2,7 +2,7 @@ import { createRequire as __esbuildCreateRequire } from 'node:module';
2
2
  const require = __esbuildCreateRequire(import.meta.url);
3
3
  import {
4
4
  isEsbFlowUnavailable
5
- } from "./chunk-VLY5RTVO.js";
5
+ } from "./chunk-UVWW5ABZ.js";
6
6
  import {
7
7
  esbValidationError
8
8
  } from "./chunk-TXUG266F.js";
@@ -24,7 +24,7 @@ function codeFromStructured(type, subtype, httpStatus) {
24
24
  if (type === "authentication") {
25
25
  return /expired|invalid_token|token_expired/u.test(subtype) ? "E-0002" : "E-0001";
26
26
  }
27
- if (type === "permission" || type === "authorization") return "E-0005";
27
+ if (type === "permission" || type === "authorization" || type === "policy") return "E-0005";
28
28
  if (type === "validation" || type === "usage") return "E-0003";
29
29
  if (type === "network" || type === "upstream" || type === "http") return "E-0004";
30
30
  return "E-9999";