惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

小众软件
小众软件
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
WordPress大学
WordPress大学
月光博客
月光博客
Hugging Face - Blog
Hugging Face - Blog
博客园 - 聂微东
博客园 - 【当耐特】
博客园_首页
The Cloudflare Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Apple Machine Learning Research
Apple Machine Learning Research
Last Week in AI
Last Week in AI
酷 壳 – CoolShell
酷 壳 – CoolShell
大猫的无限游戏
大猫的无限游戏
雷峰网
雷峰网
量子位
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Tailwind CSS Blog
IT之家
IT之家
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
GbyAI
GbyAI
V
Visual Studio Blog
F
Fortinet All Blogs
Martin Fowler
Martin Fowler

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
refactor: share Google Chat plugin base · openclaw/opencl...
vincentkoc · 2026-05-30 · via Recent Commits to openclaw:main
1+

import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";

2+

import { formatNormalizedAllowFromEntries } from "openclaw/plugin-sdk/allow-from";

3+

import {

4+

adaptScopedAccountAccessor,

5+

createScopedChannelConfigAdapter,

6+

} from "openclaw/plugin-sdk/channel-config-helpers";

7+

import type { ChannelPlugin } from "openclaw/plugin-sdk/channel-core";

8+

import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";

9+

import {

10+

type GoogleChatConfigAccessorAccount,

11+

listGoogleChatAccountIds,

12+

resolveDefaultGoogleChatAccountId,

13+

resolveGoogleChatConfigAccessorAccount,

14+

resolveGoogleChatAccount,

15+

type ResolvedGoogleChatAccount,

16+

} from "./accounts.js";

17+

import { googlechatSetupAdapter } from "./setup-core.js";

18+

import { googlechatSetupWizard } from "./setup-surface.js";

19+20+

export const GOOGLECHAT_CHANNEL_ID = "googlechat" as const;

21+22+

export const googlechatMeta = {

23+

id: GOOGLECHAT_CHANNEL_ID,

24+

label: "Google Chat",

25+

selectionLabel: "Google Chat (Chat API)",

26+

docsPath: "/channels/googlechat",

27+

docsLabel: "googlechat",

28+

blurb: "Google Workspace Chat app with HTTP webhook.",

29+

aliases: ["gchat", "google-chat"],

30+

order: 55,

31+

detailLabel: "Google Chat",

32+

systemImage: "message.badge",

33+

markdownCapable: true,

34+

};

35+36+

export const formatGoogleChatAllowFromEntry = (entry: string) =>

37+

normalizeLowercaseStringOrEmpty(

38+

entry

39+

.trim()

40+

.replace(/^(googlechat|google-chat|gchat):/i, "")

41+

.replace(/^user:/i, "")

42+

.replace(/^users\//i, ""),

43+

);

44+45+

const googleChatConfigAdapter = createScopedChannelConfigAdapter<

46+

ResolvedGoogleChatAccount,

47+

GoogleChatConfigAccessorAccount

48+

>({

49+

sectionKey: GOOGLECHAT_CHANNEL_ID,

50+

listAccountIds: listGoogleChatAccountIds,

51+

resolveAccount: adaptScopedAccountAccessor(resolveGoogleChatAccount),

52+

resolveAccessorAccount: resolveGoogleChatConfigAccessorAccount,

53+

defaultAccountId: resolveDefaultGoogleChatAccountId,

54+

clearBaseFields: [

55+

"serviceAccount",

56+

"serviceAccountFile",

57+

"audienceType",

58+

"audience",

59+

"webhookPath",

60+

"webhookUrl",

61+

"botUser",

62+

"name",

63+

],

64+

resolveAllowFrom: (account) => account.config.dm?.allowFrom,

65+

formatAllowFrom: (allowFrom) =>

66+

formatNormalizedAllowFromEntries({

67+

allowFrom,

68+

normalizeEntry: formatGoogleChatAllowFromEntry,

69+

}),

70+

resolveDefaultTo: (account) => account.config.defaultTo,

71+

});

72+73+

type GoogleChatPluginBase = Pick<

74+

ChannelPlugin<ResolvedGoogleChatAccount>,

75+

| "id"

76+

| "meta"

77+

| "setup"

78+

| "setupWizard"

79+

| "capabilities"

80+

| "streaming"

81+

| "reload"

82+

| "configSchema"

83+

| "config"

84+

>;

85+86+

export function createGoogleChatPluginBase(

87+

params: {

88+

configSchema?: ChannelPlugin<ResolvedGoogleChatAccount>["configSchema"];

89+

} = {},

90+

): GoogleChatPluginBase {

91+

return {

92+

id: GOOGLECHAT_CHANNEL_ID,

93+

meta: { ...googlechatMeta },

94+

setup: googlechatSetupAdapter,

95+

setupWizard: googlechatSetupWizard,

96+

capabilities: {

97+

chatTypes: ["direct", "group", "thread"],

98+

reactions: true,

99+

threads: true,

100+

media: true,

101+

nativeCommands: false,

102+

blockStreaming: true,

103+

},

104+

streaming: {

105+

blockStreamingCoalesceDefaults: { minChars: 1500, idleMs: 1000 },

106+

},

107+

reload: { configPrefixes: ["channels.googlechat"] },

108+

...(params.configSchema ? { configSchema: params.configSchema } : {}),

109+

config: {

110+

...googleChatConfigAdapter,

111+

isConfigured: (account) => account.credentialSource !== "none",

112+

describeAccount: (account) =>

113+

describeAccountSnapshot({

114+

account,

115+

configured: account.credentialSource !== "none",

116+

extra: {

117+

credentialSource: account.credentialSource,

118+

},

119+

}),

120+

},

121+

};

122+

}