@openclaw/googlechat 2026.6.2-beta.1 → 2026.6.5-beta.2

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.
@@ -1,7 +1,6 @@
1
- import { c as resolveGoogleChatAccount, o as listEnabledGoogleChatAccounts } from "./channel-base-DpPD0ef1.js";
1
+ import { l as resolveGoogleChatAccount, o as listEnabledGoogleChatAccounts } from "./channel-base-Qh87GFW_.js";
2
+ import { b as uploadGoogleChatAttachment, d as resolveGoogleChatOutboundSpace, f as createGoogleChatReaction, g as listGoogleChatReactions, m as deleteGoogleChatReaction, v as sendGoogleChatMessage } from "./channel.adapters-BQoq1F4R.js";
2
3
  import { P as getGoogleChatRuntime } from "./runtime-api-BbVoWRxq.js";
3
- import { c as sendGoogleChatMessage, o as listGoogleChatReactions, r as deleteGoogleChatReaction, t as createGoogleChatReaction, u as uploadGoogleChatAttachment } from "./api-DPvlxpWa.js";
4
- import { d as resolveGoogleChatOutboundSpace } from "./channel.adapters-LlD3wKl5.js";
5
4
  import { extractToolSend } from "openclaw/plugin-sdk/tool-send";
6
5
  import { createActionGate, jsonResult, readPositiveIntegerParam, readReactionParams, readStringParam } from "openclaw/plugin-sdk/channel-actions";
7
6
  import { loadOutboundMediaFromUrl } from "openclaw/plugin-sdk/outbound-media";
package/dist/api.js CHANGED
@@ -1,3 +1,3 @@
1
- import { a as googlechatSetupAdapter, i as googlechatSetupWizard } from "./channel-base-DpPD0ef1.js";
2
- import { t as googlechatPlugin } from "./channel-AbgtAg3y.js";
1
+ import { a as googlechatSetupAdapter, i as googlechatSetupWizard } from "./channel-base-Qh87GFW_.js";
2
+ import { t as googlechatPlugin } from "./channel-BY9hwCh2.js";
3
3
  export { googlechatPlugin, googlechatSetupAdapter, googlechatSetupWizard };
@@ -0,0 +1,27 @@
1
+ import { l as resolveGoogleChatAccount } from "./channel-base-Qh87GFW_.js";
2
+ import { l as isGoogleChatUserTarget, u as normalizeGoogleChatTarget } from "./channel.adapters-BQoq1F4R.js";
3
+ import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
4
+ import { createResolvedApproverActionAuthAdapter, resolveApprovalApprovers } from "openclaw/plugin-sdk/approval-auth-runtime";
5
+ //#region extensions/googlechat/src/approval-auth.ts
6
+ function normalizeGoogleChatApproverId(value) {
7
+ const normalized = normalizeGoogleChatTarget(String(value));
8
+ if (!normalized || !isGoogleChatUserTarget(normalized)) return;
9
+ const suffix = normalizeLowercaseStringOrEmpty(normalized.slice(6));
10
+ if (!suffix || suffix.includes("@")) return;
11
+ return `users/${suffix}`;
12
+ }
13
+ function getGoogleChatApprovalApprovers(params) {
14
+ const account = resolveGoogleChatAccount(params).config;
15
+ return resolveApprovalApprovers({
16
+ allowFrom: account.dm?.allowFrom,
17
+ defaultTo: account.defaultTo,
18
+ normalizeApprover: normalizeGoogleChatApproverId
19
+ });
20
+ }
21
+ const googleChatApprovalAuth = createResolvedApproverActionAuthAdapter({
22
+ channelLabel: "Google Chat",
23
+ resolveApprovers: getGoogleChatApprovalApprovers,
24
+ normalizeSenderId: (value) => normalizeGoogleChatApproverId(value)
25
+ });
26
+ //#endregion
27
+ export { googleChatApprovalAuth as n, normalizeGoogleChatApproverId as r, getGoogleChatApprovalApprovers as t };
@@ -0,0 +1,272 @@
1
+ import { l as resolveGoogleChatAccount } from "./channel-base-Qh87GFW_.js";
2
+ import { A as registerGoogleChatManualApprovalFollowupSuppression, C as buildGoogleChatApprovalActionParameters, E as createGoogleChatApprovalToken, M as unregisterGoogleChatApprovalCardBindings, N as unregisterGoogleChatManualApprovalFollowupSuppression, S as GOOGLECHAT_APPROVAL_ACTION, d as resolveGoogleChatOutboundSpace, k as registerGoogleChatApprovalCardBinding, v as sendGoogleChatMessage, y as updateGoogleChatMessage } from "./channel.adapters-BQoq1F4R.js";
3
+ import { n as isGoogleChatNativeApprovalClientEnabled, r as shouldHandleGoogleChatNativeApprovalRequest } from "./channel-BY9hwCh2.js";
4
+ import { buildChannelApprovalNativeTargetKey } from "openclaw/plugin-sdk/approval-native-runtime";
5
+ import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
6
+ import { createChannelApprovalNativeRuntimeAdapter } from "openclaw/plugin-sdk/approval-handler-runtime";
7
+ import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env";
8
+ //#region extensions/googlechat/src/approval-handler.runtime.ts
9
+ const log = createSubsystemLogger("googlechat/approvals");
10
+ const GOOGLECHAT_APPROVAL_CARD_ID = "openclaw-approval";
11
+ const MAX_TEXT_PARAGRAPH_CHARS = 1800;
12
+ function resolveHandlerAccount(params) {
13
+ const account = params.context?.account ?? resolveGoogleChatAccount({
14
+ cfg: params.cfg,
15
+ accountId: params.accountId
16
+ });
17
+ if (!account.enabled || account.credentialSource === "none") return null;
18
+ return account;
19
+ }
20
+ function escapeGoogleChatText(text) {
21
+ return text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
22
+ }
23
+ function truncateText(text, maxChars = MAX_TEXT_PARAGRAPH_CHARS) {
24
+ return text.length <= maxChars ? text : `${text.slice(0, maxChars - 3)}...`;
25
+ }
26
+ function buildMetadataText(metadata) {
27
+ return metadata.map((item) => `<b>${escapeGoogleChatText(item.label)}:</b> ${escapeGoogleChatText(item.value)}`).join("<br>");
28
+ }
29
+ function formatDecision(decision) {
30
+ return decision === "allow-once" ? "Allowed once" : decision === "allow-always" ? "Allowed always" : "Denied";
31
+ }
32
+ function buildMainTextWidget(text) {
33
+ return { textParagraph: { text: escapeGoogleChatText(truncateText(text)) } };
34
+ }
35
+ function buildHtmlTextWidget(text) {
36
+ return { textParagraph: { text: truncateText(text) } };
37
+ }
38
+ function buildExecPendingSections(view) {
39
+ if (view.approvalKind !== "exec") return [];
40
+ return [{
41
+ header: "Command",
42
+ widgets: [buildMainTextWidget(view.commandText)]
43
+ }, ...view.commandPreview && view.commandPreview !== view.commandText ? [{
44
+ header: "Preview",
45
+ widgets: [buildMainTextWidget(view.commandPreview)]
46
+ }] : []];
47
+ }
48
+ function buildPluginPendingSections(view) {
49
+ if (view.approvalKind !== "plugin") return [];
50
+ return [{
51
+ header: "Request",
52
+ widgets: [buildHtmlTextWidget(`<b>${escapeGoogleChatText(view.title)}</b>${view.description ? `<br>${escapeGoogleChatText(view.description)}` : ""}`)]
53
+ }];
54
+ }
55
+ function buildMetadataSection(view) {
56
+ const metadata = [{
57
+ label: "Approval ID",
58
+ value: view.approvalId
59
+ }, ...view.metadata];
60
+ return metadata.length > 0 ? [{
61
+ header: "Details",
62
+ widgets: [buildHtmlTextWidget(buildMetadataText(metadata))]
63
+ }] : [];
64
+ }
65
+ function buildActionSection(params) {
66
+ const { actionFunction, view } = params;
67
+ const actionTokens = view.actions.map((action) => ({
68
+ token: createGoogleChatApprovalToken(),
69
+ decision: action.decision
70
+ }));
71
+ return {
72
+ actionTokens,
73
+ section: { widgets: [{ buttonList: { buttons: view.actions.map((action, index) => {
74
+ const actionToken = actionTokens[index];
75
+ if (!actionToken) throw new Error("Google Chat approval action token missing.");
76
+ return {
77
+ text: action.label,
78
+ onClick: { action: {
79
+ function: actionFunction,
80
+ parameters: buildGoogleChatApprovalActionParameters(actionToken.token),
81
+ loadIndicator: "SPINNER"
82
+ } }
83
+ };
84
+ }) } }] }
85
+ };
86
+ }
87
+ function buildPendingPayload(params) {
88
+ const { actionFunction, nowMs, view } = params;
89
+ const { section: actionSection, actionTokens } = buildActionSection({
90
+ actionFunction,
91
+ view
92
+ });
93
+ const card = {
94
+ cardId: GOOGLECHAT_APPROVAL_CARD_ID,
95
+ card: {
96
+ header: {
97
+ title: view.approvalKind === "plugin" ? "Plugin Approval Required" : "Exec Approval Required",
98
+ subtitle: `Expires in ${Math.max(0, Math.ceil((view.expiresAtMs - nowMs) / 1e3))}s`
99
+ },
100
+ sections: [
101
+ ...buildExecPendingSections(view),
102
+ ...buildPluginPendingSections(view),
103
+ ...buildMetadataSection(view),
104
+ actionSection
105
+ ]
106
+ }
107
+ };
108
+ return {
109
+ approvalId: view.approvalId,
110
+ approvalKind: view.approvalKind,
111
+ expiresAtMs: view.expiresAtMs,
112
+ cardsV2: [card],
113
+ actionTokens,
114
+ allowedDecisions: view.actions.map((action) => action.decision)
115
+ };
116
+ }
117
+ function resolveApprovalActionFunction(params) {
118
+ const account = resolveHandlerAccount(params);
119
+ const audience = normalizeOptionalString(account?.config.audience);
120
+ const appPrincipal = normalizeOptionalString(account?.config.appPrincipal);
121
+ return account?.config.audienceType === "app-url" && audience && appPrincipal ? audience : GOOGLECHAT_APPROVAL_ACTION;
122
+ }
123
+ function buildResolvedPayload(view) {
124
+ const resolvedBy = normalizeOptionalString(view.resolvedBy);
125
+ return { cardsV2: [{
126
+ cardId: GOOGLECHAT_APPROVAL_CARD_ID,
127
+ card: {
128
+ header: {
129
+ title: `${view.approvalKind === "plugin" ? "Plugin" : "Exec"} Approval: ${formatDecision(view.decision)}`,
130
+ subtitle: resolvedBy ? `Resolved by ${resolvedBy}` : "Resolved"
131
+ },
132
+ sections: buildMetadataSection(view)
133
+ }
134
+ }] };
135
+ }
136
+ function buildExpiredPayload(view) {
137
+ return { cardsV2: [{
138
+ cardId: GOOGLECHAT_APPROVAL_CARD_ID,
139
+ card: {
140
+ header: {
141
+ title: `${view.approvalKind === "plugin" ? "Plugin" : "Exec"} Approval Expired`,
142
+ subtitle: "This approval request expired before it was resolved."
143
+ },
144
+ sections: buildMetadataSection(view)
145
+ }
146
+ }] };
147
+ }
148
+ const googleChatApprovalNativeRuntime = createChannelApprovalNativeRuntimeAdapter({
149
+ eventKinds: ["exec", "plugin"],
150
+ availability: {
151
+ isConfigured: ({ cfg, accountId }) => isGoogleChatNativeApprovalClientEnabled({
152
+ cfg,
153
+ accountId
154
+ }),
155
+ shouldHandle: ({ cfg, accountId, request }) => shouldHandleGoogleChatNativeApprovalRequest({
156
+ cfg,
157
+ accountId,
158
+ request
159
+ })
160
+ },
161
+ presentation: {
162
+ buildPendingPayload: ({ cfg, accountId, context, nowMs, view }) => buildPendingPayload({
163
+ actionFunction: resolveApprovalActionFunction({
164
+ cfg,
165
+ accountId,
166
+ context
167
+ }),
168
+ nowMs,
169
+ view
170
+ }),
171
+ buildResolvedResult: ({ view }) => ({
172
+ kind: "update",
173
+ payload: buildResolvedPayload(view)
174
+ }),
175
+ buildExpiredResult: ({ view }) => ({
176
+ kind: "update",
177
+ payload: buildExpiredPayload(view)
178
+ })
179
+ },
180
+ transport: {
181
+ prepareTarget: ({ plannedTarget }) => ({
182
+ dedupeKey: buildChannelApprovalNativeTargetKey(plannedTarget.target),
183
+ target: {
184
+ to: plannedTarget.target.to,
185
+ threadName: plannedTarget.target.threadId != null ? String(plannedTarget.target.threadId) : void 0
186
+ }
187
+ }),
188
+ deliverPending: async ({ cfg, accountId, context, preparedTarget, pendingPayload }) => {
189
+ const account = resolveHandlerAccount({
190
+ cfg,
191
+ accountId,
192
+ context
193
+ });
194
+ if (!account) return null;
195
+ const spaceName = await resolveGoogleChatOutboundSpace({
196
+ account,
197
+ target: preparedTarget.to
198
+ });
199
+ registerGoogleChatManualApprovalFollowupSuppression({
200
+ approvalId: pendingPayload.approvalId,
201
+ approvalKind: pendingPayload.approvalKind,
202
+ allowedDecisions: pendingPayload.allowedDecisions,
203
+ expiresAtMs: pendingPayload.expiresAtMs
204
+ });
205
+ let sent;
206
+ try {
207
+ sent = await sendGoogleChatMessage({
208
+ account,
209
+ space: spaceName,
210
+ cardsV2: pendingPayload.cardsV2,
211
+ thread: preparedTarget.threadName
212
+ });
213
+ } catch (error) {
214
+ unregisterGoogleChatManualApprovalFollowupSuppression(pendingPayload.approvalId);
215
+ throw error;
216
+ }
217
+ if (!sent?.messageName) {
218
+ unregisterGoogleChatManualApprovalFollowupSuppression(pendingPayload.approvalId);
219
+ return null;
220
+ }
221
+ return {
222
+ accountId: account.accountId,
223
+ spaceName,
224
+ messageName: sent.messageName,
225
+ ...preparedTarget.threadName ? { threadName: preparedTarget.threadName } : {},
226
+ actionTokens: pendingPayload.actionTokens
227
+ };
228
+ },
229
+ updateEntry: async ({ cfg, accountId, context, entry, payload }) => {
230
+ const account = resolveHandlerAccount({
231
+ cfg,
232
+ accountId,
233
+ context
234
+ });
235
+ if (!account) return;
236
+ await updateGoogleChatMessage({
237
+ account,
238
+ messageName: entry.messageName,
239
+ cardsV2: payload.cardsV2
240
+ });
241
+ }
242
+ },
243
+ interactions: {
244
+ bindPending: ({ entry, request, approvalKind, view, pendingPayload }) => {
245
+ const tokens = [];
246
+ for (const actionToken of entry.actionTokens) if (registerGoogleChatApprovalCardBinding({
247
+ token: actionToken.token,
248
+ accountId: entry.accountId,
249
+ approvalId: request.id,
250
+ approvalKind,
251
+ decision: actionToken.decision,
252
+ allowedDecisions: pendingPayload.allowedDecisions,
253
+ spaceName: entry.spaceName,
254
+ messageName: entry.messageName,
255
+ threadName: entry.threadName ?? null,
256
+ expiresAtMs: view.expiresAtMs
257
+ })) tokens.push(actionToken.token);
258
+ return tokens.length > 0 ? tokens : null;
259
+ },
260
+ unbindPending: ({ binding }) => {
261
+ unregisterGoogleChatApprovalCardBindings(binding);
262
+ },
263
+ cancelDelivered: ({ entry }) => {
264
+ unregisterGoogleChatApprovalCardBindings(entry.actionTokens.map((actionToken) => actionToken.token));
265
+ }
266
+ },
267
+ observe: { onDeliveryError: ({ error, request }) => {
268
+ log.error(`googlechat approvals: failed to send request ${request.id}: ${String(error)}`);
269
+ } }
270
+ });
271
+ //#endregion
272
+ export { googleChatApprovalNativeRuntime };
@@ -1,6 +1,7 @@
1
- import { c as resolveGoogleChatAccount, n as createGoogleChatPluginBase, s as listGoogleChatAccountIds, t as GOOGLECHAT_CHANNEL_ID } from "./channel-base-DpPD0ef1.js";
1
+ import { c as resolveDefaultGoogleChatAccountId, l as resolveGoogleChatAccount, n as createGoogleChatPluginBase, s as listGoogleChatAccountIds, t as GOOGLECHAT_CHANNEL_ID } from "./channel-base-Qh87GFW_.js";
2
+ import { a as googlechatPairingTextAdapter, c as isGoogleChatSpaceTarget, i as googlechatOutboundAdapter, l as isGoogleChatUserTarget, n as googlechatGroupsAdapter, o as googlechatSecurityAdapter, r as googlechatMessageAdapter, s as googlechatThreadingAdapter, t as googlechatDirectoryAdapter, u as normalizeGoogleChatTarget } from "./channel.adapters-BQoq1F4R.js";
2
3
  import { a as buildChannelConfigSchema, r as GoogleChatConfigSchema, t as DEFAULT_ACCOUNT_ID } from "./runtime-api-BbVoWRxq.js";
3
- import { a as googlechatPairingTextAdapter, c as isGoogleChatSpaceTarget, i as googlechatOutboundAdapter, l as isGoogleChatUserTarget, n as googlechatGroupsAdapter, o as googlechatSecurityAdapter, r as googlechatMessageAdapter, s as googlechatThreadingAdapter, t as googlechatDirectoryAdapter, u as normalizeGoogleChatTarget } from "./channel.adapters-LlD3wKl5.js";
4
+ import { n as googleChatApprovalAuth, r as normalizeGoogleChatApproverId, t as getGoogleChatApprovalApprovers } from "./approval-auth-C-vWY4bY.js";
4
5
  import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-BcEqUZ4j.js";
5
6
  import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-lCMHqumt.js";
6
7
  import { createChatChannelPlugin } from "openclaw/plugin-sdk/channel-core";
@@ -8,33 +9,140 @@ import { buildPassiveProbedChannelStatusSummary } from "openclaw/plugin-sdk/exte
8
9
  import { createLazyRuntimeNamedExport } from "openclaw/plugin-sdk/lazy-runtime";
9
10
  import { createComputedAccountStatusAdapter, createDefaultChannelRuntimeState } from "openclaw/plugin-sdk/status-helpers";
10
11
  import { extractToolSend } from "openclaw/plugin-sdk/tool-send";
11
- import { createResolvedApproverActionAuthAdapter, resolveApprovalApprovers } from "openclaw/plugin-sdk/approval-auth-runtime";
12
- import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
12
+ import { createApproverRestrictedNativeApprovalCapability, splitChannelApprovalCapability } from "openclaw/plugin-sdk/approval-delivery-runtime";
13
+ import { CHANNEL_APPROVAL_NATIVE_RUNTIME_CONTEXT_CAPABILITY, createLazyChannelApprovalNativeRuntimeAdapter } from "openclaw/plugin-sdk/approval-handler-adapter-runtime";
14
+ import { createChannelApproverDmTargetResolver, createChannelNativeOriginTargetResolver, createNativeApprovalChannelRouteGates, shouldSuppressLocalNativeExecApprovalPrompt } from "openclaw/plugin-sdk/approval-native-runtime";
15
+ import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
13
16
  import { createAccountStatusSink, runPassiveAccountLifecycle } from "openclaw/plugin-sdk/channel-outbound";
14
17
  import { createDangerousNameMatchingMutableAllowlistWarningCollector } from "openclaw/plugin-sdk/channel-policy";
15
- //#region extensions/googlechat/src/approval-auth.ts
16
- function normalizeGoogleChatApproverId(value) {
17
- const normalized = normalizeGoogleChatTarget(String(value));
18
- if (!normalized || !isGoogleChatUserTarget(normalized)) return;
19
- const suffix = normalizeLowercaseStringOrEmpty(normalized.slice(6));
20
- if (!suffix || suffix.includes("@")) return;
21
- return `users/${suffix}`;
18
+ import { registerChannelRuntimeContext } from "openclaw/plugin-sdk/channel-runtime-context";
19
+ //#region extensions/googlechat/src/approval-native.ts
20
+ const DEFAULT_APPROVAL_FORWARDING_MODE = "session";
21
+ function isGoogleChatAccountConfigured(params) {
22
+ const account = resolveGoogleChatAccount(params);
23
+ return account.enabled && account.credentialSource !== "none";
22
24
  }
23
- const googleChatApprovalAuth = createResolvedApproverActionAuthAdapter({
25
+ function hasGoogleChatWebhookApprovalAuthConfig(params) {
26
+ const account = resolveGoogleChatAccount(params).config;
27
+ if (!normalizeOptionalString(account.audience)) return false;
28
+ if (account.audienceType === "project-number") return true;
29
+ return account.audienceType === "app-url";
30
+ }
31
+ function isGoogleChatApprovalTransportEnabled(params) {
32
+ return isGoogleChatAccountConfigured(params) && hasGoogleChatWebhookApprovalAuthConfig(params);
33
+ }
34
+ function normalizeGoogleChatForwardTarget(target) {
35
+ if (normalizeLowercaseStringOrEmpty(target.channel) !== "googlechat") return null;
36
+ const to = normalizeGoogleChatTarget(target.to);
37
+ return to ? {
38
+ to,
39
+ accountId: normalizeOptionalString(target.accountId),
40
+ threadId: target.threadId ?? null
41
+ } : null;
42
+ }
43
+ function resolveTurnSourceGoogleChatOriginTarget(request) {
44
+ if (normalizeLowercaseStringOrEmpty(request.request.turnSourceChannel) !== "googlechat") return null;
45
+ const target = normalizeGoogleChatTarget(request.request.turnSourceTo ?? "");
46
+ if (!target || !isGoogleChatSpaceTarget(target)) return null;
47
+ return {
48
+ to: target,
49
+ accountId: normalizeOptionalString(request.request.turnSourceAccountId),
50
+ threadId: request.request.turnSourceThreadId ?? null
51
+ };
52
+ }
53
+ const googleChatApprovalRouteGates = createNativeApprovalChannelRouteGates({
54
+ channel: "googlechat",
55
+ defaultForwardingMode: DEFAULT_APPROVAL_FORWARDING_MODE,
56
+ isTransportEnabled: isGoogleChatApprovalTransportEnabled,
57
+ listAccountIds: listGoogleChatAccountIds,
58
+ resolveDefaultAccountId: resolveDefaultGoogleChatAccountId,
59
+ normalizeForwardTarget: normalizeGoogleChatForwardTarget,
60
+ resolveTurnSourceTarget: resolveTurnSourceGoogleChatOriginTarget
61
+ });
62
+ function isGoogleChatNativeApprovalClientEnabled(params) {
63
+ return googleChatApprovalRouteGates.canAnyApprovalPotentiallyRouteToChannel({
64
+ ...params,
65
+ nativeSessionOnly: true
66
+ }) && getGoogleChatApprovalApprovers(params).length > 0;
67
+ }
68
+ function resolveSessionGoogleChatOriginTarget(sessionTarget) {
69
+ const target = normalizeGoogleChatTarget(sessionTarget.to);
70
+ return target && isGoogleChatSpaceTarget(target) ? {
71
+ to: target,
72
+ threadId: sessionTarget.threadId ?? null
73
+ } : null;
74
+ }
75
+ function shouldHandleGoogleChatNativeApprovalRequest(params) {
76
+ return googleChatApprovalRouteGates.shouldHandleApprovalRequest(params) && getGoogleChatApprovalApprovers(params).length > 0 && Boolean(resolveTurnSourceGoogleChatOriginTarget(params.request));
77
+ }
78
+ function shouldSuppressLocalGoogleChatExecApprovalPrompt(params) {
79
+ return shouldSuppressLocalNativeExecApprovalPrompt({
80
+ ...params,
81
+ isNativeDeliveryEnabled: isGoogleChatNativeApprovalClientEnabled
82
+ });
83
+ }
84
+ const googleChatApprovalCapability = createApproverRestrictedNativeApprovalCapability({
85
+ channel: "googlechat",
24
86
  channelLabel: "Google Chat",
25
- resolveApprovers: ({ cfg, accountId }) => {
26
- const account = resolveGoogleChatAccount({
87
+ describeExecApprovalSetup: ({ accountId }) => {
88
+ const prefix = accountId && accountId !== "default" ? `channels.googlechat.accounts.${accountId}` : "channels.googlechat";
89
+ return `Approve it from the Web UI or terminal UI for now. Google Chat supports native approvals for this account when the webhook and service account are configured. Configure \`${prefix}.dm.allowFrom\` or \`${prefix}.defaultTo\` with numeric \`users/{id}\` approvers.`;
90
+ },
91
+ listAccountIds: listGoogleChatAccountIds,
92
+ hasApprovers: ({ cfg, accountId }) => getGoogleChatApprovalApprovers({
93
+ cfg,
94
+ accountId
95
+ }).length > 0,
96
+ isExecAuthorizedSender: ({ cfg, accountId, senderId }) => googleChatApprovalAuth.authorizeActorAction?.({
97
+ cfg,
98
+ accountId,
99
+ senderId,
100
+ action: "approve",
101
+ approvalKind: "exec"
102
+ })?.authorized ?? false,
103
+ isPluginAuthorizedSender: ({ cfg, accountId, senderId }) => googleChatApprovalAuth.authorizeActorAction?.({
104
+ cfg,
105
+ accountId,
106
+ senderId,
107
+ action: "approve",
108
+ approvalKind: "plugin"
109
+ })?.authorized ?? false,
110
+ isNativeDeliveryEnabled: isGoogleChatNativeApprovalClientEnabled,
111
+ resolveNativeDeliveryMode: () => "channel",
112
+ requireMatchingTurnSourceChannel: true,
113
+ resolveSuppressionAccountId: ({ target, request }) => normalizeOptionalString(target.accountId) ?? normalizeOptionalString(request.request.turnSourceAccountId),
114
+ resolveOriginTarget: createChannelNativeOriginTargetResolver({
115
+ channel: "googlechat",
116
+ shouldHandleRequest: shouldHandleGoogleChatNativeApprovalRequest,
117
+ resolveTurnSourceTarget: resolveTurnSourceGoogleChatOriginTarget,
118
+ resolveSessionTarget: resolveSessionGoogleChatOriginTarget
119
+ }),
120
+ resolveApproverDmTargets: createChannelApproverDmTargetResolver({
121
+ shouldHandleRequest: shouldHandleGoogleChatNativeApprovalRequest,
122
+ resolveApprovers: getGoogleChatApprovalApprovers,
123
+ mapApprover: (approver, params) => {
124
+ const to = normalizeGoogleChatApproverId(approver);
125
+ return to ? {
126
+ to,
127
+ accountId: normalizeOptionalString(params.accountId)
128
+ } : null;
129
+ }
130
+ }),
131
+ nativeRuntime: createLazyChannelApprovalNativeRuntimeAdapter({
132
+ eventKinds: ["exec", "plugin"],
133
+ isConfigured: ({ cfg, accountId }) => isGoogleChatNativeApprovalClientEnabled({
27
134
  cfg,
28
135
  accountId
29
- }).config;
30
- return resolveApprovalApprovers({
31
- allowFrom: account.dm?.allowFrom,
32
- defaultTo: account.defaultTo,
33
- normalizeApprover: normalizeGoogleChatApproverId
34
- });
35
- },
36
- normalizeSenderId: (value) => normalizeGoogleChatApproverId(value)
136
+ }),
137
+ shouldHandle: ({ cfg, accountId, request }) => shouldHandleGoogleChatNativeApprovalRequest({
138
+ cfg,
139
+ accountId,
140
+ request
141
+ }),
142
+ load: async () => (await import("./approval-handler.runtime-CWeVJAQF.js")).googleChatApprovalNativeRuntime
143
+ })
37
144
  });
145
+ splitChannelApprovalCapability(googleChatApprovalCapability);
38
146
  //#endregion
39
147
  //#region extensions/googlechat/src/doctor.ts
40
148
  function asObjectRecord(value) {
@@ -74,7 +182,7 @@ const collectGoogleChatMutableAllowlistWarnings = createDangerousNameMatchingMut
74
182
  });
75
183
  //#endregion
76
184
  //#region extensions/googlechat/src/gateway.ts
77
- const loadGoogleChatChannelRuntime$1 = createLazyRuntimeNamedExport(() => import("./channel.runtime-C4eLDKR3.js"), "googleChatChannelRuntime");
185
+ const loadGoogleChatChannelRuntime$1 = createLazyRuntimeNamedExport(() => import("./channel.runtime-CbSK_Zox.js"), "googleChatChannelRuntime");
78
186
  async function startGoogleChatGatewayAccount(ctx) {
79
187
  const account = ctx.account;
80
188
  const statusSink = createAccountStatusSink({
@@ -90,6 +198,17 @@ async function startGoogleChatGatewayAccount(ctx) {
90
198
  audienceType: account.config.audienceType,
91
199
  audience: account.config.audience
92
200
  });
201
+ if (isGoogleChatNativeApprovalClientEnabled({
202
+ cfg: ctx.cfg,
203
+ accountId: account.accountId
204
+ })) registerChannelRuntimeContext({
205
+ channelRuntime: ctx.channelRuntime,
206
+ channelId: "googlechat",
207
+ accountId: account.accountId,
208
+ capability: CHANNEL_APPROVAL_NATIVE_RUNTIME_CONTEXT_CAPABILITY,
209
+ context: { account },
210
+ abortSignal: ctx.abortSignal
211
+ });
93
212
  await runPassiveAccountLifecycle({
94
213
  abortSignal: ctx.abortSignal,
95
214
  start: async () => await startGoogleChatMonitor({
@@ -114,7 +233,7 @@ async function startGoogleChatGatewayAccount(ctx) {
114
233
  }
115
234
  //#endregion
116
235
  //#region extensions/googlechat/src/channel.ts
117
- const loadGoogleChatChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-C4eLDKR3.js"), "googleChatChannelRuntime");
236
+ const loadGoogleChatChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-CbSK_Zox.js"), "googleChatChannelRuntime");
118
237
  const googlechatActions = {
119
238
  describeMessageTool: ({ cfg, accountId }) => {
120
239
  const accounts = accountId ? [resolveGoogleChatAccount({
@@ -134,7 +253,7 @@ const googlechatActions = {
134
253
  },
135
254
  extractToolSend: ({ args }) => extractToolSend(args, "sendMessage"),
136
255
  handleAction: async (ctx) => {
137
- const { googlechatMessageActions } = await import("./actions-DisAY2Ac.js");
256
+ const { googlechatMessageActions } = await import("./actions-DvYC089V.js");
138
257
  if (!googlechatMessageActions.handleAction) throw new Error("Google Chat actions are not available.");
139
258
  return await googlechatMessageActions.handleAction(ctx);
140
259
  }
@@ -142,7 +261,7 @@ const googlechatActions = {
142
261
  const googlechatPlugin = createChatChannelPlugin({
143
262
  base: {
144
263
  ...createGoogleChatPluginBase({ configSchema: buildChannelConfigSchema(GoogleChatConfigSchema) }),
145
- approvalCapability: googleChatApprovalAuth,
264
+ approvalCapability: googleChatApprovalCapability,
146
265
  secrets: {
147
266
  secretTargetRegistryEntries,
148
267
  collectRuntimeConfigAssignments
@@ -252,7 +371,18 @@ const googlechatPlugin = createChatChannelPlugin({
252
371
  pairing: { text: googlechatPairingTextAdapter },
253
372
  security: googlechatSecurityAdapter,
254
373
  threading: googlechatThreadingAdapter,
255
- outbound: googlechatOutboundAdapter
374
+ outbound: {
375
+ ...googlechatOutboundAdapter,
376
+ base: {
377
+ ...googlechatOutboundAdapter.base,
378
+ shouldSuppressLocalPayloadPrompt: ({ cfg, accountId, payload, hint }) => shouldSuppressLocalGoogleChatExecApprovalPrompt({
379
+ cfg,
380
+ accountId,
381
+ payload,
382
+ hint
383
+ })
384
+ }
385
+ }
256
386
  });
257
387
  //#endregion
258
- export { googlechatPlugin as t };
388
+ export { isGoogleChatNativeApprovalClientEnabled as n, shouldHandleGoogleChatNativeApprovalRequest as r, googlechatPlugin as t };
@@ -396,4 +396,4 @@ function createGoogleChatPluginBase(params = {}) {
396
396
  };
397
397
  }
398
398
  //#endregion
399
- export { googlechatSetupAdapter as a, resolveGoogleChatAccount as c, googlechatSetupWizard as i, createGoogleChatPluginBase as n, listEnabledGoogleChatAccounts as o, formatGoogleChatAllowFromEntry as r, listGoogleChatAccountIds as s, GOOGLECHAT_CHANNEL_ID as t };
399
+ export { googlechatSetupAdapter as a, resolveDefaultGoogleChatAccountId as c, googlechatSetupWizard as i, resolveGoogleChatAccount as l, createGoogleChatPluginBase as n, listEnabledGoogleChatAccounts as o, formatGoogleChatAllowFromEntry as r, listGoogleChatAccountIds as s, GOOGLECHAT_CHANNEL_ID as t };
@@ -1,2 +1,2 @@
1
- import { t as googlechatPlugin } from "./channel-AbgtAg3y.js";
1
+ import { t as googlechatPlugin } from "./channel-BY9hwCh2.js";
2
2
  export { googlechatPlugin };