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
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
getWorkflowOperation,
|
|
5
5
|
hasWorkflowOperation,
|
|
6
6
|
workflowOperationDefinitions
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-LFMSDBZN.js";
|
|
8
8
|
import "./chunk-EZALDOQH.js";
|
|
9
9
|
import "./chunk-FMPJJYYI.js";
|
|
10
10
|
import "./chunk-ZUX3P6BQ.js";
|
|
11
11
|
import "./chunk-AJ62BGAW.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-4TEDNCON.js";
|
|
13
13
|
import "./chunk-LUSPKZKY.js";
|
|
14
14
|
import "./chunk-BUSC6UAE.js";
|
|
15
15
|
export {
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
loadRooms,
|
|
7
7
|
recommendRooms,
|
|
8
8
|
rememberFrequentRoom
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-FLS4DPGP.js";
|
|
10
|
+
import "./chunk-I566ZYNF.js";
|
|
11
|
+
import "./chunk-NJKREDA3.js";
|
|
12
|
+
import "./chunk-7BRU4EFH.js";
|
|
13
13
|
import "./chunk-LUSPKZKY.js";
|
|
14
14
|
import "./chunk-BUSC6UAE.js";
|
|
15
15
|
export {
|
|
@@ -8,10 +8,10 @@ import {
|
|
|
8
8
|
resolveMeetingScheduleTypeIds,
|
|
9
9
|
resolveMemberIdsByName,
|
|
10
10
|
runScheduleConflictFlow
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-4CTESSKI.js";
|
|
12
|
+
import "./chunk-I566ZYNF.js";
|
|
13
|
+
import "./chunk-NJKREDA3.js";
|
|
14
|
+
import "./chunk-7BRU4EFH.js";
|
|
15
15
|
import "./chunk-LUSPKZKY.js";
|
|
16
16
|
import "./chunk-BUSC6UAE.js";
|
|
17
17
|
export {
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { createRequire as __esbuildCreateRequire } from 'node:module';
|
|
2
2
|
const require = __esbuildCreateRequire(import.meta.url);
|
|
3
|
-
import {
|
|
4
|
-
createWorkflowHost
|
|
5
|
-
} from "./chunk-K3RUEEOL.js";
|
|
6
3
|
import {
|
|
7
4
|
USER_INTENT_RULE_FILE,
|
|
8
5
|
aigroupUserDir,
|
|
@@ -17,10 +14,13 @@ import {
|
|
|
17
14
|
validateRuleFile,
|
|
18
15
|
workflowOperationDefinitions,
|
|
19
16
|
workflowSuccess
|
|
20
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-LFMSDBZN.js";
|
|
21
18
|
import {
|
|
22
19
|
createWorkflowContinuationSigner
|
|
23
20
|
} from "./chunk-EZALDOQH.js";
|
|
21
|
+
import {
|
|
22
|
+
createWorkflowHost
|
|
23
|
+
} from "./chunk-NETCCARD.js";
|
|
24
24
|
import {
|
|
25
25
|
CLARIFICATION_SUBTYPE,
|
|
26
26
|
WorkflowCliError,
|
|
@@ -28,8 +28,8 @@ import {
|
|
|
28
28
|
} from "./chunk-FMPJJYYI.js";
|
|
29
29
|
import "./chunk-ZUX3P6BQ.js";
|
|
30
30
|
import "./chunk-AJ62BGAW.js";
|
|
31
|
-
import "./chunk-
|
|
32
|
-
import "./chunk-
|
|
31
|
+
import "./chunk-WFFNM65B.js";
|
|
32
|
+
import "./chunk-4TEDNCON.js";
|
|
33
33
|
import {
|
|
34
34
|
isCliError,
|
|
35
35
|
toErrorEnvelope
|
package/dist/index.js
CHANGED
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
firstPositionalToken,
|
|
8
8
|
registerCommands,
|
|
9
9
|
toCommandMetadata
|
|
10
|
-
} from "./chunks/chunk-
|
|
10
|
+
} from "./chunks/chunk-LN447PY2.js";
|
|
11
11
|
import "./chunks/chunk-ZUX3P6BQ.js";
|
|
12
12
|
import "./chunks/chunk-AJ62BGAW.js";
|
|
13
|
-
import "./chunks/chunk-
|
|
14
|
-
import "./chunks/chunk-
|
|
15
|
-
import "./chunks/chunk-
|
|
13
|
+
import "./chunks/chunk-SPRHHSVC.js";
|
|
14
|
+
import "./chunks/chunk-WFFNM65B.js";
|
|
15
|
+
import "./chunks/chunk-4TEDNCON.js";
|
|
16
16
|
import "./chunks/chunk-LUSPKZKY.js";
|
|
17
17
|
import "./chunks/chunk-BUSC6UAE.js";
|
|
18
18
|
|
|
@@ -29,7 +29,7 @@ function lazyShortcut(definition) {
|
|
|
29
29
|
placeholder.allowExcessArguments(true);
|
|
30
30
|
placeholder.helpOption(false);
|
|
31
31
|
placeholder.action(async () => {
|
|
32
|
-
const { dispatchLazyShortcut } = await import("./chunks/lazy-dispatch-
|
|
32
|
+
const { dispatchLazyShortcut } = await import("./chunks/lazy-dispatch-XRRI46M6.js");
|
|
33
33
|
await dispatchLazyShortcut(definition, shortcutMetadata());
|
|
34
34
|
});
|
|
35
35
|
}
|
|
@@ -39,117 +39,117 @@ var builtinShortcuts = [
|
|
|
39
39
|
lazyShortcut({
|
|
40
40
|
name: "invoice",
|
|
41
41
|
description: "E10 \u4E1A\u7968\u901A\u53D1\u7968\u7BA1\u7406 CLI",
|
|
42
|
-
load: async () => (await import("./chunks/invoice-
|
|
42
|
+
load: async () => (await import("./chunks/invoice-T5JTA32H.js")).invoiceShortcut
|
|
43
43
|
}),
|
|
44
44
|
lazyShortcut({
|
|
45
45
|
name: "ehr",
|
|
46
46
|
description: "\u6CDB\u5FAEE10\u805A\u624D\u6797\uFF08\u4EBA\u4E8B/\u51FA\u52E4/\u85AA\u916C\uFF09CLI",
|
|
47
|
-
load: async () => (await import("./chunks/ehr-
|
|
47
|
+
load: async () => (await import("./chunks/ehr-GYXIYH3A.js")).ehrShortcut
|
|
48
48
|
}),
|
|
49
49
|
lazyShortcut({
|
|
50
50
|
name: "cowork",
|
|
51
51
|
description: "\u6CDB\u5FAEE10\u534F\u4F5C\u533A\uFF08\u534F\u4F5C\u4E8B\u9879/\u8BA8\u8BBA/\u5BA1\u6279/\u5171\u4EAB\u6743\u9650\uFF09CLI",
|
|
52
|
-
load: async () => (await import("./chunks/cowork-
|
|
52
|
+
load: async () => (await import("./chunks/cowork-HJLI353D.js")).coworkShortcut
|
|
53
53
|
}),
|
|
54
54
|
lazyShortcut({
|
|
55
55
|
name: "archive",
|
|
56
56
|
description: "E10 \u6587\u4E66\u5B9A\u6863\u6848\u7BA1\u7406 CLI",
|
|
57
|
-
load: async () => (await import("./chunks/archive-
|
|
57
|
+
load: async () => (await import("./chunks/archive-JHTONRST.js")).archiveShortcut
|
|
58
58
|
}),
|
|
59
59
|
lazyShortcut({
|
|
60
60
|
name: "archive-oa",
|
|
61
61
|
description: "E10 \u6863\u6848\u5B9A\u4F4D\u4E0E OA \u5546\u52A1\u5408\u540C\u501F\u9605 CLI",
|
|
62
|
-
load: async () => (await import("./chunks/archive-oa-
|
|
62
|
+
load: async () => (await import("./chunks/archive-oa-FCHLCPHC.js")).archiveOaShortcut
|
|
63
63
|
}),
|
|
64
64
|
lazyShortcut({
|
|
65
65
|
name: "calendar",
|
|
66
66
|
description: "\u6CDB\u5FAEE10\u65E5\u7A0B\u7BA1\u7406 CLI\uFF08\u521B\u5EFA/\u67E5\u8BE2/\u66F4\u65B0/\u5220\u9664/\u5B57\u5178\uFF09",
|
|
67
|
-
load: async () => (await import("./chunks/calendar-
|
|
67
|
+
load: async () => (await import("./chunks/calendar-RTWAMKHD.js")).calendarShortcut
|
|
68
68
|
}),
|
|
69
69
|
lazyShortcut({
|
|
70
70
|
name: "fna",
|
|
71
71
|
description: "\u6CDB\u5FAEE10\u9F50\u4E1A\u6210\u8D39\u63A7\u4E2D\u5FC3\uFF08\u9884\u7B97/\u8D39\u7528\u4E2D\u5FC3/\u501F\u6B3E\u7BA1\u7406/\u53D1\u7968\u6838\u9500\uFF09CLI",
|
|
72
|
-
load: async () => (await import("./chunks/fna-
|
|
72
|
+
load: async () => (await import("./chunks/fna-K2MHTQ24.js")).fnaShortcut
|
|
73
73
|
}),
|
|
74
74
|
lazyShortcut({
|
|
75
75
|
name: "hrm",
|
|
76
76
|
description: "\u6CDB\u5FAEE10\u7EC4\u7EC7\u7BA1\u7406\uFF08\u5458\u5DE5/\u7EC4\u7EC7/\u5C97\u4F4D\u67E5\u8BE2\uFF09CLI",
|
|
77
|
-
load: async () => (await import("./chunks/hrm-
|
|
77
|
+
load: async () => (await import("./chunks/hrm-VLRBKTZB.js")).hrmShortcut
|
|
78
78
|
}),
|
|
79
79
|
lazyShortcut({
|
|
80
80
|
name: "mail",
|
|
81
81
|
description: "\u6CDB\u5FAEE10\u90AE\u4EF6\u7BA1\u7406 CLI",
|
|
82
|
-
load: async () => (await import("./chunks/mail-
|
|
82
|
+
load: async () => (await import("./chunks/mail-3Y7MJ6PS.js")).mailShortcut
|
|
83
83
|
}),
|
|
84
84
|
lazyShortcut({
|
|
85
85
|
name: "meeting",
|
|
86
86
|
description: "\u6CDB\u5FAEE10\u4F1A\u8BAE\u7BA1\u7406 CLI\uFF08\u6807\u51C6\u7248\uFF1A\u67E5\u8BE2/\u51B2\u7A81/\u9884\u7EA6/\u56DE\u6267/\u7B7E\u5230\uFF09",
|
|
87
|
-
load: async () => (await import("./chunks/meeting-
|
|
87
|
+
load: async () => (await import("./chunks/meeting-M7LTXGJE.js")).meetingShortcut
|
|
88
88
|
}),
|
|
89
89
|
lazyShortcut({
|
|
90
90
|
name: "okr",
|
|
91
91
|
description: "\u6CDB\u5FAEE10 OKR \u76EE\u6807\u7BA1\u7406 CLI\uFF08\u76EE\u6807\u67E5\u8BE2/\u65B0\u5EFA/\u7F16\u8F91\u3001\u5173\u952E\u6210\u679C\u3001\u76EE\u6807\u5BF9\u9F50\u3001\u8BC4\u8BBA\uFF09",
|
|
92
|
-
load: async () => (await import("./chunks/okr-
|
|
92
|
+
load: async () => (await import("./chunks/okr-OBC6S67L.js")).okrShortcut
|
|
93
93
|
}),
|
|
94
94
|
lazyShortcut({
|
|
95
95
|
name: "plan",
|
|
96
96
|
description: "\u6CDB\u5FAEE10\u8BA1\u5212\u62A5\u544A CLI\uFF08\u67E5\u8BE2/\u65B0\u5EFA/\u4FEE\u6539/\u53D1\u5E03/\u64A4\u56DE/\u63D0\u4EA4\u63D0\u9192/\u8BC4\u8BBA\uFF09",
|
|
97
|
-
load: async () => (await import("./chunks/plan-
|
|
97
|
+
load: async () => (await import("./chunks/plan-5H6I53SK.js")).planShortcut
|
|
98
98
|
}),
|
|
99
99
|
lazyShortcut({
|
|
100
100
|
name: "esb",
|
|
101
101
|
description: "\u6CDB\u5FAEE10 ESB \u4E2D\u5FC3\u81EA\u5B9A\u4E49\u89E6\u53D1\u52A8\u4F5C\u6D41 CLI",
|
|
102
|
-
load: async () => (await import("./chunks/esb-
|
|
102
|
+
load: async () => (await import("./chunks/esb-I5INCEFE.js")).esbShortcut
|
|
103
103
|
}),
|
|
104
104
|
lazyShortcut({
|
|
105
105
|
name: "ebuilder-form",
|
|
106
106
|
description: "\u6CDB\u5FAEE10 eBuilder \u8868\u5355\u83DC\u5355\u3001\u5217\u8868\u548C\u8868\u5355\u6570\u636E CLI",
|
|
107
|
-
load: async () => (await import("./chunks/ebuilder-form-
|
|
107
|
+
load: async () => (await import("./chunks/ebuilder-form-HTGI63UU.js")).ebuilderFormShortcut
|
|
108
108
|
}),
|
|
109
109
|
lazyShortcut({
|
|
110
110
|
name: "jiuchuanhui",
|
|
111
111
|
description: "\u6CDB\u5FAEE10\u4E5D\u6C1A\u6C47\u8425\u9500\u7BA1\u7406 CLI\uFF08\u5BA2\u6237/\u8054\u7CFB\u4EBA/\u5546\u673A/\u7EBF\u7D22/\u8054\u7CFB\u8BA1\u5212/\u516C\u6D77\uFF09",
|
|
112
|
-
load: async () => (await import("./chunks/jiuchuanhui-
|
|
112
|
+
load: async () => (await import("./chunks/jiuchuanhui-P2FNEQVZ.js")).jiuchuanhuiShortcut
|
|
113
113
|
}),
|
|
114
114
|
lazyShortcut({
|
|
115
115
|
name: "asset",
|
|
116
116
|
description: "E10 \u8D44\u4EA7\u7BA1\u7406\uFF08\u8D44\u7BA1\u5BB6\uFF09CLI",
|
|
117
|
-
load: async () => (await import("./chunks/asset-
|
|
117
|
+
load: async () => (await import("./chunks/asset-RLIHC7DB.js")).assetShortcut
|
|
118
118
|
}),
|
|
119
119
|
lazyShortcut({
|
|
120
120
|
name: "asset-idle",
|
|
121
121
|
description: "E10 \u95F2\u7F6E\u8D44\u4EA7\u5224\u5B9A\u7ED3\u679C\u67E5\u8BE2 CLI\uFF08\u5206\u9875\u83B7\u53D6/\u805A\u5408\u7EDF\u8BA1\uFF09",
|
|
122
|
-
load: async () => (await import("./chunks/asset-idle-
|
|
122
|
+
load: async () => (await import("./chunks/asset-idle-KVOFTLCP.js")).assetIdleShortcut
|
|
123
123
|
}),
|
|
124
124
|
lazyShortcut({
|
|
125
125
|
name: "im",
|
|
126
126
|
description: "\u6CDB\u5FAEE10\u6613\u79D2\u529E\uFF08\u5373\u65F6\u901A\u8BAF\uFF09CLI",
|
|
127
|
-
load: async () => (await import("./chunks/im-
|
|
127
|
+
load: async () => (await import("./chunks/im-QK3VTLXK.js")).imShortcut
|
|
128
128
|
}),
|
|
129
129
|
lazyShortcut({
|
|
130
130
|
name: "project",
|
|
131
131
|
description: "\u6CDB\u5FAEE10\u4E8B\u4E95\u7136\u9879\u76EE\u7BA1\u7406 CLI\uFF08\u9879\u76EE/\u4EFB\u52A1\u67E5\u8BE2\u4E0E\u786E\u8BA4\u5199\u5165\uFF09",
|
|
132
|
-
load: async () => (await import("./chunks/project-
|
|
132
|
+
load: async () => (await import("./chunks/project-L75QZV4S.js")).projectShortcut
|
|
133
133
|
}),
|
|
134
134
|
lazyShortcut({
|
|
135
135
|
name: "workflow",
|
|
136
136
|
description: "\u6CDB\u5FAEE10\u6D41\u7A0B\u667A\u80FD\u52A9\u624B CLI\uFF08\u67E5\u8BE2/\u67E5\u770B/\u64CD\u4F5C/\u6279\u91CF/\u53D1\u8D77/\u4FEE\u6539\uFF09",
|
|
137
|
-
load: async () => (await import("./chunks/workflow-
|
|
137
|
+
load: async () => (await import("./chunks/workflow-M5ZJ7DWF.js")).workflowShortcut
|
|
138
138
|
}),
|
|
139
139
|
lazyShortcut({
|
|
140
140
|
name: "blog",
|
|
141
141
|
description: "\u6CDB\u5FAEE10\u5DE5\u4F5C\u65E5\u62A5 CLI\uFF08\u67E5\u8BE2/\u53D1\u5E03/\u7F16\u8F91/\u8BC4\u8BBA/\u70B9\u8D5E/\u63D0\u9192/\u5BFC\u51FA\uFF09",
|
|
142
|
-
load: async () => (await import("./chunks/blog-
|
|
142
|
+
load: async () => (await import("./chunks/blog-42OZTJNP.js")).blogShortcut
|
|
143
143
|
}),
|
|
144
144
|
lazyShortcut({
|
|
145
145
|
name: "caizhilian",
|
|
146
146
|
description: "\u6CDB\u5FAEE10\u91C7\u77E5\u8FDE\uFF08\u6587\u6863\u4E2D\u5FC3\uFF09CLI",
|
|
147
|
-
load: async () => (await import("./chunks/caizhilian-
|
|
147
|
+
load: async () => (await import("./chunks/caizhilian-KRK547K5.js")).caizhilianShortcut
|
|
148
148
|
}),
|
|
149
149
|
lazyShortcut({
|
|
150
150
|
name: "contract",
|
|
151
151
|
description: "\u6CDB\u5FAEE10\u4ECA\u627F\u8FBE\u5408\u540C\u7BA1\u7406 CLI",
|
|
152
|
-
load: async () => (await import("./chunks/contract-
|
|
152
|
+
load: async () => (await import("./chunks/contract-HI4FNPYE.js")).contractShortcut
|
|
153
153
|
})
|
|
154
154
|
];
|
|
155
155
|
function shortcutMetadata() {
|
|
@@ -17,6 +17,7 @@ const AGENT_RETURN_URL_ENV_KEY = 'WEAVER_AGENT_RETURN_URL';
|
|
|
17
17
|
const AGENT_RETURN_PATH = '/agent-return';
|
|
18
18
|
const AGENT_RETURN_TOKEN_HEADER = 'x-weaver-agent-return-token';
|
|
19
19
|
const AGENT_RETURN_TIMEOUT_MS = 900_000;
|
|
20
|
+
const OAUTH_CALLBACK_PROTOCOL_MISMATCH_GRACE_MS = 30_000;
|
|
20
21
|
const UNSAFE_AGENT_RETURN_PROTOCOLS = new Set([
|
|
21
22
|
'about:',
|
|
22
23
|
'blob:',
|
|
@@ -191,6 +192,7 @@ function formatAuthStatus(status) {
|
|
|
191
192
|
...('credentialSourceStep' in status && status.credentialSourceStep ? ['credentialSourceStep: ' + status.credentialSourceStep] : []),
|
|
192
193
|
...('credentialSourceType' in status && status.credentialSourceType ? ['credentialSourceType: ' + status.credentialSourceType] : []),
|
|
193
194
|
...('credentialSourceLabel' in status && status.credentialSourceLabel ? ['credentialSourceLabel: ' + status.credentialSourceLabel] : []),
|
|
195
|
+
...('expiryTimes' in status && status.expiryTimes ? ['expiryTimes: ' + status.expiryTimes] : []),
|
|
194
196
|
];
|
|
195
197
|
if ('valid' in status) {
|
|
196
198
|
lines.push('valid: ' + String(status.valid));
|
|
@@ -210,6 +212,7 @@ function formatLoginResult(result) {
|
|
|
210
212
|
...(result.credentialSourceStep ? ['credentialSourceStep: ' + result.credentialSourceStep] : []),
|
|
211
213
|
...(result.credentialSourceType ? ['credentialSourceType: ' + result.credentialSourceType] : []),
|
|
212
214
|
...(result.credentialSourceLabel ? ['credentialSourceLabel: ' + result.credentialSourceLabel] : []),
|
|
215
|
+
...(result.expiryTimes ? ['expiryTimes: ' + result.expiryTimes] : []),
|
|
213
216
|
].join('\n');
|
|
214
217
|
}
|
|
215
218
|
async function clearInvoiceTokenCache(profile, authData) {
|
|
@@ -300,6 +303,24 @@ export function buildE10AuthorizeUrl(baseUrl, redirectUri, agentType) {
|
|
|
300
303
|
});
|
|
301
304
|
return `${baseUrl}/papi/sso/oauth2.0/authorize?${authorizeParams.toString()}`;
|
|
302
305
|
}
|
|
306
|
+
/** Node's HTTP parser exposes the first unread bytes when TLS is sent to an HTTP listener. */
|
|
307
|
+
export function isTlsClientHello(error) {
|
|
308
|
+
if (!error || typeof error !== 'object')
|
|
309
|
+
return false;
|
|
310
|
+
const rawPacket = error.rawPacket;
|
|
311
|
+
return Buffer.isBuffer(rawPacket)
|
|
312
|
+
&& rawPacket.length >= 3
|
|
313
|
+
&& rawPacket[0] === 0x16
|
|
314
|
+
&& rawPacket[1] === 0x03;
|
|
315
|
+
}
|
|
316
|
+
export function createOAuthCallbackProtocolMismatchError(port) {
|
|
317
|
+
return Object.assign(new CliError(`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.`, ExitCode.AuthError), {
|
|
318
|
+
type: 'authentication',
|
|
319
|
+
subtype: 'oauth_callback_protocol_mismatch',
|
|
320
|
+
retryable: false,
|
|
321
|
+
stage: 'oauth_callback',
|
|
322
|
+
});
|
|
323
|
+
}
|
|
303
324
|
async function readJsonObject(resp) {
|
|
304
325
|
const data = await resp.json().catch(() => ({}));
|
|
305
326
|
return data && typeof data === 'object' && !Array.isArray(data) ? data : {};
|
|
@@ -488,7 +509,7 @@ function xiaoEUnifiedLoginUnavailableMessage(baseUrl, attempted) {
|
|
|
488
509
|
'CLI 会优先使用 XiaoE 客户端内置 Python 执行 tokens.py;自动发现不可用时,可用 WEAVER_XIAOE_TOKEN_SCRIPT_PYTHON 指定兼容解释器。',
|
|
489
510
|
].join(' ');
|
|
490
511
|
}
|
|
491
|
-
async function
|
|
512
|
+
async function runXiaoELogin(ctx, options) {
|
|
492
513
|
const commandOpts = asOptions(options);
|
|
493
514
|
const globalOptions = ctx.getGlobalOptions();
|
|
494
515
|
const profileFromGlobal = globalOptions.profile;
|
|
@@ -499,59 +520,49 @@ async function runBrowserLogin(ctx, options, behavior = {}) {
|
|
|
499
520
|
profileBaseUrl: cfg.baseUrl,
|
|
500
521
|
env: ctx.env,
|
|
501
522
|
});
|
|
502
|
-
const xiaoESources =
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
523
|
+
const xiaoESources = inspectXiaoEUnifiedLoginSources({
|
|
524
|
+
env: ctx.env,
|
|
525
|
+
baseUrl: preferredXiaoEBaseUrl,
|
|
526
|
+
profileBaseUrl: cfg.baseUrl,
|
|
527
|
+
allowTokenScript: true,
|
|
528
|
+
});
|
|
529
|
+
const useXiaoELogin = xiaoESources.any;
|
|
530
|
+
const baseUrl = preferredXiaoEBaseUrl;
|
|
531
|
+
const tenantKey = optionString(commandOpts, 'tenantKey');
|
|
532
|
+
ctx.logger.info([
|
|
533
|
+
'XiaoE unified login preflight:',
|
|
534
|
+
'authMode=xiaoe',
|
|
535
|
+
`credentialSourceDetected=${String(xiaoESources.any)}`,
|
|
536
|
+
`attempted=${String(useXiaoELogin)}`,
|
|
537
|
+
`platformCredentialDetected=${String(xiaoESources.platformCredential)}`,
|
|
538
|
+
`tokenScriptDetected=${String(xiaoESources.tokenScript)}`,
|
|
539
|
+
`clientSettingsDetected=${String(xiaoESources.clientCredential)}`,
|
|
540
|
+
`environmentCredentialDetected=${String(xiaoESources.environmentCredential)}`,
|
|
541
|
+
`baseUrl=${baseUrl || '(unresolved)'}`,
|
|
542
|
+
].join(' '));
|
|
543
|
+
if (useXiaoELogin) {
|
|
544
|
+
const xiaoEResult = await tryXiaoEUnifiedLogin(ctx, baseUrl, tenantKey, profileFromGlobal, true);
|
|
545
|
+
if (xiaoEResult)
|
|
546
|
+
return xiaoEResult;
|
|
547
|
+
}
|
|
548
|
+
ctx.logger.warn(xiaoEUnifiedLoginUnavailableMessage(baseUrl, useXiaoELogin));
|
|
549
|
+
throw createXiaoEUnifiedLoginUnavailableError(baseUrl);
|
|
550
|
+
}
|
|
551
|
+
async function runBrowserLogin(ctx, options) {
|
|
552
|
+
const commandOpts = asOptions(options);
|
|
553
|
+
const globalOptions = ctx.getGlobalOptions();
|
|
554
|
+
const profileFromGlobal = globalOptions.profile;
|
|
555
|
+
const cfg = readProfileConfig(profileFromGlobal || getActiveProfile());
|
|
556
|
+
const explicitBaseUrl = optionString(commandOpts, 'baseUrl') || globalOptions.baseUrl || '';
|
|
557
|
+
const baseUrl = normalizeUrl(explicitBaseUrl || cfg.baseUrl || '');
|
|
520
558
|
const tenantKey = optionString(commandOpts, 'tenantKey');
|
|
521
559
|
const portText = optionString(commandOpts, 'port') || '19800';
|
|
522
560
|
const port = Number.parseInt(portText, 10);
|
|
523
561
|
const explicitAgentType = optionString(commandOpts, 'agentType', 'agent_type');
|
|
524
|
-
const agentType =
|
|
525
|
-
? optionString(commandOpts, 'agentType', 'agent_type') || XIAOE_AGENT_TYPE
|
|
526
|
-
: resolveAgentType(commandOpts, ctx.env);
|
|
562
|
+
const agentType = resolveAgentType(commandOpts, ctx.env);
|
|
527
563
|
if (!Number.isInteger(port) || port <= 0 || port > 65535) {
|
|
528
564
|
throw new CliError('Invalid --port value', ExitCode.UsageError);
|
|
529
565
|
}
|
|
530
|
-
if (behavior.tryXiaoEUnifiedLogin) {
|
|
531
|
-
ctx.logger.info([
|
|
532
|
-
'XiaoE unified login preflight:',
|
|
533
|
-
'authMode=xiaoe',
|
|
534
|
-
`credentialSourceDetected=${String(xiaoESources.any)}`,
|
|
535
|
-
`attempted=${String(useXiaoELogin)}`,
|
|
536
|
-
`platformCredentialDetected=${String(xiaoESources.platformCredential)}`,
|
|
537
|
-
`tokenScriptDetected=${String(xiaoESources.tokenScript)}`,
|
|
538
|
-
`clientSettingsDetected=${String(xiaoESources.clientCredential)}`,
|
|
539
|
-
`environmentCredentialDetected=${String(xiaoESources.environmentCredential)}`,
|
|
540
|
-
`baseUrl=${baseUrl || '(unresolved)'}`,
|
|
541
|
-
].join(' '));
|
|
542
|
-
}
|
|
543
|
-
if (useXiaoELogin) {
|
|
544
|
-
const xiaoEResult = await tryXiaoEUnifiedLogin(ctx, baseUrl, tenantKey, profileFromGlobal, behavior.allowXiaoETokenScript === true);
|
|
545
|
-
if (xiaoEResult)
|
|
546
|
-
return xiaoEResult;
|
|
547
|
-
}
|
|
548
|
-
const willOpenBrowser = behavior.browserFallback !== 'never';
|
|
549
|
-
if (behavior.tryXiaoEUnifiedLogin && behavior.explainXiaoEFallback) {
|
|
550
|
-
ctx.logger.warn(xiaoEUnifiedLoginUnavailableMessage(baseUrl, useXiaoELogin));
|
|
551
|
-
}
|
|
552
|
-
if (!willOpenBrowser) {
|
|
553
|
-
throw createXiaoEUnifiedLoginUnavailableError(baseUrl);
|
|
554
|
-
}
|
|
555
566
|
if (!baseUrl)
|
|
556
567
|
throw new CliError('Missing --base-url', ExitCode.UsageError);
|
|
557
568
|
const agentReturnTarget = resolveAgentReturnTarget(commandOpts, ctx.env, agentType);
|
|
@@ -564,6 +575,7 @@ async function runBrowserLogin(ctx, options, behavior = {}) {
|
|
|
564
575
|
let settled = false;
|
|
565
576
|
let timer = null;
|
|
566
577
|
let pendingLoginResult = null;
|
|
578
|
+
let tlsCallbackDetected = false;
|
|
567
579
|
const finish = (error, result) => {
|
|
568
580
|
if (settled)
|
|
569
581
|
return;
|
|
@@ -647,6 +659,13 @@ async function runBrowserLogin(ctx, options, behavior = {}) {
|
|
|
647
659
|
finish(new CliError('No authorization code received.', ExitCode.AuthError));
|
|
648
660
|
return;
|
|
649
661
|
}
|
|
662
|
+
// The user followed the recovery instruction and reached the HTTP
|
|
663
|
+
// callback. Do not let the protocol-mismatch grace timer race the token
|
|
664
|
+
// exchange that is now legitimately in progress.
|
|
665
|
+
if (tlsCallbackDetected && timer) {
|
|
666
|
+
clearTimeout(timer);
|
|
667
|
+
timer = null;
|
|
668
|
+
}
|
|
650
669
|
try {
|
|
651
670
|
const result = await oidcExchange(code, redirectUri, baseUrl, tenantKey, redirectAgentType, profileFromGlobal);
|
|
652
671
|
const responseHeaders = {
|
|
@@ -685,6 +704,26 @@ async function runBrowserLogin(ctx, options, behavior = {}) {
|
|
|
685
704
|
: error.message;
|
|
686
705
|
finish(new CliError(message, ExitCode.UsageError));
|
|
687
706
|
});
|
|
707
|
+
server.on('clientError', (error, socket) => {
|
|
708
|
+
if (isTlsClientHello(error)) {
|
|
709
|
+
if (!tlsCallbackDetected) {
|
|
710
|
+
tlsCallbackDetected = true;
|
|
711
|
+
ctx.logger.warn([
|
|
712
|
+
`OAuth callback protocol mismatch: the browser used HTTPS for 127.0.0.1:${port}, while the CLI listener is HTTP.`,
|
|
713
|
+
'在 30 秒内把浏览器当前地址开头明确改为 http://,保留后面的完整路径和参数,然后回车重试。',
|
|
714
|
+
'不要把地址中的授权码复制到聊天或日志。',
|
|
715
|
+
].join(' '));
|
|
716
|
+
if (timer)
|
|
717
|
+
clearTimeout(timer);
|
|
718
|
+
timer = setTimeout(() => {
|
|
719
|
+
finish(createOAuthCallbackProtocolMismatchError(port));
|
|
720
|
+
}, OAUTH_CALLBACK_PROTOCOL_MISMATCH_GRACE_MS);
|
|
721
|
+
}
|
|
722
|
+
socket.destroy();
|
|
723
|
+
return;
|
|
724
|
+
}
|
|
725
|
+
socket.destroy();
|
|
726
|
+
});
|
|
688
727
|
server.listen(port, '127.0.0.1', () => {
|
|
689
728
|
ctx.logger.info('Local callback server: ' + redirectUri);
|
|
690
729
|
openUrlInBrowser(loginUrl, ctx);
|
|
@@ -728,7 +767,7 @@ function formatWhoami(title, data) {
|
|
|
728
767
|
'User-Agent: ' + (data.userAgent || ''),
|
|
729
768
|
].join('\n');
|
|
730
769
|
}
|
|
731
|
-
function registerBrowserLoginCommand(auth, action, name, description
|
|
770
|
+
function registerBrowserLoginCommand(auth, action, name, description) {
|
|
732
771
|
const command = auth.command(name)
|
|
733
772
|
.description(description)
|
|
734
773
|
.option('--base-url <url>', 'E10 base URL')
|
|
@@ -738,7 +777,23 @@ function registerBrowserLoginCommand(auth, action, name, description, behavior =
|
|
|
738
777
|
.option('--agent-type <value>', 'Alias of --agent_type')
|
|
739
778
|
.option('--agent-return-url <url>', 'Desktop application URL linked by the login success page');
|
|
740
779
|
command.action(action(async (ctx, options) => {
|
|
741
|
-
const result = await runBrowserLogin(ctx, options
|
|
780
|
+
const result = await runBrowserLogin(ctx, options);
|
|
781
|
+
ctx.output.write(result, { text: formatLoginResult(result) });
|
|
782
|
+
}));
|
|
783
|
+
}
|
|
784
|
+
function registerXiaoELoginCommand(auth, action) {
|
|
785
|
+
auth.command('xiaoe')
|
|
786
|
+
.description('Use XiaoE unified login without browser OAuth fallback')
|
|
787
|
+
.option('--base-url <url>', 'E10 base URL')
|
|
788
|
+
.option('--tenant-key <key>', 'Tenant key fallback after login')
|
|
789
|
+
// Keep previously accepted browser flags as no-ops so existing wrappers do
|
|
790
|
+
// not break. The dedicated handler never parses them or opens a callback.
|
|
791
|
+
.option('--port <n>', 'Deprecated compatibility option; ignored by XiaoE unified login', '19800')
|
|
792
|
+
.option('--agent_type <value>', 'Deprecated compatibility option; ignored by XiaoE unified login')
|
|
793
|
+
.option('--agent-type <value>', 'Alias of --agent_type')
|
|
794
|
+
.option('--agent-return-url <url>', 'Deprecated compatibility option; ignored by XiaoE unified login')
|
|
795
|
+
.action(action(async (ctx, options) => {
|
|
796
|
+
const result = await runXiaoELogin(ctx, options);
|
|
742
797
|
ctx.output.write(result, { text: formatLoginResult(result) });
|
|
743
798
|
}));
|
|
744
799
|
}
|
|
@@ -758,7 +813,9 @@ export function registerE10AuthCommands(parent, action) {
|
|
|
758
813
|
const commandOpts = asOptions(options);
|
|
759
814
|
const authFile = findAuthFile(ctx.cwd, opts);
|
|
760
815
|
const session = authFile ? E10AuthSession.fromFile(authFile, opts.baseUrl, opts.passportUrl) : null;
|
|
761
|
-
const valid = session && commandOpts.check !== false
|
|
816
|
+
const valid = session && commandOpts.check !== false
|
|
817
|
+
? session.isExpired() ? false : await session.checkValid()
|
|
818
|
+
: undefined;
|
|
762
819
|
const status = session
|
|
763
820
|
? {
|
|
764
821
|
loggedIn: true,
|
|
@@ -779,6 +836,7 @@ export function registerE10AuthCommands(parent, action) {
|
|
|
779
836
|
...(session.credentialSourceStep ? { credentialSourceStep: session.credentialSourceStep } : {}),
|
|
780
837
|
...(session.credentialSourceType ? { credentialSourceType: session.credentialSourceType } : {}),
|
|
781
838
|
...(session.credentialSourceLabel ? { credentialSourceLabel: session.credentialSourceLabel } : {}),
|
|
839
|
+
...(session.expiryTimes ? { expiryTimes: session.expiryTimes } : {}),
|
|
782
840
|
valid,
|
|
783
841
|
}
|
|
784
842
|
: {
|
|
@@ -823,12 +881,7 @@ export function registerE10AuthCommands(parent, action) {
|
|
|
823
881
|
}));
|
|
824
882
|
registerBrowserLoginCommand(auth, action, 'login', 'Open browser OAuth2.0 login and save E10 auth');
|
|
825
883
|
registerBrowserLoginCommand(auth, action, 'oidc', 'Alias of auth login for OAuth2.0 browser login');
|
|
826
|
-
|
|
827
|
-
tryXiaoEUnifiedLogin: true,
|
|
828
|
-
allowXiaoETokenScript: true,
|
|
829
|
-
explainXiaoEFallback: true,
|
|
830
|
-
browserFallback: 'never',
|
|
831
|
-
});
|
|
884
|
+
registerXiaoELoginCommand(auth, action);
|
|
832
885
|
auth.command('logout')
|
|
833
886
|
.alias('clear')
|
|
834
887
|
.description('Clear saved E10 auth for the current or selected profile')
|
|
@@ -337,6 +337,15 @@ export class E10AuthSession {
|
|
|
337
337
|
get credentialSourceLabel() {
|
|
338
338
|
return this.data.credentialSourceLabel || '';
|
|
339
339
|
}
|
|
340
|
+
get expiryTimes() {
|
|
341
|
+
const value = Number(this.data.expiryTimes);
|
|
342
|
+
return Number.isFinite(value) && value > 0 ? value : undefined;
|
|
343
|
+
}
|
|
344
|
+
/** XiaoE 换取的 ETEAMSID 是否已经超过其明确的失效时间。 */
|
|
345
|
+
isExpired(now = Date.now()) {
|
|
346
|
+
const expiryTimes = this.expiryTimes;
|
|
347
|
+
return expiryTimes !== undefined && now >= expiryTimes;
|
|
348
|
+
}
|
|
340
349
|
getBaseUrl() {
|
|
341
350
|
return (this.data.baseUrl || '').replace(/\/$/, '');
|
|
342
351
|
}
|
|
@@ -389,6 +398,7 @@ export class E10AuthSession {
|
|
|
389
398
|
stTicket: this.data.stTicket,
|
|
390
399
|
redirectUrl: this.data.redirectUrl,
|
|
391
400
|
cookieSavedAt: this.data.cookieSavedAt,
|
|
401
|
+
expiryTimes: this.expiryTimes,
|
|
392
402
|
mainUrl: this.data.mainUrl,
|
|
393
403
|
...sourceInfo,
|
|
394
404
|
hasEteamsId: Boolean(this.eteamsId),
|
|
@@ -419,7 +429,7 @@ export class E10AuthSession {
|
|
|
419
429
|
return null;
|
|
420
430
|
const session = E10AuthSession.fromFile(authPath, baseUrl, passportUrl);
|
|
421
431
|
// 富化只是"刷新/纠偏":登录时这些字段已落盘。调用方可显式跳过(见 E10SessionLoadOptions)。
|
|
422
|
-
if (session && !(load.skipProfileEnrichment && hasUsableUserId(session))) {
|
|
432
|
+
if (session && !session.isExpired() && !(load.skipProfileEnrichment && hasUsableUserId(session))) {
|
|
423
433
|
await session.fetchEmployeeId();
|
|
424
434
|
}
|
|
425
435
|
return session;
|
|
@@ -57,6 +57,8 @@ export const XIAOE_SKILL_ETEAMID_API_PATH = '/spec-apps/api/app/rpachat/skill/ex
|
|
|
57
57
|
export const XIAOE_CLIENT_SETTINGS_SOURCE = 'XiaoE/Robots/user_settings.json';
|
|
58
58
|
export const XIAOE_USER_TOKEN_SOURCE = 'XIAOE_USER_TOKEN';
|
|
59
59
|
export const XIAOE_BUNDLED_ENV_SCRIPT_SOURCE = 'bundled scripts/xiaoe_env.py';
|
|
60
|
+
/** 与 XiaoE `tokens.py` 保持一致:换票成功后默认有效 2 小时。 */
|
|
61
|
+
export const XIAOE_ETEAMID_TTL_MS = 7_200_000;
|
|
60
62
|
function envString(env, ...keys) {
|
|
61
63
|
for (const key of keys) {
|
|
62
64
|
const value = env[key];
|
|
@@ -134,6 +136,14 @@ function readString(data, ...keys) {
|
|
|
134
136
|
}
|
|
135
137
|
return '';
|
|
136
138
|
}
|
|
139
|
+
function readExpiryTimes(data) {
|
|
140
|
+
for (const key of ['expiryTimes', 'expiryTime', 'expiresAt', 'expires_at']) {
|
|
141
|
+
const value = Number(data[key]);
|
|
142
|
+
if (Number.isFinite(value) && value > 0)
|
|
143
|
+
return Math.trunc(value);
|
|
144
|
+
}
|
|
145
|
+
return undefined;
|
|
146
|
+
}
|
|
137
147
|
function cookieString(value) {
|
|
138
148
|
if (!value)
|
|
139
149
|
return '';
|
|
@@ -209,7 +219,19 @@ function readXiaoECredentialRecord(value, source, fallbackBaseUrl = '') {
|
|
|
209
219
|
|| cookieValue(rawCookie, 'ETEAMSID');
|
|
210
220
|
if (!baseUrl || !eteamsId)
|
|
211
221
|
return null;
|
|
212
|
-
|
|
222
|
+
const expiryTimes = candidates.map(readExpiryTimes).find((value) => value !== undefined);
|
|
223
|
+
return {
|
|
224
|
+
baseUrl: normalizeUrl(baseUrl),
|
|
225
|
+
eteamsId,
|
|
226
|
+
source,
|
|
227
|
+
rawCookie,
|
|
228
|
+
...(expiryTimes !== undefined ? { expiryTimes } : {}),
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
function withDefaultXiaoEExpiry(credential) {
|
|
232
|
+
if (!credential || credential.expiryTimes !== undefined)
|
|
233
|
+
return credential;
|
|
234
|
+
return { ...credential, expiryTimes: Date.now() + XIAOE_ETEAMID_TTL_MS };
|
|
213
235
|
}
|
|
214
236
|
function parseXiaoEUnifiedLoginMap(raw, source) {
|
|
215
237
|
const value = raw.trim();
|
|
@@ -533,7 +555,7 @@ async function resolveXiaoETokenScriptCredential(baseUrl, env = process.env) {
|
|
|
533
555
|
const tokenData = await runXiaoETokenScript(baseUrl, env);
|
|
534
556
|
if (!tokenData)
|
|
535
557
|
return null;
|
|
536
|
-
return readXiaoECredentialRecord(tokenData, 'xiaoeUserData/tokens.py', baseUrl);
|
|
558
|
+
return withDefaultXiaoEExpiry(readXiaoECredentialRecord(tokenData, 'xiaoeUserData/tokens.py', baseUrl));
|
|
537
559
|
}
|
|
538
560
|
async function resolveXiaoEBundledEnvScriptCredential(baseUrl, env = process.env) {
|
|
539
561
|
const scriptPath = xiaoEBundledEnvScriptPath();
|
|
@@ -542,7 +564,7 @@ async function resolveXiaoEBundledEnvScriptCredential(baseUrl, env = process.env
|
|
|
542
564
|
const tokenData = await runXiaoEPythonCredentialScript(scriptPath, baseUrl, env);
|
|
543
565
|
if (!tokenData)
|
|
544
566
|
return null;
|
|
545
|
-
return readXiaoECredentialRecord(tokenData, XIAOE_BUNDLED_ENV_SCRIPT_SOURCE, baseUrl);
|
|
567
|
+
return withDefaultXiaoEExpiry(readXiaoECredentialRecord(tokenData, XIAOE_BUNDLED_ENV_SCRIPT_SOURCE, baseUrl));
|
|
546
568
|
}
|
|
547
569
|
export function xiaoEClientRobotsRoot(env = process.env) {
|
|
548
570
|
if (process.platform === 'win32') {
|
|
@@ -766,7 +788,7 @@ async function resolveXiaoETokenCredential(credential, baseUrl) {
|
|
|
766
788
|
// from the same origin as the token exchange. Newer 0000/200 responses keep
|
|
767
789
|
// the XiaoE service origin separate and use the requested E10 target.
|
|
768
790
|
const resolvedBaseUrl = payload.code === 0 ? credential.erpaUrl : targetBaseUrl;
|
|
769
|
-
return readXiaoECredentialRecord(payload, credential.source, resolvedBaseUrl);
|
|
791
|
+
return withDefaultXiaoEExpiry(readXiaoECredentialRecord(payload, credential.source, resolvedBaseUrl));
|
|
770
792
|
}
|
|
771
793
|
async function resolveXiaoEPlatformCredential(baseUrl, env = process.env) {
|
|
772
794
|
const credential = readXiaoEPlatformCredential(env);
|
|
@@ -850,6 +872,7 @@ async function saveXiaoEUnifiedLogin(input) {
|
|
|
850
872
|
baseUrl,
|
|
851
873
|
passportUrl: baseUrl,
|
|
852
874
|
cookieSavedAt: Date.now(),
|
|
875
|
+
...(input.expiryTimes !== undefined ? { expiryTimes: input.expiryTimes } : {}),
|
|
853
876
|
loginSource: 'xiaoe-unified',
|
|
854
877
|
credentialSourceStep: input.credentialSource.credentialSourceStep,
|
|
855
878
|
credentialSourceType: input.credentialSource.credentialSourceType,
|
|
@@ -872,6 +895,7 @@ async function saveXiaoEUnifiedLogin(input) {
|
|
|
872
895
|
agentType: XIAOE_AGENT_TYPE,
|
|
873
896
|
version: '',
|
|
874
897
|
loginSource: 'xiaoe-unified',
|
|
898
|
+
...(input.expiryTimes !== undefined ? { expiryTimes: input.expiryTimes } : {}),
|
|
875
899
|
...input.credentialSource,
|
|
876
900
|
},
|
|
877
901
|
};
|
|
@@ -973,6 +997,7 @@ export async function tryXiaoEUnifiedLogin(options = {}) {
|
|
|
973
997
|
baseUrl: credential.baseUrl || baseUrl || DEFAULT_E10_BASE_URL,
|
|
974
998
|
eteamsId: credential.eteamsId,
|
|
975
999
|
rawCookie: credential.rawCookie,
|
|
1000
|
+
expiryTimes: credential.expiryTimes,
|
|
976
1001
|
tenantKeyFallback: options.tenantKeyFallback,
|
|
977
1002
|
profileHint: options.profileHint,
|
|
978
1003
|
credentialSource: describeXiaoECredentialSource(credential.source),
|