refactor: trim feishu helper exports · openclaw/openclaw@b388209
steipete
·
2026-05-01
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | const RACE_TIMEOUT = Symbol("race-timeout"); |
2 | 2 | const RACE_ABORT = Symbol("race-abort"); |
3 | 3 | |
4 | | -export type RaceWithTimeoutAndAbortResult<T> = |
| 4 | +type RaceWithTimeoutAndAbortResult<T> = |
5 | 5 | | { status: "resolved"; value: T } |
6 | 6 | | { status: "timeout" } |
7 | 7 | | { status: "aborted" }; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -7,7 +7,7 @@ import { parsePostContent } from "./post.js";
|
7 | 7 | import { getFeishuRuntime } from "./runtime.js"; |
8 | 8 | import type { FeishuChatType, FeishuMediaInfo } from "./types.js"; |
9 | 9 | |
10 | | -export type FeishuMention = { |
| 10 | +type FeishuMention = { |
11 | 11 | key: string; |
12 | 12 | id: { |
13 | 13 | open_id?: string; |
@@ -37,11 +37,11 @@ type FeishuMessageLike = {
|
37 | 37 | }; |
38 | 38 | }; |
39 | 39 | |
40 | | -export type GroupSessionScope = "group" | "group_sender" | "group_topic" | "group_topic_sender"; |
| 40 | +type GroupSessionScope = "group" | "group_sender" | "group_topic" | "group_topic_sender"; |
41 | 41 | |
42 | 42 | type FeishuLogger = (...args: unknown[]) => void; |
43 | 43 | |
44 | | -export type ResolvedFeishuGroupSession = { |
| 44 | +type ResolvedFeishuGroupSession = { |
45 | 45 | peerId: string; |
46 | 46 | parentPeer: { kind: "group"; id: string } | null; |
47 | 47 | groupSessionScope: GroupSessionScope; |
@@ -299,7 +299,7 @@ export function normalizeFeishuCommandProbeBody(text: string): string {
|
299 | 299 | .trim(); |
300 | 300 | } |
301 | 301 | |
302 | | -export function parseMediaKeys( |
| 302 | +function parseMediaKeys( |
303 | 303 | content: string, |
304 | 304 | messageType: string, |
305 | 305 | ): { imageKey?: string; fileKey?: string; fileName?: string } { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -2,17 +2,10 @@ import { isRecord } from "./comment-shared.js";
|
2 | 2 | |
3 | 3 | export const FEISHU_CARD_INTERACTION_VERSION = "ocf1"; |
4 | 4 | |
5 | | -export type FeishuCardInteractionKind = "button" | "quick" | "meta"; |
6 | | -export type FeishuCardInteractionReason = |
7 | | -| "malformed" |
8 | | -| "stale" |
9 | | -| "wrong_user" |
10 | | -| "wrong_conversation"; |
11 | | - |
12 | | -export type FeishuCardInteractionMetadata = Record< |
13 | | -string, |
14 | | -string | number | boolean | null | undefined |
15 | | ->; |
| 5 | +type FeishuCardInteractionKind = "button" | "quick" | "meta"; |
| 6 | +type FeishuCardInteractionReason = "malformed" | "stale" | "wrong_user" | "wrong_conversation"; |
| 7 | + |
| 8 | +type FeishuCardInteractionMetadata = Record<string, string | number | boolean | null | undefined>; |
16 | 9 | |
17 | 10 | export type FeishuCardInteractionEnvelope = { |
18 | 11 | oc: typeof FEISHU_CARD_INTERACTION_VERSION; |
@@ -29,7 +22,7 @@ export type FeishuCardInteractionEnvelope = {
|
29 | 22 | }; |
30 | 23 | }; |
31 | 24 | |
32 | | -export type FeishuCardActionEventLike = { |
| 25 | +type FeishuCardActionEventLike = { |
33 | 26 | operator: { |
34 | 27 | open_id?: string; |
35 | 28 | }; |
@@ -41,7 +34,7 @@ export type FeishuCardActionEventLike = {
|
41 | 34 | }; |
42 | 35 | }; |
43 | 36 | |
44 | | -export type DecodedFeishuCardAction = |
| 37 | +type DecodedFeishuCardAction = |
45 | 38 | | { |
46 | 39 | kind: "structured"; |
47 | 40 | envelope: FeishuCardInteractionEnvelope; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -5,7 +5,7 @@ import { FEISHU_APPROVAL_REQUEST_ACTION } from "./card-ux-approval.js";
|
5 | 5 | import { buildFeishuCardButton, buildFeishuCardInteractionContext } from "./card-ux-shared.js"; |
6 | 6 | import { sendCardFeishu } from "./send.js"; |
7 | 7 | |
8 | | -export const FEISHU_QUICK_ACTION_CARD_TTL_MS = 10 * 60_000; |
| 8 | +const FEISHU_QUICK_ACTION_CARD_TTL_MS = 10 * 60_000; |
9 | 9 | |
10 | 10 | const QUICK_ACTION_MENU_KEYS = new Set(["quick-actions", "quick_actions", "launcher"]); |
11 | 11 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -12,7 +12,7 @@ import type { CommentFileType } from "./comment-target.js";
|
12 | 12 | import { deliverCommentThreadText } from "./drive.js"; |
13 | 13 | import { getFeishuRuntime } from "./runtime.js"; |
14 | 14 | |
15 | | -export type CreateFeishuCommentReplyDispatcherParams = { |
| 15 | +type CreateFeishuCommentReplyDispatcherParams = { |
16 | 16 | cfg: ClawdbotConfig; |
17 | 17 | agentId: string; |
18 | 18 | runtime: RuntimeEnv; |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | import { |
2 | | -hasNonEmptyString as sharedHasNonEmptyString, |
3 | 2 | isRecord as sharedIsRecord, |
4 | 3 | normalizeOptionalString, |
5 | 4 | readStringValue, |
@@ -24,8 +23,6 @@ export const normalizeString = normalizeOptionalString;
|
24 | 23 | |
25 | 24 | export const isRecord = sharedIsRecord; |
26 | 25 | |
27 | | -export const hasNonEmptyString = sharedHasNonEmptyString; |
28 | | - |
29 | 26 | export function formatFeishuApiError( |
30 | 27 | error: unknown, |
31 | 28 | options: { |
@@ -64,26 +61,26 @@ export function formatFeishuApiError(
|
64 | 61 | }); |
65 | 62 | } |
66 | 63 | |
67 | | -export type ParsedCommentDocumentRef = { |
| 64 | +type ParsedCommentDocumentRef = { |
68 | 65 | fileType?: CommentFileType; |
69 | 66 | fileToken?: string; |
70 | 67 | }; |
71 | 68 | |
72 | | -export type ParsedCommentMention = { |
| 69 | +type ParsedCommentMention = { |
73 | 70 | userId: string; |
74 | 71 | displayText: string; |
75 | 72 | isBotMention: boolean; |
76 | 73 | }; |
77 | 74 | |
78 | | -export type ParsedCommentLinkedDocumentKind = |
| 75 | +type ParsedCommentLinkedDocumentKind = |
79 | 76 | | CommentFileType |
80 | 77 | | "wiki" |
81 | 78 | | "mindnote" |
82 | 79 | | "bitable" |
83 | 80 | | "base" |
84 | 81 | | "unknown"; |
85 | 82 | |
86 | | -export type ParsedCommentResolvedDocumentType = Exclude< |
| 83 | +type ParsedCommentResolvedDocumentType = Exclude< |
87 | 84 | ParsedCommentLinkedDocumentKind, |
88 | 85 | "wiki" | "unknown" |
89 | 86 | >; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -9,7 +9,7 @@ export function normalizeCommentFileType(value: unknown): CommentFileType | unde
|
9 | 9 | : undefined; |
10 | 10 | } |
11 | 11 | |
12 | | -export type FeishuCommentTarget = { |
| 12 | +type FeishuCommentTarget = { |
13 | 13 | fileType: CommentFileType; |
14 | 14 | fileToken: string; |
15 | 15 | commentId: string; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -59,7 +59,7 @@ type DocxTextElement = NonNullable<
|
59 | 59 | * [bold]text[/bold] → bold |
60 | 60 | * [green bold]text[/green] → green + bold |
61 | 61 | */ |
62 | | -export function parseColorMarkup(content: string): Segment[] { |
| 62 | +function parseColorMarkup(content: string): Segment[] { |
63 | 63 | const segments: Segment[] = []; |
64 | 64 | // Only [known_tag]...[/...] pairs are treated as markup. Using an open |
65 | 65 | // pattern like \[([^\]]+)\] would match any bracket token — e.g. [Q1] — |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -61,10 +61,7 @@ function createDescendantTable(
|
61 | 61 | }; |
62 | 62 | } |
63 | 63 | |
64 | | -export function calculateAdaptiveColumnWidths( |
65 | | -blocks: FeishuDocxBlock[], |
66 | | -tableBlockId: string, |
67 | | -): number[] { |
| 64 | +function calculateAdaptiveColumnWidths(blocks: FeishuDocxBlock[], tableBlockId: string): number[] { |
68 | 65 | // Find the table block |
69 | 66 | const tableBlock = blocks.find((b) => b.block_id === tableBlockId && b.block_type === 31); |
70 | 67 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | | -export type FeishuBlockText = { |
| 1 | +type FeishuBlockText = { |
2 | 2 | elements?: Array<{ |
3 | 3 | text_run?: { |
4 | 4 | content?: string; |
5 | 5 | }; |
6 | 6 | }>; |
7 | 7 | }; |
8 | 8 | |
9 | | -export type FeishuBlockTableProperty = { |
| 9 | +type FeishuBlockTableProperty = { |
10 | 10 | row_size?: number; |
11 | 11 | column_size?: number; |
12 | 12 | column_width?: number[]; |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。