weaver-work-cli 0.1.54 → 0.1.56

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 (183) hide show
  1. package/dist/chunks/{archive-ZQ4A4TV6.js → archive-4SQAVTIB.js} +3 -2
  2. package/dist/chunks/{archive-oa-57R2FYHV.js → archive-oa-W2UEJ67L.js} +137 -8
  3. package/dist/chunks/{asset-ZOJVBWZH.js → asset-EGZEABBI.js} +3 -2
  4. package/dist/chunks/{asset-idle-XGB5IPGT.js → asset-idle-EBUZBB6M.js} +3 -2
  5. package/dist/chunks/{attachment-content-2EPEI4HV.js → attachment-content-QGM5MLQE.js} +4 -3
  6. package/dist/chunks/{blog-QSHLZSFW.js → blog-2YKMWOWI.js} +3 -2
  7. package/dist/chunks/{caizhilian-KCQYFH72.js → caizhilian-QJ4FLSQJ.js} +5 -4
  8. package/dist/chunks/{calendar-DLGMRJQA.js → calendar-H4QTJCUY.js} +3 -2
  9. package/dist/chunks/{chunk-XPQN4E5O.js → chunk-44KJ7WFA.js} +300 -55
  10. package/dist/chunks/{chunk-CZNZKOHR.js → chunk-4GG72JAT.js} +2 -2
  11. package/dist/chunks/{chunk-YIKSL36S.js → chunk-5N222HK6.js} +2 -2
  12. package/dist/chunks/{chunk-XHMJBRLZ.js → chunk-6DVL5IN5.js} +4 -1
  13. package/dist/chunks/{chunk-JJRIT2ZN.js → chunk-6MS3RLPO.js} +5 -334
  14. package/dist/chunks/{chunk-QUDHSMG3.js → chunk-7EBV7Q3R.js} +112 -27
  15. package/dist/chunks/{chunk-CNVZETM5.js → chunk-AHJZIMCX.js} +1 -1
  16. package/dist/chunks/{chunk-TGAGQV4I.js → chunk-CQ4OVCKG.js} +2 -2
  17. package/dist/chunks/{chunk-2BQESR2U.js → chunk-DVR2EDUU.js} +99 -34
  18. package/dist/chunks/{chunk-7KKI5KDY.js → chunk-FDAJC7R4.js} +4 -4
  19. package/dist/chunks/{chunk-GR76ZDDX.js → chunk-FMNCSYIG.js} +2 -2
  20. package/dist/chunks/{chunk-6LGLI46Q.js → chunk-L2LMBFG5.js} +1 -1
  21. package/dist/chunks/{chunk-DLY5GUXX.js → chunk-PH7N4UFT.js} +1 -1
  22. package/dist/chunks/{chunk-U6R6FZHD.js → chunk-SFM3M2L3.js} +286 -93
  23. package/dist/chunks/chunk-SHYQUBY3.js +48 -0
  24. package/dist/chunks/{chunk-HFXK54M4.js → chunk-TGM7BWEH.js} +2 -2
  25. package/dist/chunks/{chunk-Z7B7QSR2.js → chunk-TJUAGZU7.js} +11 -11
  26. package/dist/chunks/{chunk-LYOFRYC4.js → chunk-UI66EMOR.js} +4 -4
  27. package/dist/chunks/{chunk-762M5XJS.js → chunk-VMCCRWFO.js} +2 -2
  28. package/dist/chunks/{chunk-FE3CQAAM.js → chunk-WHJIUKJW.js} +681 -48
  29. package/dist/chunks/{chunk-PGO4ILMQ.js → chunk-WMB3SMXI.js} +1 -1
  30. package/dist/chunks/chunk-WMRNO6IU.js +337 -0
  31. package/dist/chunks/{chunk-6NXT4ICB.js → chunk-WVH5ESDA.js} +1 -1
  32. package/dist/chunks/{chunk-O6RIBG5E.js → chunk-XU3FL3AW.js} +4 -4
  33. package/dist/chunks/{chunk-Z6UUBY37.js → chunk-Z4IPY5GV.js} +2 -2
  34. package/dist/chunks/{conflict-K2IAKKFR.js → conflict-VAFFPUY3.js} +2 -2
  35. package/dist/chunks/{contract-LJRAXVZU.js → contract-LLRKMLQQ.js} +2655 -1319
  36. package/dist/chunks/{cowork-3ACICHDQ.js → cowork-2RDFBZWB.js} +3 -2
  37. package/dist/chunks/{create-flow-UL37MZGP.js → create-flow-TVYE3IOH.js} +6 -6
  38. package/dist/chunks/{data-WK5CQXNF.js → data-WVICO3DT.js} +57 -11
  39. package/dist/chunks/{ebuilder-form-CBYI6CQ6.js → ebuilder-form-TWSXS5NA.js} +7 -6
  40. package/dist/chunks/{ehr-XI4BIVR2.js → ehr-52GBKNJR.js} +3 -2
  41. package/dist/chunks/{env-BZDB5OVZ.js → env-BVVFIN4P.js} +2 -2
  42. package/dist/chunks/{esb-4BQHNP5C.js → esb-HJSXCEOM.js} +5 -4
  43. package/dist/chunks/{factory-VD3YI6N7.js → factory-RCQ36LLE.js} +1 -1
  44. package/dist/chunks/{fna-ECOYBQYL.js → fna-OBACRT3J.js} +72 -3
  45. package/dist/chunks/{group-chat-DHNVO76L.js → group-chat-YFZDUUY3.js} +3 -3
  46. package/dist/chunks/{host-TUOIOEMC.js → host-2BKMPWDH.js} +4 -3
  47. package/dist/chunks/{host-3TNBMDTR.js → host-KJT3G5D2.js} +4 -3
  48. package/dist/chunks/{host-7OWWPLM4.js → host-KOWUMNAY.js} +4 -3
  49. package/dist/chunks/{host-M4XP5URR.js → host-MFXRA2MY.js} +4 -3
  50. package/dist/chunks/{host-7NTIBSPK.js → host-TTSGY5NZ.js} +4 -3
  51. package/dist/chunks/{host-G3VU7SDW.js → host-W4JCNRFS.js} +4 -3
  52. package/dist/chunks/{hrm-YGIR3HGF.js → hrm-AK3WGBMN.js} +4 -3
  53. package/dist/chunks/{im-TN2JYVGJ.js → im-JZSBPO4Z.js} +4 -3
  54. package/dist/chunks/{invoice-V7ZTITUO.js → invoice-V6KD4TZE.js} +4 -3
  55. package/dist/chunks/{jiuchuanhui-ASFZBMPU.js → jiuchuanhui-K4EQU6GK.js} +3 -2
  56. package/dist/chunks/{lazy-dispatch-XSAHDK6Z.js → lazy-dispatch-JHGFCKJN.js} +5 -4
  57. package/dist/chunks/{mail-M3HJF5ER.js → mail-IKVCQCVZ.js} +3 -2
  58. package/dist/chunks/{meeting-OWG4O2XH.js → meeting-JOHV4RH3.js} +14 -12
  59. package/dist/chunks/minute-doc-JLS4KMFZ.js +156 -0
  60. package/dist/chunks/{okr-EVX7FB5G.js → okr-KV43FPPX.js} +3 -2
  61. package/dist/chunks/{operations-J7PUIVWZ.js → operations-ZPWBMYKE.js} +5 -4
  62. package/dist/chunks/{plan-2QJQEPBO.js → plan-WOYR4WEG.js} +3 -2
  63. package/dist/chunks/{project-XELELW2T.js → project-CQJKBUIL.js} +3 -2
  64. package/dist/chunks/{reception-QGPNTGHG.js → reception-MPBU3JXC.js} +3 -2
  65. package/dist/chunks/{recruit-stage-XCMVEQA2.js → recruit-stage-USTTRHOX.js} +3 -2
  66. package/dist/chunks/{registry-CJOVECZD.js → registry-GURQG4ZV.js} +3 -2
  67. package/dist/chunks/{registry-ASYCWF2U.js → registry-LITYOH2W.js} +12 -10
  68. package/dist/chunks/{registry-QJCZ2GVG.js → registry-SS5J2FZQ.js} +5 -4
  69. package/dist/chunks/{room-recommend-LSVAMGKV.js → room-recommend-62MECG4J.js} +4 -4
  70. package/dist/chunks/{schedule-7QOPRUU4.js → schedule-6QRXIBGU.js} +4 -4
  71. package/dist/chunks/{smart-extract-FOUYNIG3.js → smart-extract-APX2PNIN.js} +3 -2
  72. package/dist/chunks/{workflow-YHXFIU63.js → workflow-WMPW3WSB.js} +5 -4
  73. package/dist/index.js +33 -32
  74. package/dist/internal/e10/auth/agent-host-key.js +68 -0
  75. package/dist/internal/e10/auth/agent-hosts.js +250 -0
  76. package/dist/internal/e10/auth/commands.js +99 -30
  77. package/dist/internal/e10/auth/paths.js +9 -0
  78. package/dist/internal/e10/auth/session.js +17 -0
  79. package/dist/internal/e10/auth/xiaoe.js +37 -3
  80. package/dist/shortcuts/archive-oa/operations/contract-modules.js +106 -0
  81. package/dist/shortcuts/archive-oa/operations/contract.js +38 -4
  82. package/dist/shortcuts/archive-oa/operations/registry.js +2 -1
  83. package/dist/shortcuts/contract/index.js +6 -7
  84. package/dist/shortcuts/contract/manifest.js +101 -24
  85. package/dist/shortcuts/contract/ooxml/docx-table.js +75 -3
  86. package/dist/shortcuts/contract/ooxml/xlsx.js +49 -13
  87. package/dist/shortcuts/contract/operations/card-action.js +113 -12
  88. package/dist/shortcuts/contract/operations/card-ebdf-list.js +29 -7
  89. package/dist/shortcuts/contract/operations/card-plan.js +75 -9
  90. package/dist/shortcuts/contract/operations/card-risk-report.js +2 -2
  91. package/dist/shortcuts/contract/operations/card.js +1 -1
  92. package/dist/shortcuts/contract/operations/clause-library.js +88 -16
  93. package/dist/shortcuts/contract/operations/compare-screen.js +378 -0
  94. package/dist/shortcuts/contract/operations/compare.js +1 -1
  95. package/dist/shortcuts/contract/operations/credit-page.js +1 -1
  96. package/dist/shortcuts/contract/operations/docx-slots.js +1000 -0
  97. package/dist/shortcuts/contract/operations/flow.js +2 -2
  98. package/dist/shortcuts/contract/operations/quote-to-contract.js +495 -0
  99. package/dist/shortcuts/contract/operations/quote.js +2 -229
  100. package/dist/shortcuts/contract/operations/recommend.js +1 -1
  101. package/dist/shortcuts/contract/operations/registry.js +6 -2
  102. package/dist/shortcuts/contract/operations/review.js +230 -4
  103. package/dist/shortcuts/contract/operations/save-recognize.js +122 -3
  104. package/dist/shortcuts/contract/operations/template.js +11 -10
  105. package/dist/shortcuts/data/operations/ds.js +5 -5
  106. package/dist/shortcuts/data/operations/shared.js +76 -4
  107. package/dist/shortcuts/fna/manifest.js +7 -2
  108. package/dist/shortcuts/fna/operations/budget.js +68 -0
  109. package/dist/shortcuts/meeting/minute-doc.js +153 -0
  110. package/dist/shortcuts/meeting/operations/compose-outcome.js +176 -0
  111. package/dist/shortcuts/meeting/operations/eb/catalog.js +1 -1
  112. package/dist/shortcuts/meeting/operations/eb/create-flow.js +26 -0
  113. package/dist/shortcuts/meeting/operations/eb/decision-task-batch.js +144 -0
  114. package/dist/shortcuts/meeting/operations/eb/decision.js +92 -4
  115. package/dist/shortcuts/meeting/operations/eb/index.js +133 -4
  116. package/dist/shortcuts/meeting/operations/eb/meeting-link.js +90 -0
  117. package/dist/shortcuts/meeting/operations/from-group-chat.js +46 -0
  118. package/dist/shortcuts/meeting/operations/minute-content.js +61 -0
  119. package/dist/shortcuts/meeting/operations/registry.js +14 -1
  120. package/dist/shortcuts/meeting/operations/self-check.js +49 -0
  121. package/dist/shortcuts/workflow/endpoints.js +2 -0
  122. package/dist/shortcuts/workflow/operations/read.js +114 -8
  123. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +72 -46
  124. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +41 -0
  125. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +46 -11
  126. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.smartGroup.js +18 -1
  127. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.smartGroupAdd.js +51 -0
  128. package/docs/e10-auth.md +78 -0
  129. package/docs/fna.md +8 -3
  130. package/package.json +4 -2
  131. package/scripts/pack-offline.mjs +228 -0
  132. package/scripts/package-skill.mjs +14 -5
  133. package/skill-template/business-info.json +3 -0
  134. package/skill-template/domains/qiyecheng.md +4 -3
  135. package/skills/weaver-e10-archive-oa/SKILL.md +6 -1
  136. package/skills/weaver-e10-archive-oa/references/contract-search.md +91 -4
  137. package/skills/weaver-e10-jinchengda/SKILL.md +100 -81
  138. package/skills/weaver-e10-jinchengda/references/contract-action-card-template.html +11 -6
  139. package/skills/weaver-e10-jinchengda/references/contract-action-card.md +5 -4
  140. package/skills/weaver-e10-jinchengda/references/contract-action-engine.md +38 -12
  141. package/skills/weaver-e10-jinchengda/references/contract-agent-entry.md +1 -1
  142. package/skills/weaver-e10-jinchengda/references/contract-ai-assistant.md +1 -1
  143. package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +20 -6
  144. package/skills/weaver-e10-jinchengda/references/contract-card-render-internals.md +8 -3
  145. package/skills/weaver-e10-jinchengda/references/contract-clause-library-crud.md +56 -13
  146. package/skills/weaver-e10-jinchengda/references/contract-clause-recommender.md +7 -0
  147. package/skills/weaver-e10-jinchengda/references/contract-command-index.md +4 -4
  148. package/skills/weaver-e10-jinchengda/references/contract-compare-report.md +11 -5
  149. package/skills/weaver-e10-jinchengda/references/contract-credit-page.md +1 -1
  150. package/skills/weaver-e10-jinchengda/references/contract-disabled-capabilities.md +1 -1
  151. package/skills/weaver-e10-jinchengda/references/contract-doc-compare.md +38 -7
  152. package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +13 -25
  153. package/skills/weaver-e10-jinchengda/references/contract-element-save-record.md +9 -8
  154. package/skills/weaver-e10-jinchengda/references/contract-execution-rules.md +8 -6
  155. package/skills/weaver-e10-jinchengda/references/contract-field-extract-new-customer.md +10 -7
  156. package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +2 -2
  157. package/skills/weaver-e10-jinchengda/references/contract-ledger-catalog.md +3 -1
  158. package/skills/weaver-e10-jinchengda/references/contract-ledger-query-playbook.md +26 -18
  159. package/skills/weaver-e10-jinchengda/references/contract-modeltext-library.md +4 -4
  160. package/skills/weaver-e10-jinchengda/references/contract-multi-file.md +18 -13
  161. package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +5 -3
  162. package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +105 -49
  163. package/skills/weaver-e10-jinchengda/references/contract-template-recommend.md +1 -1
  164. package/skills/weaver-e10-jinchengda/references/contract-template-selector.md +3 -6
  165. package/skills/weaver-e10-meeting/SKILL.md +47 -9
  166. package/skills/weaver-e10-qiyecheng/SKILL.md +16 -7
  167. package/skills/weaver-e10-qiyecheng/references/budget.md +77 -3
  168. package/skills/weaver-e10-qiyecheng/references/catalog.md +6 -4
  169. package/skills/weaver-e10-qiyecheng/references/getEnabledTemplate-api.md +255 -0
  170. package/skills/weaver-e10-qiyecheng/references/source-manifest.json +70 -25
  171. package/skills/weaver-e10-workflow/SKILL.md +54 -40
  172. package/skills/weaver-e10-workflow/references/todo-dialogue.md +134 -0
  173. package/skills/weaver-e10-workflow/references/todo-smart-convert.md +102 -80
  174. package/skills/weaver-e10-workflow/references/workflow-agent-entry.md +23 -13
  175. package/skills/weaver-e10-workflow/references/workflow-query.md +68 -46
  176. package/skills/weaver-e10-workflow/references/workflow-view.md +21 -13
  177. package/skills/weaver-e10-workflow/tools/todo-summary.cjs +317 -332
  178. package/dist/shortcuts/contract/ooxml/docx.js +0 -295
  179. package/dist/shortcuts/contract/operations/docx-fillfromquote.js +0 -532
  180. package/skills/weaver-e10-jinchengda/references/contract-risk-report-template.html +0 -178
  181. package/skills/weaver-e10-jinchengda/references/source-manifest.json +0 -1270
  182. package/skills/weaver-e10-jinchengda/scripts/fill_plan.py +0 -998
  183. package/skills/weaver-e10-workflow/tools/todo-serve.cjs +0 -327
@@ -17,7 +17,7 @@ import {
17
17
  import {
18
18
  Command,
19
19
  clearInvoiceTokenForSession
20
- } from "./chunk-GR76ZDDX.js";
20
+ } from "./chunk-FMNCSYIG.js";
21
21
  import {
22
22
  refsDir
23
23
  } from "./chunk-AJ62BGAW.js";
@@ -32,7 +32,7 @@ import {
32
32
  normalizeXiaoEAuthErrorLogLimit,
33
33
  readXiaoEAuthErrorLog,
34
34
  xiaoEAuthLogSecrets
35
- } from "./chunk-6NXT4ICB.js";
35
+ } from "./chunk-WVH5ESDA.js";
36
36
  import {
37
37
  E10AuthSession,
38
38
  XIAOE_AGENT_TYPE,
@@ -49,19 +49,27 @@ import {
49
49
  hasXiaoEEnv,
50
50
  inspectXiaoEUnifiedLoginSources,
51
51
  listProfiles,
52
+ lookupAgentHost,
52
53
  normalizeGlobalOptions,
53
- packageFileUrl,
54
- packagePath,
55
54
  profileNameFromUrl,
56
55
  readProfileConfig,
57
56
  readTeamsCheckUserInfo,
57
+ resolveActiveProfileForHost,
58
+ resolveAgentHostKey,
59
+ resolveDefaultE10BaseUrl,
60
+ resolveLoginProfileName,
58
61
  resolveXiaoEPreferredBaseUrl,
59
62
  saveAuthFile,
60
63
  saveProfileConfig,
61
64
  setActiveProfile,
62
65
  switchActiveProfile,
63
- tryXiaoEUnifiedLogin
64
- } from "./chunk-U6R6FZHD.js";
66
+ tryXiaoEUnifiedLogin,
67
+ upsertAgentHost
68
+ } from "./chunk-SFM3M2L3.js";
69
+ import {
70
+ packageFileUrl,
71
+ packagePath
72
+ } from "./chunk-SHYQUBY3.js";
65
73
  import {
66
74
  CliError,
67
75
  isCliError,
@@ -320,11 +328,28 @@ function inferAgentTypeFromEnv(env) {
320
328
  if (hasXiaoEEnv(env)) return XIAOE_AGENT_TYPE;
321
329
  if (hasEnvPrefix(env, "WORKBUDDY")) return "workbuddy";
322
330
  if (hasEnvPrefix(env, "CODEX")) return "codex";
331
+ if (hasEnvPrefix(env, "DOUBAO_OFFICE") || hasEnvPrefix(env, "DOUBAO")) return "doubao";
332
+ if (hasEnvPrefix(env, "QWENWORK") || hasEnvPrefix(env, "QWEN")) return "qwen";
323
333
  return "";
324
334
  }
325
335
  function resolveAgentType(options = {}, env = process.env) {
326
336
  return optionString(options, "agentType", "agent_type") || envString(env, ...EXPLICIT_AGENT_TYPE_ENV_KEYS) || inferAgentTypeFromEnv(env) || DEFAULT_AGENT_TYPE;
327
337
  }
338
+ function resolveLoginTarget(input) {
339
+ const explicitAgentType = (input.explicitAgentType || "").trim();
340
+ const hostKey = resolveAgentHostKey(input.env, explicitAgentType);
341
+ const explicitProfile = (input.explicitProfile || "").trim();
342
+ if (explicitProfile) {
343
+ return { hostKey, profile: explicitProfile, cfg: readProfileConfig(explicitProfile) };
344
+ }
345
+ const host = lookupAgentHost(input.env, explicitAgentType);
346
+ if (host) {
347
+ const cfg = readProfileConfig(host.profile);
348
+ if (cfg.baseUrl || cfg.tenantKey) return { hostKey, profile: host.profile, cfg };
349
+ }
350
+ const active = getActiveProfile();
351
+ return { hostKey, profile: active, cfg: readProfileConfig(active) };
352
+ }
328
353
  function normalizeAgentKey(value) {
329
354
  return value.toLowerCase().replace(/[^a-z0-9]+/gu, "");
330
355
  }
@@ -410,6 +435,7 @@ function formatAuthStatus(status) {
410
435
  "agentType: " + (status.agentType || ""),
411
436
  "baseUrl: " + status.baseUrl,
412
437
  "profile: " + status.profile,
438
+ ..."agentHost" in status && status.agentHost ? ["agentHost: " + status.agentHost] : [],
413
439
  "authFile: " + status.authFile,
414
440
  ..."loginSource" in status && status.loginSource ? ["loginSource: " + status.loginSource] : [],
415
441
  ..."credentialSourceStep" in status && status.credentialSourceStep ? ["credentialSourceStep: " + status.credentialSourceStep] : [],
@@ -549,7 +575,12 @@ async function saveEteamsIdLogin(input) {
549
575
  throw new CliError("Could not resolve userId. Check whether ETEAMSID is valid for this E10 domain.", 3 /* AuthError */);
550
576
  }
551
577
  const tenantKey = userInfo.tenantKey || input.tenantKeyFallback;
552
- const profile = input.profileHint || profileNameFromUrl(baseUrl);
578
+ const profile = resolveLoginProfileName({
579
+ derivedName: profileNameFromUrl(baseUrl),
580
+ baseUrl,
581
+ hostKey: input.hostKey,
582
+ profileHint: input.profileHint
583
+ });
553
584
  setActiveProfile(profile);
554
585
  const cookies = { ETEAMSID: input.eteamsId };
555
586
  if (input.rawCookie) cookies.raw = input.rawCookie;
@@ -572,6 +603,7 @@ async function saveEteamsIdLogin(input) {
572
603
  await clearInvoiceTokenCache(profile, authData);
573
604
  const authFile = saveAuthFile(authData, profile);
574
605
  saveProfileConfig(baseUrl, passportUrl, profile, tenantKey);
606
+ upsertAgentHost({ profile, baseUrl, tenantKey, agentType: input.agentType, hostKey: input.hostKey });
575
607
  return {
576
608
  ...userInfo,
577
609
  tenantKey,
@@ -584,7 +616,7 @@ async function saveEteamsIdLogin(input) {
584
616
  version: input.version || ""
585
617
  };
586
618
  }
587
- async function tryXiaoEUnifiedLogin2(ctx, baseUrl, tenantKeyFallback, profileHint, allowTokenScript = false, diagnostics) {
619
+ async function tryXiaoEUnifiedLogin2(ctx, baseUrl, tenantKeyFallback, profileHint, allowTokenScript = false, diagnostics, hostKey) {
588
620
  const login = await tryXiaoEUnifiedLogin({
589
621
  env: ctx.env,
590
622
  baseUrl,
@@ -593,11 +625,12 @@ async function tryXiaoEUnifiedLogin2(ctx, baseUrl, tenantKeyFallback, profileHin
593
625
  profileHint,
594
626
  allowTokenScript,
595
627
  logger: ctx.logger,
596
- diagnostics
628
+ diagnostics,
629
+ hostKey
597
630
  });
598
631
  return login?.result || null;
599
632
  }
600
- async function oidcExchange(code, redirectUri, baseUrl, tenantKeyFallback, agentTypeFallback, profileHint) {
633
+ async function oidcExchange(code, redirectUri, baseUrl, tenantKeyFallback, agentTypeFallback, profileHint, hostKey) {
601
634
  const base = normalizeUrl(baseUrl);
602
635
  const tokenParams = new URLSearchParams({
603
636
  grant_type: "authorization_code",
@@ -667,11 +700,17 @@ async function oidcExchange(code, redirectUri, baseUrl, tenantKeyFallback, agent
667
700
  cookieSavedAt: Date.now(),
668
701
  ...ztSession ? { ztSession } : {}
669
702
  };
670
- const profile = profileHint || profileNameFromUrl(base);
703
+ const profile = resolveLoginProfileName({
704
+ derivedName: profileNameFromUrl(base),
705
+ baseUrl: base,
706
+ hostKey,
707
+ profileHint
708
+ });
671
709
  setActiveProfile(profile);
672
710
  await clearInvoiceTokenCache(profile, authData);
673
711
  const authFile = saveAuthFile(authData, profile);
674
712
  saveProfileConfig(base, base, profile, tenantKey);
713
+ upsertAgentHost({ profile, baseUrl: base, tenantKey, agentType: agentTypeFallback, hostKey });
675
714
  return {
676
715
  userId: authData.userId,
677
716
  tenantKey,
@@ -701,7 +740,8 @@ async function runXiaoELogin(ctx, options) {
701
740
  const commandOpts = asOptions(options);
702
741
  const globalOptions = ctx.getGlobalOptions();
703
742
  const profileFromGlobal = globalOptions.profile;
704
- const cfg = readProfileConfig(profileFromGlobal || getActiveProfile());
743
+ const hostKey = resolveAgentHostKey(ctx.env);
744
+ const cfg = readProfileConfig(profileFromGlobal || resolveActiveProfileForHost(ctx.env));
705
745
  const explicitBaseUrl = optionString(commandOpts, "baseUrl") || globalOptions.baseUrl || "";
706
746
  const preferredXiaoEBaseUrl = resolveXiaoEPreferredBaseUrl({
707
747
  explicitBaseUrl,
@@ -752,13 +792,14 @@ async function runXiaoELogin(ctx, options) {
752
792
  tenantKey,
753
793
  profileFromGlobal,
754
794
  true,
755
- diagnostics
795
+ diagnostics,
796
+ hostKey
756
797
  );
757
798
  if (xiaoEResult) return xiaoEResult;
758
799
  } catch (error2) {
759
800
  await appendXiaoEAuthErrorLog({
760
801
  source: "login",
761
- profile: profileFromGlobal || getActiveProfile(),
802
+ profile: profileFromGlobal || resolveActiveProfileForHost(ctx.env),
762
803
  baseUrl,
763
804
  diagnostics,
764
805
  error: error2,
@@ -773,7 +814,7 @@ async function runXiaoELogin(ctx, options) {
773
814
  const error = createXiaoEUnifiedLoginUnavailableError(baseUrl);
774
815
  await appendXiaoEAuthErrorLog({
775
816
  source: "login",
776
- profile: profileFromGlobal || getActiveProfile(),
817
+ profile: profileFromGlobal || resolveActiveProfileForHost(ctx.env),
777
818
  baseUrl,
778
819
  diagnostics,
779
820
  error,
@@ -787,18 +828,22 @@ async function runBrowserLogin(ctx, options) {
787
828
  const commandOpts = asOptions(options);
788
829
  const globalOptions = ctx.getGlobalOptions();
789
830
  const profileFromGlobal = globalOptions.profile;
790
- const cfg = readProfileConfig(profileFromGlobal || getActiveProfile());
791
831
  const explicitBaseUrl = optionString(commandOpts, "baseUrl") || globalOptions.baseUrl || "";
792
- const baseUrl = normalizeUrl(explicitBaseUrl || cfg.baseUrl || "");
832
+ const explicitAgentType = optionString(commandOpts, "agentType", "agent_type");
833
+ const agentType = resolveAgentType(commandOpts, ctx.env);
834
+ const target = resolveLoginTarget({
835
+ env: ctx.env,
836
+ explicitProfile: profileFromGlobal,
837
+ explicitAgentType
838
+ });
839
+ const hostKey = target.hostKey;
840
+ const baseUrl = normalizeUrl(explicitBaseUrl || target.cfg.baseUrl || resolveDefaultE10BaseUrl(ctx.env));
793
841
  const tenantKey = optionString(commandOpts, "tenantKey");
794
842
  const portText = optionString(commandOpts, "port") || "19800";
795
843
  const port = Number.parseInt(portText, 10);
796
- const explicitAgentType = optionString(commandOpts, "agentType", "agent_type");
797
- const agentType = resolveAgentType(commandOpts, ctx.env);
798
844
  if (!Number.isInteger(port) || port <= 0 || port > 65535) {
799
845
  throw new CliError("Invalid --port value", 2 /* UsageError */);
800
846
  }
801
- if (!baseUrl) throw new CliError("Missing --base-url", 2 /* UsageError */);
802
847
  const agentReturnTarget = resolveAgentReturnTarget(commandOpts, ctx.env, agentType);
803
848
  const agentReturnToken = agentReturnTarget ? randomBytes(24).toString("base64url") : "";
804
849
  const redirectUri = `http://127.0.0.1:${port}/callback`;
@@ -885,7 +930,7 @@ async function runBrowserLogin(ctx, options) {
885
930
  timer = null;
886
931
  }
887
932
  try {
888
- const result = await oidcExchange(code, redirectUri, baseUrl, tenantKey, redirectAgentType, profileFromGlobal);
933
+ const result = await oidcExchange(code, redirectUri, baseUrl, tenantKey, redirectAgentType, profileFromGlobal, hostKey);
889
934
  const responseHeaders = {
890
935
  "cache-control": "no-store",
891
936
  "content-security-policy": agentReturnTarget ? `default-src 'none'; style-src 'unsafe-inline'; script-src 'nonce-${agentReturnToken}'; connect-src 'self'` : `default-src 'none'; style-src 'unsafe-inline'`,
@@ -1067,7 +1112,7 @@ logFile: ${result.path}`;
1067
1112
  }));
1068
1113
  }
1069
1114
  function registerBrowserLoginCommand(auth, action, name, description, machine = false) {
1070
- 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");
1115
+ const command = auth.command(name).description(description).option("--base-url <url>", "E10 base URL (defaults to https://weapp.eteams.cn)").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");
1071
1116
  command.action(action(async (ctx, options) => {
1072
1117
  if (!machine) {
1073
1118
  const result = await runBrowserLogin(ctx, options);
@@ -1091,7 +1136,7 @@ function registerBrowserLoginCommand(auth, action, name, description, machine =
1091
1136
  }));
1092
1137
  }
1093
1138
  function registerXiaoELoginCommand(auth, action) {
1094
- 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) => {
1139
+ auth.command("xiaoe").description("Use XiaoE unified login without browser OAuth fallback").option("--base-url <url>", "E10 base URL (defaults to the host-provided domain)").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) => {
1095
1140
  const result = await runXiaoELogin(ctx, options);
1096
1141
  ctx.output.write(result, { text: formatLoginResult(result) });
1097
1142
  }));
@@ -1107,6 +1152,8 @@ function registerE10AuthCommands(parent, action) {
1107
1152
  const commandOpts = asOptions(options);
1108
1153
  const authFile = findAuthFile(ctx.cwd, opts);
1109
1154
  const session = authFile ? E10AuthSession.fromFile(authFile, opts.baseUrl, opts.passportUrl) : null;
1155
+ const profile2 = opts.profile || resolveActiveProfileForHost(ctx.env);
1156
+ const agentHost = resolveAgentHostKey(ctx.env);
1110
1157
  const valid = session && commandOpts.check !== false ? session.isExpired() ? false : await session.checkValid() : void 0;
1111
1158
  const status = session ? {
1112
1159
  loggedIn: true,
@@ -1120,7 +1167,8 @@ function registerE10AuthCommands(parent, action) {
1120
1167
  agentType: session.agentType,
1121
1168
  baseUrl: session.getBaseUrl(),
1122
1169
  passportUrl: session.getPassportUrl(),
1123
- profile: opts.profile || getActiveProfile(),
1170
+ profile: profile2,
1171
+ agentHost,
1124
1172
  authFile,
1125
1173
  hasEteamsId: Boolean(session.eteamsId),
1126
1174
  ...session.loginSource ? { loginSource: session.loginSource } : {},
@@ -1131,7 +1179,8 @@ function registerE10AuthCommands(parent, action) {
1131
1179
  valid
1132
1180
  } : {
1133
1181
  loggedIn: false,
1134
- profile: opts.profile || getActiveProfile(),
1182
+ profile: profile2,
1183
+ agentHost,
1135
1184
  authFile
1136
1185
  };
1137
1186
  ctx.output.write(status, { text: formatAuthStatus(status) });
@@ -1141,7 +1190,7 @@ function registerE10AuthCommands(parent, action) {
1141
1190
  const commandOpts = asOptions(options);
1142
1191
  const authFile = findAuthFile(ctx.cwd, opts);
1143
1192
  const session = authFile ? E10AuthSession.fromFile(authFile, opts.baseUrl, opts.passportUrl) : null;
1144
- const profile2 = opts.profile || getActiveProfile();
1193
+ const profile2 = opts.profile || resolveActiveProfileForHost(ctx.env);
1145
1194
  const expired = session ? session.isExpired() : false;
1146
1195
  const probe = session && !expired && commandOpts.check !== false ? await session.probeValid() : void 0;
1147
1196
  const authorized = Boolean(session) && !expired && probe !== false;
@@ -1158,17 +1207,23 @@ function registerE10AuthCommands(parent, action) {
1158
1207
  baseUrl: session ? session.getBaseUrl() : ""
1159
1208
  }, { json: true });
1160
1209
  }));
1161
- auth.command("set").description("Save E10 auth from an ETEAMSID cookie").requiredOption("--eteamsid <id>", "ETEAMSID cookie value").option("--base-url <url>", "E10 base URL").option("--passport-url <url>", "E10 passport URL; defaults to base URL").option("--tenant-key <key>", "Tenant key fallback").option("--agent_type <value>", "Agent type used in cookie and User-Agent").option("--agent-type <value>", "Alias of --agent_type").action(action(async (ctx, options) => {
1210
+ auth.command("set").description("Save E10 auth from an ETEAMSID cookie").requiredOption("--eteamsid <id>", "ETEAMSID cookie value").option("--base-url <url>", "E10 base URL (defaults to https://weapp.eteams.cn)").option("--passport-url <url>", "E10 passport URL; defaults to base URL").option("--tenant-key <key>", "Tenant key fallback").option("--agent_type <value>", "Agent type used in cookie and User-Agent").option("--agent-type <value>", "Alias of --agent_type").action(action(async (ctx, options) => {
1162
1211
  const globalOptions = ctx.getGlobalOptions();
1163
1212
  const commandOpts = asOptions(options);
1164
1213
  const profileFromGlobal = globalOptions.profile;
1165
- const cfg = readProfileConfig(profileFromGlobal || getActiveProfile());
1166
- const baseUrl = normalizeUrl(optionString(commandOpts, "baseUrl") || globalOptions.baseUrl || cfg.baseUrl || "");
1214
+ const target = resolveLoginTarget({
1215
+ env: ctx.env,
1216
+ explicitProfile: profileFromGlobal,
1217
+ explicitAgentType: optionString(commandOpts, "agentType", "agent_type")
1218
+ });
1219
+ const cfg = target.cfg;
1220
+ const baseUrl = normalizeUrl(
1221
+ optionString(commandOpts, "baseUrl") || globalOptions.baseUrl || cfg.baseUrl || resolveDefaultE10BaseUrl(ctx.env)
1222
+ );
1167
1223
  const passportUrl = normalizeUrl(optionString(commandOpts, "passportUrl") || globalOptions.passportUrl || cfg.passportUrl || baseUrl);
1168
1224
  const tenantKeyFallback = optionString(commandOpts, "tenantKey");
1169
1225
  const agentType = resolveAgentType(commandOpts, ctx.env);
1170
1226
  const eteamsId = optionString(commandOpts, "eteamsid");
1171
- if (!baseUrl) throw new CliError("Missing --base-url", 2 /* UsageError */);
1172
1227
  if (!eteamsId) throw new CliError("Missing --eteamsid", 2 /* UsageError */);
1173
1228
  ctx.logger.info("Resolving E10 user information...");
1174
1229
  const result = await saveEteamsIdLogin({
@@ -1177,7 +1232,8 @@ function registerE10AuthCommands(parent, action) {
1177
1232
  eteamsId,
1178
1233
  tenantKeyFallback,
1179
1234
  agentType,
1180
- profileHint: profileFromGlobal
1235
+ profileHint: profileFromGlobal,
1236
+ hostKey: target.hostKey
1181
1237
  });
1182
1238
  ctx.output.write(result, { text: formatLoginResult(result) });
1183
1239
  }));
@@ -1194,7 +1250,7 @@ function registerE10AuthCommands(parent, action) {
1194
1250
  registerXiaoEAuthLogCommands(auth, action);
1195
1251
  auth.command("logout").alias("clear").description("Clear saved E10 auth for the current or selected profile").action(action(async (ctx) => {
1196
1252
  const opts = ctx.getGlobalOptions();
1197
- const profile2 = opts.profile || getActiveProfile();
1253
+ const profile2 = opts.profile || resolveActiveProfileForHost(ctx.env);
1198
1254
  const authFile = getProfileAuthPath(profile2);
1199
1255
  const session = E10AuthSession.fromFile(authFile, opts.baseUrl, opts.passportUrl);
1200
1256
  if (session) {
@@ -1215,7 +1271,7 @@ function registerE10AuthCommands(parent, action) {
1215
1271
  const authFile = findAuthFile(ctx.cwd, opts);
1216
1272
  const session = authFile ? E10AuthSession.fromFile(authFile, opts.baseUrl, opts.passportUrl) : null;
1217
1273
  if (!session || !session.eteamsId) throw new CliError("E10 auth not found.", 3 /* AuthError */);
1218
- const profile2 = opts.profile || getActiveProfile();
1274
+ const profile2 = opts.profile || resolveActiveProfileForHost(ctx.env);
1219
1275
  const cached = sessionToCachedUser(session, profile2);
1220
1276
  if (!live) {
1221
1277
  ctx.output.write(cached, {
@@ -1285,10 +1341,19 @@ function registerE10AuthCommands(parent, action) {
1285
1341
  profile.command("use").description("Switch active E10 profile; creates it if missing").argument("<name>", "profile name").action(action((ctx, name) => {
1286
1342
  if (typeof name !== "string") throw new CliError("profile name must be a string", 2 /* UsageError */);
1287
1343
  switchActiveProfile(name);
1344
+ const cfg = readProfileConfig(name);
1345
+ const hostRecord = upsertAgentHost({
1346
+ profile: name,
1347
+ ...cfg.baseUrl ? { baseUrl: cfg.baseUrl } : {},
1348
+ ...cfg.tenantKey ? { tenantKey: cfg.tenantKey } : {},
1349
+ env: ctx.env
1350
+ });
1288
1351
  const result = {
1289
1352
  active: name,
1290
1353
  dir: getProfileDir(name),
1291
- authFile: getProfileAuthPath(name)
1354
+ authFile: getProfileAuthPath(name),
1355
+ agentHost: resolveAgentHostKey(ctx.env),
1356
+ ...hostRecord ? { agentHostProfile: hostRecord.profile } : {}
1292
1357
  };
1293
1358
  ctx.output.write(result, { text: "Active E10 profile: " + name + "\ndir: " + result.dir });
1294
1359
  }));
@@ -3,13 +3,13 @@ const require = __esbuildCreateRequire(import.meta.url);
3
3
  import {
4
4
  readCache,
5
5
  writeCache
6
- } from "./chunk-CNVZETM5.js";
6
+ } from "./chunk-AHJZIMCX.js";
7
7
  import {
8
8
  SCHEMA_DATETIME_MINUTE,
9
9
  meetingSuccess,
10
10
  meetingValidationError,
11
11
  schemaOf
12
- } from "./chunk-XHMJBRLZ.js";
12
+ } from "./chunk-6DVL5IN5.js";
13
13
 
14
14
  // src/shortcuts/meeting/operations/eb/schedule.ts
15
15
  var SCHEDULE_TYPE_PATH = "/api/ebuilder/form/formdata/v2/getFormDataList/queryAgendaType";
@@ -110,9 +110,9 @@ async function runScheduleConflictFlow(env, input) {
110
110
  if (!employeeId) {
111
111
  throw meetingValidationError("schedule_employee_required", "\u53D6\u4E0D\u5230\u5F53\u524D\u767B\u5F55\u7528\u6237 id\uFF0C\u65E0\u6CD5\u89E6\u53D1 ESB \u65E5\u7A0B\u67E5\u8BE2");
112
112
  }
113
- const { createEsbHost } = await import("./host-3TNBMDTR.js");
113
+ const { createEsbHost } = await import("./host-KJT3G5D2.js");
114
114
  const { createEsbContinuationSigner } = await import("./continuation-KI7DRRZN.js");
115
- const { getEsbOperation } = await import("./registry-QJCZ2GVG.js");
115
+ const { getEsbOperation } = await import("./registry-SS5J2FZQ.js");
116
116
  const esbEnv = {
117
117
  ctx: env.ctx,
118
118
  host: createEsbHost(env.ctx),
@@ -4,12 +4,12 @@ import {
4
4
  createE10RequestRuntime,
5
5
  isE10SessionExpiredResponse,
6
6
  requireE10Session
7
- } from "./chunk-6NXT4ICB.js";
7
+ } from "./chunk-WVH5ESDA.js";
8
8
  import {
9
9
  E10_REAUTH_GUIDANCE,
10
10
  E10_SESSION_EXPIRED_MESSAGE,
11
11
  getActiveProfile
12
- } from "./chunk-U6R6FZHD.js";
12
+ } from "./chunk-SFM3M2L3.js";
13
13
  import {
14
14
  CliError
15
15
  } from "./chunk-UG5G54VL.js";
@@ -5,7 +5,7 @@ import {
5
5
  ebBusinessSuccess,
6
6
  meetingSuccess,
7
7
  meetingValidationError
8
- } from "./chunk-XHMJBRLZ.js";
8
+ } from "./chunk-6DVL5IN5.js";
9
9
 
10
10
  // src/shortcuts/meeting/operations/env.ts
11
11
  import { existsSync } from "node:fs";
@@ -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-TGAGQV4I.js";
5
+ } from "./chunk-CQ4OVCKG.js";
6
6
  import {
7
7
  esbValidationError
8
8
  } from "./chunk-TXUG266F.js";