weaver-work-cli 0.1.38 → 0.1.40

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 (166) hide show
  1. package/README.md +7 -3
  2. package/dist/chunks/{archive-PDV724YK.js → archive-JHTONRST.js} +556 -66
  3. package/dist/chunks/{archive-oa-4XE4MNXQ.js → archive-oa-FCHLCPHC.js} +2 -2
  4. package/dist/chunks/{asset-PDL2QE2N.js → asset-RLIHC7DB.js} +2 -2
  5. package/dist/chunks/asset-idle-KVOFTLCP.js +670 -0
  6. package/dist/chunks/{attachment-content-MDDGOE5E.js → attachment-content-RZYDB3MB.js} +3 -3
  7. package/dist/chunks/{blog-UYR3EUXW.js → blog-42OZTJNP.js} +2 -2
  8. package/dist/chunks/{caizhilian-LG2X5NMF.js → caizhilian-KRK547K5.js} +2 -2
  9. package/dist/chunks/{calendar-FG4BAZHE.js → calendar-RTWAMKHD.js} +2 -2
  10. package/dist/chunks/{chunk-J7USS3ED.js → chunk-4CTESSKI.js} +4 -4
  11. package/dist/chunks/{chunk-OJQUJZQF.js → chunk-4TEDNCON.js} +45 -5
  12. package/dist/chunks/chunk-57IECMWX.js +487 -0
  13. package/dist/chunks/{chunk-ELYDWBZJ.js → chunk-7BRU4EFH.js} +13 -7
  14. package/dist/chunks/{chunk-6LTFIFLM.js → chunk-7E6MUOEK.js} +2 -2
  15. package/dist/chunks/{chunk-KKRL3REV.js → chunk-7U577Q7U.js} +2 -2
  16. package/dist/chunks/{chunk-UJJD4QWF.js → chunk-CAQNBBQA.js} +2 -2
  17. package/dist/chunks/{chunk-CORFRD7Q.js → chunk-CXRQWOZ5.js} +2 -2
  18. package/dist/chunks/{chunk-GGJFMNJM.js → chunk-FLS4DPGP.js} +110 -16
  19. package/dist/chunks/{chunk-JSMFPO43.js → chunk-I566ZYNF.js} +1 -1
  20. package/dist/chunks/{chunk-6FTTSA45.js → chunk-IZSSVYAG.js} +2 -2
  21. package/dist/chunks/{chunk-XJY7G4DD.js → chunk-JWRZM2H2.js} +3 -3
  22. package/dist/chunks/{chunk-NI6GIPIM.js → chunk-LFMSDBZN.js} +529 -395
  23. package/dist/chunks/{chunk-VRYHGG6O.js → chunk-LN447PY2.js} +92 -51
  24. package/dist/chunks/{chunk-NR6RKXPA.js → chunk-NETCCARD.js} +4 -2
  25. package/dist/chunks/{chunk-Z32KWY6G.js → chunk-NJKREDA3.js} +1 -1
  26. package/dist/chunks/{chunk-FUWVHMVV.js → chunk-SPRHHSVC.js} +2 -2
  27. package/dist/chunks/{chunk-IZUDA353.js → chunk-T6EGVBKU.js} +1 -1
  28. package/dist/chunks/{chunk-DMV2TOMH.js → chunk-VNBU55SL.js} +428 -145
  29. package/dist/chunks/{chunk-UZZBA6PV.js → chunk-WFFNM65B.js} +47 -6
  30. package/dist/chunks/{chunk-EG6ZU444.js → chunk-ZUX3P6BQ.js} +10 -5
  31. package/dist/chunks/{conflict-BQZEQ4SP.js → conflict-VR55AOOO.js} +2 -2
  32. package/dist/chunks/{contract-XIRAFTEV.js → contract-HI4FNPYE.js} +2 -2
  33. package/dist/chunks/{cowork-BLG62BL2.js → cowork-HJLI353D.js} +12 -5
  34. package/dist/chunks/{ebuilder-form-NUKG5QW4.js → ebuilder-form-HTGI63UU.js} +3 -3
  35. package/dist/chunks/{ehr-2STW5ILH.js → ehr-GYXIYH3A.js} +2 -2
  36. package/dist/chunks/env-DW3G4HUO.js +19 -0
  37. package/dist/chunks/{esb-UUDQUNKY.js → esb-I5INCEFE.js} +4 -4
  38. package/dist/chunks/factory-TKXGXS6L.js +30 -0
  39. package/dist/chunks/{fna-6RCY4NU5.js → fna-K2MHTQ24.js} +2 -2
  40. package/dist/chunks/group-chat-VYBNMJLG.js +18 -0
  41. package/dist/chunks/{host-FWDOSRH5.js → host-256GVCAH.js} +3 -3
  42. package/dist/chunks/{host-EJZFROU3.js → host-D5SERMAJ.js} +3 -3
  43. package/dist/chunks/{host-RHM3NPXV.js → host-JM4YVHFM.js} +3 -3
  44. package/dist/chunks/{host-7RXEDMAH.js → host-L3VLITMT.js} +3 -3
  45. package/dist/chunks/{host-UFF33TWJ.js → host-ZUQTJYYK.js} +3 -3
  46. package/dist/chunks/{hrm-PKJ6ELSH.js → hrm-VLRBKTZB.js} +3 -3
  47. package/dist/chunks/{im-YJAXS7CO.js → im-QK3VTLXK.js} +8 -8
  48. package/dist/chunks/{invoice-HWVSXGX6.js → invoice-T5JTA32H.js} +3 -3
  49. package/dist/chunks/{jiuchuanhui-L7VKILZB.js → jiuchuanhui-P2FNEQVZ.js} +2 -2
  50. package/dist/chunks/{lazy-dispatch-NMYEIHRH.js → lazy-dispatch-XRRI46M6.js} +5 -5
  51. package/dist/chunks/{mail-B42RRU7G.js → mail-3Y7MJ6PS.js} +9 -4
  52. package/dist/chunks/{meeting-CFYVBJSS.js → meeting-M7LTXGJE.js} +11 -10
  53. package/dist/chunks/{okr-GCLF6V7W.js → okr-OBC6S67L.js} +2 -2
  54. package/dist/chunks/{plan-ZVL7GBRI.js → plan-5H6I53SK.js} +2 -2
  55. package/dist/chunks/{project-4YWAAE2K.js → project-L75QZV4S.js} +2 -2
  56. package/dist/chunks/{registry-EP4VTHZS.js → registry-KMHCPAAD.js} +9 -8
  57. package/dist/chunks/{registry-OZSMDVPP.js → registry-QGHFNUWS.js} +2 -2
  58. package/dist/chunks/{registry-FRJ6H7BT.js → registry-RXPN6BBT.js} +4 -4
  59. package/dist/chunks/{registry-SG2PGVCF.js → registry-UGRBCBHO.js} +3 -3
  60. package/dist/chunks/{room-recommend-R3JVUUAC.js → room-recommend-A3UDC3CA.js} +4 -4
  61. package/dist/chunks/{schedule-NIJBTYDO.js → schedule-5GCACCK7.js} +4 -4
  62. package/dist/chunks/{workflow-BB24DFBY.js → workflow-M5ZJ7DWF.js} +11 -8
  63. package/dist/core/output.js +16 -6
  64. package/dist/index.js +33 -28
  65. package/dist/internal/e10/auth/commands.js +109 -56
  66. package/dist/internal/e10/auth/messages.js +1 -0
  67. package/dist/internal/e10/auth/session.js +11 -1
  68. package/dist/internal/e10/auth/xiaoe.js +29 -4
  69. package/dist/internal/e10/auth-recovery.js +13 -6
  70. package/dist/internal/e10/client.js +13 -0
  71. package/dist/internal/e10/context.js +24 -3
  72. package/dist/internal/e10/request-runtime.js +12 -1
  73. package/dist/shortcuts/archive/host.js +2 -0
  74. package/dist/shortcuts/archive/manifest.js +1 -1
  75. package/dist/shortcuts/archive/operations/borrow-list.js +13 -1
  76. package/dist/shortcuts/archive/operations/flow-url.js +1 -1
  77. package/dist/shortcuts/archive/operations/prelib.js +472 -0
  78. package/dist/shortcuts/archive/operations/registry.js +2 -0
  79. package/dist/shortcuts/archive/operations/upload.js +1 -1
  80. package/dist/shortcuts/asset-idle/errors.js +44 -0
  81. package/dist/shortcuts/asset-idle/host.js +161 -0
  82. package/dist/shortcuts/asset-idle/index.js +114 -0
  83. package/dist/shortcuts/asset-idle/manifest.js +159 -0
  84. package/dist/shortcuts/asset-idle/operations/idle.js +47 -0
  85. package/dist/shortcuts/asset-idle/operations/registry.js +33 -0
  86. package/dist/shortcuts/asset-idle/operations/shared.js +142 -0
  87. package/dist/shortcuts/asset-idle/operations/types.js +9 -0
  88. package/dist/shortcuts/asset-idle/operations.js +15 -0
  89. package/dist/shortcuts/cowork/operations/item-write.js +10 -2
  90. package/dist/shortcuts/index.js +5 -0
  91. package/dist/shortcuts/mail/operations/mail-send.js +8 -2
  92. package/dist/shortcuts/meeting/operations/eb/catalog.js +5 -1
  93. package/dist/shortcuts/meeting/operations/eb/create-flow.js +381 -104
  94. package/dist/shortcuts/meeting/operations/eb/crm-search.js +87 -5
  95. package/dist/shortcuts/meeting/operations/eb/flow-memory.js +49 -0
  96. package/dist/shortcuts/meeting/operations/eb/group-chat.js +583 -0
  97. package/dist/shortcuts/meeting/operations/eb/index.js +2 -0
  98. package/dist/shortcuts/meeting/operations/eb/room-recommend.js +19 -3
  99. package/dist/shortcuts/meeting/operations/eb/room-summary.js +2 -0
  100. package/dist/shortcuts/meeting/operations/eb/usage-cache.js +99 -0
  101. package/dist/shortcuts/meeting/operations/from-group-chat.js +35 -12
  102. package/dist/shortcuts/workflow/host.js +3 -0
  103. package/dist/shortcuts/workflow/index.js +1 -1
  104. package/dist/shortcuts/workflow/operations/form.js +65 -171
  105. package/dist/shortcuts/workflow/operations/todoSmartConvert/aigroupRules.js +129 -27
  106. package/dist/shortcuts/workflow/operations/todoSmartConvert/aigroupStore.js +6 -0
  107. package/dist/shortcuts/workflow/operations/todoSmartConvert/summaryCache.js +60 -117
  108. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoDetailCache.js +44 -7
  109. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoDetailFetcher.js +37 -29
  110. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +48 -8
  111. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +1 -0
  112. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.detail.js +22 -18
  113. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.group.js +17 -9
  114. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.groupSummary.js +34 -10
  115. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +5 -2
  116. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.smartGroup.js +9 -2
  117. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.summary.js +122 -20
  118. package/docs/_catalog.md +3 -0
  119. package/docs/asset-idle.md +45 -0
  120. package/docs/e10-auth.md +16 -1
  121. package/docs/todo-smart-convert/subgroup-rules.md +1 -1
  122. package/package.json +1 -1
  123. package/scripts/mcp-meeting.mjs +234 -0
  124. package/scripts/package-skill.mjs +2 -0
  125. package/skill-template/business-info.json +14 -1
  126. package/skill-template/domains/asset-idle.md +13 -0
  127. package/skill-template/domains/wenshuding.md +3 -0
  128. package/skills/weaver-e10-archive-oa/SKILL.md +1 -0
  129. package/skills/weaver-e10-archive-oa/references/my-borrow.md +49 -0
  130. package/skills/weaver-e10-asset-idle/SKILL.md +73 -0
  131. package/skills/weaver-e10-asset-idle/references/idle-list.md +62 -0
  132. package/skills/weaver-e10-asset-idle/references/idle-stats-and-charts.md +65 -0
  133. package/skills/weaver-e10-asset-idle/references/source-manifest.json +193 -0
  134. package/skills/weaver-e10-asset-idle/references/widget-style.md +205 -0
  135. package/skills/weaver-e10-caizhilian/SKILL.md +29 -11
  136. package/skills/weaver-e10-caizhilian/references/auth-and-install.md +12 -0
  137. package/skills/weaver-e10-caizhilian/references/files.md +1 -1
  138. package/skills/weaver-e10-caizhilian/references/setting-encrypt.md +1 -1
  139. package/skills/weaver-e10-caizhilian/references/source-manifest.json +45 -45
  140. package/skills/weaver-e10-cowork/SKILL.md +2 -0
  141. package/skills/weaver-e10-cowork/references/cowork-write.md +1 -1
  142. package/skills/weaver-e10-jucailin/SKILL.md +2 -0
  143. package/skills/weaver-e10-jucailin/references/recruit-read.md +2 -0
  144. package/skills/weaver-e10-jucailin/references/recruit-write.md +1 -1
  145. package/skills/weaver-e10-mail/SKILL.md +3 -0
  146. package/skills/weaver-e10-mail/references/mail-send.md +2 -0
  147. package/skills/weaver-e10-meeting/SKILL.md +88 -25
  148. package/skills/weaver-e10-meeting/references/meeting-minute-file.md +25 -11
  149. package/skills/weaver-e10-meeting.zip +0 -0
  150. package/skills/weaver-e10-shared/SKILL.md +5 -5
  151. package/skills/weaver-e10-shared/references/e10-auth-and-session.md +3 -3
  152. package/skills/weaver-e10-wenshuding/SKILL.md +29 -6
  153. package/skills/weaver-e10-wenshuding/references/archive-borrow-list.md +14 -0
  154. package/skills/weaver-e10-wenshuding/references/archive-download.md +2 -0
  155. package/skills/weaver-e10-wenshuding/references/archive-flow.md +1 -1
  156. package/skills/weaver-e10-wenshuding/references/archive-prelib-arrange.md +76 -0
  157. package/skills/weaver-e10-wenshuding/references/archive-prelib-list.md +107 -0
  158. package/skills/weaver-e10-wenshuding/references/archive-prelib-open.md +59 -0
  159. package/skills/weaver-e10-wenshuding/references/archive-upload.md +4 -1
  160. package/skills/weaver-e10-wenshuding/references/source-manifest.json +108 -65
  161. package/skills/weaver-e10-workflow/SKILL.md +9 -2
  162. package/skills/weaver-e10-workflow/aigroup/default.json +166 -19
  163. package/skills/weaver-e10-workflow/references/todo-smart-convert.md +72 -34
  164. package/skills/weaver-e10-workflow/tools/todo-serve.cjs +113 -25
  165. package/skills/weaver-e10-workflow/tools/todo-summary.cjs +350 -50
  166. package/dist/chunks/{chunk-2LV74IWP.js → chunk-E7OK5WD5.js} +5 -5
@@ -13,13 +13,13 @@ import {
13
13
  refMaxCount,
14
14
  resolveRefInput,
15
15
  resultThresholdBytes
16
- } from "./chunk-EG6ZU444.js";
16
+ } from "./chunk-ZUX3P6BQ.js";
17
17
  import {
18
18
  refsDir
19
19
  } from "./chunk-AJ62BGAW.js";
20
20
  import {
21
21
  clearInvoiceTokenForSession
22
- } from "./chunk-FUWVHMVV.js";
22
+ } from "./chunk-SPRHHSVC.js";
23
23
  import {
24
24
  E10AuthSession,
25
25
  XIAOE_AGENT_TYPE,
@@ -48,7 +48,7 @@ import {
48
48
  setActiveProfile,
49
49
  switchActiveProfile,
50
50
  tryXiaoEUnifiedLogin
51
- } from "./chunk-OJQUJZQF.js";
51
+ } from "./chunk-4TEDNCON.js";
52
52
  import {
53
53
  CliError,
54
54
  isCliError,
@@ -3547,6 +3547,7 @@ var AGENT_RETURN_URL_ENV_KEY = "WEAVER_AGENT_RETURN_URL";
3547
3547
  var AGENT_RETURN_PATH = "/agent-return";
3548
3548
  var AGENT_RETURN_TOKEN_HEADER = "x-weaver-agent-return-token";
3549
3549
  var AGENT_RETURN_TIMEOUT_MS = 9e5;
3550
+ var OAUTH_CALLBACK_PROTOCOL_MISMATCH_GRACE_MS = 3e4;
3550
3551
  var UNSAFE_AGENT_RETURN_PROTOCOLS = /* @__PURE__ */ new Set([
3551
3552
  "about:",
3552
3553
  "blob:",
@@ -3698,7 +3699,8 @@ function formatAuthStatus(status) {
3698
3699
  ..."loginSource" in status && status.loginSource ? ["loginSource: " + status.loginSource] : [],
3699
3700
  ..."credentialSourceStep" in status && status.credentialSourceStep ? ["credentialSourceStep: " + status.credentialSourceStep] : [],
3700
3701
  ..."credentialSourceType" in status && status.credentialSourceType ? ["credentialSourceType: " + status.credentialSourceType] : [],
3701
- ..."credentialSourceLabel" in status && status.credentialSourceLabel ? ["credentialSourceLabel: " + status.credentialSourceLabel] : []
3702
+ ..."credentialSourceLabel" in status && status.credentialSourceLabel ? ["credentialSourceLabel: " + status.credentialSourceLabel] : [],
3703
+ ..."expiryTimes" in status && status.expiryTimes ? ["expiryTimes: " + status.expiryTimes] : []
3702
3704
  ];
3703
3705
  if ("valid" in status) {
3704
3706
  lines.push("valid: " + String(status.valid));
@@ -3717,7 +3719,8 @@ function formatLoginResult(result) {
3717
3719
  ...result.loginSource ? ["loginSource: " + result.loginSource] : [],
3718
3720
  ...result.credentialSourceStep ? ["credentialSourceStep: " + result.credentialSourceStep] : [],
3719
3721
  ...result.credentialSourceType ? ["credentialSourceType: " + result.credentialSourceType] : [],
3720
- ...result.credentialSourceLabel ? ["credentialSourceLabel: " + result.credentialSourceLabel] : []
3722
+ ...result.credentialSourceLabel ? ["credentialSourceLabel: " + result.credentialSourceLabel] : [],
3723
+ ...result.expiryTimes ? ["expiryTimes: " + result.expiryTimes] : []
3721
3724
  ].join("\n");
3722
3725
  }
3723
3726
  async function clearInvoiceTokenCache(profile, authData) {
@@ -3787,6 +3790,22 @@ function buildE10AuthorizeUrl(baseUrl, redirectUri, agentType) {
3787
3790
  });
3788
3791
  return `${baseUrl}/papi/sso/oauth2.0/authorize?${authorizeParams.toString()}`;
3789
3792
  }
3793
+ function isTlsClientHello(error) {
3794
+ if (!error || typeof error !== "object") return false;
3795
+ const rawPacket = error.rawPacket;
3796
+ return Buffer.isBuffer(rawPacket) && rawPacket.length >= 3 && rawPacket[0] === 22 && rawPacket[1] === 3;
3797
+ }
3798
+ function createOAuthCallbackProtocolMismatchError(port) {
3799
+ return Object.assign(new CliError(
3800
+ `OAuth callback protocol mismatch: the browser connected to https://127.0.0.1:${port}, but the CLI callback listener uses HTTP. Retry the login and, on the callback error page, change only the URL scheme to http:// before reloading; keep the path and query unchanged. The E10 authorization service should preserve HTTP loopback redirect URIs.`,
3801
+ 3 /* AuthError */
3802
+ ), {
3803
+ type: "authentication",
3804
+ subtype: "oauth_callback_protocol_mismatch",
3805
+ retryable: false,
3806
+ stage: "oauth_callback"
3807
+ });
3808
+ }
3790
3809
  async function readJsonObject(resp) {
3791
3810
  const data = await resp.json().catch(() => ({}));
3792
3811
  return data && typeof data === "object" && !Array.isArray(data) ? data : {};
@@ -3962,7 +3981,7 @@ function xiaoEUnifiedLoginUnavailableMessage(baseUrl, attempted) {
3962
3981
  "CLI \u4F1A\u4F18\u5148\u4F7F\u7528 XiaoE \u5BA2\u6237\u7AEF\u5185\u7F6E Python \u6267\u884C tokens.py\uFF1B\u81EA\u52A8\u53D1\u73B0\u4E0D\u53EF\u7528\u65F6\uFF0C\u53EF\u7528 WEAVER_XIAOE_TOKEN_SCRIPT_PYTHON \u6307\u5B9A\u517C\u5BB9\u89E3\u91CA\u5668\u3002"
3963
3982
  ].join(" ");
3964
3983
  }
3965
- async function runBrowserLogin(ctx, options, behavior = {}) {
3984
+ async function runXiaoELogin(ctx, options) {
3966
3985
  const commandOpts = asOptions(options);
3967
3986
  const globalOptions = ctx.getGlobalOptions();
3968
3987
  const profileFromGlobal = globalOptions.profile;
@@ -3973,52 +3992,48 @@ async function runBrowserLogin(ctx, options, behavior = {}) {
3973
3992
  profileBaseUrl: cfg.baseUrl,
3974
3993
  env: ctx.env
3975
3994
  });
3976
- const xiaoESources = behavior.tryXiaoEUnifiedLogin === true ? inspectXiaoEUnifiedLoginSources({
3995
+ const xiaoESources = inspectXiaoEUnifiedLoginSources({
3977
3996
  env: ctx.env,
3978
3997
  baseUrl: preferredXiaoEBaseUrl,
3979
3998
  profileBaseUrl: cfg.baseUrl,
3980
- allowTokenScript: behavior.allowXiaoETokenScript === true
3981
- }) : {
3982
- platformCredential: false,
3983
- tokenScript: false,
3984
- clientCredential: false,
3985
- environmentCredential: false,
3986
- any: false
3987
- };
3988
- const useXiaoELogin = behavior.tryXiaoEUnifiedLogin === true && xiaoESources.any;
3989
- const baseUrl = behavior.tryXiaoEUnifiedLogin ? preferredXiaoEBaseUrl : normalizeUrl(explicitBaseUrl || cfg.baseUrl || "");
3999
+ allowTokenScript: true
4000
+ });
4001
+ const useXiaoELogin = xiaoESources.any;
4002
+ const baseUrl = preferredXiaoEBaseUrl;
4003
+ const tenantKey = optionString(commandOpts, "tenantKey");
4004
+ ctx.logger.info([
4005
+ "XiaoE unified login preflight:",
4006
+ "authMode=xiaoe",
4007
+ `credentialSourceDetected=${String(xiaoESources.any)}`,
4008
+ `attempted=${String(useXiaoELogin)}`,
4009
+ `platformCredentialDetected=${String(xiaoESources.platformCredential)}`,
4010
+ `tokenScriptDetected=${String(xiaoESources.tokenScript)}`,
4011
+ `clientSettingsDetected=${String(xiaoESources.clientCredential)}`,
4012
+ `environmentCredentialDetected=${String(xiaoESources.environmentCredential)}`,
4013
+ `baseUrl=${baseUrl || "(unresolved)"}`
4014
+ ].join(" "));
4015
+ if (useXiaoELogin) {
4016
+ const xiaoEResult = await tryXiaoEUnifiedLogin2(ctx, baseUrl, tenantKey, profileFromGlobal, true);
4017
+ if (xiaoEResult) return xiaoEResult;
4018
+ }
4019
+ ctx.logger.warn(xiaoEUnifiedLoginUnavailableMessage(baseUrl, useXiaoELogin));
4020
+ throw createXiaoEUnifiedLoginUnavailableError(baseUrl);
4021
+ }
4022
+ async function runBrowserLogin(ctx, options) {
4023
+ const commandOpts = asOptions(options);
4024
+ const globalOptions = ctx.getGlobalOptions();
4025
+ const profileFromGlobal = globalOptions.profile;
4026
+ const cfg = readProfileConfig(profileFromGlobal || getActiveProfile());
4027
+ const explicitBaseUrl = optionString(commandOpts, "baseUrl") || globalOptions.baseUrl || "";
4028
+ const baseUrl = normalizeUrl(explicitBaseUrl || cfg.baseUrl || "");
3990
4029
  const tenantKey = optionString(commandOpts, "tenantKey");
3991
4030
  const portText = optionString(commandOpts, "port") || "19800";
3992
4031
  const port = Number.parseInt(portText, 10);
3993
4032
  const explicitAgentType = optionString(commandOpts, "agentType", "agent_type");
3994
- const agentType = useXiaoELogin ? optionString(commandOpts, "agentType", "agent_type") || XIAOE_AGENT_TYPE : resolveAgentType(commandOpts, ctx.env);
4033
+ const agentType = resolveAgentType(commandOpts, ctx.env);
3995
4034
  if (!Number.isInteger(port) || port <= 0 || port > 65535) {
3996
4035
  throw new CliError("Invalid --port value", 2 /* UsageError */);
3997
4036
  }
3998
- if (behavior.tryXiaoEUnifiedLogin) {
3999
- ctx.logger.info([
4000
- "XiaoE unified login preflight:",
4001
- "authMode=xiaoe",
4002
- `credentialSourceDetected=${String(xiaoESources.any)}`,
4003
- `attempted=${String(useXiaoELogin)}`,
4004
- `platformCredentialDetected=${String(xiaoESources.platformCredential)}`,
4005
- `tokenScriptDetected=${String(xiaoESources.tokenScript)}`,
4006
- `clientSettingsDetected=${String(xiaoESources.clientCredential)}`,
4007
- `environmentCredentialDetected=${String(xiaoESources.environmentCredential)}`,
4008
- `baseUrl=${baseUrl || "(unresolved)"}`
4009
- ].join(" "));
4010
- }
4011
- if (useXiaoELogin) {
4012
- const xiaoEResult = await tryXiaoEUnifiedLogin2(ctx, baseUrl, tenantKey, profileFromGlobal, behavior.allowXiaoETokenScript === true);
4013
- if (xiaoEResult) return xiaoEResult;
4014
- }
4015
- const willOpenBrowser = behavior.browserFallback !== "never";
4016
- if (behavior.tryXiaoEUnifiedLogin && behavior.explainXiaoEFallback) {
4017
- ctx.logger.warn(xiaoEUnifiedLoginUnavailableMessage(baseUrl, useXiaoELogin));
4018
- }
4019
- if (!willOpenBrowser) {
4020
- throw createXiaoEUnifiedLoginUnavailableError(baseUrl);
4021
- }
4022
4037
  if (!baseUrl) throw new CliError("Missing --base-url", 2 /* UsageError */);
4023
4038
  const agentReturnTarget = resolveAgentReturnTarget(commandOpts, ctx.env, agentType);
4024
4039
  const agentReturnToken = agentReturnTarget ? randomBytes(24).toString("base64url") : "";
@@ -4030,6 +4045,7 @@ async function runBrowserLogin(ctx, options, behavior = {}) {
4030
4045
  let settled = false;
4031
4046
  let timer = null;
4032
4047
  let pendingLoginResult = null;
4048
+ let tlsCallbackDetected = false;
4033
4049
  const finish = (error, result) => {
4034
4050
  if (settled) return;
4035
4051
  settled = true;
@@ -4100,6 +4116,10 @@ async function runBrowserLogin(ctx, options, behavior = {}) {
4100
4116
  finish(new CliError("No authorization code received.", 3 /* AuthError */));
4101
4117
  return;
4102
4118
  }
4119
+ if (tlsCallbackDetected && timer) {
4120
+ clearTimeout(timer);
4121
+ timer = null;
4122
+ }
4103
4123
  try {
4104
4124
  const result = await oidcExchange(code, redirectUri, baseUrl, tenantKey, redirectAgentType, profileFromGlobal);
4105
4125
  const responseHeaders = {
@@ -4130,6 +4150,25 @@ async function runBrowserLogin(ctx, options, behavior = {}) {
4130
4150
  const message = error.code === "EADDRINUSE" ? `Port ${port} is already in use. Retry with --port ${port + 1}.` : error.code === "EACCES" ? `Port ${port} is not accessible. Retry with another --port.` : error.message;
4131
4151
  finish(new CliError(message, 2 /* UsageError */));
4132
4152
  });
4153
+ server.on("clientError", (error, socket) => {
4154
+ if (isTlsClientHello(error)) {
4155
+ if (!tlsCallbackDetected) {
4156
+ tlsCallbackDetected = true;
4157
+ ctx.logger.warn([
4158
+ `OAuth callback protocol mismatch: the browser used HTTPS for 127.0.0.1:${port}, while the CLI listener is HTTP.`,
4159
+ "\u5728 30 \u79D2\u5185\u628A\u6D4F\u89C8\u5668\u5F53\u524D\u5730\u5740\u5F00\u5934\u660E\u786E\u6539\u4E3A http://\uFF0C\u4FDD\u7559\u540E\u9762\u7684\u5B8C\u6574\u8DEF\u5F84\u548C\u53C2\u6570\uFF0C\u7136\u540E\u56DE\u8F66\u91CD\u8BD5\u3002",
4160
+ "\u4E0D\u8981\u628A\u5730\u5740\u4E2D\u7684\u6388\u6743\u7801\u590D\u5236\u5230\u804A\u5929\u6216\u65E5\u5FD7\u3002"
4161
+ ].join(" "));
4162
+ if (timer) clearTimeout(timer);
4163
+ timer = setTimeout(() => {
4164
+ finish(createOAuthCallbackProtocolMismatchError(port));
4165
+ }, OAUTH_CALLBACK_PROTOCOL_MISMATCH_GRACE_MS);
4166
+ }
4167
+ socket.destroy();
4168
+ return;
4169
+ }
4170
+ socket.destroy();
4171
+ });
4133
4172
  server.listen(port, "127.0.0.1", () => {
4134
4173
  ctx.logger.info("Local callback server: " + redirectUri);
4135
4174
  openUrlInBrowser(loginUrl, ctx);
@@ -4173,10 +4212,16 @@ function formatWhoami(title, data) {
4173
4212
  "User-Agent: " + (data.userAgent || "")
4174
4213
  ].join("\n");
4175
4214
  }
4176
- function registerBrowserLoginCommand(auth, action, name, description, behavior = {}) {
4215
+ function registerBrowserLoginCommand(auth, action, name, description) {
4177
4216
  const command = auth.command(name).description(description).option("--base-url <url>", "E10 base URL").option("--tenant-key <key>", "Tenant key fallback after login").option("--port <n>", "Local OAuth callback port", "19800").option("--agent_type <value>", "Agent type sent to E10 authorize endpoint").option("--agent-type <value>", "Alias of --agent_type").option("--agent-return-url <url>", "Desktop application URL linked by the login success page");
4178
4217
  command.action(action(async (ctx, options) => {
4179
- const result = await runBrowserLogin(ctx, options, behavior);
4218
+ const result = await runBrowserLogin(ctx, options);
4219
+ ctx.output.write(result, { text: formatLoginResult(result) });
4220
+ }));
4221
+ }
4222
+ function registerXiaoELoginCommand(auth, action) {
4223
+ auth.command("xiaoe").description("Use XiaoE unified login without browser OAuth fallback").option("--base-url <url>", "E10 base URL").option("--tenant-key <key>", "Tenant key fallback after login").option("--port <n>", "Deprecated compatibility option; ignored by XiaoE unified login", "19800").option("--agent_type <value>", "Deprecated compatibility option; ignored by XiaoE unified login").option("--agent-type <value>", "Alias of --agent_type").option("--agent-return-url <url>", "Deprecated compatibility option; ignored by XiaoE unified login").action(action(async (ctx, options) => {
4224
+ const result = await runXiaoELogin(ctx, options);
4180
4225
  ctx.output.write(result, { text: formatLoginResult(result) });
4181
4226
  }));
4182
4227
  }
@@ -4191,7 +4236,7 @@ function registerE10AuthCommands(parent, action) {
4191
4236
  const commandOpts = asOptions(options);
4192
4237
  const authFile = findAuthFile(ctx.cwd, opts);
4193
4238
  const session = authFile ? E10AuthSession.fromFile(authFile, opts.baseUrl, opts.passportUrl) : null;
4194
- const valid = session && commandOpts.check !== false ? await session.checkValid() : void 0;
4239
+ const valid = session && commandOpts.check !== false ? session.isExpired() ? false : await session.checkValid() : void 0;
4195
4240
  const status = session ? {
4196
4241
  loggedIn: true,
4197
4242
  userId: session.userId,
@@ -4211,6 +4256,7 @@ function registerE10AuthCommands(parent, action) {
4211
4256
  ...session.credentialSourceStep ? { credentialSourceStep: session.credentialSourceStep } : {},
4212
4257
  ...session.credentialSourceType ? { credentialSourceType: session.credentialSourceType } : {},
4213
4258
  ...session.credentialSourceLabel ? { credentialSourceLabel: session.credentialSourceLabel } : {},
4259
+ ...session.expiryTimes ? { expiryTimes: session.expiryTimes } : {},
4214
4260
  valid
4215
4261
  } : {
4216
4262
  loggedIn: false,
@@ -4244,12 +4290,7 @@ function registerE10AuthCommands(parent, action) {
4244
4290
  }));
4245
4291
  registerBrowserLoginCommand(auth, action, "login", "Open browser OAuth2.0 login and save E10 auth");
4246
4292
  registerBrowserLoginCommand(auth, action, "oidc", "Alias of auth login for OAuth2.0 browser login");
4247
- registerBrowserLoginCommand(auth, action, "xiaoe", "Use XiaoE unified login without browser OAuth fallback", {
4248
- tryXiaoEUnifiedLogin: true,
4249
- allowXiaoETokenScript: true,
4250
- explainXiaoEFallback: true,
4251
- browserFallback: "never"
4252
- });
4293
+ registerXiaoELoginCommand(auth, action);
4253
4294
  auth.command("logout").alias("clear").description("Clear saved E10 auth for the current or selected profile").action(action(async (ctx) => {
4254
4295
  const opts = ctx.getGlobalOptions();
4255
4296
  const profile2 = opts.profile || getActiveProfile();
@@ -7,12 +7,13 @@ import {
7
7
  } from "./chunk-FMPJJYYI.js";
8
8
  import {
9
9
  createE10RequestRuntime,
10
+ isE10AuthenticationRequired,
10
11
  requireE10Session
11
- } from "./chunk-UZZBA6PV.js";
12
+ } from "./chunk-WFFNM65B.js";
12
13
  import {
13
14
  E10_SESSION_EXPIRED_MESSAGE,
14
15
  getActiveProfile
15
- } from "./chunk-OJQUJZQF.js";
16
+ } from "./chunk-4TEDNCON.js";
16
17
 
17
18
  // src/shortcuts/workflow/host.ts
18
19
  var DEFAULT_TIMEOUT_MS = 3e4;
@@ -72,6 +73,7 @@ function isAtustRedirect(status, value) {
72
73
  }
73
74
  function isLoginExpired(value, httpStatus) {
74
75
  if (httpStatus === 401 || httpStatus === 403) return true;
76
+ if (isE10AuthenticationRequired({ status: httpStatus ?? 200, value })) return true;
75
77
  if (isAtustRedirect(httpStatus, value)) return true;
76
78
  const joined = payloadTexts(value).join("\n").toLowerCase();
77
79
  if (joined.includes("login.jsp")) return true;
@@ -5,7 +5,7 @@ import {
5
5
  ebBusinessSuccess,
6
6
  meetingSuccess,
7
7
  meetingValidationError
8
- } from "./chunk-ELYDWBZJ.js";
8
+ } from "./chunk-7BRU4EFH.js";
9
9
 
10
10
  // src/shortcuts/meeting/operations/env.ts
11
11
  import { existsSync } from "node:fs";
@@ -4,12 +4,12 @@ import {
4
4
  createE10RequestRuntime,
5
5
  isE10SessionExpiredResponse,
6
6
  requireE10Session
7
- } from "./chunk-UZZBA6PV.js";
7
+ } from "./chunk-WFFNM65B.js";
8
8
  import {
9
9
  E10_REAUTH_GUIDANCE,
10
10
  E10_SESSION_EXPIRED_MESSAGE,
11
11
  getActiveProfile
12
- } from "./chunk-OJQUJZQF.js";
12
+ } from "./chunk-4TEDNCON.js";
13
13
  import {
14
14
  CliError
15
15
  } from "./chunk-LUSPKZKY.js";
@@ -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-UJJD4QWF.js";
5
+ } from "./chunk-CAQNBBQA.js";
6
6
  import {
7
7
  esbValidationError
8
8
  } from "./chunk-GPMFD4RD.js";