oasis_test_v2 2.2.114 → 2.2.116
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/dist/feishu/wrapper.sh +6 -4
- package/dist/index.js +169 -33
- package/package.json +2 -2
package/dist/feishu/wrapper.sh
CHANGED
|
@@ -51,15 +51,17 @@ feishu_reply_blocked() {
|
|
|
51
51
|
feishu_blocked() {
|
|
52
52
|
# $1 = 规则要求的模块(逗号分隔,空 = 不属于任何模块);$2 = 给人看的命令写法(已过滤成安全字符)。
|
|
53
53
|
local mods="$1" shown="$2" need="" m entry label
|
|
54
|
-
|
|
54
|
+
# 只勾模块、保存即可让机器人身份可用,不需要用户授权;用户身份才要本人另行授权。
|
|
55
|
+
local pick="请让配置人在 Oasis 里这个 agent 的飞书连接器详情「接入功能」"
|
|
56
|
+
local bot_ok="保存后机器人身份即可调用(不需要用户授权,应用须已开通对应权限);只有需要以用户身份调用时,才需本人在同一处「去授权 / 重新授权」"
|
|
55
57
|
case "${OASIS_FEISHU_POLICY:-}" in
|
|
56
58
|
ok) ;;
|
|
57
59
|
none)
|
|
58
60
|
feishu_reply_blocked "本 agent 的飞书连接器还没有保存过可用模块的选择,Oasis 按「一个模块都没开放」处理,${shown} 已被拦下(机器人与用户身份都不可用)。" \
|
|
59
|
-
"${
|
|
61
|
+
"${pick}勾选需要的模块并保存;${bot_ok}。" ;;
|
|
60
62
|
invalid)
|
|
61
63
|
feishu_reply_blocked "本 agent 的飞书连接器保存的模块选择无法识别,Oasis 按「一个模块都没开放」处理,${shown} 已被拦下(机器人与用户身份都不可用)。" \
|
|
62
|
-
"${
|
|
64
|
+
"${pick}重新勾选模块并保存;${bot_ok}。" ;;
|
|
63
65
|
*)
|
|
64
66
|
feishu_reply_blocked "本次运行没有拿到飞书模块放行表,Oasis 不放行 ${shown}(机器人与用户身份都不可用)。" \
|
|
65
67
|
"请重新发起任务;仍出现请联系 Oasis 管理员检查飞书连接器。" ;;
|
|
@@ -73,7 +75,7 @@ feishu_blocked() {
|
|
|
73
75
|
need="${need:+${need}」或「}${label}"
|
|
74
76
|
done
|
|
75
77
|
feishu_reply_blocked "本 agent 的飞书连接器没有开放「${need}」模块,${shown} 已被 Oasis 拦下(机器人与用户身份都不可用)。当前开放的模块:${OASIS_FEISHU_MODULES:-无}。" \
|
|
76
|
-
"如需使用,${
|
|
78
|
+
"如需使用,${pick}点「调整接入功能」勾选「${need}」并保存;${bot_ok}。"
|
|
77
79
|
fi
|
|
78
80
|
feishu_reply_blocked "${shown} 不属于任何可勾选的飞书功能模块;本 agent 的飞书调用已按模块限制,Oasis 不放行它。当前开放的模块:${OASIS_FEISHU_MODULES:-无}。" \
|
|
79
81
|
"请改用已开放模块对应的 lark-cli 命令;共用的 drive 子命令须紧跟在 drive 之后写。确需此能力请联系 Oasis 管理员。"
|
package/dist/index.js
CHANGED
|
@@ -20789,6 +20789,9 @@ ${input.link}` : `${head}
|
|
|
20789
20789
|
function feishuPendingApprovalNotice(modules) {
|
|
20790
20790
|
return `${moduleNames(modules)}\u542B\u9700\u98DE\u4E66\u7BA1\u7406\u5458\u5BA1\u6279\u7684\u6743\u9650\uFF0C\u5DF2\u63D0\u4EA4\u5BA1\u6279\u3002\u6279\u51C6\u540E\u4F1A\u5728\u98DE\u4E66\u79C1\u4FE1\u901A\u77E5\u4F60\uFF0C\u70B9\u4E00\u4E0B\u5373\u53EF\u8865\u4E0A\u8FD9\u90E8\u5206\u6743\u9650\uFF1B\u5DF2\u6709\u7684\u98DE\u4E66\u80FD\u529B\u4E0D\u53D7\u5F71\u54CD\u3002`;
|
|
20791
20791
|
}
|
|
20792
|
+
function feishuApprovalUnconfirmedNotice(modules, expired) {
|
|
20793
|
+
return `${expired ? "\u6388\u6743\u9875\u5DF2\u8D85\u65F6\uFF0C" : ""}\u98DE\u4E66\u8FD9\u4E00\u8F6E\u6CA1\u6709\u7ED9\u51FA\u6388\u6743\uFF0COasis \u65E0\u6CD5\u786E\u8BA4\u4F60\u662F\u5426\u5728\u6388\u6743\u9875\u5BF9${moduleNames(modules)}\u7684\u6743\u9650\u70B9\u4E86\u300C\u7533\u8BF7\u300D\u3002\u5982\u679C\u70B9\u4E86\uFF0C\u8BF7\u9009\u300C\u6211\u70B9\u4E86\u7533\u8BF7\u300D\uFF0C\u6279\u51C6\u540E\u4F1A\u5728\u98DE\u4E66\u79C1\u4FE1\u901A\u77E5\u4F60\u8865\u6388\u6743\uFF1B\u6CA1\u70B9\uFF08\u6216\u70B9\u7684\u662F\u62D2\u7EDD\uFF09\u7684\u8BDD\u91CD\u65B0\u53D1\u8D77\u6388\u6743\u5373\u53EF\u3002\u5DF2\u6709\u7684\u98DE\u4E66\u80FD\u529B\u4E0D\u53D7\u5F71\u54CD\u3002`;
|
|
20794
|
+
}
|
|
20792
20795
|
var FEISHU_AUTH_PENDING_APPROVAL_VAR, FEISHU_PENDING_APPROVAL_WATCH_MS, FEISHU_APPROVED_SUPPLEMENT_KEEP_MS, AUTO_APPROVED2, userScopeIndex, isGranted, moduleNames;
|
|
20793
20796
|
var init_pending_approval = __esm({
|
|
20794
20797
|
"../connectors/src/feishu/pending-approval.ts"() {
|
|
@@ -24796,7 +24799,7 @@ function createFeishuReauth(deps) {
|
|
|
24796
24799
|
message: `\u8FD9\u4E2A\u94FE\u63A5\u53EA\u80FD\u7531\u539F\u6388\u6743\u4EBA\u672C\u4EBA\u4F7F\u7528\u3002\u4F60${who.name ? `\uFF08${who.name}\uFF09` : ""}\u4E0D\u662F\u539F\u6388\u6743\u4EBA\uFF0C\u672C\u6B21\u6388\u6743\u672A\u4FDD\u5B58\uFF0C\u539F\u6388\u6743\u4FDD\u6301\u4E0D\u53D8\u3002`
|
|
24797
24800
|
};
|
|
24798
24801
|
}
|
|
24799
|
-
await withConnectorCredentialLock("feishu", claims.actorId, async () => {
|
|
24802
|
+
const supplement = await withConnectorCredentialLock("feishu", claims.actorId, async () => {
|
|
24800
24803
|
const pending2 = claims.purpose === "supplement" ? await readFeishuPendingApproval(store, claims.actorId) : null;
|
|
24801
24804
|
await persistFeishuUserAuthorization(store, claims.actorId, data, now(), {
|
|
24802
24805
|
openId: who.openId,
|
|
@@ -24811,19 +24814,48 @@ function createFeishuReauth(deps) {
|
|
|
24811
24814
|
connectorId: "feishu",
|
|
24812
24815
|
encrypted: false
|
|
24813
24816
|
});
|
|
24814
|
-
if (
|
|
24815
|
-
|
|
24816
|
-
|
|
24817
|
-
|
|
24818
|
-
|
|
24819
|
-
|
|
24820
|
-
|
|
24821
|
-
|
|
24822
|
-
|
|
24823
|
-
|
|
24824
|
-
|
|
24825
|
-
|
|
24826
|
-
|
|
24817
|
+
if (claims.purpose !== "supplement") return null;
|
|
24818
|
+
if (!record10.grantedScopes) return "unknown";
|
|
24819
|
+
if (!pending2) {
|
|
24820
|
+
const granted2 = new Set(record10.grantedScopes);
|
|
24821
|
+
const wanted = scopesForSelection(sel, sendAsUserRequested).filter((x2) => x2 !== "offline_access");
|
|
24822
|
+
return wanted.every((x2) => granted2.has(x2)) ? "complete" : "short";
|
|
24823
|
+
}
|
|
24824
|
+
const granted = new Set(record10.grantedScopes);
|
|
24825
|
+
const still = pending2.pendingScopes.filter((x2) => !granted.has(x2));
|
|
24826
|
+
if (still.length === 0) {
|
|
24827
|
+
await clearFeishuPendingApproval(store, claims.actorId);
|
|
24828
|
+
return "complete";
|
|
24829
|
+
}
|
|
24830
|
+
const next = { ...pending2, pendingScopes: still };
|
|
24831
|
+
delete next.approvedAt;
|
|
24832
|
+
delete next.notice;
|
|
24833
|
+
await writeFeishuPendingApproval(store, claims.actorId, next);
|
|
24834
|
+
return "partial";
|
|
24835
|
+
});
|
|
24836
|
+
const userName = who.name ? { userName: who.name } : {};
|
|
24837
|
+
if (supplement === "partial") {
|
|
24838
|
+
return {
|
|
24839
|
+
state: "incomplete",
|
|
24840
|
+
...userName,
|
|
24841
|
+
message: "\u6388\u6743\u5DF2\u4FDD\u5B58\uFF0C\u4F46\u98DE\u4E66\u8FD9\u6B21\u6CA1\u6709\u7ED9\u9F50\u7BA1\u7406\u5458\u6279\u51C6\u7684\u6743\u9650\uFF0C\u8FD8\u5DEE\u7684\u90E8\u5206\u7EE7\u7EED\u7B49\u5F85\u5BA1\u6279\uFF1B\u6279\u51C6\u540E\u4F1A\u518D\u79C1\u4FE1\u901A\u77E5\u4F60\u3002\u5DF2\u6709\u7684\u98DE\u4E66\u80FD\u529B\u4E0D\u53D7\u5F71\u54CD\u3002"
|
|
24842
|
+
};
|
|
24843
|
+
}
|
|
24844
|
+
if (supplement === "short") {
|
|
24845
|
+
return {
|
|
24846
|
+
state: "incomplete",
|
|
24847
|
+
...userName,
|
|
24848
|
+
message: "\u6388\u6743\u5DF2\u4FDD\u5B58\uFF0C\u4F46\u98DE\u4E66\u8FD9\u6B21\u6CA1\u6709\u7ED9\u9F50\u6240\u7533\u8BF7\u7684\u6743\u9650\u3002\u53EF\u5728 Oasis \u8FDE\u63A5\u5668\u8BE6\u60C5\u67E5\u770B\u5DF2\u5F00\u901A\u7684\u529F\u80FD\uFF0C\u9700\u8981\u65F6\u91CD\u65B0\u8FDE\u63A5\u98DE\u4E66\u3002"
|
|
24849
|
+
};
|
|
24850
|
+
}
|
|
24851
|
+
if (supplement === "unknown") {
|
|
24852
|
+
return {
|
|
24853
|
+
state: "incomplete",
|
|
24854
|
+
...userName,
|
|
24855
|
+
message: "\u6388\u6743\u5DF2\u4FDD\u5B58\uFF0C\u4F46\u98DE\u4E66\u6CA1\u6709\u56DE\u62A5\u8FD9\u6B21\u6388\u4E88\u4E86\u54EA\u4E9B\u6743\u9650\uFF0C\u65E0\u6CD5\u786E\u8BA4\u7BA1\u7406\u5458\u6279\u51C6\u7684\u6743\u9650\u662F\u5426\u5DF2\u8865\u4E0A\u3002\u53EF\u5728 Oasis \u8FDE\u63A5\u5668\u8BE6\u60C5\u67E5\u770B\uFF1B\u4ECD\u663E\u793A\u5F85\u8865\u6388\u6743\u7684\u8BDD\uFF0C\u518D\u70B9\u4E00\u6B21\u94FE\u63A5\u5373\u53EF\u3002"
|
|
24856
|
+
};
|
|
24857
|
+
}
|
|
24858
|
+
await deps.onRestored?.(claims, { openId: who.openId, ...userName }).catch((e) => warn(`onRestored: ${String(e)}`));
|
|
24827
24859
|
return { state: "restored", ...who.name ? { userName: who.name } : {} };
|
|
24828
24860
|
};
|
|
24829
24861
|
const watch = async (deviceCode, entry, ctx) => {
|
|
@@ -212296,6 +212328,35 @@ async function feishuModuleAccess(store, actorId, fetchScopes = fetchFeishuAppSc
|
|
|
212296
212328
|
...botCheckError ? { botCheckError } : {}
|
|
212297
212329
|
};
|
|
212298
212330
|
}
|
|
212331
|
+
async function saveFeishuModuleSelection(store, actorId, body2) {
|
|
212332
|
+
const read3 = (key2) => store.revealResolvedVariable(key2, actorId).catch(() => null);
|
|
212333
|
+
if (!await read3("FEISHU_APP_ID") || !await read3("FEISHU_APP_SECRET")) return { ok: false, error: "no_app" };
|
|
212334
|
+
const sel = normalizeFeishuAuthSelection({ modules: Array.isArray(body2.modules) ? body2.modules : [] });
|
|
212335
|
+
if (!sel) return { ok: false, error: "empty" };
|
|
212336
|
+
let prev = {};
|
|
212337
|
+
const raw = await read3(FEISHU_AUTH_SELECTION_VAR);
|
|
212338
|
+
try {
|
|
212339
|
+
prev = raw ? JSON.parse(raw) ?? {} : {};
|
|
212340
|
+
} catch {
|
|
212341
|
+
prev = {};
|
|
212342
|
+
}
|
|
212343
|
+
const grantedScopes = Array.isArray(prev.grantedScopes) ? prev.grantedScopes.filter((s2) => typeof s2 === "string") : void 0;
|
|
212344
|
+
const sendAsUser = prev.sendAsUser === true;
|
|
212345
|
+
const record10 = {
|
|
212346
|
+
modules: sel.modules,
|
|
212347
|
+
sendAsUser,
|
|
212348
|
+
sendAsUserRequested: sendAsUser && prev.sendAsUserRequested === true,
|
|
212349
|
+
...grantedScopes ? { grantedScopes } : {}
|
|
212350
|
+
};
|
|
212351
|
+
await store.putVariable({
|
|
212352
|
+
key: FEISHU_AUTH_SELECTION_VAR,
|
|
212353
|
+
value: JSON.stringify(record10),
|
|
212354
|
+
...actorId ? { scope: "personal", actorId } : { scope: "global" },
|
|
212355
|
+
connectorId: "feishu",
|
|
212356
|
+
encrypted: false
|
|
212357
|
+
});
|
|
212358
|
+
return { ok: true, record: record10 };
|
|
212359
|
+
}
|
|
212299
212360
|
var init_feishu_module_access = __esm({
|
|
212300
212361
|
"../server/src/feishu-module-access.ts"() {
|
|
212301
212362
|
"use strict";
|
|
@@ -212305,14 +212366,7 @@ var init_feishu_module_access = __esm({
|
|
|
212305
212366
|
|
|
212306
212367
|
// ../server/src/feishu-pending-approval.ts
|
|
212307
212368
|
async function recordFeishuPendingApproval(input) {
|
|
212308
|
-
const
|
|
212309
|
-
let appScopes = null;
|
|
212310
|
-
try {
|
|
212311
|
-
appScopes = await (input.fetchScopes ?? fetchFeishuAppScopes)(input.appId, input.appSecret);
|
|
212312
|
-
} catch (e) {
|
|
212313
|
-
(input.warn ?? ((m2) => console.warn(`[feishu-oauth] ${m2}`)))(`\u5E94\u7528\u6743\u9650\u5217\u8868\u67E5\u8BE2\u5931\u8D25\uFF0C\u5F85\u5BA1\u6279\u6309\u514D\u5BA1\u96C6\u5408\u4F30\u7B97: ${String(e)}`);
|
|
212314
|
-
}
|
|
212315
|
-
const pendingScopes = feishuPendingApprovalScopes({ requested, granted: input.granted, appScopes });
|
|
212369
|
+
const pendingScopes = await pendingApprovalScopes(input);
|
|
212316
212370
|
if (pendingScopes.length === 0) {
|
|
212317
212371
|
if (input.granted) {
|
|
212318
212372
|
await withConnectorCredentialLock("feishu", input.actorId, () => clearFeishuPendingApproval(input.store, input.actorId));
|
|
@@ -212332,6 +212386,22 @@ async function recordFeishuPendingApproval(input) {
|
|
|
212332
212386
|
const modules = feishuPendingApprovalModules(record10);
|
|
212333
212387
|
return { modules, scopes: pendingScopes, notice: feishuPendingApprovalNotice(modules) };
|
|
212334
212388
|
}
|
|
212389
|
+
async function pendingApprovalScopes(input) {
|
|
212390
|
+
const requested = scopesForSelection(input.selection, input.sendAsUserRequested);
|
|
212391
|
+
let appScopes = null;
|
|
212392
|
+
try {
|
|
212393
|
+
appScopes = await (input.fetchScopes ?? fetchFeishuAppScopes)(input.appId, input.appSecret);
|
|
212394
|
+
} catch (e) {
|
|
212395
|
+
(input.warn ?? ((m2) => console.warn(`[feishu-oauth] ${m2}`)))(`\u5E94\u7528\u6743\u9650\u5217\u8868\u67E5\u8BE2\u5931\u8D25\uFF0C\u5F85\u5BA1\u6279\u6309\u514D\u5BA1\u96C6\u5408\u4F30\u7B97: ${String(e)}`);
|
|
212396
|
+
}
|
|
212397
|
+
return feishuPendingApprovalScopes({ requested, granted: input.granted, appScopes });
|
|
212398
|
+
}
|
|
212399
|
+
async function assessFeishuApprovalUnconfirmed(input) {
|
|
212400
|
+
const scopes = await pendingApprovalScopes(input);
|
|
212401
|
+
if (scopes.length === 0) return null;
|
|
212402
|
+
const modules = feishuPendingApprovalModules({ modules: input.selection.modules, pendingScopes: scopes });
|
|
212403
|
+
return { modules, scopes, notice: feishuApprovalUnconfirmedNotice(modules, input.expired) };
|
|
212404
|
+
}
|
|
212335
212405
|
var init_feishu_pending_approval = __esm({
|
|
212336
212406
|
"../server/src/feishu-pending-approval.ts"() {
|
|
212337
212407
|
"use strict";
|
|
@@ -218543,6 +218613,27 @@ ${composed}`;
|
|
|
218543
218613
|
}
|
|
218544
218614
|
return;
|
|
218545
218615
|
}
|
|
218616
|
+
if (url.pathname === "/api/connectors/feishu/modules" && req.method === "POST") {
|
|
218617
|
+
try {
|
|
218618
|
+
const body2 = JSON.parse(rawBody || "{}");
|
|
218619
|
+
const svc = await connectorActorsService();
|
|
218620
|
+
if (!svc) throw new Error("actors service unavailable");
|
|
218621
|
+
const denied = await connectorWriteDenied(svc, body2.actorId, "\u8C03\u6574\u98DE\u4E66\u63A5\u5165\u529F\u80FD");
|
|
218622
|
+
if (denied) {
|
|
218623
|
+
writeApiError(res, denied);
|
|
218624
|
+
return;
|
|
218625
|
+
}
|
|
218626
|
+
const saved = await saveFeishuModuleSelection(svc, body2.actorId, body2);
|
|
218627
|
+
if (!saved.ok) {
|
|
218628
|
+
res.writeHead(saved.error === "no_app" ? 409 : 400, { "content-type": "application/json" }).end(JSON.stringify({ error: saved.error === "no_app" ? "\u8FD8\u6CA1\u6709\u914D\u7F6E\u98DE\u4E66\u5E94\u7528\uFF0C\u8BF7\u5148\u5B8C\u6210\u8FDE\u63A5" : "\u8BF7\u81F3\u5C11\u9009\u62E9\u4E00\u4E2A\u529F\u80FD\u6A21\u5757" }));
|
|
218629
|
+
return;
|
|
218630
|
+
}
|
|
218631
|
+
res.writeHead(200, { "content-type": "application/json" }).end(JSON.stringify({ ok: true, modules: saved.record.modules }));
|
|
218632
|
+
} catch (e) {
|
|
218633
|
+
res.writeHead(500).end(JSON.stringify({ error: String(e) }));
|
|
218634
|
+
}
|
|
218635
|
+
return;
|
|
218636
|
+
}
|
|
218546
218637
|
if (url.pathname === "/api/connectors/feishu/login/start" && req.method === "POST") {
|
|
218547
218638
|
const startBody = JSON.parse(rawBody);
|
|
218548
218639
|
const { appId, actorId } = startBody;
|
|
@@ -218612,6 +218703,51 @@ ${composed}`;
|
|
|
218612
218703
|
}
|
|
218613
218704
|
return;
|
|
218614
218705
|
}
|
|
218706
|
+
if (url.pathname === "/api/connectors/feishu/login/confirm-application" && req.method === "POST") {
|
|
218707
|
+
const { appId, deviceCode, actorId } = JSON.parse(rawBody);
|
|
218708
|
+
if (!appId || !deviceCode) {
|
|
218709
|
+
res.writeHead(400).end(JSON.stringify({ error: "appId and deviceCode required" }));
|
|
218710
|
+
return;
|
|
218711
|
+
}
|
|
218712
|
+
try {
|
|
218713
|
+
const devicePending = opts.connectorAuthPending?.githubApp;
|
|
218714
|
+
const started = devicePending ? await devicePending.get(feishuDevicePendingKey(deviceCode), Date.now()) : { status: "missing" };
|
|
218715
|
+
if (started.status !== "found") {
|
|
218716
|
+
res.writeHead(409).end(JSON.stringify({ ok: false, restart: true, error: "\u8FD9\u6B21\u6388\u6743\u7684\u767B\u8BB0\u5DF2\u5931\u6548\uFF08\u8D85\u65F6\u6216\u670D\u52A1\u5DF2\u66F4\u65B0\uFF09\uFF0C\u8BF7\u91CD\u65B0\u53D1\u8D77\u6388\u6743" }));
|
|
218717
|
+
return;
|
|
218718
|
+
}
|
|
218719
|
+
const v2 = started.value.value;
|
|
218720
|
+
if (v2["appId"] !== appId || v2["actorId"] !== (actorId ?? "") || (started.value.companyId ?? "") !== (currentCompanyId ?? "")) {
|
|
218721
|
+
res.writeHead(400).end(JSON.stringify({ ok: false, restart: true, error: "\u8FD9\u6B21\u6388\u6743\u4E0D\u662F\u7531\u5F53\u524D\u5E94\u7528\u6216\u5458\u5DE5\u53D1\u8D77\u7684\uFF0C\u8BF7\u91CD\u65B0\u53D1\u8D77\u6388\u6743" }));
|
|
218722
|
+
return;
|
|
218723
|
+
}
|
|
218724
|
+
if (v2["ended"] !== "no_token") {
|
|
218725
|
+
res.writeHead(409).end(JSON.stringify({ ok: false, error: "\u8FD9\u6B21\u6388\u6743\u6CA1\u6709\u5904\u5728\u300C\u5F85\u786E\u8BA4\u662F\u5426\u5DF2\u7533\u8BF7\u300D\u7684\u72B6\u6001\uFF0C\u65E0\u9700\u786E\u8BA4" }));
|
|
218726
|
+
return;
|
|
218727
|
+
}
|
|
218728
|
+
const selection = normalizeFeishuAuthSelection({ modules: v2["modules"], sendAsUser: v2["sendAsUser"] });
|
|
218729
|
+
const confirmSvc = await connectorActorsService();
|
|
218730
|
+
const appSecret = confirmSvc ? await confirmSvc.revealResolvedVariable("FEISHU_APP_SECRET", actorId) : null;
|
|
218731
|
+
if (!selection || !confirmSvc || !appSecret) {
|
|
218732
|
+
res.writeHead(409).end(JSON.stringify({ ok: false, restart: true, error: "\u8FD9\u6B21\u6388\u6743\u7684\u767B\u8BB0\u5DF2\u635F\u574F\u6216\u5E94\u7528\u51ED\u636E\u5DF2\u4E0D\u5B58\u5728\uFF0C\u8BF7\u91CD\u65B0\u53D1\u8D77\u6388\u6743" }));
|
|
218733
|
+
return;
|
|
218734
|
+
}
|
|
218735
|
+
const pendingApproval = await recordFeishuPendingApproval({
|
|
218736
|
+
store: confirmSvc,
|
|
218737
|
+
actorId,
|
|
218738
|
+
appId,
|
|
218739
|
+
appSecret,
|
|
218740
|
+
selection,
|
|
218741
|
+
sendAsUserRequested: selection.sendAsUser && v2["sendAsUserRequested"] === true,
|
|
218742
|
+
...isHumanActorId(actor) ? { applicant: actor } : {},
|
|
218743
|
+
now: Date.now()
|
|
218744
|
+
});
|
|
218745
|
+
res.writeHead(200, { "content-type": "application/json" }).end(JSON.stringify(pendingApproval ? { ok: true, pendingApproval: { modules: pendingApproval.modules, scopes: pendingApproval.scopes }, notice: pendingApproval.notice } : { ok: false, error: "\u8FD9\u4E9B\u6743\u9650\u73B0\u5728\u5DF2\u7ECF\u53EF\u7528\uFF08\u7BA1\u7406\u5458\u53EF\u80FD\u5DF2\u6279\u51C6\uFF09\uFF0C\u8BF7\u91CD\u65B0\u53D1\u8D77\u6388\u6743\u5B8C\u6210\u8FDE\u63A5" }));
|
|
218746
|
+
} catch (e) {
|
|
218747
|
+
res.writeHead(500).end(JSON.stringify({ error: String(e) }));
|
|
218748
|
+
}
|
|
218749
|
+
return;
|
|
218750
|
+
}
|
|
218615
218751
|
if (url.pathname === "/api/connectors/feishu/login/poll" && req.method === "POST") {
|
|
218616
218752
|
const { appId, deviceCode, actorId } = JSON.parse(rawBody);
|
|
218617
218753
|
if (!appId || !deviceCode) {
|
|
@@ -218645,22 +218781,22 @@ ${composed}`;
|
|
|
218645
218781
|
polled = await pollFeishuDeviceToken({ appId, appSecret, deviceCode });
|
|
218646
218782
|
} catch (e) {
|
|
218647
218783
|
if (!(e instanceof FeishuDeviceFlowError) || !pollSvc) throw e;
|
|
218648
|
-
const
|
|
218649
|
-
|
|
218650
|
-
actorId,
|
|
218784
|
+
const expired = e.code === "expired_token" || e.code === "invalid_grant";
|
|
218785
|
+
const unconfirmed = await assessFeishuApprovalUnconfirmed({
|
|
218651
218786
|
appId,
|
|
218652
218787
|
appSecret,
|
|
218653
218788
|
selection: startedSelection.selection,
|
|
218654
218789
|
sendAsUserRequested: startedSelection.sendAsUserRequested,
|
|
218655
|
-
|
|
218656
|
-
now: Date.now()
|
|
218790
|
+
expired
|
|
218657
218791
|
});
|
|
218658
|
-
|
|
218659
|
-
|
|
218792
|
+
if (unconfirmed && devicePending) {
|
|
218793
|
+
await devicePending.patch(feishuDevicePendingKey(deviceCode), { ended: "no_token", endedCode: e.code });
|
|
218794
|
+
}
|
|
218795
|
+
res.writeHead(200, { "content-type": "application/json" }).end(JSON.stringify(unconfirmed ? {
|
|
218660
218796
|
ok: false,
|
|
218661
218797
|
final: true,
|
|
218662
|
-
|
|
218663
|
-
notice:
|
|
218798
|
+
approvalUnconfirmed: { modules: unconfirmed.modules, scopes: unconfirmed.scopes },
|
|
218799
|
+
notice: unconfirmed.notice
|
|
218664
218800
|
} : {
|
|
218665
218801
|
ok: false,
|
|
218666
218802
|
final: true,
|
|
@@ -301399,7 +301535,7 @@ async function waitForCommandAuthorization(base, headers, draftId, fallback) {
|
|
|
301399
301535
|
}
|
|
301400
301536
|
}
|
|
301401
301537
|
}
|
|
301402
|
-
var CLI_VERSION = "2.2.
|
|
301538
|
+
var CLI_VERSION = "2.2.116" ? "2.2.116" : "dev";
|
|
301403
301539
|
function apiHeaders(token2, company) {
|
|
301404
301540
|
const headers = {
|
|
301405
301541
|
authorization: `Bearer ${token2}`,
|
|
@@ -305570,7 +305706,7 @@ function shimScript() {
|
|
|
305570
305706
|
}
|
|
305571
305707
|
|
|
305572
305708
|
// src/index.ts
|
|
305573
|
-
var PKG_VERSION = true ? "2.2.
|
|
305709
|
+
var PKG_VERSION = true ? "2.2.116" : "dev";
|
|
305574
305710
|
var LOCAL_BIN = localBin();
|
|
305575
305711
|
var NPM_PREFIX = npmPrefix();
|
|
305576
305712
|
var INSTANCE = DEFAULT_INSTANCE;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oasis_test_v2",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.116",
|
|
4
4
|
"description": "Oasis node daemon + CLI — background daemon, auto-start, full server CLI",
|
|
5
5
|
"bin": {
|
|
6
6
|
"oasis": "./dist/index.js"
|
|
@@ -26,6 +26,6 @@
|
|
|
26
26
|
"node": ">=20"
|
|
27
27
|
},
|
|
28
28
|
"oasisRelease": {
|
|
29
|
-
"sourceHead": "
|
|
29
|
+
"sourceHead": "17187478d4f35a162acf4ef5433e2a6f1ed5374a"
|
|
30
30
|
}
|
|
31
31
|
}
|