weaver-work-cli 0.1.39 → 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.
- package/README.md +4 -2
- package/dist/chunks/{archive-ENZYBBME.js → archive-JHTONRST.js} +2 -2
- package/dist/chunks/{archive-oa-YWLEC5V4.js → archive-oa-FCHLCPHC.js} +2 -2
- package/dist/chunks/{asset-OOV6DWPA.js → asset-RLIHC7DB.js} +2 -2
- package/dist/chunks/{asset-idle-RE632MY5.js → asset-idle-KVOFTLCP.js} +2 -2
- package/dist/chunks/{attachment-content-RWN2FCLL.js → attachment-content-RZYDB3MB.js} +3 -3
- package/dist/chunks/{blog-PEPOJAL7.js → blog-42OZTJNP.js} +2 -2
- package/dist/chunks/{caizhilian-WYIQDVPJ.js → caizhilian-KRK547K5.js} +2 -2
- package/dist/chunks/{calendar-CIARBAOX.js → calendar-RTWAMKHD.js} +2 -2
- package/dist/chunks/{chunk-L4N7B7ZD.js → chunk-4CTESSKI.js} +4 -4
- package/dist/chunks/{chunk-XXJOSZTQ.js → chunk-4TEDNCON.js} +43 -5
- package/dist/chunks/chunk-57IECMWX.js +487 -0
- package/dist/chunks/{chunk-CQHGNCK2.js → chunk-7BRU4EFH.js} +13 -7
- package/dist/chunks/{chunk-KTCB5R5H.js → chunk-7E6MUOEK.js} +2 -2
- package/dist/chunks/{chunk-I2HB737U.js → chunk-7U577Q7U.js} +2 -2
- package/dist/chunks/{chunk-BJGXMFGD.js → chunk-CAQNBBQA.js} +2 -2
- package/dist/chunks/{chunk-MUQUHKPG.js → chunk-CXRQWOZ5.js} +2 -2
- package/dist/chunks/{chunk-T7JDJJ7H.js → chunk-FLS4DPGP.js} +110 -16
- package/dist/chunks/{chunk-P2DAISYW.js → chunk-I566ZYNF.js} +1 -1
- package/dist/chunks/{chunk-36DIFZAH.js → chunk-IZSSVYAG.js} +2 -2
- package/dist/chunks/{chunk-EINRJHQ3.js → chunk-JWRZM2H2.js} +3 -3
- package/dist/chunks/{chunk-F2EQXUEE.js → chunk-LFMSDBZN.js} +97 -14
- package/dist/chunks/{chunk-GVPJZXJ2.js → chunk-LN447PY2.js} +91 -50
- package/dist/chunks/{chunk-K3RUEEOL.js → chunk-NETCCARD.js} +2 -2
- package/dist/chunks/{chunk-YS5DPN4T.js → chunk-NJKREDA3.js} +1 -1
- package/dist/chunks/{chunk-ZXRNHZTE.js → chunk-SPRHHSVC.js} +2 -2
- package/dist/chunks/{chunk-HJYVHXUQ.js → chunk-T6EGVBKU.js} +1 -1
- package/dist/chunks/{chunk-NLK2RZKG.js → chunk-VNBU55SL.js} +428 -145
- package/dist/chunks/{chunk-EZGFHJFW.js → chunk-WFFNM65B.js} +26 -7
- package/dist/chunks/{conflict-DRMDOL56.js → conflict-VR55AOOO.js} +2 -2
- package/dist/chunks/{contract-73MERZWN.js → contract-HI4FNPYE.js} +2 -2
- package/dist/chunks/{cowork-HNGBPD7A.js → cowork-HJLI353D.js} +12 -5
- package/dist/chunks/{ebuilder-form-OY6DVNRK.js → ebuilder-form-HTGI63UU.js} +3 -3
- package/dist/chunks/{ehr-RAQNEQO7.js → ehr-GYXIYH3A.js} +2 -2
- package/dist/chunks/env-DW3G4HUO.js +19 -0
- package/dist/chunks/{esb-6XV7C7YV.js → esb-I5INCEFE.js} +4 -4
- package/dist/chunks/factory-TKXGXS6L.js +30 -0
- package/dist/chunks/{fna-XTSRB7G7.js → fna-K2MHTQ24.js} +2 -2
- package/dist/chunks/group-chat-VYBNMJLG.js +18 -0
- package/dist/chunks/{host-VGPVP7YF.js → host-256GVCAH.js} +3 -3
- package/dist/chunks/{host-A7J6GDUP.js → host-D5SERMAJ.js} +3 -3
- package/dist/chunks/{host-3F5UM5GN.js → host-JM4YVHFM.js} +3 -3
- package/dist/chunks/{host-YAQAPYNP.js → host-L3VLITMT.js} +3 -3
- package/dist/chunks/{host-YMBXWFWX.js → host-ZUQTJYYK.js} +3 -3
- package/dist/chunks/{hrm-TLHKC545.js → hrm-VLRBKTZB.js} +3 -3
- package/dist/chunks/{im-YOUCFMUK.js → im-QK3VTLXK.js} +8 -8
- package/dist/chunks/{invoice-WNBS2B4C.js → invoice-T5JTA32H.js} +3 -3
- package/dist/chunks/{jiuchuanhui-XABWS5RN.js → jiuchuanhui-P2FNEQVZ.js} +2 -2
- package/dist/chunks/{lazy-dispatch-NLZ5UQQI.js → lazy-dispatch-XRRI46M6.js} +4 -4
- package/dist/chunks/{mail-LRYMBFNL.js → mail-3Y7MJ6PS.js} +9 -4
- package/dist/chunks/{meeting-ESXL6MFI.js → meeting-M7LTXGJE.js} +11 -10
- package/dist/chunks/{okr-EOV65SSF.js → okr-OBC6S67L.js} +2 -2
- package/dist/chunks/{plan-YFPVKW6Y.js → plan-5H6I53SK.js} +2 -2
- package/dist/chunks/{project-MDVZUYQW.js → project-L75QZV4S.js} +2 -2
- package/dist/chunks/{registry-QCLZEDAP.js → registry-KMHCPAAD.js} +9 -8
- package/dist/chunks/{registry-OZSMDVPP.js → registry-QGHFNUWS.js} +2 -2
- package/dist/chunks/{registry-VT5Y2HLA.js → registry-RXPN6BBT.js} +4 -4
- package/dist/chunks/{registry-YX4CSEMD.js → registry-UGRBCBHO.js} +2 -2
- package/dist/chunks/{room-recommend-L3MWH4JW.js → room-recommend-A3UDC3CA.js} +4 -4
- package/dist/chunks/{schedule-UASAVDVD.js → schedule-5GCACCK7.js} +4 -4
- package/dist/chunks/{workflow-KDGIUCNW.js → workflow-M5ZJ7DWF.js} +6 -6
- package/dist/index.js +28 -28
- package/dist/internal/e10/auth/commands.js +109 -56
- package/dist/internal/e10/auth/session.js +11 -1
- package/dist/internal/e10/auth/xiaoe.js +29 -4
- package/dist/internal/e10/client.js +13 -0
- package/dist/internal/e10/context.js +14 -6
- package/dist/internal/e10/request-runtime.js +9 -0
- package/dist/shortcuts/cowork/operations/item-write.js +10 -2
- package/dist/shortcuts/mail/operations/mail-send.js +8 -2
- package/dist/shortcuts/meeting/operations/eb/catalog.js +5 -1
- package/dist/shortcuts/meeting/operations/eb/create-flow.js +381 -104
- package/dist/shortcuts/meeting/operations/eb/crm-search.js +87 -5
- package/dist/shortcuts/meeting/operations/eb/flow-memory.js +49 -0
- package/dist/shortcuts/meeting/operations/eb/group-chat.js +583 -0
- package/dist/shortcuts/meeting/operations/eb/index.js +2 -0
- package/dist/shortcuts/meeting/operations/eb/room-recommend.js +19 -3
- package/dist/shortcuts/meeting/operations/eb/room-summary.js +2 -0
- package/dist/shortcuts/meeting/operations/eb/usage-cache.js +99 -0
- package/dist/shortcuts/meeting/operations/from-group-chat.js +35 -12
- package/dist/shortcuts/workflow/operations/form.js +21 -2
- package/dist/shortcuts/workflow/operations/todoSmartConvert/aigroupRules.js +52 -1
- package/dist/shortcuts/workflow/operations/todoSmartConvert/summaryCache.js +10 -9
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +28 -2
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +1 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.group.js +17 -9
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +1 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.summary.js +14 -2
- package/docs/e10-auth.md +15 -0
- package/package.json +1 -1
- package/scripts/mcp-meeting.mjs +234 -0
- package/skills/weaver-e10-cowork/references/cowork-write.md +1 -1
- package/skills/weaver-e10-mail/references/mail-send.md +2 -0
- package/skills/weaver-e10-meeting/SKILL.md +88 -25
- package/skills/weaver-e10-meeting/references/meeting-minute-file.md +25 -11
- package/skills/weaver-e10-meeting.zip +0 -0
- package/skills/weaver-e10-shared/SKILL.md +1 -1
- package/skills/weaver-e10-shared/references/e10-auth-and-session.md +1 -1
- package/skills/weaver-e10-workflow/SKILL.md +4 -0
- package/skills/weaver-e10-workflow/aigroup/default.json +12 -0
- package/skills/weaver-e10-workflow/references/todo-smart-convert.md +17 -11
- package/skills/weaver-e10-workflow/tools/todo-summary.cjs +73 -23
- package/dist/chunks/{chunk-2LV74IWP.js → chunk-E7OK5WD5.js} +5 -5
package/README.md
CHANGED
|
@@ -224,6 +224,8 @@ weaver-work-cli auth xiaoe
|
|
|
224
224
|
桌面 XiaoE 客户端会话和 `WEAVER_XIAOE_*` 映射。`XIAOE_DOMAIN` 是 XiaoE/erpa 换票
|
|
225
225
|
服务地址,不是 E10 地址。E10 目标按“显式 `--base-url` → 专用 `WEAVER_XIAOE_*`
|
|
226
226
|
E10 配置/映射 → 当前 profile → `https://www.e-cology.com.cn`”解析。
|
|
227
|
+
换票结果会保存 Unix 毫秒时间戳 `expiryTimes`;响应未携带时,CLI 按小E `tokens.py`
|
|
228
|
+
的规则使用换票成功时间加 2 小时。
|
|
227
229
|
|
|
228
230
|
统一登录失败时,所有操作系统都返回结构化的
|
|
229
231
|
`authentication/xiaoe_credential_unavailable`,不会自动打开浏览器或降级到
|
|
@@ -232,7 +234,7 @@ E10 配置/映射 → 当前 profile → `https://www.e-cology.com.cn`”解析
|
|
|
232
234
|
业务命令缺少可读取的本地会话时,若当前环境已通过 `XIAOE_*`、`--runtime-agent xiaoe`
|
|
233
235
|
等运行时标记识别为 XiaoE,CLI 会先静默尝试统一登录,再继续原业务操作;失败时返回
|
|
234
236
|
`authentication/xiaoe_credential_unavailable`,提示已尝试自动获取。未识别到 XiaoE 的首次认证仍需显式选择登录方式。
|
|
235
|
-
`auth status --no-check` 等本地状态查询不会触发登录。已有 XiaoE
|
|
237
|
+
`auth status --no-check` 等本地状态查询不会触发登录。已有 XiaoE 会话达到 `expiryTimes` 时,CLI 会在业务请求发出前静默换取新会话;接口层明确判定失效(HTTP 401/302、业务码 `-2` 或登录页)时,
|
|
236
238
|
公共 E10 请求运行时会根据持久化会话的 `agentType` / `loginSource` 静默换取一次新会话并把被拒绝的请求重放一次;该恢复不依赖 shared Skill、Agent、`XIAOE_*` 或 `--runtime-agent xiaoe`。这个过程不向
|
|
237
239
|
stdout/stderr 输出中间“登录”步骤,并会合并同一 profile 的并发换票。流式请求、网络错误、
|
|
238
240
|
`partial` / `write_uncertain` 不会重放;恢复后的地址或用户身份变化时也会停止。
|
|
@@ -251,7 +253,7 @@ weaver-work-cli --runtime-agent xiaoe workflow ...
|
|
|
251
253
|
`credentialSourceDetected`、`attempted` 及各凭据源检测结果;命中 `tokens.py` 或内置
|
|
252
254
|
Node 客户端会话路径时还会输出明确的尝试日志。统一登录成功后,登录结果以及后续
|
|
253
255
|
`auth status` 会显示 `credentialSourceStep`、`credentialSourceType`、
|
|
254
|
-
`credentialSourceLabel`,可据此确认实际凭证来源;`3 / xiaoe_client / XiaoE client settings`
|
|
256
|
+
`credentialSourceLabel`、`expiryTimes`,可据此确认实际凭证来源;`3 / xiaoe_client / XiaoE client settings`
|
|
255
257
|
表示未依赖 `tokens.py`,由 Node 直接换票。
|
|
256
258
|
|
|
257
259
|
默认本地回调地址为 `http://127.0.0.1:19800/callback`。如果端口被占用:
|
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
createE10RequestRuntime,
|
|
6
6
|
isE10SessionExpiredResponse,
|
|
7
7
|
requireE10Session
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-WFFNM65B.js";
|
|
9
9
|
import {
|
|
10
10
|
E10_SESSION_EXPIRED_MESSAGE,
|
|
11
11
|
getActiveProfile
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-4TEDNCON.js";
|
|
13
13
|
import {
|
|
14
14
|
CliError,
|
|
15
15
|
isCliError,
|
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
createE10RequestRuntime,
|
|
6
6
|
isE10SessionExpiredResponse,
|
|
7
7
|
requireE10Session
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-WFFNM65B.js";
|
|
9
9
|
import {
|
|
10
10
|
E10_SESSION_EXPIRED_MESSAGE,
|
|
11
11
|
getActiveProfile
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-4TEDNCON.js";
|
|
13
13
|
import {
|
|
14
14
|
CliError,
|
|
15
15
|
isCliError,
|
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
createE10RequestRuntime,
|
|
5
5
|
isE10SessionExpiredResponse,
|
|
6
6
|
requireE10Session
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-WFFNM65B.js";
|
|
8
8
|
import {
|
|
9
9
|
E10_SESSION_EXPIRED_MESSAGE,
|
|
10
10
|
getActiveProfile
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-4TEDNCON.js";
|
|
12
12
|
import {
|
|
13
13
|
CliError,
|
|
14
14
|
isCliError,
|
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
createE10RequestRuntime,
|
|
6
6
|
isE10SessionExpiredResponse,
|
|
7
7
|
requireE10Session
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-WFFNM65B.js";
|
|
9
9
|
import {
|
|
10
10
|
E10_SESSION_EXPIRED_MESSAGE,
|
|
11
11
|
getActiveProfile
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-4TEDNCON.js";
|
|
13
13
|
import {
|
|
14
14
|
CliError,
|
|
15
15
|
isCliError,
|
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
looksLikeFileId,
|
|
9
9
|
meetingAttachmentContentOperations,
|
|
10
10
|
parseFileIdList
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-7E6MUOEK.js";
|
|
12
|
+
import "./chunk-NJKREDA3.js";
|
|
13
|
+
import "./chunk-7BRU4EFH.js";
|
|
14
14
|
import "./chunk-LUSPKZKY.js";
|
|
15
15
|
import "./chunk-BUSC6UAE.js";
|
|
16
16
|
export {
|
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
createE10RequestRuntime,
|
|
5
5
|
isE10SessionExpiredResponse,
|
|
6
6
|
requireE10Session
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-WFFNM65B.js";
|
|
8
8
|
import {
|
|
9
9
|
E10_SESSION_EXPIRED_MESSAGE,
|
|
10
10
|
getActiveProfile
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-4TEDNCON.js";
|
|
12
12
|
import {
|
|
13
13
|
CliError,
|
|
14
14
|
isCliError,
|
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
createE10RequestRuntime,
|
|
6
6
|
isE10SessionExpiredResponse,
|
|
7
7
|
requireE10Session
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-WFFNM65B.js";
|
|
9
9
|
import {
|
|
10
10
|
E10_SESSION_EXPIRED_MESSAGE,
|
|
11
11
|
getActiveProfile
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-4TEDNCON.js";
|
|
13
13
|
import {
|
|
14
14
|
CliError,
|
|
15
15
|
isCliError,
|
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
createE10RequestRuntime,
|
|
6
6
|
isE10SessionExpiredResponse,
|
|
7
7
|
requireE10Session
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-WFFNM65B.js";
|
|
9
9
|
import {
|
|
10
10
|
E10_SESSION_EXPIRED_MESSAGE,
|
|
11
11
|
getActiveProfile
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-4TEDNCON.js";
|
|
13
13
|
import {
|
|
14
14
|
CliError,
|
|
15
15
|
isCliError,
|
|
@@ -3,13 +3,13 @@ const require = __esbuildCreateRequire(import.meta.url);
|
|
|
3
3
|
import {
|
|
4
4
|
readCache,
|
|
5
5
|
writeCache
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-I566ZYNF.js";
|
|
7
7
|
import {
|
|
8
8
|
SCHEMA_DATETIME_MINUTE,
|
|
9
9
|
meetingSuccess,
|
|
10
10
|
meetingValidationError,
|
|
11
11
|
schemaOf
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-7BRU4EFH.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-
|
|
113
|
+
const { createEsbHost } = await import("./host-256GVCAH.js");
|
|
114
114
|
const { createEsbContinuationSigner } = await import("./continuation-NLECEJPX.js");
|
|
115
|
-
const { getEsbOperation } = await import("./registry-
|
|
115
|
+
const { getEsbOperation } = await import("./registry-RXPN6BBT.js");
|
|
116
116
|
const esbEnv = {
|
|
117
117
|
ctx: env.ctx,
|
|
118
118
|
host: createEsbHost(env.ctx),
|
|
@@ -488,6 +488,15 @@ var E10AuthSession = class _E10AuthSession {
|
|
|
488
488
|
get credentialSourceLabel() {
|
|
489
489
|
return this.data.credentialSourceLabel || "";
|
|
490
490
|
}
|
|
491
|
+
get expiryTimes() {
|
|
492
|
+
const value = Number(this.data.expiryTimes);
|
|
493
|
+
return Number.isFinite(value) && value > 0 ? value : void 0;
|
|
494
|
+
}
|
|
495
|
+
/** XiaoE 换取的 ETEAMSID 是否已经超过其明确的失效时间。 */
|
|
496
|
+
isExpired(now = Date.now()) {
|
|
497
|
+
const expiryTimes = this.expiryTimes;
|
|
498
|
+
return expiryTimes !== void 0 && now >= expiryTimes;
|
|
499
|
+
}
|
|
491
500
|
getBaseUrl() {
|
|
492
501
|
return (this.data.baseUrl || "").replace(/\/$/, "");
|
|
493
502
|
}
|
|
@@ -540,6 +549,7 @@ var E10AuthSession = class _E10AuthSession {
|
|
|
540
549
|
stTicket: this.data.stTicket,
|
|
541
550
|
redirectUrl: this.data.redirectUrl,
|
|
542
551
|
cookieSavedAt: this.data.cookieSavedAt,
|
|
552
|
+
expiryTimes: this.expiryTimes,
|
|
543
553
|
mainUrl: this.data.mainUrl,
|
|
544
554
|
...sourceInfo,
|
|
545
555
|
hasEteamsId: Boolean(this.eteamsId)
|
|
@@ -566,7 +576,7 @@ var E10AuthSession = class _E10AuthSession {
|
|
|
566
576
|
const authPath = findAuthFile(startDir, options);
|
|
567
577
|
if (!authPath) return null;
|
|
568
578
|
const session = _E10AuthSession.fromFile(authPath, baseUrl, passportUrl);
|
|
569
|
-
if (session && !(load.skipProfileEnrichment && hasUsableUserId(session))) {
|
|
579
|
+
if (session && !session.isExpired() && !(load.skipProfileEnrichment && hasUsableUserId(session))) {
|
|
570
580
|
await session.fetchEmployeeId();
|
|
571
581
|
}
|
|
572
582
|
return session;
|
|
@@ -825,6 +835,7 @@ var XIAOE_SKILL_ETEAMID_API_PATH = "/spec-apps/api/app/rpachat/skill/extend/etea
|
|
|
825
835
|
var XIAOE_CLIENT_SETTINGS_SOURCE = "XiaoE/Robots/user_settings.json";
|
|
826
836
|
var XIAOE_USER_TOKEN_SOURCE = "XIAOE_USER_TOKEN";
|
|
827
837
|
var XIAOE_BUNDLED_ENV_SCRIPT_SOURCE = "bundled scripts/xiaoe_env.py";
|
|
838
|
+
var XIAOE_ETEAMID_TTL_MS = 72e5;
|
|
828
839
|
function envString(env, ...keys) {
|
|
829
840
|
for (const key of keys) {
|
|
830
841
|
const value = env[key];
|
|
@@ -882,6 +893,13 @@ function readString(data, ...keys) {
|
|
|
882
893
|
}
|
|
883
894
|
return "";
|
|
884
895
|
}
|
|
896
|
+
function readExpiryTimes(data) {
|
|
897
|
+
for (const key of ["expiryTimes", "expiryTime", "expiresAt", "expires_at"]) {
|
|
898
|
+
const value = Number(data[key]);
|
|
899
|
+
if (Number.isFinite(value) && value > 0) return Math.trunc(value);
|
|
900
|
+
}
|
|
901
|
+
return void 0;
|
|
902
|
+
}
|
|
885
903
|
function cookieString(value) {
|
|
886
904
|
if (!value) return "";
|
|
887
905
|
if (typeof value === "string") return value;
|
|
@@ -937,7 +955,18 @@ function readXiaoECredentialRecord(value, source, fallbackBaseUrl = "") {
|
|
|
937
955
|
const rawCookie = candidates.map((entry) => cookieString(entry.cookies || entry.cookie || entry.rawCookie || entry.raw_cookie)).find(Boolean) || "";
|
|
938
956
|
const eteamsId = candidates.map((entry) => readString(entry, "eteamsId", "eteamsid", "ETEAMSID", "eteamId", "eteam_id", "eTeamId", "eteamID", "eteam_id")).find(Boolean) || cookieValue(rawCookie, "ETEAMSID");
|
|
939
957
|
if (!baseUrl || !eteamsId) return null;
|
|
940
|
-
|
|
958
|
+
const expiryTimes = candidates.map(readExpiryTimes).find((value2) => value2 !== void 0);
|
|
959
|
+
return {
|
|
960
|
+
baseUrl: normalizeUrl(baseUrl),
|
|
961
|
+
eteamsId,
|
|
962
|
+
source,
|
|
963
|
+
rawCookie,
|
|
964
|
+
...expiryTimes !== void 0 ? { expiryTimes } : {}
|
|
965
|
+
};
|
|
966
|
+
}
|
|
967
|
+
function withDefaultXiaoEExpiry(credential) {
|
|
968
|
+
if (!credential || credential.expiryTimes !== void 0) return credential;
|
|
969
|
+
return { ...credential, expiryTimes: Date.now() + XIAOE_ETEAMID_TTL_MS };
|
|
941
970
|
}
|
|
942
971
|
function parseXiaoEUnifiedLoginMap(raw, source) {
|
|
943
972
|
const value = raw.trim();
|
|
@@ -1201,14 +1230,18 @@ async function runXiaoETokenScript(baseUrl, env = process.env) {
|
|
|
1201
1230
|
async function resolveXiaoETokenScriptCredential(baseUrl, env = process.env) {
|
|
1202
1231
|
const tokenData = await runXiaoETokenScript(baseUrl, env);
|
|
1203
1232
|
if (!tokenData) return null;
|
|
1204
|
-
return
|
|
1233
|
+
return withDefaultXiaoEExpiry(
|
|
1234
|
+
readXiaoECredentialRecord(tokenData, "xiaoeUserData/tokens.py", baseUrl)
|
|
1235
|
+
);
|
|
1205
1236
|
}
|
|
1206
1237
|
async function resolveXiaoEBundledEnvScriptCredential(baseUrl, env = process.env) {
|
|
1207
1238
|
const scriptPath = xiaoEBundledEnvScriptPath();
|
|
1208
1239
|
if (!scriptPath) return null;
|
|
1209
1240
|
const tokenData = await runXiaoEPythonCredentialScript(scriptPath, baseUrl, env);
|
|
1210
1241
|
if (!tokenData) return null;
|
|
1211
|
-
return
|
|
1242
|
+
return withDefaultXiaoEExpiry(
|
|
1243
|
+
readXiaoECredentialRecord(tokenData, XIAOE_BUNDLED_ENV_SCRIPT_SOURCE, baseUrl)
|
|
1244
|
+
);
|
|
1212
1245
|
}
|
|
1213
1246
|
function xiaoEClientRobotsRoot(env = process.env) {
|
|
1214
1247
|
if (process.platform === "win32") {
|
|
@@ -1388,7 +1421,9 @@ async function resolveXiaoETokenCredential(credential, baseUrl) {
|
|
|
1388
1421
|
const targetBaseUrl = baseUrl || DEFAULT_E10_BASE_URL;
|
|
1389
1422
|
const payload = await fetchXiaoEClientEteamId(credential, targetBaseUrl);
|
|
1390
1423
|
const resolvedBaseUrl = payload.code === 0 ? credential.erpaUrl : targetBaseUrl;
|
|
1391
|
-
return
|
|
1424
|
+
return withDefaultXiaoEExpiry(
|
|
1425
|
+
readXiaoECredentialRecord(payload, credential.source, resolvedBaseUrl)
|
|
1426
|
+
);
|
|
1392
1427
|
}
|
|
1393
1428
|
async function resolveXiaoEPlatformCredential(baseUrl, env = process.env) {
|
|
1394
1429
|
const credential = readXiaoEPlatformCredential(env);
|
|
@@ -1466,6 +1501,7 @@ async function saveXiaoEUnifiedLogin(input) {
|
|
|
1466
1501
|
baseUrl,
|
|
1467
1502
|
passportUrl: baseUrl,
|
|
1468
1503
|
cookieSavedAt: Date.now(),
|
|
1504
|
+
...input.expiryTimes !== void 0 ? { expiryTimes: input.expiryTimes } : {},
|
|
1469
1505
|
loginSource: "xiaoe-unified",
|
|
1470
1506
|
credentialSourceStep: input.credentialSource.credentialSourceStep,
|
|
1471
1507
|
credentialSourceType: input.credentialSource.credentialSourceType,
|
|
@@ -1488,6 +1524,7 @@ async function saveXiaoEUnifiedLogin(input) {
|
|
|
1488
1524
|
agentType: XIAOE_AGENT_TYPE,
|
|
1489
1525
|
version: "",
|
|
1490
1526
|
loginSource: "xiaoe-unified",
|
|
1527
|
+
...input.expiryTimes !== void 0 ? { expiryTimes: input.expiryTimes } : {},
|
|
1491
1528
|
...input.credentialSource
|
|
1492
1529
|
}
|
|
1493
1530
|
};
|
|
@@ -1569,6 +1606,7 @@ async function tryXiaoEUnifiedLogin(options = {}) {
|
|
|
1569
1606
|
baseUrl: credential.baseUrl || baseUrl || DEFAULT_E10_BASE_URL,
|
|
1570
1607
|
eteamsId: credential.eteamsId,
|
|
1571
1608
|
rawCookie: credential.rawCookie,
|
|
1609
|
+
expiryTimes: credential.expiryTimes,
|
|
1572
1610
|
tenantKeyFallback: options.tenantKeyFallback,
|
|
1573
1611
|
profileHint: options.profileHint,
|
|
1574
1612
|
credentialSource: describeXiaoECredentialSource(credential.source)
|