mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-12 16:33:22 +08:00
重构主控编排与运行时预热链路,统一工作区提示词/专家调度协议并补齐 wiki 记忆注入与写回闭环。
同时收敛启动与运维脚本默认行为(含 wiki worker)、更新 Admin 可观测性与相关测试,降低首轮时延并提高运行稳定性。 Made-with: Cursor
This commit is contained in:
parent
4a23b715a2
commit
dbbe3add6a
14438 changed files with 2693620 additions and 2546 deletions
65
openclaw/extensions/line/src/group-keys.ts
Normal file
65
openclaw/extensions/line/src/group-keys.ts
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
||||
import type { OpenClawConfig } from "openclaw/plugin-sdk/account-resolution";
|
||||
import { resolveAccountEntry } from "openclaw/plugin-sdk/account-resolution";
|
||||
import type { LineConfig, LineGroupConfig } from "./types.js";
|
||||
|
||||
export function resolveLineGroupLookupIds(groupId?: string | null): string[] {
|
||||
const normalized = groupId?.trim();
|
||||
if (!normalized) {
|
||||
return [];
|
||||
}
|
||||
if (normalized.startsWith("group:") || normalized.startsWith("room:")) {
|
||||
const rawId = normalized.split(":").slice(1).join(":");
|
||||
return rawId ? [rawId, normalized] : [normalized];
|
||||
}
|
||||
return [normalized, `group:${normalized}`, `room:${normalized}`];
|
||||
}
|
||||
|
||||
export function resolveLineGroupConfigEntry<T>(
|
||||
groups: Record<string, T | undefined> | undefined,
|
||||
params: { groupId?: string | null; roomId?: string | null },
|
||||
): T | undefined {
|
||||
if (!groups) {
|
||||
return undefined;
|
||||
}
|
||||
for (const candidate of resolveLineGroupLookupIds(params.groupId)) {
|
||||
const hit = groups[candidate];
|
||||
if (hit) {
|
||||
return hit;
|
||||
}
|
||||
}
|
||||
for (const candidate of resolveLineGroupLookupIds(params.roomId)) {
|
||||
const hit = groups[candidate];
|
||||
if (hit) {
|
||||
return hit;
|
||||
}
|
||||
}
|
||||
return groups["*"];
|
||||
}
|
||||
|
||||
export function resolveLineGroupsConfig(
|
||||
cfg: OpenClawConfig,
|
||||
accountId?: string | null,
|
||||
): Record<string, LineGroupConfig | undefined> | undefined {
|
||||
const lineConfig = cfg.channels?.line as LineConfig | undefined;
|
||||
if (!lineConfig) {
|
||||
return undefined;
|
||||
}
|
||||
const normalizedAccountId = normalizeAccountId(accountId);
|
||||
const accountGroups = resolveAccountEntry(lineConfig.accounts, normalizedAccountId)?.groups;
|
||||
return accountGroups ?? lineConfig.groups;
|
||||
}
|
||||
|
||||
export function resolveExactLineGroupConfigKey(params: {
|
||||
cfg: OpenClawConfig;
|
||||
accountId?: string | null;
|
||||
groupId?: string | null;
|
||||
}): string | undefined {
|
||||
const groups = resolveLineGroupsConfig(params.cfg, params.accountId);
|
||||
if (!groups) {
|
||||
return undefined;
|
||||
}
|
||||
return resolveLineGroupLookupIds(params.groupId).find((candidate) =>
|
||||
Object.hasOwn(groups, candidate),
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue