@openclaw/googlechat 2026.7.2-beta.3 → 2026.7.2-beta.5

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.
Files changed (31) hide show
  1. package/README.md +1 -1
  2. package/dist/{actions-C9M27Xgq.js → actions-wnreW-IQ.js} +2 -2
  3. package/dist/api.js +2 -2
  4. package/dist/{approval-auth-DXkKpb-s.js → approval-auth-G-OFufNc.js} +3 -3
  5. package/dist/{approval-handler.runtime-DemP1cMx.js → approval-handler.runtime-BJXVLK9y.js} +3 -3
  6. package/dist/{channel-Bylft8ql.js → channel-CehfTiWZ.js} +13 -13
  7. package/dist/{channel-base-CuSSPg6I.js → channel-base-CC85hRUC.js} +92 -64
  8. package/dist/channel-plugin-api.js +1 -1
  9. package/dist/{channel.adapters-CAVl8EUt.js → channel.adapters-DLatFGZz.js} +289 -12
  10. package/dist/{channel.runtime-tLQQKXrg.js → channel.runtime-Bz0__ttC.js} +296 -112
  11. package/dist/directory-contract-api.js +1 -1
  12. package/dist/doctor-contract-BpuSvJro.js +115 -0
  13. package/dist/doctor-contract-api.js +1 -1
  14. package/dist/{secret-contract-ZFiLJ7Yn.js → secret-contract-BFYyuE0F.js} +7 -21
  15. package/dist/secret-contract-api.js +1 -1
  16. package/dist/setup-plugin-api.js +1 -1
  17. package/node_modules/gaxios/build/cjs/src/gaxios.js +1 -1
  18. package/node_modules/gaxios/build/cjs/src/gaxios.js.map +1 -1
  19. package/node_modules/gaxios/build/cjs/test/test.getch.js +66 -0
  20. package/node_modules/gaxios/build/cjs/test/test.getch.js.map +1 -1
  21. package/node_modules/gaxios/build/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  22. package/node_modules/gaxios/build/esm/src/gaxios.js +1 -1
  23. package/node_modules/gaxios/build/esm/src/gaxios.js.map +1 -1
  24. package/node_modules/gaxios/build/esm/test/test.getch.js +66 -0
  25. package/node_modules/gaxios/build/esm/test/test.getch.js.map +1 -1
  26. package/node_modules/gaxios/build/esm/tsconfig.tsbuildinfo +1 -1
  27. package/node_modules/gaxios/package.json +4 -4
  28. package/openclaw.plugin.json +403 -499
  29. package/package.json +81 -23
  30. package/dist/doctor-contract-CvhD0eoX.js +0 -167
  31. package/npm-shrinkwrap.json +0 -313
@@ -1,5 +1,5 @@
1
- import { l as resolveGoogleChatAccount, r as formatGoogleChatAllowFromEntry, u as MAX_GOOGLE_CHAT_SERVICE_ACCOUNT_FILE_BYTES } from "./channel-base-CuSSPg6I.js";
2
- import { d as fetchWithSsrFGuard$1, i as chunkTextForOutbound, m as missingTargetError, r as PAIRING_APPROVED_MESSAGE } from "./runtime-api-Dh0CNVS4.js";
1
+ import { l as resolveGoogleChatAccount, r as formatGoogleChatAllowFromEntry, u as MAX_GOOGLE_CHAT_SERVICE_ACCOUNT_FILE_BYTES } from "./channel-base-CC85hRUC.js";
2
+ import { d as fetchWithSsrFGuard$1, m as missingTargetError, r as PAIRING_APPROVED_MESSAGE } from "./runtime-api-Dh0CNVS4.js";
3
3
  import { buildChannelOutboundSessionRoute } from "openclaw/plugin-sdk/channel-core";
4
4
  import { createLazyRuntimeNamedExport } from "openclaw/plugin-sdk/lazy-runtime";
5
5
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
@@ -12,7 +12,7 @@ import crypto from "node:crypto";
12
12
  import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
13
13
  import { readProviderJsonResponse } from "openclaw/plugin-sdk/provider-http";
14
14
  import { createMessageReceiptFromOutboundResults, defineChannelMessageAdapter, sanitizeForPlainText } from "openclaw/plugin-sdk/channel-outbound";
15
- import { sanitizeAssistantVisibleText } from "openclaw/plugin-sdk/text-chunking";
15
+ import { FormatCapabilityProfile, markdownToIR, renderMarkdownIRChunksWithinLimit, renderMarkdownWithMarkers, sanitizeAssistantVisibleText } from "openclaw/plugin-sdk/text-chunking";
16
16
  import fs from "node:fs/promises";
17
17
  import { adaptScopedAccountAccessor } from "openclaw/plugin-sdk/channel-config-helpers";
18
18
  import { buildChannelGroupsScopeTree, composeAccountWarningCollectors, createAllowlistProviderOpenWarningCollector, resolveScopeRequireMention } from "openclaw/plugin-sdk/channel-policy";
@@ -867,6 +867,283 @@ async function resolveGoogleChatOutboundSessionRoute(params) {
867
867
  });
868
868
  }
869
869
  //#endregion
870
+ //#region extensions/googlechat/src/format.ts
871
+ const GOOGLE_CHAT_FORMAT_PROFILE = FormatCapabilityProfile.define({
872
+ mechanism: "markdown",
873
+ constructs: {
874
+ underline: "fallback",
875
+ spoiler: "fallback",
876
+ codeLanguage: "fallback",
877
+ heading: "fallback",
878
+ orderedList: "fallback",
879
+ taskList: "fallback",
880
+ table: "fallback",
881
+ image: "fallback",
882
+ mention: "strip"
883
+ },
884
+ chunk: {
885
+ limit: 32e3,
886
+ unit: "bytes"
887
+ }
888
+ });
889
+ const GOOGLE_CHAT_LITERAL_FALLBACKS = /* @__PURE__ */ new Map([
890
+ ["*", "*"],
891
+ ["_", "_"],
892
+ ["~", "~"],
893
+ ["`", "`"],
894
+ ["<", "<"],
895
+ [">", ">"],
896
+ ["\\", "\"],
897
+ ["-", "-"],
898
+ ["|", "|"]
899
+ ]);
900
+ function createPrivateMarkerGenerator(text) {
901
+ const used = /* @__PURE__ */ new Set();
902
+ let candidate = 0;
903
+ const rangeSize = 6400;
904
+ return () => {
905
+ while (true) {
906
+ const marker = String.fromCharCode(57344 + Math.floor(candidate / rangeSize), 57344 + candidate % rangeSize);
907
+ candidate += 1;
908
+ if (!used.has(marker) && !text.includes(marker)) {
909
+ used.add(marker);
910
+ return marker;
911
+ }
912
+ }
913
+ };
914
+ }
915
+ function createGoogleChatMarkers(text) {
916
+ const nextMarker = createPrivateMarkerGenerator(text);
917
+ return {
918
+ list: nextMarker(),
919
+ blockquoteOpen: nextMarker(),
920
+ blockquoteClose: nextMarker()
921
+ };
922
+ }
923
+ /** Removes unsafe HTML and internal scaffolding while retaining source Markdown for chunking. */
924
+ function sanitizeGoogleChatText(text) {
925
+ return sanitizeForPlainText(sanitizeAssistantVisibleText(text), { style: "markdown" });
926
+ }
927
+ function projectDecodedGoogleChatResources(ir) {
928
+ const characters = ir.text.split("");
929
+ let changed = false;
930
+ for (const match of ir.text.matchAll(/<(?:users|customEmojis)\/[^<>\s]+>/giu)) {
931
+ const start = match.index ?? 0;
932
+ characters[start] = "<";
933
+ characters[start + match[0].length - 1] = ">";
934
+ changed = true;
935
+ }
936
+ return changed ? {
937
+ ...ir,
938
+ text: characters.join("")
939
+ } : ir;
940
+ }
941
+ function projectGoogleChatLinkLabels(ir) {
942
+ const characters = ir.text.split("");
943
+ let changed = false;
944
+ for (const link of ir.links) {
945
+ const label = ir.text.slice(link.start, link.end);
946
+ const comparableHref = link.href.startsWith("mailto:") ? link.href.slice(7) : link.href;
947
+ if (label === link.href || label === comparableHref) continue;
948
+ for (let index = link.start; index < link.end; index += 1) {
949
+ const character = characters[index] ?? "";
950
+ const fallback = GOOGLE_CHAT_LITERAL_FALLBACKS.get(character);
951
+ if (fallback && /[<>|*_~`]/u.test(character)) {
952
+ characters[index] = fallback;
953
+ changed = true;
954
+ }
955
+ }
956
+ }
957
+ return changed ? {
958
+ ...ir,
959
+ text: characters.join("")
960
+ } : ir;
961
+ }
962
+ function markGoogleChatBulletLists(ir, markerToken) {
963
+ let text = ir.text;
964
+ for (const item of ir.listItems ?? []) {
965
+ const marker = item.listMarker;
966
+ if (item.kind !== "bullet" || !marker || text.slice(marker.start, marker.end) !== "• ") continue;
967
+ text = `${text.slice(0, marker.start)}${markerToken}${text.slice(marker.end)}`;
968
+ }
969
+ return text === ir.text ? ir : {
970
+ ...ir,
971
+ text
972
+ };
973
+ }
974
+ function projectUnsafeCodeFallbacks(ir) {
975
+ let text = ir.text;
976
+ const styles = ir.styles.filter((span) => {
977
+ const content = ir.text.slice(span.start, span.end);
978
+ const unsafe = span.style === "code" && content.includes("`") || span.style === "code_block" && content.includes("```");
979
+ if (unsafe) {
980
+ const replacement = content.split("").map((character) => GOOGLE_CHAT_LITERAL_FALLBACKS.get(character) ?? character).join("");
981
+ text = `${text.slice(0, span.start)}${replacement}${text.slice(span.end)}`;
982
+ }
983
+ return !unsafe;
984
+ });
985
+ return styles.length === ir.styles.length ? ir : {
986
+ ...ir,
987
+ styles,
988
+ text
989
+ };
990
+ }
991
+ function projectGoogleChatPlainLiterals(ir) {
992
+ const codeRanges = ir.styles.filter((span) => span.style === "code" || span.style === "code_block");
993
+ const inCode = (index) => codeRanges.some((span) => index >= span.start && index < span.end);
994
+ const inLink = (index) => ir.links.some((span) => index >= span.start && index < span.end);
995
+ const styleDelimiter = /* @__PURE__ */ new Map([
996
+ ["~", "strikethrough"],
997
+ ["_", "italic"],
998
+ ["*", "bold"],
999
+ ["`", "code"]
1000
+ ]);
1001
+ const characters = ir.text.split("");
1002
+ let lineStart = 0;
1003
+ while (lineStart < characters.length) {
1004
+ const nextNewline = characters.indexOf("\n", lineStart);
1005
+ const lineEnd = nextNewline < 0 ? characters.length : nextNewline;
1006
+ for (const delimiter of [
1007
+ "~",
1008
+ "_",
1009
+ "*",
1010
+ "`"
1011
+ ]) {
1012
+ const indexes = [];
1013
+ for (let index = lineStart; index < lineEnd; index += 1) if (characters[index] === delimiter && !inCode(index) && !inLink(index)) indexes.push(index);
1014
+ if (indexes.length === 0) continue;
1015
+ const renderedStyle = styleDelimiter.get(delimiter);
1016
+ const lineAddsDelimiter = ir.styles.some((span) => span.style === renderedStyle && span.start < lineEnd && span.end > lineStart);
1017
+ if (indexes.length >= 2 || lineAddsDelimiter) for (const index of indexes) characters[index] = GOOGLE_CHAT_LITERAL_FALLBACKS.get(delimiter) ?? delimiter;
1018
+ }
1019
+ let firstTextIndex = lineStart;
1020
+ while (firstTextIndex < lineEnd && characters[firstTextIndex] === " ") firstTextIndex += 1;
1021
+ if (firstTextIndex >= lineStart && !inCode(firstTextIndex)) {
1022
+ const character = characters[firstTextIndex];
1023
+ if ((character === "*" || character === "-") && characters[firstTextIndex + 1] === " " || character === ">") characters[firstTextIndex] = GOOGLE_CHAT_LITERAL_FALLBACKS.get(character) ?? character;
1024
+ }
1025
+ const line = characters.slice(lineStart, lineEnd).join("");
1026
+ for (const match of line.matchAll(/<[^<>\n]*\|[^<>\n]*>/gu)) {
1027
+ const open = lineStart + (match.index ?? 0);
1028
+ const close = open + match[0].length - 1;
1029
+ if (!inCode(open) && !inCode(close) && !inLink(open) && !inLink(close)) {
1030
+ characters[open] = "<";
1031
+ characters[close] = ">";
1032
+ }
1033
+ }
1034
+ lineStart = lineEnd + 1;
1035
+ }
1036
+ const text = characters.join("");
1037
+ return text === ir.text ? ir : {
1038
+ ...ir,
1039
+ text
1040
+ };
1041
+ }
1042
+ function emitGoogleChatLists(text, markerToken) {
1043
+ return text.split("\n").map((line) => {
1044
+ const markerIndex = line.indexOf(markerToken);
1045
+ if (markerIndex < 0) return line;
1046
+ const prefix = line.slice(0, markerIndex);
1047
+ const quote = /^(?:> )*/u.exec(prefix)?.[0] ?? "";
1048
+ const indent = prefix.slice(quote.length);
1049
+ return `${quote}${" ".repeat(indent.length * 2)}* ${line.slice(markerIndex + markerToken.length)}`;
1050
+ }).join("\n");
1051
+ }
1052
+ function emitGoogleChatBlockquotes(text, markers) {
1053
+ let depth = 0;
1054
+ let lineStart = true;
1055
+ let rendered = "";
1056
+ for (let index = 0; index < text.length; index += 1) {
1057
+ if (text.startsWith(markers.blockquoteOpen, index)) {
1058
+ depth += 1;
1059
+ index += markers.blockquoteOpen.length - 1;
1060
+ continue;
1061
+ }
1062
+ if (text.startsWith(markers.blockquoteClose, index)) {
1063
+ depth = Math.max(0, depth - 1);
1064
+ index += markers.blockquoteClose.length - 1;
1065
+ continue;
1066
+ }
1067
+ const character = text[index] ?? "";
1068
+ if (lineStart && depth > 0) rendered += "> ".repeat(depth);
1069
+ rendered += character;
1070
+ lineStart = character === "\n";
1071
+ }
1072
+ return rendered;
1073
+ }
1074
+ function prepareGoogleChatIR(text) {
1075
+ const ir = projectGoogleChatPlainLiterals(projectGoogleChatLinkLabels(projectDecodedGoogleChatResources(projectUnsafeCodeFallbacks(markdownToIR(sanitizeGoogleChatText(text), {
1076
+ enableSpoilers: true,
1077
+ enableTaskLists: true,
1078
+ headingStyle: "rich",
1079
+ tableMode: "bullets"
1080
+ })))));
1081
+ const markers = createGoogleChatMarkers(ir.text);
1082
+ return {
1083
+ ir: markGoogleChatBulletLists(ir, markers.list),
1084
+ markers
1085
+ };
1086
+ }
1087
+ function renderGoogleChatIR(ir, markers) {
1088
+ return emitGoogleChatLists(emitGoogleChatBlockquotes(renderMarkdownWithMarkers(ir, {
1089
+ styleMarkers: {
1090
+ bold: {
1091
+ open: "*",
1092
+ close: "*"
1093
+ },
1094
+ italic: {
1095
+ open: "_",
1096
+ close: "_"
1097
+ },
1098
+ strikethrough: {
1099
+ open: "~",
1100
+ close: "~"
1101
+ },
1102
+ code: {
1103
+ open: "`",
1104
+ close: "`"
1105
+ },
1106
+ code_block: {
1107
+ open: "```\n",
1108
+ close: "```"
1109
+ },
1110
+ blockquote: {
1111
+ open: markers.blockquoteOpen,
1112
+ close: markers.blockquoteClose
1113
+ }
1114
+ },
1115
+ escapeText: (value) => value,
1116
+ buildLink: (link, value, context) => {
1117
+ if (context.origin === "linkify") return null;
1118
+ const href = link.href.trim();
1119
+ const label = value.slice(link.start, link.end);
1120
+ if (!href || !label) return null;
1121
+ const labelHasStyles = ir.styles.some((span) => span.start < link.end && span.end > link.start);
1122
+ return /[<>|]/u.test(href) || /[<>|*_~`]/u.test(label) || labelHasStyles ? {
1123
+ start: link.start,
1124
+ end: link.end,
1125
+ open: "",
1126
+ close: ` (${href})`
1127
+ } : {
1128
+ start: link.start,
1129
+ end: link.end,
1130
+ open: `<${href}|`,
1131
+ close: ">"
1132
+ };
1133
+ }
1134
+ }, GOOGLE_CHAT_FORMAT_PROFILE), markers), markers.list);
1135
+ }
1136
+ /** Renders CommonMark into byte-bounded Google Chat app-message chunks. */
1137
+ function formatGoogleChatTextChunks(text, limit = GOOGLE_CHAT_FORMAT_PROFILE.chunk.limit) {
1138
+ const prepared = prepareGoogleChatIR(text);
1139
+ return renderMarkdownIRChunksWithinLimit({
1140
+ ir: prepared.ir,
1141
+ limit: Math.min(limit, GOOGLE_CHAT_FORMAT_PROFILE.chunk.limit),
1142
+ measureRendered: (rendered) => new TextEncoder().encode(rendered).byteLength,
1143
+ renderChunk: (chunk) => renderGoogleChatIR(chunk, prepared.markers)
1144
+ }).map((chunk) => chunk.rendered);
1145
+ }
1146
+ //#endregion
870
1147
  //#region extensions/googlechat/src/group-policy.ts
871
1148
  function buildGoogleChatGroupPolicyScope(params) {
872
1149
  const matchKey = params.groupId && Object.hasOwn(params.tree.scopes, params.groupId) ? params.groupId : void 0;
@@ -884,7 +1161,7 @@ function resolveGoogleChatGroupRequireMention(params) {
884
1161
  }
885
1162
  //#endregion
886
1163
  //#region extensions/googlechat/src/channel.adapters.ts
887
- const loadGoogleChatChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-tLQQKXrg.js"), "googleChatChannelRuntime");
1164
+ const loadGoogleChatChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-Bz0__ttC.js"), "googleChatChannelRuntime");
888
1165
  function createGoogleChatSendReceipt(params) {
889
1166
  const messageId = params.messageId?.trim();
890
1167
  return createMessageReceiptFromOutboundResults({
@@ -906,13 +1183,13 @@ const collectGoogleChatSecurityWarnings = composeAccountWarningCollectors(create
906
1183
  openBehavior: "allows any space to trigger (mention-gated)",
907
1184
  remediation: "Set channels.googlechat.groupPolicy=\"allowlist\" and configure channels.googlechat.groups"
908
1185
  }
909
- }), (account) => account.config.dm?.policy === "open" && "- Google Chat DMs are open to anyone. Set channels.googlechat.dm.policy=\"pairing\" or \"allowlist\".");
1186
+ }), (account) => account.config.dmPolicy === "open" && "- Google Chat DMs are open to anyone. Set channels.googlechat.dmPolicy=\"pairing\" or \"allowlist\".");
910
1187
  const googlechatGroupsAdapter = { resolveRequireMention: resolveGoogleChatGroupRequireMention };
911
1188
  const googlechatDirectoryAdapter = createChannelDirectoryAdapter({
912
1189
  listPeers: async (params) => listResolvedDirectoryUserEntriesFromAllowFrom({
913
1190
  ...params,
914
1191
  resolveAccount: adaptScopedAccountAccessor(resolveGoogleChatAccount),
915
- resolveAllowFrom: (account) => account.config.dm?.allowFrom,
1192
+ resolveAllowFrom: (account) => account.config.allowFrom,
916
1193
  normalizeId: (entry) => normalizeGoogleChatTarget(entry) ?? entry
917
1194
  }),
918
1195
  listGroups: async (params) => listResolvedDirectoryGroupEntriesFromMapKeys({
@@ -924,9 +1201,9 @@ const googlechatDirectoryAdapter = createChannelDirectoryAdapter({
924
1201
  const googlechatSecurityAdapter = {
925
1202
  dm: {
926
1203
  channelKey: "googlechat",
927
- resolvePolicy: (account) => account.config.dm?.policy,
928
- resolveAllowFrom: (account) => account.config.dm?.allowFrom,
929
- allowFromPathSuffix: "dm.",
1204
+ resolvePolicy: (account) => account.config.dmPolicy,
1205
+ resolveAllowFrom: (account) => account.config.allowFrom,
1206
+ allowFromPathSuffix: "",
930
1207
  normalizeEntry: (raw) => formatGoogleChatAllowFromEntry(raw)
931
1208
  },
932
1209
  collectWarnings: collectGoogleChatSecurityWarnings
@@ -981,10 +1258,10 @@ const googlechatPairingTextAdapter = {
981
1258
  const googlechatOutboundAdapter = {
982
1259
  base: {
983
1260
  deliveryMode: "direct",
984
- chunker: chunkTextForOutbound,
1261
+ chunker: (text, limit) => formatGoogleChatTextChunks(text, limit),
985
1262
  chunkerMode: "markdown",
986
- textChunkLimit: 4e3,
987
- sanitizeText: ({ text }) => sanitizeForPlainText(sanitizeAssistantVisibleText(text)),
1263
+ textChunkLimit: GOOGLE_CHAT_FORMAT_PROFILE.chunk.limit,
1264
+ sanitizeText: ({ text }) => sanitizeGoogleChatText(text),
988
1265
  normalizePayload: ({ payload }) => shouldSuppressGoogleChatManualExecApprovalFollowupPayload(payload) ? null : payload,
989
1266
  resolveTarget: ({ to }) => {
990
1267
  const trimmed = normalizeOptionalString(to) ?? "";