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

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