aai-lark-bridge 0.2.20 → 0.2.22
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/cli.js +20 -10
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -4,7 +4,7 @@ import { Command } from "commander";
|
|
|
4
4
|
// package.json
|
|
5
5
|
var package_default = {
|
|
6
6
|
name: "aai-lark-bridge",
|
|
7
|
-
version: "0.2.
|
|
7
|
+
version: "0.2.22",
|
|
8
8
|
description: "Lark AI Native Bridge - Lark\u57FA\u7840\u8BBE\u65BD\u5C42\u548CCLI\u96C6\u6210",
|
|
9
9
|
type: "module",
|
|
10
10
|
main: "./dist/index.js",
|
|
@@ -729,7 +729,8 @@ function normalizePerSenderUser(input, agentKind) {
|
|
|
729
729
|
if (typeof raw.tokenCommand !== "string" || !raw.tokenCommand.trim()) {
|
|
730
730
|
throw new Error("larkCli.perSenderUser.tokenCommand \u4E0D\u80FD\u4E3A\u7A7A");
|
|
731
731
|
}
|
|
732
|
-
|
|
732
|
+
const dbPrompt = typeof raw.dbPrompt === "string" && raw.dbPrompt.trim() ? raw.dbPrompt : void 0;
|
|
733
|
+
return { enabled: true, gatewayUrl: raw.gatewayUrl.replace(/\/+$/, ""), tokenCommand: raw.tokenCommand, ...dbPrompt ? { dbPrompt } : {} };
|
|
733
734
|
}
|
|
734
735
|
function normalizeLarkCliUserImport(input) {
|
|
735
736
|
if (!input || typeof input !== "object" || Array.isArray(input)) return void 0;
|
|
@@ -19930,27 +19931,36 @@ function createGateway(opts) {
|
|
|
19930
19931
|
/**
|
|
19931
19932
|
* POST /db/task-handle:调度的只读运行(只读分析、出文档、补报告)起 claude 前凭任务申请查库句柄(intent 0049 R-04)。
|
|
19932
19933
|
* 负责人得是这个任务的 assignee(网关向飞书核对,同 0048 的 /claude/task-token);不看私聊查库名单(spec D-3)。
|
|
19934
|
+
* 评测(intent 0050,带 eval: true):评测的任务号不是真飞书任务,不带 taskGuid,改按私聊查库名单放行,日志记 task=eval。
|
|
19933
19935
|
*/
|
|
19934
19936
|
async dbTaskHandle(input) {
|
|
19935
|
-
|
|
19937
|
+
const isEval = input.eval === true;
|
|
19938
|
+
let taskGuid = null, openId, runId;
|
|
19936
19939
|
try {
|
|
19937
|
-
taskGuid = str2(input, "taskGuid", TASK_GUID);
|
|
19940
|
+
if (!isEval) taskGuid = str2(input, "taskGuid", TASK_GUID);
|
|
19938
19941
|
openId = str2(input, "openId", OPEN_ID2);
|
|
19939
19942
|
runId = str2(input, "runId", RUN_ID);
|
|
19940
19943
|
} catch {
|
|
19941
19944
|
return { status: "bad_request" };
|
|
19942
19945
|
}
|
|
19943
19946
|
if (!db.enabled) return { status: "off" };
|
|
19944
|
-
|
|
19945
|
-
|
|
19946
|
-
|
|
19947
|
-
|
|
19948
|
-
|
|
19947
|
+
if (taskGuid === null) {
|
|
19948
|
+
if (!db.readers.includes(openId)) {
|
|
19949
|
+
log.warn("user-gateway", "db.handle-refused", { sender: tail6(openId), runId, task: "eval", result: "not_reader" });
|
|
19950
|
+
return { status: "not_reader" };
|
|
19951
|
+
}
|
|
19952
|
+
} else {
|
|
19953
|
+
const assignees = await taskAssignees(taskGuid);
|
|
19954
|
+
if (assignees === "lark_error") return { status: "lark_error" };
|
|
19955
|
+
if (!assignees.includes(openId)) {
|
|
19956
|
+
log.warn("user-gateway", "db.handle-refused", { sender: tail6(openId), runId, result: "not_assignee" });
|
|
19957
|
+
return { status: "not_assignee" };
|
|
19958
|
+
}
|
|
19949
19959
|
}
|
|
19950
19960
|
const handle2 = randomBytes10(32).toString("base64url");
|
|
19951
19961
|
const expiresAt = now() + TASK_HANDLE_TTL_MS;
|
|
19952
19962
|
handles.set(handle2, { openId, messageId: "", runId, expiresAt, kind: "task", db: true });
|
|
19953
|
-
log.info("user-gateway", "db.handle-issued", { sender: tail6(openId), runId, task: taskGuid });
|
|
19963
|
+
log.info("user-gateway", "db.handle-issued", { sender: tail6(openId), runId, task: taskGuid ?? "eval" });
|
|
19954
19964
|
return { status: "ok", handle: handle2, expiresAt };
|
|
19955
19965
|
},
|
|
19956
19966
|
/** POST /db/query:凭句柄替 agent 查一条,每次记一条 db.query(intent 0049 R-01、R-03、R-05)。 */
|