@openclaw/clickclack 2026.11.5 → 2026.11.10-beta.1

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,7 @@
1
- import { n as __reExport, t as __exportAll } from "./rolldown-runtime-BBjsoOtd.mjs";
2
- import { c as CLICKCLACK_CHANNEL_ID, d as DEFAULT_ACCOUNT_ID, f as isClickClackAccountCurrent, g as resolveClickClackAccountConfig, h as resolveClickClackAccount, l as clickClackConfigAdapter, m as listEnabledClickClackAccounts, n as clickClackSetupContract, s as clickClackConfigSchema, t as clickClackSetupWizard, u as clickClackMeta } from "./setup-surface-CSITttSD.mjs";
3
- import { a as createClickClackClient, i as ClickClackHttpError, n as resolveChannelId, r as resolveWorkspaceId, s as normalizeClickClackCorrelationId } from "./resolve-BgFJI_p4.mjs";
4
- import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-CF7TKtkU.mjs";
1
+ import { n as __reExport, t as __exportAll } from "./rolldown-runtime-782esTHO.mjs";
2
+ import { _ as resolveClickClackAccountConfig, c as CLICKCLACK_CHANNEL_ID, d as DEFAULT_ACCOUNT_ID, f as isClickClackAccountCurrent, g as resolveClickClackAccountAsync, l as clickClackConfigAdapter, m as listEnabledClickClackAccounts, n as clickClackSetupContract, p as listClickClackAccountIds, s as clickClackConfigSchema, t as clickClackSetupWizard, u as clickClackMeta, v as resolveClickClackAccountMetadata } from "./setup-surface-DSbHN_QA.mjs";
3
+ import { a as createClickClackClient, i as ClickClackHttpError, n as resolveChannelId, r as resolveWorkspaceId, s as normalizeClickClackCorrelationId } from "./resolve-qeIY2bou.mjs";
4
+ import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-Dj8nibUr.mjs";
5
5
  import { resolveChannelMediaMaxBytes } from "openclaw/plugin-sdk/account-helpers";
6
6
  import { parseDateStringTimestampMs } from "openclaw/plugin-sdk/number-runtime";
7
7
  import { mergePairLoopGuardConfig } from "openclaw/plugin-sdk/pair-loop-guard-runtime";
@@ -12,7 +12,7 @@ import { createComputedAccountStatusAdapter, createDefaultChannelRuntimeState }
12
12
  import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
13
13
  import { channelReadyPatch, channelStoppedPatch } from "openclaw/plugin-sdk/gateway-runtime";
14
14
  import { listNativeCommandSpecsForConfig } from "openclaw/plugin-sdk/native-command-registry";
15
- import { sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
15
+ import { createSubsystemLogger, sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
16
16
  import { safeParseJson, truncateCodePoints } from "openclaw/plugin-sdk/text-utility-runtime";
17
17
  import { rawDataToString } from "openclaw/plugin-sdk/webhook-ingress";
18
18
  import { startWebSocketKeepalive } from "openclaw/plugin-sdk/websocket-runtime";
@@ -32,7 +32,7 @@ import { extensionForMime } from "openclaw/plugin-sdk/media-mime";
32
32
  import { loadOutboundMediaFromUrl } from "openclaw/plugin-sdk/outbound-media";
33
33
  import { sanitizeAssistantVisibleText } from "openclaw/plugin-sdk/text-chunking";
34
34
  import { raceWithTimeout } from "openclaw/plugin-sdk/time-runtime";
35
- //#region src/channels/mention-gating.ts
35
+ // src/channels/mention-gating.ts
36
36
  function resolveBotThreadMentionPolicy(params) {
37
37
  if (!params.isBotOwnedThread || params.requireMentionInBotThreads === void 0) return {
38
38
  requireMention: params.requireMention,
@@ -43,13 +43,11 @@ function resolveBotThreadMentionPolicy(params) {
43
43
  implicitMentionKinds: params.requireMentionInBotThreads ? params.implicitMentionKinds?.filter((kind) => kind === "native") : params.implicitMentionKinds
44
44
  };
45
45
  }
46
- //#endregion
47
- //#region \0openclaw:bundled-sdk:openclaw/plugin-sdk/channel-mention-gating
46
+ // \0openclaw:bundled-sdk:openclaw/plugin-sdk/channel-mention-gating
48
47
  var channel_mention_gating_exports = /* @__PURE__ */ __exportAll({ resolveBotThreadMentionPolicy: () => resolveBotThreadMentionPolicy });
49
48
  import * as import_openclaw_plugin_sdk_channel_mention_gating from "openclaw/plugin-sdk/channel-mention-gating";
50
49
  __reExport(channel_mention_gating_exports, import_openclaw_plugin_sdk_channel_mention_gating);
51
- //#endregion
52
- //#region extensions/clickclack/src/discussions/binding-generation.ts
50
+ // extensions/clickclack/src/discussions/binding-generation.ts
53
51
  const GENERATION_STORE_OPTIONS = {
54
52
  namespace: "discussion-binding-generations",
55
53
  maxEntries: 1e4,
@@ -176,8 +174,7 @@ async function hasPendingDiscussionOpenForDestination(params) {
176
174
  const serverBaseUrl = params.serverBaseUrl.replace(/\/+$/u, "");
177
175
  return (await listPendingDiscussionOpens(params.runtime)).some((pending) => pending.serverBaseUrl === serverBaseUrl && pending.workspaceId === params.workspaceId);
178
176
  }
179
- //#endregion
180
- //#region extensions/clickclack/src/discussions/binding-store.ts
177
+ // extensions/clickclack/src/discussions/binding-store.ts
181
178
  /** Retained for the shipped synchronous ScopedSessionAccessProvider contract. */
182
179
  function bindingMatchesActiveSessionIncarnation(runtime, sessionKey, binding) {
183
180
  const entry = runtime.agent.session.getSessionEntry({
@@ -377,8 +374,7 @@ function getClickClackDiscussionBindingStore(runtime) {
377
374
  storesByRuntime$1.set(runtime, created);
378
375
  return created;
379
376
  }
380
- //#endregion
381
- //#region extensions/clickclack/src/discussions/naming.ts
377
+ // extensions/clickclack/src/discussions/naming.ts
382
378
  function shortSessionHash(sessionKey) {
383
379
  return sha256Hex(sessionKey).slice(0, 32);
384
380
  }
@@ -432,18 +428,22 @@ function discussionSessionKey(params) {
432
428
  }
433
429
  });
434
430
  }
435
- //#endregion
436
- //#region extensions/clickclack/src/discussions/eligibility.ts
431
+ // extensions/clickclack/src/discussions/eligibility.ts
437
432
  function discussionAccounts(cfg) {
438
- return listEnabledClickClackAccounts(cfg).filter((account) => account.configured && account.discussions.enabled);
433
+ return listClickClackAccountIds(cfg).map((accountId) => resolveClickClackAccountMetadata({
434
+ cfg,
435
+ accountId
436
+ })).filter((account) => account.enabled && account.configured && account.discussions.enabled);
439
437
  }
440
438
  function normalizedServerBaseUrl(account) {
441
439
  return account.baseUrl.replace(/\/+$/u, "");
442
440
  }
443
441
  /** Resolves the sole live account and rejects bindings pinned to an older destination. */
444
442
  function resolveDiscussionBindingAccount(cfg, binding) {
445
- const accounts = discussionAccounts(cfg);
446
- const account = accounts.length === 1 ? accounts[0] : void 0;
443
+ const accounts = listEnabledClickClackAccounts(cfg).filter((account) => account.configured && account.discussions.enabled);
444
+ return resolveBindingAccount(accounts.length === 1 ? accounts[0] : void 0, binding);
445
+ }
446
+ function resolveBindingAccount(account, binding) {
447
447
  if (!account) return { state: "unavailable" };
448
448
  if (account.accountId !== binding.accountId || normalizedServerBaseUrl(account) !== binding.serverBaseUrl || account.discussions.workspace !== binding.workspaceRef || binding.credentialFingerprint !== void 0 && discussionCredentialFingerprint(account.token) !== binding.credentialFingerprint) return {
449
449
  state: "stale",
@@ -454,6 +454,23 @@ function resolveDiscussionBindingAccount(cfg, binding) {
454
454
  account
455
455
  };
456
456
  }
457
+ /** Config and binding checks stay synchronous after credential preparation. */
458
+ function isDiscussionAccountCurrent(cfg, account) {
459
+ const accounts = discussionAccounts(cfg);
460
+ const current = accounts.length === 1 ? accounts[0] : void 0;
461
+ return current !== void 0 && current.accountId === account.accountId && current.baseUrl === account.baseUrl && current.apiEndpoint === account.apiEndpoint && current.discussions.workspace === account.discussions.workspace && current.config.tokenFile?.trim() === account.config.tokenFile?.trim() && (current.tokenSource === "tokenFile" || current.token === account.token);
462
+ }
463
+ function resolvePreparedDiscussionBindingAccount(cfg, binding, account) {
464
+ return isDiscussionAccountCurrent(cfg, account) ? resolveBindingAccount(account, binding) : { state: "unavailable" };
465
+ }
466
+ async function prepareDiscussionBindingAccount(cfg, binding) {
467
+ const accounts = discussionAccounts(cfg);
468
+ if (accounts.length !== 1) return { state: "unavailable" };
469
+ return resolveBindingAccount(await resolveClickClackAccountAsync({
470
+ cfg,
471
+ accountId: accounts[0].accountId
472
+ }), binding);
473
+ }
457
474
  /** Public embed/open URLs for one bound discussion channel. */
458
475
  function discussionInfoForBinding(binding, account) {
459
476
  const baseUrl = normalizedServerBaseUrl(account);
@@ -463,8 +480,7 @@ function discussionInfoForBinding(binding, account) {
463
480
  openUrl: `${baseUrl}/app/${encodeURIComponent(binding.workspaceRouteId)}/${encodeURIComponent(binding.channelRouteId)}`
464
481
  };
465
482
  }
466
- //#endregion
467
- //#region extensions/clickclack/src/discussions/revoked-channel-store.ts
483
+ // extensions/clickclack/src/discussions/revoked-channel-store.ts
468
484
  const STORE_OPTIONS = {
469
485
  namespace: "discussion-revoked-channels",
470
486
  maxEntries: 1e5,
@@ -483,17 +499,7 @@ function adoptLegacyMarkers(runtime) {
483
499
  adoption = (async () => {
484
500
  const store = getStore(runtime);
485
501
  for (const entry of await store.entries()) if (entry.key.includes("\0")) {
486
- const key = revokedChannelKey(entry.value);
487
- for (;;) {
488
- const current = await store.observe(key);
489
- if (current.value && (!current.value.binding || isDeepStrictEqual(current.value.binding, entry.value.binding))) break;
490
- if (current.value && entry.value.binding) throw new Error("Conflicting ClickClack revocation evidence; legacy marker retained");
491
- if ((await store.compareAndApply(key, current.comparison, {
492
- operation: "update",
493
- action: "set",
494
- value: entry.value
495
- })).status !== "conflict") break;
496
- }
502
+ await store.registerIfAbsent(revokedChannelKey(entry.value), entry.value);
497
503
  await store.delete(entry.key);
498
504
  }
499
505
  legacyAdoptedRuntimes.add(runtime);
@@ -595,8 +601,7 @@ async function isClickClackDiscussionChannelRevokedAsync(params) {
595
601
  function revocationApplies(revoked, binding) {
596
602
  return Boolean(revoked && (!binding || !revoked.binding || isDeepStrictEqual(revoked.binding, binding)));
597
603
  }
598
- //#endregion
599
- //#region extensions/clickclack/src/discussions/session-authority.ts
604
+ // extensions/clickclack/src/discussions/session-authority.ts
600
605
  /** Retain the session owner's receipt-backed facts until the external effect completes. */
601
606
  async function prepareDiscussionSessionEntry(runtime, sessionKey) {
602
607
  const config = runtime.config.current();
@@ -612,8 +617,8 @@ async function prepareDiscussionSessionEntry(runtime, sessionKey) {
612
617
  fields: ["sessionId", "archivedAt"]
613
618
  });
614
619
  }
615
- //#endregion
616
- //#region extensions/clickclack/src/discussions/routing.ts
620
+ // extensions/clickclack/src/discussions/routing.ts
621
+ const discussionsLog = createSubsystemLogger("clickclack/discussions");
617
622
  async function resolveClickClackDiscussionRoute(params) {
618
623
  const store = getClickClackDiscussionBindingStore(params.runtime);
619
624
  await store.prepare();
@@ -632,7 +637,8 @@ async function resolveClickClackDiscussionRoute(params) {
632
637
  if (!matched) return { state: pending ? "revoked" : "unbound" };
633
638
  if (matched.binding.accountId !== params.accountId) return { state: "revoked" };
634
639
  if (matched.binding.serverBaseUrl !== params.serverBaseUrl.replace(/\/+$/u, "")) return { state: "revoked" };
635
- if (resolveDiscussionBindingAccount(params.runtime.config.current(), matched.binding).state !== "active") return { state: "revoked" };
640
+ const resolved = await prepareDiscussionBindingAccount(params.runtime.config.current(), matched.binding);
641
+ if (resolved.state !== "active") return { state: "revoked" };
636
642
  bindingFacts = await store.prepareRead(matched.sessionKey);
637
643
  let binding;
638
644
  try {
@@ -643,17 +649,14 @@ async function resolveClickClackDiscussionRoute(params) {
643
649
  binding: matched.binding
644
650
  });
645
651
  } catch (error) {
646
- params.runtime.logging.getChildLogger({
647
- plugin: "clickclack",
648
- feature: "discussions"
649
- }).warn(`discussion attachment refresh failed for channel ${params.channelId}: ${String(error)}`);
652
+ discussionsLog.warn(`discussion attachment refresh failed for channel ${params.channelId}: ${String(error)}`);
650
653
  return { state: "revoked" };
651
654
  }
652
655
  if (!binding) return { state: "revoked" };
653
656
  session = await prepareDiscussionSessionEntry(params.runtime, matched.sessionKey);
654
657
  session.source();
655
658
  const current = bindingFacts.read();
656
- if (!current || current.externalRef !== binding.externalRef || current.channelId !== binding.channelId || revocation.isRevoked(current) || session.entry?.sessionId !== binding.sessionId || session.entry.archivedAt !== void 0 || resolveDiscussionBindingAccount(params.runtime.config.current(), binding).state !== "active") return { state: "revoked" };
659
+ if (!current || current.externalRef !== binding.externalRef || current.channelId !== binding.channelId || revocation.isRevoked(current) || session.entry?.sessionId !== binding.sessionId || session.entry.archivedAt !== void 0 || resolvePreparedDiscussionBindingAccount(params.runtime.config.current(), binding, resolved.account).state !== "active") return { state: "revoked" };
657
660
  const sessionKey = discussionSessionKey({
658
661
  runtime: params.runtime,
659
662
  agentId: binding.agentId,
@@ -687,8 +690,7 @@ async function resolveClickClackDiscussionRoute(params) {
687
690
  revocation?.release();
688
691
  }
689
692
  }
690
- //#endregion
691
- //#region extensions/clickclack/src/group-policy.ts
693
+ // extensions/clickclack/src/group-policy.ts
692
694
  function resolveClickClackGroupPolicy(params) {
693
695
  const { account, channelId } = params;
694
696
  const channelKey = channelId?.trim();
@@ -703,14 +705,12 @@ function resolveClickClackGroupPolicy(params) {
703
705
  botLoopProtection: mergePairLoopGuardConfig(account.botLoopProtection, wildcard?.botLoopProtection, exact?.botLoopProtection)
704
706
  };
705
707
  }
706
- //#endregion
707
- //#region extensions/clickclack/src/runtime.ts
708
+ // extensions/clickclack/src/runtime.ts
708
709
  const { setRuntime: setClickClackRuntime, getRuntime: getClickClackRuntime } = createPluginRuntimeStore({
709
710
  pluginId: "clickclack",
710
711
  errorMessage: "ClickClack runtime not initialized"
711
712
  });
712
- //#endregion
713
- //#region extensions/clickclack/src/target.ts
713
+ // extensions/clickclack/src/target.ts
714
714
  /**
715
715
  * Parses `channel:name`, `thread:msg_id`, `dm:usr_id`, or a bare channel name.
716
716
  */
@@ -744,8 +744,7 @@ function parseClickClackTarget(raw) {
744
744
  function buildClickClackTarget(target) {
745
745
  return `${target.kind}:${target.id}`;
746
746
  }
747
- //#endregion
748
- //#region extensions/clickclack/src/access.ts
747
+ // extensions/clickclack/src/access.ts
749
748
  const CHANNEL_ID$2 = "clickclack";
750
749
  const CLICKCLACK_MENTION_PATTERN = /(?:^|[^a-z0-9_@-])@([a-z0-9][a-z0-9_-]{1,31})(?![a-z0-9_-])/giu;
751
750
  function normalizeClickClackUserId(value) {
@@ -1033,8 +1032,7 @@ async function resolveClickClackInboundAccess(params) {
1033
1032
  channelIngress: resolved
1034
1033
  };
1035
1034
  }
1036
- //#endregion
1037
- //#region extensions/clickclack/src/activity.ts
1035
+ // extensions/clickclack/src/activity.ts
1038
1036
  const CLICKCLACK_COMMENTARY_FLUSH_MS = 700;
1039
1037
  /** Item kinds rendered as agent_tool rows; everything else is commentary. */
1040
1038
  const TOOL_ITEM_KINDS = /* @__PURE__ */ new Set([
@@ -1213,8 +1211,7 @@ function createClickClackActivityPublisher(params) {
1213
1211
  }
1214
1212
  };
1215
1213
  }
1216
- //#endregion
1217
- //#region extensions/clickclack/src/outbound.ts
1214
+ // extensions/clickclack/src/outbound.ts
1218
1215
  const CLICKCLACK_MAX_UPLOAD_BYTES = 67108864;
1219
1216
  async function createTargetMessage(params) {
1220
1217
  const parsed = parseClickClackTarget(params.to);
@@ -1280,8 +1277,8 @@ async function attachUploadRetrySafe(params) {
1280
1277
  }
1281
1278
  }
1282
1279
  }
1283
- function createOutboundContext(params) {
1284
- const account = resolveClickClackAccount({
1280
+ async function createOutboundContext(params) {
1281
+ const account = await resolveClickClackAccountAsync({
1285
1282
  cfg: params.cfg,
1286
1283
  accountId: params.accountId
1287
1284
  });
@@ -1298,7 +1295,7 @@ function createOutboundContext(params) {
1298
1295
  async function sendClickClackText(params) {
1299
1296
  const text = sanitizeAssistantVisibleText(params.text);
1300
1297
  if (!text) return { outcome: "not_sent" };
1301
- const { account, client } = createOutboundContext(params);
1298
+ const { account, client } = await createOutboundContext(params);
1302
1299
  return { messageId: (await createTargetMessage({
1303
1300
  client,
1304
1301
  workspaceId: await resolveWorkspaceId(client, account.workspace),
@@ -1314,7 +1311,7 @@ async function sendClickClackText(params) {
1314
1311
  }
1315
1312
  async function sendClickClackMedia(params) {
1316
1313
  const nonces = mediaDeliveryNonces(params);
1317
- const { account, client } = createOutboundContext(params);
1314
+ const { account, client } = await createOutboundContext(params);
1318
1315
  const mediaLoadOptions = {
1319
1316
  maxBytes: Math.min(resolveChannelMediaMaxBytes({
1320
1317
  cfg: params.cfg,
@@ -1398,7 +1395,7 @@ async function reconcileClickClackUnknownSend(ctx) {
1398
1395
  const payload = ctx.payloads[0];
1399
1396
  const plannedMediaUrls = ctx.renderedBatchPlan?.items[0]?.mediaUrls;
1400
1397
  const mediaUrls = normalizeTrimmedStringList(plannedMediaUrls?.length ? plannedMediaUrls : [payload?.mediaUrl, ...payload?.mediaUrls ?? []]);
1401
- const { account, client } = createOutboundContext({
1398
+ const { account, client } = await createOutboundContext({
1402
1399
  cfg: ctx.cfg,
1403
1400
  accountId: ctx.accountId
1404
1401
  });
@@ -1485,15 +1482,13 @@ async function reconcileClickClackUnknownSend(ctx) {
1485
1482
  receipt
1486
1483
  };
1487
1484
  }
1488
- //#endregion
1489
- //#region extensions/clickclack/src/progress.ts
1485
+ // extensions/clickclack/src/progress.ts
1490
1486
  function normalizedKind(payload) {
1491
1487
  const kind = payload.kind?.trim().toLowerCase();
1492
1488
  if (!kind || kind === "preamble" || kind === "analysis" || kind === "thinking" || kind === "reasoning" || kind === "missing") return "commentary";
1493
1489
  return kind;
1494
1490
  }
1495
1491
  function progressText(payload) {
1496
- if (payload.kind !== "preamble" && payload.title) return payload.title;
1497
1492
  const line = buildChannelProgressDraftLine({
1498
1493
  ...payload,
1499
1494
  event: "item",
@@ -1667,8 +1662,7 @@ function createClickClackAgentProgressPublisher(params) {
1667
1662
  }
1668
1663
  };
1669
1664
  }
1670
- //#endregion
1671
- //#region extensions/clickclack/src/inbound.ts
1665
+ // extensions/clickclack/src/inbound.ts
1672
1666
  const CHANNEL_ID$1 = "clickclack";
1673
1667
  const CLICKCLACK_MESSAGE_ID_PATTERN = /^msg_[0-9a-hjkmnp-tv-z]{26}$/u;
1674
1668
  function hasClickClackReplyMedia(payload) {
@@ -1931,8 +1925,7 @@ async function handleClickClackInbound(params) {
1931
1925
  await activity?.finalize();
1932
1926
  }
1933
1927
  }
1934
- //#endregion
1935
- //#region extensions/clickclack/src/gateway.ts
1928
+ // extensions/clickclack/src/gateway.ts
1936
1929
  const CLICKCLACK_EVENT_PAGE_LIMIT = 500;
1937
1930
  const CLICKCLACK_COMMAND_PATTERN = /^[a-z0-9_-]{1,32}$/u;
1938
1931
  const CLICKCLACK_MAX_COMMANDS = 100;
@@ -1979,10 +1972,7 @@ async function resolveEventMessage(params) {
1979
1972
  }
1980
1973
  }
1981
1974
  async function startClickClackGatewayAccount(ctx) {
1982
- const configuredAccount = resolveClickClackAccount({
1983
- cfg: ctx.cfg,
1984
- accountId: ctx.account.accountId
1985
- });
1975
+ const configuredAccount = ctx.account;
1986
1976
  if (!configuredAccount.configured) throw new Error(`ClickClack is not configured for account "${configuredAccount.accountId}"`);
1987
1977
  const client = createClickClackClient({
1988
1978
  baseUrl: configuredAccount.apiEndpoint,
@@ -2169,8 +2159,7 @@ async function startClickClackGatewayAccount(ctx) {
2169
2159
  ctx.setStatus(channelStoppedPatch({ accountId: account.accountId }));
2170
2160
  }
2171
2161
  }
2172
- //#endregion
2173
- //#region extensions/clickclack/src/channel.ts
2162
+ // extensions/clickclack/src/channel.ts
2174
2163
  const CHANNEL_ID = CLICKCLACK_CHANNEL_ID;
2175
2164
  const clickClackTextMessageAdapter = createChannelMessageAdapterFromOutbound({ outbound: { sendText: async (ctx) => ({
2176
2165
  channel: CHANNEL_ID,
@@ -2330,5 +2319,4 @@ const clickClackPlugin = createChatChannelPlugin({
2330
2319
  }
2331
2320
  }
2332
2321
  });
2333
- //#endregion
2334
- export { clearDiscussionBindingGeneration as A, resolveDiscussionLabel as C, bindingMatchesActiveSessionIncarnation as D, attachBindingToCurrentActiveSession as E, reserveDiscussionBindingGeneration as F, getPendingDiscussionOpen as M, listPendingDiscussionOpens as N, getClickClackDiscussionBindingStore as O, recordPendingDiscussionOpen as P, isDiscussionSessionKey as S, truncateDiscussionDisplayTitle as T, resolveDiscussionBindingAccount as _, setClickClackRuntime as a, discussionSessionKey as b, clearClickClackDiscussionChannelRevoked as c, markClickClackDiscussionChannelIdentityRevoked as d, markClickClackDiscussionChannelRevoked as f, normalizedServerBaseUrl as g, discussionInfoForBinding as h, getClickClackRuntime as i, clearPendingDiscussionOpen as j, readDiscussionSessionEntry as k, isClickClackDiscussionChannelRevoked as l, discussionAccounts as m, buildClickClackTarget as n, prepareDiscussionSessionEntry as o, prepareClickClackDiscussionChannelRevocation as p, parseClickClackTarget as r, adoptLegacyMarkers as s, clickClackPlugin as t, isClickClackDiscussionChannelRevokedAsync as u, discussionCredentialFingerprint as v, slugifyDiscussionLabel as w, fallbackDiscussionLabel as x, discussionExternalRef as y };
2322
+ export { bindingMatchesActiveSessionIncarnation as A, discussionSessionKey as C, slugifyDiscussionLabel as D, resolveDiscussionLabel as E, getPendingDiscussionOpen as F, listPendingDiscussionOpens as I, recordPendingDiscussionOpen as L, readDiscussionSessionEntry as M, clearDiscussionBindingGeneration as N, truncateDiscussionDisplayTitle as O, clearPendingDiscussionOpen as P, reserveDiscussionBindingGeneration as R, discussionExternalRef as S, isDiscussionSessionKey as T, normalizedServerBaseUrl as _, setClickClackRuntime as a, resolvePreparedDiscussionBindingAccount as b, clearClickClackDiscussionChannelRevoked as c, markClickClackDiscussionChannelIdentityRevoked as d, markClickClackDiscussionChannelRevoked as f, isDiscussionAccountCurrent as g, discussionInfoForBinding as h, getClickClackRuntime as i, getClickClackDiscussionBindingStore as j, attachBindingToCurrentActiveSession as k, isClickClackDiscussionChannelRevoked as l, discussionAccounts as m, buildClickClackTarget as n, prepareDiscussionSessionEntry as o, prepareClickClackDiscussionChannelRevocation as p, parseClickClackTarget as r, adoptLegacyMarkers as s, clickClackPlugin as t, isClickClackDiscussionChannelRevokedAsync as u, prepareDiscussionBindingAccount as v, fallbackDiscussionLabel as w, discussionCredentialFingerprint as x, resolveDiscussionBindingAccount as y };
@@ -3,7 +3,8 @@ import { bufferToBlobPart } from "openclaw/plugin-sdk/blob-runtime";
3
3
  import { captureEffectAuthority } from "openclaw/plugin-sdk/fetch-runtime";
4
4
  import { redactToolPayloadText } from "openclaw/plugin-sdk/logging-core";
5
5
  import { readProviderJsonResponse, readResponseTextLimited } from "openclaw/plugin-sdk/provider-http";
6
- //#region extensions/clickclack/src/http-client.ts
6
+ import { fetchWithSsrFGuard, ssrfPolicyFromHttpBaseUrlAllowedOrigin } from "openclaw/plugin-sdk/ssrf-runtime";
7
+ // extensions/clickclack/src/http-client.ts
7
8
  /**
8
9
  * Serializes optional provenance into the wire fields. Unknown JSON fields
9
10
  * are ignored by servers without the provenance columns, so these are safe
@@ -54,7 +55,7 @@ function normalizeClickClackCorrelationId(value) {
54
55
  }
55
56
  function createClickClackClient(options) {
56
57
  const baseUrl = options.baseUrl.replace(/\/$/, "");
57
- const fetcher = options.fetch ?? fetch;
58
+ const ssrfPolicy = ssrfPolicyFromHttpBaseUrlAllowedOrigin(baseUrl);
58
59
  const correlationId = normalizeClickClackCorrelationId(options.correlationId);
59
60
  const headers = {
60
61
  Authorization: `Bearer ${options.token}`,
@@ -65,25 +66,35 @@ function createClickClackClient(options) {
65
66
  for (const [key, value] of Object.entries(headers)) requestHeaders.set(key, value);
66
67
  if (correlationId) requestHeaders.set(CLICKCLACK_CORRELATION_ID_HEADER, correlationId);
67
68
  if (init.body && !(init.body instanceof FormData)) requestHeaders.set("Content-Type", "application/json");
68
- const response = await captureEffectAuthority().initiate(() => {
69
- options.beforeRequest?.();
70
- return fetcher(`${baseUrl}${path}`, {
71
- ...init,
72
- ...requestOptions.timeoutMs !== void 0 && !init.signal ? { signal: AbortSignal.timeout(requestOptions.timeoutMs) } : {},
73
- headers: requestHeaders
69
+ const { response, release } = await captureEffectAuthority().initiate(() => {
70
+ return fetchWithSsrFGuard({
71
+ url: `${baseUrl}${path}`,
72
+ fetchImpl: options.fetch,
73
+ beforeRequest: options.beforeRequest,
74
+ init: {
75
+ ...init,
76
+ ...requestOptions.timeoutMs !== void 0 && !init.signal ? { signal: AbortSignal.timeout(requestOptions.timeoutMs) } : {},
77
+ headers: requestHeaders
78
+ },
79
+ policy: ssrfPolicy,
80
+ auditContext: "clickclack-api"
74
81
  });
75
82
  });
76
- if (!response.ok) {
77
- const detail = await readResponseTextLimited(response, CLICKCLACK_ERROR_BODY_LIMIT_BYTES);
78
- throw new ClickClackHttpError(response.status, redactToolPayloadText(detail), response.headers);
79
- }
80
- if (requestOptions.responseMode === "none") {
81
- try {
82
- await response.body?.cancel();
83
- } catch {}
84
- return;
83
+ try {
84
+ if (!response.ok) {
85
+ const detail = await readResponseTextLimited(response, CLICKCLACK_ERROR_BODY_LIMIT_BYTES);
86
+ throw new ClickClackHttpError(response.status, redactToolPayloadText(detail), response.headers);
87
+ }
88
+ if (requestOptions.responseMode === "none") {
89
+ try {
90
+ await response.body?.cancel();
91
+ } catch {}
92
+ return;
93
+ }
94
+ return await readProviderJsonResponse(response, "ClickClack response", { maxBytes: CLICKCLACK_INBOUND_JSON_LIMIT_BYTES });
95
+ } finally {
96
+ await release();
85
97
  }
86
- return await readProviderJsonResponse(response, "ClickClack response", { maxBytes: CLICKCLACK_INBOUND_JSON_LIMIT_BYTES });
87
98
  }
88
99
  async function requestObject(key, path, init) {
89
100
  return (await request(path, init))[key];
@@ -276,8 +287,7 @@ function createClickClackClient(options) {
276
287
  }
277
288
  };
278
289
  }
279
- //#endregion
280
- //#region extensions/clickclack/src/resolve.ts
290
+ // extensions/clickclack/src/resolve.ts
281
291
  function findClickClackWorkspace(workspaces, selector) {
282
292
  return workspaces.find((candidate) => candidate.id === selector || candidate.slug === selector || candidate.name === selector);
283
293
  }
@@ -293,5 +303,4 @@ async function resolveChannelId(client, workspaceId, channel) {
293
303
  if (!found) throw new Error(`ClickClack channel not found: ${channel}`);
294
304
  return found.id;
295
305
  }
296
- //#endregion
297
306
  export { createClickClackClient as a, ClickClackHttpError as i, resolveChannelId as n, isClickClackChannelNameConflict as o, resolveWorkspaceId as r, normalizeClickClackCorrelationId as s, findClickClackWorkspace as t };
@@ -1,4 +1,4 @@
1
- //#region \0rolldown/runtime.js
1
+ // \0rolldown/runtime.js
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -23,5 +23,4 @@ var __copyProps = (to, from, except, desc) => {
23
23
  return to;
24
24
  };
25
25
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
26
- //#endregion
27
26
  export { __reExport as n, __exportAll as t };