@openclaw/clickclack 2026.10.10-beta.5 → 2026.11.5-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.
- package/dist/.setup/{channel-DRcZ_twH.mjs → channel-ByAANbh8.mjs} +382 -543
- package/dist/.setup/{resolve-Br3ylpSz.mjs → resolve-CRj6QjdF.mjs} +29 -46
- package/dist/.setup/{rolldown-runtime-B4FMCO8f.mjs → rolldown-runtime-782esTHO.mjs} +1 -3
- package/dist/.setup/{runtime-api-BrlvVAQJ.mjs → runtime-api-BsRK-sfA.mjs} +329 -383
- package/dist/.setup/{secret-contract-CF7TKtkU.mjs → secret-contract-Dj8nibUr.mjs} +1 -2
- package/dist/.setup/{secret-contract-api--45pFCg3.mjs → secret-contract-api-DS3Vv0Gu.mjs} +1 -1
- package/dist/.setup/{setup-claim-BPuQuMKW.mjs → setup-claim-BAKxfObl.mjs} +5 -11
- package/dist/.setup/{setup-plugin-api-Ccxm2ydn.mjs → setup-plugin-api-BTqE973B.mjs} +2 -3
- package/dist/.setup/setup-plugin-api-CfuhJJvK.mjs +1 -0
- package/dist/.setup/{setup-surface-BJ3jioqA.mjs → setup-surface-5wSYr6p2.mjs} +11 -17
- package/dist/.setup/{setup-verify-DGsYtVh9.mjs → setup-verify-IayKkFWq.mjs} +13 -26
- package/dist/.source-module-urls/aa673c321fe9be084b8926cbe5388ff5e2a41371389e19ca60a1983f2b634030.json +1 -1
- package/dist/api.js +3 -3
- package/dist/channel-plugin-api.js +1 -1
- package/dist/doctor-contract-api.js +6 -11
- package/dist/index.js +2 -3
- package/dist/runtime-api.js +4 -4
- package/dist/secret-contract-api.js +1 -1
- package/dist/setup-entry.js +3 -4
- package/dist/setup-plugin-api.js +1 -1
- package/node_modules/zod/package.json +1 -1
- package/node_modules/zod/src/v4/classic/tests/array.test.ts +27 -0
- package/node_modules/zod/src/v4/classic/tests/map.test.ts +7 -0
- package/node_modules/zod/src/v4/classic/tests/set.test.ts +6 -0
- package/node_modules/zod/src/v4/core/compile.ts +9 -0
- package/node_modules/zod/src/v4/core/schemas.ts +35 -1
- package/node_modules/zod/src/v4/core/util.ts +13 -0
- package/node_modules/zod/src/v4/core/versions.ts +1 -1
- package/node_modules/zod/v4/core/compile.cjs +8 -0
- package/node_modules/zod/v4/core/compile.js +8 -0
- package/node_modules/zod/v4/core/schemas.cjs +30 -0
- package/node_modules/zod/v4/core/schemas.d.cts +3 -1
- package/node_modules/zod/v4/core/schemas.d.ts +3 -1
- package/node_modules/zod/v4/core/schemas.js +30 -0
- package/node_modules/zod/v4/core/util.cjs +15 -0
- package/node_modules/zod/v4/core/util.d.cts +2 -0
- package/node_modules/zod/v4/core/util.d.ts +2 -0
- package/node_modules/zod/v4/core/util.js +14 -0
- package/node_modules/zod/v4/core/versions.cjs +1 -1
- package/node_modules/zod/v4/core/versions.js +1 -1
- package/package.json +5 -7
- package/dist/.setup/setup-plugin-api-0RMVREuM.mjs +0 -1
- package/node_modules/ws/LICENSE +0 -20
- package/node_modules/ws/README.md +0 -548
- package/node_modules/ws/browser.js +0 -8
- package/node_modules/ws/index.js +0 -22
- package/node_modules/ws/lib/buffer-util.js +0 -131
- package/node_modules/ws/lib/constants.js +0 -19
- package/node_modules/ws/lib/event-target.js +0 -292
- package/node_modules/ws/lib/extension.js +0 -203
- package/node_modules/ws/lib/limiter.js +0 -55
- package/node_modules/ws/lib/permessage-deflate.js +0 -530
- package/node_modules/ws/lib/receiver.js +0 -743
- package/node_modules/ws/lib/sender.js +0 -607
- package/node_modules/ws/lib/stream.js +0 -161
- package/node_modules/ws/lib/subprotocol.js +0 -62
- package/node_modules/ws/lib/validation.js +0 -152
- package/node_modules/ws/lib/websocket-server.js +0 -562
- package/node_modules/ws/lib/websocket.js +0 -1421
- package/node_modules/ws/package.json +0 -74
- package/node_modules/ws/wrapper.mjs +0 -21
|
@@ -1,34 +1,38 @@
|
|
|
1
|
-
import { n as __reExport, t as __exportAll } from "./rolldown-runtime-
|
|
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-
|
|
3
|
-
import { a as createClickClackClient, i as ClickClackHttpError, n as resolveChannelId, r as resolveWorkspaceId, s as normalizeClickClackCorrelationId } from "./resolve-
|
|
4
|
-
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-
|
|
1
|
+
import { n as __reExport, t as __exportAll } from "./rolldown-runtime-782esTHO.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-5wSYr6p2.mjs";
|
|
3
|
+
import { a as createClickClackClient, i as ClickClackHttpError, n as resolveChannelId, r as resolveWorkspaceId, s as normalizeClickClackCorrelationId } from "./resolve-CRj6QjdF.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";
|
|
8
8
|
import { normalizeTrimmedStringList, readStringField } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
9
|
import { buildChannelOutboundSessionRoute, buildThreadAwareOutboundSessionRoute, createChatChannelPlugin } from "openclaw/plugin-sdk/channel-core";
|
|
10
|
-
import { buildChannelProgressDraftLine, createChannelMessageReplyPipeline, createMessageReceiptFromOutboundResults, defineChannelMessageAdapter, deriveDurableFinalDeliveryRequirements, formatChannelProgressDraftLineForEntry, isCompleteAgentPreamble } from "openclaw/plugin-sdk/channel-outbound";
|
|
10
|
+
import { buildChannelProgressDraftLine, createChannelMessageAdapterFromOutbound, createChannelMessageReplyPipeline, createMessageReceiptFromOutboundResults, defineChannelMessageAdapter, deriveDurableFinalDeliveryRequirements, formatChannelProgressDraftLineForEntry, isCompleteAgentPreamble } from "openclaw/plugin-sdk/channel-outbound";
|
|
11
11
|
import { createComputedAccountStatusAdapter, createDefaultChannelRuntimeState } from "openclaw/plugin-sdk/status-helpers";
|
|
12
12
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
13
13
|
import { channelReadyPatch, channelStoppedPatch } from "openclaw/plugin-sdk/gateway-runtime";
|
|
14
|
+
import { listNativeCommandSpecsForConfig } from "openclaw/plugin-sdk/native-command-registry";
|
|
14
15
|
import { sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
|
|
16
|
+
import { safeParseJson, truncateCodePoints } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
15
17
|
import { rawDataToString } from "openclaw/plugin-sdk/webhook-ingress";
|
|
18
|
+
import { startWebSocketKeepalive } from "openclaw/plugin-sdk/websocket-runtime";
|
|
16
19
|
import { isDeepStrictEqual } from "node:util";
|
|
17
20
|
import { parseAccessGroupAllowFromEntry } from "openclaw/plugin-sdk/access-groups";
|
|
18
21
|
import { formatNormalizedAllowFromEntries, resolveAllowlistMatchByCandidates } from "openclaw/plugin-sdk/allow-from";
|
|
19
22
|
import { normalizeAgentId } from "openclaw/plugin-sdk/routing";
|
|
20
|
-
import {
|
|
23
|
+
import { randomUUID } from "node:crypto";
|
|
21
24
|
import { createAsyncLock } from "openclaw/plugin-sdk/async-lock-runtime";
|
|
22
25
|
import { assertPluginStateReadAvailable, preparePluginStateRead } from "openclaw/plugin-sdk/plugin-state-runtime";
|
|
23
|
-
import {
|
|
26
|
+
import { sha256Hex } from "openclaw/plugin-sdk/node-crypto-runtime";
|
|
27
|
+
import { resolveSessionAgentIdStrict } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
28
|
+
import { captureSessionEntryCurrentCheckAsync } from "openclaw/plugin-sdk/session-binding-runtime";
|
|
24
29
|
import { createPluginRuntimeStore } from "openclaw/plugin-sdk/runtime-store";
|
|
25
|
-
import { listNativeCommandSpecsForConfig } from "openclaw/plugin-sdk/native-command-registry";
|
|
26
30
|
import { buildChannelInboundEventContext, createChannelInboundEnvelopeBuilderAsync, createChannelPartialDeliveryError, recordChannelBotPairLoopAndCheckSuppression } from "openclaw/plugin-sdk/channel-inbound";
|
|
27
31
|
import { extensionForMime } from "openclaw/plugin-sdk/media-mime";
|
|
28
32
|
import { loadOutboundMediaFromUrl } from "openclaw/plugin-sdk/outbound-media";
|
|
29
33
|
import { sanitizeAssistantVisibleText } from "openclaw/plugin-sdk/text-chunking";
|
|
30
34
|
import { raceWithTimeout } from "openclaw/plugin-sdk/time-runtime";
|
|
31
|
-
|
|
35
|
+
// src/channels/mention-gating.ts
|
|
32
36
|
function resolveBotThreadMentionPolicy(params) {
|
|
33
37
|
if (!params.isBotOwnedThread || params.requireMentionInBotThreads === void 0) return {
|
|
34
38
|
requireMention: params.requireMention,
|
|
@@ -39,13 +43,11 @@ function resolveBotThreadMentionPolicy(params) {
|
|
|
39
43
|
implicitMentionKinds: params.requireMentionInBotThreads ? params.implicitMentionKinds?.filter((kind) => kind === "native") : params.implicitMentionKinds
|
|
40
44
|
};
|
|
41
45
|
}
|
|
42
|
-
|
|
43
|
-
//#region \0openclaw:bundled-sdk:openclaw/plugin-sdk/channel-mention-gating
|
|
46
|
+
// \0openclaw:bundled-sdk:openclaw/plugin-sdk/channel-mention-gating
|
|
44
47
|
var channel_mention_gating_exports = /* @__PURE__ */ __exportAll({ resolveBotThreadMentionPolicy: () => resolveBotThreadMentionPolicy });
|
|
45
48
|
import * as import_openclaw_plugin_sdk_channel_mention_gating from "openclaw/plugin-sdk/channel-mention-gating";
|
|
46
49
|
__reExport(channel_mention_gating_exports, import_openclaw_plugin_sdk_channel_mention_gating);
|
|
47
|
-
|
|
48
|
-
//#region extensions/clickclack/src/discussions/binding-generation.ts
|
|
50
|
+
// extensions/clickclack/src/discussions/binding-generation.ts
|
|
49
51
|
const GENERATION_STORE_OPTIONS = {
|
|
50
52
|
namespace: "discussion-binding-generations",
|
|
51
53
|
maxEntries: 1e4,
|
|
@@ -100,7 +102,7 @@ function reserveDiscussionBindingGeneration(params) {
|
|
|
100
102
|
},
|
|
101
103
|
result: existing.generation
|
|
102
104
|
};
|
|
103
|
-
generation ??=
|
|
105
|
+
generation ??= randomUUID();
|
|
104
106
|
return {
|
|
105
107
|
value: {
|
|
106
108
|
accountId: params.accountId,
|
|
@@ -172,8 +174,8 @@ async function hasPendingDiscussionOpenForDestination(params) {
|
|
|
172
174
|
const serverBaseUrl = params.serverBaseUrl.replace(/\/+$/u, "");
|
|
173
175
|
return (await listPendingDiscussionOpens(params.runtime)).some((pending) => pending.serverBaseUrl === serverBaseUrl && pending.workspaceId === params.workspaceId);
|
|
174
176
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
+
// extensions/clickclack/src/discussions/binding-store.ts
|
|
178
|
+
/** Retained for the shipped synchronous ScopedSessionAccessProvider contract. */
|
|
177
179
|
function bindingMatchesActiveSessionIncarnation(runtime, sessionKey, binding) {
|
|
178
180
|
const entry = runtime.agent.session.getSessionEntry({
|
|
179
181
|
sessionKey,
|
|
@@ -202,10 +204,7 @@ async function attachBindingToCurrentActiveSession(params) {
|
|
|
202
204
|
...retained,
|
|
203
205
|
sessionId: entry.sessionId
|
|
204
206
|
};
|
|
205
|
-
return await params.store.setIfCurrent(params.sessionKey, params.binding, attached
|
|
206
|
-
const current = params.store.get(params.sessionKey);
|
|
207
|
-
if (!current || current.externalRef !== params.binding.externalRef || current.serverBaseUrl !== params.binding.serverBaseUrl || current.channelId !== params.binding.channelId || !bindingMatchesActiveSessionIncarnation(params.runtime, params.sessionKey, attached)) throw new Error("ClickClack discussion session changed before attachment committed");
|
|
208
|
-
} }) ? attached : void 0;
|
|
207
|
+
return await params.store.setIfCurrent(params.sessionKey, params.binding, attached) ? attached : void 0;
|
|
209
208
|
}
|
|
210
209
|
const DISCUSSION_BINDINGS_NAMESPACE = "discussion-bindings";
|
|
211
210
|
const MAX_DISCUSSION_BINDINGS = 1e4;
|
|
@@ -214,7 +213,6 @@ const BINDING_STORE_OPTIONS = {
|
|
|
214
213
|
maxEntries: MAX_DISCUSSION_BINDINGS,
|
|
215
214
|
overflowPolicy: "reject-new"
|
|
216
215
|
};
|
|
217
|
-
const MAX_RETAINED_DETACHED_DISCUSSION_BINDINGS = 1e3;
|
|
218
216
|
const storesByRuntime$1 = /* @__PURE__ */ new WeakMap();
|
|
219
217
|
function channelKey(serverBaseUrl, channelId) {
|
|
220
218
|
return `${serverBaseUrl.replace(/\/+$/u, "")}\0${channelId}`;
|
|
@@ -230,7 +228,6 @@ var ClickClackDiscussionBindingStore = class {
|
|
|
230
228
|
#withMutation = createAsyncLock();
|
|
231
229
|
#prepared = false;
|
|
232
230
|
#preparing;
|
|
233
|
-
#changedDuringPreparation = /* @__PURE__ */ new Set();
|
|
234
231
|
constructor(runtime) {
|
|
235
232
|
this.#runtime = runtime;
|
|
236
233
|
}
|
|
@@ -298,36 +295,19 @@ var ClickClackDiscussionBindingStore = class {
|
|
|
298
295
|
this.#publish(sessionKey, observed.value);
|
|
299
296
|
return false;
|
|
300
297
|
}
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
operation: "update",
|
|
312
|
-
action: "set",
|
|
313
|
-
value: next
|
|
314
|
-
} : {
|
|
315
|
-
operation: "delete",
|
|
316
|
-
action: "delete"
|
|
317
|
-
});
|
|
318
|
-
this.#publish(sessionKey, result.status === "conflict" ? result.current.value : next);
|
|
319
|
-
return result.status === "applied";
|
|
320
|
-
} catch (error) {
|
|
321
|
-
if (!authorityRejected) throw error;
|
|
322
|
-
const current = await worker.observe(sessionKey);
|
|
323
|
-
if (current.comparison === observed.comparison) throw error;
|
|
324
|
-
this.#publish(sessionKey, current.value);
|
|
325
|
-
return false;
|
|
326
|
-
}
|
|
298
|
+
const result = await (options?.assertCurrent ? this.#runtime.state.openKeyedStoreV2(BINDING_STORE_OPTIONS, { assertCurrent: options.assertCurrent }) : worker).compareAndApply(sessionKey, observed.comparison, next ? {
|
|
299
|
+
operation: "update",
|
|
300
|
+
action: "set",
|
|
301
|
+
value: next
|
|
302
|
+
} : {
|
|
303
|
+
operation: "delete",
|
|
304
|
+
action: "delete"
|
|
305
|
+
});
|
|
306
|
+
this.#publish(sessionKey, result.status === "conflict" ? result.current.value : next);
|
|
307
|
+
return result.status === "applied";
|
|
327
308
|
});
|
|
328
309
|
}
|
|
329
310
|
#publish(sessionKey, binding) {
|
|
330
|
-
if (!this.#prepared) this.#changedDuringPreparation.add(sessionKey);
|
|
331
311
|
this.#unindex(sessionKey);
|
|
332
312
|
if (binding) this.#index(sessionKey, binding);
|
|
333
313
|
}
|
|
@@ -337,10 +317,10 @@ var ClickClackDiscussionBindingStore = class {
|
|
|
337
317
|
binding: entry.value
|
|
338
318
|
}));
|
|
339
319
|
if (this.#prepared) return await load();
|
|
340
|
-
this.#preparing ??=
|
|
341
|
-
|
|
320
|
+
this.#preparing ??= this.#withMutation(async () => {
|
|
321
|
+
const entries = await load();
|
|
322
|
+
for (const { sessionKey, binding } of entries) this.#index(sessionKey, binding);
|
|
342
323
|
this.#prepared = true;
|
|
343
|
-
this.#changedDuringPreparation.clear();
|
|
344
324
|
return entries;
|
|
345
325
|
}).finally(() => {
|
|
346
326
|
this.#preparing = void 0;
|
|
@@ -394,10 +374,9 @@ function getClickClackDiscussionBindingStore(runtime) {
|
|
|
394
374
|
storesByRuntime$1.set(runtime, created);
|
|
395
375
|
return created;
|
|
396
376
|
}
|
|
397
|
-
|
|
398
|
-
//#region extensions/clickclack/src/discussions/naming.ts
|
|
377
|
+
// extensions/clickclack/src/discussions/naming.ts
|
|
399
378
|
function shortSessionHash(sessionKey) {
|
|
400
|
-
return
|
|
379
|
+
return sha256Hex(sessionKey).slice(0, 32);
|
|
401
380
|
}
|
|
402
381
|
function slugifyLabel(label) {
|
|
403
382
|
return label.normalize("NFKD").replace(/[\u0300-\u036f]/gu, "").toLowerCase().replace(/[^a-z0-9]+/gu, "-").replace(/^-+|-+$/gu, "").slice(0, 80).replace(/-+$/gu, "");
|
|
@@ -417,13 +396,13 @@ function slugifyDiscussionLabel(label, sessionKey) {
|
|
|
417
396
|
return slugifyLabel(label) || fallbackDiscussionLabel(sessionKey);
|
|
418
397
|
}
|
|
419
398
|
function discussionSessionPeerId(identity) {
|
|
420
|
-
return `disc-${
|
|
399
|
+
return `disc-${sha256Hex([
|
|
421
400
|
identity.mainSessionKey,
|
|
422
401
|
identity.sessionId,
|
|
423
402
|
identity.serverBaseUrl,
|
|
424
403
|
identity.channelId,
|
|
425
404
|
identity.externalRef
|
|
426
|
-
].join("\0")).
|
|
405
|
+
].join("\0")).slice(0, 32)}`;
|
|
427
406
|
}
|
|
428
407
|
function isDiscussionSessionKey(sessionKey) {
|
|
429
408
|
return sessionKey.includes(":clickclack:") && /:channel:disc-[0-9a-f]{32}$/u.test(sessionKey);
|
|
@@ -436,7 +415,7 @@ function discussionExternalRef(installationId, mainSessionKey, destinationIdenti
|
|
|
436
415
|
].join("\0"))}`;
|
|
437
416
|
}
|
|
438
417
|
function discussionCredentialFingerprint(token) {
|
|
439
|
-
return
|
|
418
|
+
return sha256Hex(token);
|
|
440
419
|
}
|
|
441
420
|
function discussionSessionKey(params) {
|
|
442
421
|
return params.runtime.channel.routing.buildAgentSessionKey({
|
|
@@ -449,8 +428,7 @@ function discussionSessionKey(params) {
|
|
|
449
428
|
}
|
|
450
429
|
});
|
|
451
430
|
}
|
|
452
|
-
|
|
453
|
-
//#region extensions/clickclack/src/discussions/eligibility.ts
|
|
431
|
+
// extensions/clickclack/src/discussions/eligibility.ts
|
|
454
432
|
function discussionAccounts(cfg) {
|
|
455
433
|
return listEnabledClickClackAccounts(cfg).filter((account) => account.configured && account.discussions.enabled);
|
|
456
434
|
}
|
|
@@ -460,8 +438,7 @@ function normalizedServerBaseUrl(account) {
|
|
|
460
438
|
/** Resolves the sole live account and rejects bindings pinned to an older destination. */
|
|
461
439
|
function resolveDiscussionBindingAccount(cfg, binding) {
|
|
462
440
|
const accounts = discussionAccounts(cfg);
|
|
463
|
-
|
|
464
|
-
const account = accounts[0];
|
|
441
|
+
const account = accounts.length === 1 ? accounts[0] : void 0;
|
|
465
442
|
if (!account) return { state: "unavailable" };
|
|
466
443
|
if (account.accountId !== binding.accountId || normalizedServerBaseUrl(account) !== binding.serverBaseUrl || account.discussions.workspace !== binding.workspaceRef || binding.credentialFingerprint !== void 0 && discussionCredentialFingerprint(account.token) !== binding.credentialFingerprint) return {
|
|
467
444
|
state: "stale",
|
|
@@ -481,8 +458,7 @@ function discussionInfoForBinding(binding, account) {
|
|
|
481
458
|
openUrl: `${baseUrl}/app/${encodeURIComponent(binding.workspaceRouteId)}/${encodeURIComponent(binding.channelRouteId)}`
|
|
482
459
|
};
|
|
483
460
|
}
|
|
484
|
-
|
|
485
|
-
//#region extensions/clickclack/src/discussions/revoked-channel-store.ts
|
|
461
|
+
// extensions/clickclack/src/discussions/revoked-channel-store.ts
|
|
486
462
|
const STORE_OPTIONS = {
|
|
487
463
|
namespace: "discussion-revoked-channels",
|
|
488
464
|
maxEntries: 1e5,
|
|
@@ -579,8 +555,23 @@ async function isClickClackDiscussionChannelRevokedAsync(params) {
|
|
|
579
555
|
function revocationApplies(revoked, binding) {
|
|
580
556
|
return Boolean(revoked && (!binding || !revoked.binding || isDeepStrictEqual(revoked.binding, binding)));
|
|
581
557
|
}
|
|
582
|
-
|
|
583
|
-
|
|
558
|
+
// extensions/clickclack/src/discussions/session-authority.ts
|
|
559
|
+
/** Retain the session owner's receipt-backed facts until the external effect completes. */
|
|
560
|
+
async function prepareDiscussionSessionEntry(runtime, sessionKey) {
|
|
561
|
+
const config = runtime.config.current();
|
|
562
|
+
const agentId = resolveSessionAgentIdStrict({
|
|
563
|
+
config,
|
|
564
|
+
sessionKey
|
|
565
|
+
});
|
|
566
|
+
return await captureSessionEntryCurrentCheckAsync({
|
|
567
|
+
agentId,
|
|
568
|
+
sessionKey,
|
|
569
|
+
storePath: runtime.agent.session.resolveStorePath(config.session?.store, { agentId }),
|
|
570
|
+
matchGeneration: false,
|
|
571
|
+
fields: ["sessionId", "archivedAt"]
|
|
572
|
+
});
|
|
573
|
+
}
|
|
574
|
+
// extensions/clickclack/src/discussions/routing.ts
|
|
584
575
|
async function resolveClickClackDiscussionRoute(params) {
|
|
585
576
|
const store = getClickClackDiscussionBindingStore(params.runtime);
|
|
586
577
|
await store.prepare();
|
|
@@ -592,6 +583,7 @@ async function resolveClickClackDiscussionRoute(params) {
|
|
|
592
583
|
}
|
|
593
584
|
let revocation;
|
|
594
585
|
let bindingFacts;
|
|
586
|
+
let session;
|
|
595
587
|
try {
|
|
596
588
|
revocation = await prepareClickClackDiscussionChannelRevocation(params);
|
|
597
589
|
if (revocation.isRevoked(matched?.binding)) return { state: "revoked" };
|
|
@@ -616,8 +608,10 @@ async function resolveClickClackDiscussionRoute(params) {
|
|
|
616
608
|
return { state: "revoked" };
|
|
617
609
|
}
|
|
618
610
|
if (!binding) return { state: "revoked" };
|
|
611
|
+
session = await prepareDiscussionSessionEntry(params.runtime, matched.sessionKey);
|
|
612
|
+
session.source();
|
|
619
613
|
const current = bindingFacts.read();
|
|
620
|
-
if (!current || current.externalRef !== binding.externalRef || current.channelId !== binding.channelId || revocation.isRevoked(current) ||
|
|
614
|
+
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" };
|
|
621
615
|
const sessionKey = discussionSessionKey({
|
|
622
616
|
runtime: params.runtime,
|
|
623
617
|
agentId: binding.agentId,
|
|
@@ -646,12 +640,12 @@ async function resolveClickClackDiscussionRoute(params) {
|
|
|
646
640
|
} catch {
|
|
647
641
|
return { state: "revoked" };
|
|
648
642
|
} finally {
|
|
643
|
+
session?.release();
|
|
649
644
|
bindingFacts?.release();
|
|
650
645
|
revocation?.release();
|
|
651
646
|
}
|
|
652
647
|
}
|
|
653
|
-
|
|
654
|
-
//#region extensions/clickclack/src/group-policy.ts
|
|
648
|
+
// extensions/clickclack/src/group-policy.ts
|
|
655
649
|
function resolveClickClackGroupPolicy(params) {
|
|
656
650
|
const { account, channelId } = params;
|
|
657
651
|
const channelKey = channelId?.trim();
|
|
@@ -666,73 +660,12 @@ function resolveClickClackGroupPolicy(params) {
|
|
|
666
660
|
botLoopProtection: mergePairLoopGuardConfig(account.botLoopProtection, wildcard?.botLoopProtection, exact?.botLoopProtection)
|
|
667
661
|
};
|
|
668
662
|
}
|
|
669
|
-
|
|
670
|
-
//#region extensions/clickclack/src/mention-facts.ts
|
|
671
|
-
const CLICKCLACK_MENTION_PATTERN = /(?:^|[^a-z0-9_@-])@([a-z0-9][a-z0-9_-]{1,31})(?![a-z0-9_-])/giu;
|
|
672
|
-
function buildLocalMentionRegexes(params) {
|
|
673
|
-
if (params.mentionPatterns.length === 0) return [];
|
|
674
|
-
const cfg = params.cfg;
|
|
675
|
-
const syntheticCfg = {
|
|
676
|
-
...cfg,
|
|
677
|
-
messages: {
|
|
678
|
-
...cfg?.messages,
|
|
679
|
-
groupChat: {
|
|
680
|
-
...cfg?.messages?.groupChat,
|
|
681
|
-
mentionPatterns: params.mentionPatterns
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
};
|
|
685
|
-
return (0, channel_mention_gating_exports.buildMentionRegexes)(syntheticCfg, void 0, {
|
|
686
|
-
provider: "clickclack",
|
|
687
|
-
conversationId: params.channelId
|
|
688
|
-
});
|
|
689
|
-
}
|
|
690
|
-
function resolveMentionHandles(body) {
|
|
691
|
-
return [...body.matchAll(CLICKCLACK_MENTION_PATTERN)].map((match) => match[1]?.toLowerCase()).filter((handle) => Boolean(handle));
|
|
692
|
-
}
|
|
693
|
-
function resolveClickClackMentionFacts(params) {
|
|
694
|
-
const { isDirect, body, mentionPatterns, botHandle, cfg, agentId, channelId } = params;
|
|
695
|
-
if (isDirect) return {
|
|
696
|
-
canDetectMention: false,
|
|
697
|
-
wasMentioned: false
|
|
698
|
-
};
|
|
699
|
-
if (!body) return {
|
|
700
|
-
canDetectMention: true,
|
|
701
|
-
wasMentioned: false,
|
|
702
|
-
hasAnyMention: false
|
|
703
|
-
};
|
|
704
|
-
const sharedMentionRegexes = (0, channel_mention_gating_exports.buildMentionRegexes)(cfg, agentId, {
|
|
705
|
-
provider: "clickclack",
|
|
706
|
-
conversationId: channelId
|
|
707
|
-
});
|
|
708
|
-
const localMentionRegexes = buildLocalMentionRegexes({
|
|
709
|
-
cfg,
|
|
710
|
-
mentionPatterns,
|
|
711
|
-
channelId
|
|
712
|
-
});
|
|
713
|
-
const mentionRegexes = [...sharedMentionRegexes, ...localMentionRegexes];
|
|
714
|
-
const bodyForRegex = (0, channel_mention_gating_exports.normalizeMentionText)(body);
|
|
715
|
-
const hasConfiguredMention = mentionRegexes.some((regex) => regex.test(bodyForRegex));
|
|
716
|
-
const mentionHandles = resolveMentionHandles(body);
|
|
717
|
-
const normalizedBotHandle = botHandle?.replace(/^@/u, "").trim().toLowerCase();
|
|
718
|
-
return {
|
|
719
|
-
canDetectMention: true,
|
|
720
|
-
wasMentioned: (normalizedBotHandle ? mentionHandles.includes(normalizedBotHandle) : false) || hasConfiguredMention,
|
|
721
|
-
hasAnyMention: mentionHandles.length > 0 || hasConfiguredMention
|
|
722
|
-
};
|
|
723
|
-
}
|
|
724
|
-
//#endregion
|
|
725
|
-
//#region extensions/clickclack/src/runtime.ts
|
|
726
|
-
/**
|
|
727
|
-
* Runtime store for host-provided OpenClaw services used by the ClickClack
|
|
728
|
-
* bundled plugin.
|
|
729
|
-
*/
|
|
663
|
+
// extensions/clickclack/src/runtime.ts
|
|
730
664
|
const { setRuntime: setClickClackRuntime, getRuntime: getClickClackRuntime } = createPluginRuntimeStore({
|
|
731
665
|
pluginId: "clickclack",
|
|
732
666
|
errorMessage: "ClickClack runtime not initialized"
|
|
733
667
|
});
|
|
734
|
-
|
|
735
|
-
//#region extensions/clickclack/src/target.ts
|
|
668
|
+
// extensions/clickclack/src/target.ts
|
|
736
669
|
/**
|
|
737
670
|
* Parses `channel:name`, `thread:msg_id`, `dm:usr_id`, or a bare channel name.
|
|
738
671
|
*/
|
|
@@ -766,15 +699,9 @@ function parseClickClackTarget(raw) {
|
|
|
766
699
|
function buildClickClackTarget(target) {
|
|
767
700
|
return `${target.kind}:${target.id}`;
|
|
768
701
|
}
|
|
769
|
-
|
|
770
|
-
return buildClickClackTarget(parseClickClackTarget(raw));
|
|
771
|
-
}
|
|
772
|
-
function looksLikeClickClackTarget(raw) {
|
|
773
|
-
return raw.trim().length > 0;
|
|
774
|
-
}
|
|
775
|
-
//#endregion
|
|
776
|
-
//#region extensions/clickclack/src/access.ts
|
|
702
|
+
// extensions/clickclack/src/access.ts
|
|
777
703
|
const CHANNEL_ID$2 = "clickclack";
|
|
704
|
+
const CLICKCLACK_MENTION_PATTERN = /(?:^|[^a-z0-9_@-])@([a-z0-9][a-z0-9_-]{1,31})(?![a-z0-9_-])/giu;
|
|
778
705
|
function normalizeClickClackUserId(value) {
|
|
779
706
|
const trimmed = value.trim();
|
|
780
707
|
if (!trimmed) return null;
|
|
@@ -801,77 +728,83 @@ async function isClickClackBotOwnedThread(params) {
|
|
|
801
728
|
return false;
|
|
802
729
|
}
|
|
803
730
|
}
|
|
804
|
-
function
|
|
805
|
-
if (params.message.parent_message_id && params.message.thread_root_id) return params.message.thread_root_id;
|
|
806
|
-
return params.isDirect ? params.message.direct_conversation_id ?? params.message.author_id : params.message.channel_id ?? params.message.thread_root_id ?? params.message.author_id;
|
|
807
|
-
}
|
|
808
|
-
function resolveAccountAgentRoute(params) {
|
|
731
|
+
async function resolveClickClackInboundAccess(params) {
|
|
809
732
|
const runtime = getClickClackRuntime();
|
|
810
|
-
const
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
};
|
|
814
|
-
const
|
|
815
|
-
cfg:
|
|
816
|
-
|
|
817
|
-
accountId: params.account.accountId,
|
|
818
|
-
peer
|
|
819
|
-
});
|
|
820
|
-
const agentId = normalizeAgentId(params.account.agentId ?? route.agentId);
|
|
821
|
-
if (agentId === route.agentId) return route;
|
|
822
|
-
const dmScope = params.cfg.session?.dmScope ?? "main";
|
|
823
|
-
const sessionKey = runtime.channel.routing.buildAgentSessionKey({
|
|
824
|
-
agentId,
|
|
825
|
-
mainKey: params.cfg.session?.mainKey,
|
|
826
|
-
channel: CHANNEL_ID$2,
|
|
827
|
-
accountId: params.account.accountId,
|
|
828
|
-
peer,
|
|
829
|
-
dmScope,
|
|
830
|
-
identityLinks: params.cfg.session?.identityLinks
|
|
831
|
-
});
|
|
832
|
-
const mainSessionKey = runtime.channel.routing.buildAgentSessionKey({
|
|
833
|
-
agentId,
|
|
834
|
-
mainKey: params.cfg.session?.mainKey,
|
|
835
|
-
channel: CHANNEL_ID$2,
|
|
836
|
-
accountId: params.account.accountId,
|
|
837
|
-
dmScope: "main"
|
|
733
|
+
const rootPolicyConfigured = resolveClickClackGroupPolicy({
|
|
734
|
+
account: params.account,
|
|
735
|
+
channelId: params.message.channel_id
|
|
736
|
+
}).requireMentionInBotThreads !== void 0;
|
|
737
|
+
const isCurrent = () => isClickClackAccountCurrent({
|
|
738
|
+
cfg: runtime.config.current(),
|
|
739
|
+
account: params.account
|
|
838
740
|
});
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
741
|
+
const isBotOwnedThread = rootPolicyConfigured && await isClickClackBotOwnedThread(params);
|
|
742
|
+
const routeConfig = rootPolicyConfigured ? runtime.config.current() : params.config;
|
|
743
|
+
const routeAccountConfig = rootPolicyConfigured ? resolveClickClackAccountConfig(routeConfig, params.account.accountId) : params.account;
|
|
744
|
+
const routingMessage = params.message;
|
|
745
|
+
const routingAccount = {
|
|
746
|
+
...params.account,
|
|
747
|
+
agentId: routeAccountConfig.agentId
|
|
846
748
|
};
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
const runtime = getClickClackRuntime();
|
|
850
|
-
const isDirect = Boolean(params.message.direct_conversation_id);
|
|
749
|
+
const routeRuntime = getClickClackRuntime();
|
|
750
|
+
const isDirect = Boolean(routingMessage.direct_conversation_id);
|
|
851
751
|
const target = buildClickClackTarget(isDirect ? {
|
|
852
752
|
chatType: "direct",
|
|
853
753
|
kind: "dm",
|
|
854
|
-
id:
|
|
754
|
+
id: routingMessage.author_id
|
|
855
755
|
} : {
|
|
856
756
|
chatType: "group",
|
|
857
757
|
kind: "channel",
|
|
858
|
-
id:
|
|
758
|
+
id: routingMessage.channel_id ?? ""
|
|
859
759
|
});
|
|
860
|
-
const
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
target
|
|
864
|
-
|
|
760
|
+
const routingConfig = routeConfig;
|
|
761
|
+
const peer = {
|
|
762
|
+
kind: isDirect ? "direct" : "channel",
|
|
763
|
+
id: target
|
|
764
|
+
};
|
|
765
|
+
let accountRoute = routeRuntime.channel.routing.resolveAgentRoute({
|
|
766
|
+
cfg: routingConfig,
|
|
767
|
+
channel: CHANNEL_ID$2,
|
|
768
|
+
accountId: routingAccount.accountId,
|
|
769
|
+
peer
|
|
865
770
|
});
|
|
866
|
-
const
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
771
|
+
const agentId = normalizeAgentId(routingAccount.agentId ?? accountRoute.agentId);
|
|
772
|
+
if (agentId !== accountRoute.agentId) {
|
|
773
|
+
const dmScope = routingConfig.session?.dmScope ?? "main";
|
|
774
|
+
const sessionKey = routeRuntime.channel.routing.buildAgentSessionKey({
|
|
775
|
+
agentId,
|
|
776
|
+
mainKey: routingConfig.session?.mainKey,
|
|
777
|
+
channel: CHANNEL_ID$2,
|
|
778
|
+
accountId: routingAccount.accountId,
|
|
779
|
+
peer,
|
|
780
|
+
dmScope,
|
|
781
|
+
identityLinks: routingConfig.session?.identityLinks
|
|
782
|
+
});
|
|
783
|
+
const mainSessionKey = routeRuntime.channel.routing.buildAgentSessionKey({
|
|
784
|
+
agentId,
|
|
785
|
+
mainKey: routingConfig.session?.mainKey,
|
|
786
|
+
channel: CHANNEL_ID$2,
|
|
787
|
+
accountId: routingAccount.accountId,
|
|
788
|
+
dmScope: "main"
|
|
789
|
+
});
|
|
790
|
+
accountRoute = {
|
|
791
|
+
...accountRoute,
|
|
792
|
+
agentId,
|
|
793
|
+
dmScope,
|
|
794
|
+
sessionKey,
|
|
795
|
+
mainSessionKey,
|
|
796
|
+
lastRoutePolicy: sessionKey === mainSessionKey ? "main" : "session"
|
|
797
|
+
};
|
|
798
|
+
}
|
|
799
|
+
const discussionResolution = await (!isDirect && routingMessage.channel_id ? resolveClickClackDiscussionRoute({
|
|
800
|
+
runtime: routeRuntime,
|
|
801
|
+
accountId: routingAccount.accountId,
|
|
802
|
+
serverBaseUrl: routingAccount.baseUrl,
|
|
803
|
+
workspaceId: routingMessage.workspace_id,
|
|
804
|
+
channelId: routingMessage.channel_id
|
|
805
|
+
}) : { state: "unbound" });
|
|
873
806
|
const discussionRoute = discussionResolution.state === "active" ? discussionResolution.route : void 0;
|
|
874
|
-
|
|
807
|
+
const preparedRoute = {
|
|
875
808
|
isDirect,
|
|
876
809
|
target,
|
|
877
810
|
route: discussionRoute ? {
|
|
@@ -883,28 +816,44 @@ async function resolvePreparedInboundRoute(params) {
|
|
|
883
816
|
discussionRoute,
|
|
884
817
|
revoked: discussionResolution.state === "revoked"
|
|
885
818
|
};
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
819
|
+
const resolveMentionFacts = (mentionConfig, mentionPatterns) => {
|
|
820
|
+
if (preparedRoute.isDirect) return {
|
|
821
|
+
canDetectMention: false,
|
|
822
|
+
wasMentioned: false
|
|
823
|
+
};
|
|
824
|
+
const body = params.message.body;
|
|
825
|
+
if (!body) return {
|
|
826
|
+
canDetectMention: true,
|
|
827
|
+
wasMentioned: false,
|
|
828
|
+
hasAnyMention: false
|
|
829
|
+
};
|
|
830
|
+
const sharedMentionRegexes = (0, channel_mention_gating_exports.buildMentionRegexes)(mentionConfig, preparedRoute.route.agentId, {
|
|
831
|
+
provider: CHANNEL_ID$2,
|
|
832
|
+
conversationId: params.message.channel_id
|
|
833
|
+
});
|
|
834
|
+
const localMentionRegexes = mentionPatterns.length ? (0, channel_mention_gating_exports.buildMentionRegexes)({
|
|
835
|
+
...mentionConfig,
|
|
836
|
+
messages: {
|
|
837
|
+
...mentionConfig.messages,
|
|
838
|
+
groupChat: {
|
|
839
|
+
...mentionConfig.messages?.groupChat,
|
|
840
|
+
mentionPatterns
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
}, void 0, {
|
|
844
|
+
provider: CHANNEL_ID$2,
|
|
845
|
+
conversationId: params.message.channel_id
|
|
846
|
+
}) : [];
|
|
847
|
+
const bodyForRegex = (0, channel_mention_gating_exports.normalizeMentionText)(body);
|
|
848
|
+
const hasConfiguredMention = [...sharedMentionRegexes, ...localMentionRegexes].some((regex) => regex.test(bodyForRegex));
|
|
849
|
+
const mentionHandles = [...body.matchAll(CLICKCLACK_MENTION_PATTERN)].map((match) => match[1]?.toLowerCase()).filter((handle) => Boolean(handle));
|
|
850
|
+
const botHandle = params.account.botHandle?.replace(/^@/u, "").trim().toLowerCase();
|
|
851
|
+
return {
|
|
852
|
+
canDetectMention: true,
|
|
853
|
+
wasMentioned: (botHandle ? mentionHandles.includes(botHandle) : false) || hasConfiguredMention,
|
|
854
|
+
hasAnyMention: mentionHandles.length > 0 || hasConfiguredMention
|
|
855
|
+
};
|
|
856
|
+
};
|
|
908
857
|
const cfg = rootPolicyConfigured ? runtime.config.current() : params.config;
|
|
909
858
|
const accountPolicy = rootPolicyConfigured ? resolveClickClackAccountConfig(cfg, params.account.accountId) : params.account;
|
|
910
859
|
const effectiveGroupPolicy = resolveClickClackGroupPolicy({
|
|
@@ -917,16 +866,10 @@ async function resolveClickClackInboundAccess(params) {
|
|
|
917
866
|
requireMention: effectiveGroupPolicy.requireMention
|
|
918
867
|
});
|
|
919
868
|
const shouldCheckCommand = runtime.channel.commands.shouldComputeCommandAuthorized(params.message.body, cfg);
|
|
920
|
-
const mentionFacts =
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
botHandle: params.account.botHandle,
|
|
925
|
-
cfg,
|
|
926
|
-
agentId: preparedRoute.route.agentId,
|
|
927
|
-
channelId: params.message.channel_id
|
|
928
|
-
});
|
|
929
|
-
if (!isCurrent() || params.message.kind !== void 0 && params.message.kind !== "message") return {
|
|
869
|
+
const mentionFacts = resolveMentionFacts(cfg, effectiveGroupPolicy.mentionPatterns);
|
|
870
|
+
const isBotAuthor = params.message.author?.kind === "bot";
|
|
871
|
+
const botMentionAllowed = !isBotAuthor || effectiveGroupPolicy.allowBots === true || effectiveGroupPolicy.allowBots === "mentions" && (preparedRoute.isDirect || mentionFacts.wasMentioned);
|
|
872
|
+
if (!isCurrent() || params.message.kind !== void 0 && params.message.kind !== "message" || !botMentionAllowed) return {
|
|
930
873
|
shouldDispatch: false,
|
|
931
874
|
isCurrent,
|
|
932
875
|
commandAuthorized: false,
|
|
@@ -934,24 +877,12 @@ async function resolveClickClackInboundAccess(params) {
|
|
|
934
877
|
mentionFacts,
|
|
935
878
|
preparedRoute
|
|
936
879
|
};
|
|
937
|
-
const isBotAuthor = params.message.author?.kind === "bot";
|
|
938
880
|
const allowFrom = accountPolicy.allowFrom ?? ["*"];
|
|
939
881
|
const ingressAllowFrom = isBotAuthor ? allowFrom.filter((entry) => normalizeClickClackUserId(entry) !== "*") : allowFrom;
|
|
940
|
-
if (!(!isBotAuthor || effectiveGroupPolicy.allowBots === true || effectiveGroupPolicy.allowBots === "mentions" && (preparedRoute.isDirect || mentionFacts.wasMentioned))) return {
|
|
941
|
-
shouldDispatch: false,
|
|
942
|
-
isCurrent,
|
|
943
|
-
commandAuthorized: false,
|
|
944
|
-
requireMention: threadMentionPolicy.requireMention,
|
|
945
|
-
mentionFacts,
|
|
946
|
-
preparedRoute
|
|
947
|
-
};
|
|
948
882
|
const botLoopNowMs = parseDateStringTimestampMs(params.message.created_at);
|
|
949
883
|
const botLoopProtection = isBotAuthor && params.message.author_id !== params.account.botUserId && params.account.botUserId ? {
|
|
950
884
|
scopeId: params.account.workspace,
|
|
951
|
-
conversationId:
|
|
952
|
-
message: params.message,
|
|
953
|
-
isDirect: preparedRoute.isDirect
|
|
954
|
-
}),
|
|
885
|
+
conversationId: params.message.parent_message_id && params.message.thread_root_id ? params.message.thread_root_id : preparedRoute.isDirect ? params.message.direct_conversation_id ?? params.message.author_id : params.message.channel_id ?? params.message.thread_root_id ?? params.message.author_id,
|
|
955
886
|
senderId: params.message.author_id,
|
|
956
887
|
receiverId: params.account.botUserId,
|
|
957
888
|
eventId: params.message.id,
|
|
@@ -992,7 +923,8 @@ async function resolveClickClackInboundAccess(params) {
|
|
|
992
923
|
} },
|
|
993
924
|
command: shouldCheckCommand ? {
|
|
994
925
|
cfg,
|
|
995
|
-
modeWhenAccessGroupsOff: "configured"
|
|
926
|
+
modeWhenAccessGroupsOff: "configured",
|
|
927
|
+
hasControlCommand: runtime.channel.text.hasControlCommand(params.message.body, cfg)
|
|
996
928
|
} : false
|
|
997
929
|
});
|
|
998
930
|
const isAdmissionCurrent = () => {
|
|
@@ -1022,15 +954,7 @@ async function resolveClickClackInboundAccess(params) {
|
|
|
1022
954
|
return group?.type === "message.senders" && resolved.state.allowlists[preparedRoute.isDirect ? "dm" : "group"].accessGroups.matched.includes(name) && isDeepStrictEqual(group, cfg.accessGroups?.[name]);
|
|
1023
955
|
});
|
|
1024
956
|
if (!directSenderAllowed && !staticGroupAllowed) return false;
|
|
1025
|
-
const currentMentionFacts =
|
|
1026
|
-
isDirect: preparedRoute.isDirect,
|
|
1027
|
-
body: params.message.body,
|
|
1028
|
-
mentionPatterns: currentGroupPolicy.mentionPatterns,
|
|
1029
|
-
botHandle: params.account.botHandle,
|
|
1030
|
-
cfg: currentCfg,
|
|
1031
|
-
agentId: preparedRoute.route.agentId,
|
|
1032
|
-
channelId: params.message.channel_id
|
|
1033
|
-
});
|
|
957
|
+
const currentMentionFacts = resolveMentionFacts(currentCfg, currentGroupPolicy.mentionPatterns);
|
|
1034
958
|
if (isBotAuthor && currentGroupPolicy.allowBots !== true && !(currentGroupPolicy.allowBots === "mentions" && (preparedRoute.isDirect || currentMentionFacts.wasMentioned))) return false;
|
|
1035
959
|
const currentThreadPolicy = resolveBotThreadMentionPolicy({
|
|
1036
960
|
isBotOwnedThread,
|
|
@@ -1047,7 +971,7 @@ async function resolveClickClackInboundAccess(params) {
|
|
|
1047
971
|
surface: CHANNEL_ID$2,
|
|
1048
972
|
commandSource: "text"
|
|
1049
973
|
}),
|
|
1050
|
-
hasControlCommand: shouldCheckCommand && runtime.channel.
|
|
974
|
+
hasControlCommand: shouldCheckCommand && runtime.channel.text.hasControlCommand(params.message.body, currentCfg),
|
|
1051
975
|
commandAuthorized: resolved.commandAccess.authorized
|
|
1052
976
|
}
|
|
1053
977
|
}).shouldSkip;
|
|
@@ -1063,64 +987,7 @@ async function resolveClickClackInboundAccess(params) {
|
|
|
1063
987
|
channelIngress: resolved
|
|
1064
988
|
};
|
|
1065
989
|
}
|
|
1066
|
-
|
|
1067
|
-
//#region extensions/clickclack/src/command-menu.ts
|
|
1068
|
-
const CLICKCLACK_COMMAND_PATTERN = /^[a-z0-9_-]{1,32}$/u;
|
|
1069
|
-
const CLICKCLACK_MAX_COMMANDS = 100;
|
|
1070
|
-
const CLICKCLACK_MAX_DESCRIPTION_LENGTH = 100;
|
|
1071
|
-
const CLICKCLACK_MAX_ARGS_HINT_LENGTH = 100;
|
|
1072
|
-
function commandArgsHint(spec) {
|
|
1073
|
-
if (spec.args?.length) return truncateCodePoints(spec.args.map((arg) => arg.required ? `<${arg.name}>` : `[${arg.name}]`).join(" "), CLICKCLACK_MAX_ARGS_HINT_LENGTH);
|
|
1074
|
-
return spec.acceptsArgs ? "[args]" : "";
|
|
1075
|
-
}
|
|
1076
|
-
function errorStatus(error) {
|
|
1077
|
-
if (!error || typeof error !== "object" || !("status" in error)) return;
|
|
1078
|
-
const status = error.status;
|
|
1079
|
-
return typeof status === "number" ? status : void 0;
|
|
1080
|
-
}
|
|
1081
|
-
function mapNativeCommandSpecsToClickClackMenu(specs, log) {
|
|
1082
|
-
const commands = [];
|
|
1083
|
-
const seen = /* @__PURE__ */ new Set();
|
|
1084
|
-
const invalidNames = /* @__PURE__ */ new Set();
|
|
1085
|
-
for (const spec of specs) {
|
|
1086
|
-
if (spec.isAlias) continue;
|
|
1087
|
-
const command = spec.name.trim().toLowerCase();
|
|
1088
|
-
if (!CLICKCLACK_COMMAND_PATTERN.test(command)) {
|
|
1089
|
-
invalidNames.add(spec.name.trim() || "<empty>");
|
|
1090
|
-
continue;
|
|
1091
|
-
}
|
|
1092
|
-
if (seen.has(command)) continue;
|
|
1093
|
-
seen.add(command);
|
|
1094
|
-
const description = spec.description.trim() || command;
|
|
1095
|
-
commands.push({
|
|
1096
|
-
command,
|
|
1097
|
-
description: truncateCodePoints(description, CLICKCLACK_MAX_DESCRIPTION_LENGTH),
|
|
1098
|
-
args_hint: commandArgsHint(spec)
|
|
1099
|
-
});
|
|
1100
|
-
}
|
|
1101
|
-
if (invalidNames.size > 0) log?.warn?.(`ClickClack command menu skipped invalid native command names: ${[...invalidNames].map((name) => JSON.stringify(name)).join(", ")}`);
|
|
1102
|
-
return commands.slice(0, CLICKCLACK_MAX_COMMANDS);
|
|
1103
|
-
}
|
|
1104
|
-
async function syncClickClackCommandMenu(params) {
|
|
1105
|
-
try {
|
|
1106
|
-
const commands = mapNativeCommandSpecsToClickClackMenu(listNativeCommandSpecsForConfig(params.cfg, { provider: "clickclack" }), params.log);
|
|
1107
|
-
await params.client.setBotCommands(commands);
|
|
1108
|
-
} catch (error) {
|
|
1109
|
-
const status = errorStatus(error);
|
|
1110
|
-
const messagePrefix = `[${params.accountId}] ClickClack command menu sync`;
|
|
1111
|
-
if (status === 403) {
|
|
1112
|
-
params.log?.warn?.(`${messagePrefix} skipped: ${formatErrorMessage(error)}; verify token/workspace command permissions or set commandMenu: false if menus are not needed`);
|
|
1113
|
-
return;
|
|
1114
|
-
}
|
|
1115
|
-
if (status === 404) {
|
|
1116
|
-
params.log?.debug?.(`${messagePrefix} skipped: server does not support /api/bots/self/commands`);
|
|
1117
|
-
return;
|
|
1118
|
-
}
|
|
1119
|
-
params.log?.warn?.(`${messagePrefix} failed: ${formatErrorMessage(error)}`);
|
|
1120
|
-
}
|
|
1121
|
-
}
|
|
1122
|
-
//#endregion
|
|
1123
|
-
//#region extensions/clickclack/src/activity.ts
|
|
990
|
+
// extensions/clickclack/src/activity.ts
|
|
1124
991
|
const CLICKCLACK_COMMENTARY_FLUSH_MS = 700;
|
|
1125
992
|
/** Item kinds rendered as agent_tool rows; everything else is commentary. */
|
|
1126
993
|
const TOOL_ITEM_KINDS = /* @__PURE__ */ new Set([
|
|
@@ -1149,31 +1016,11 @@ const THINKING_ITEM_KINDS = /* @__PURE__ */ new Set([
|
|
|
1149
1016
|
function normalizedItemKind(payload) {
|
|
1150
1017
|
return payload.kind?.trim().toLowerCase() ?? "";
|
|
1151
1018
|
}
|
|
1152
|
-
function commentaryBody(payload) {
|
|
1153
|
-
const text = payload.progressText?.trim() || payload.summary?.trim() || payload.meta?.trim() || "";
|
|
1154
|
-
if (!text) return "";
|
|
1155
|
-
const kind = normalizedItemKind(payload);
|
|
1156
|
-
if (THINKING_ITEM_KINDS.has(kind)) return `**Thinking**\n\n${text}`;
|
|
1157
|
-
return text;
|
|
1158
|
-
}
|
|
1159
|
-
function activityBody(payload) {
|
|
1160
|
-
const line = formatChannelProgressDraftLineForEntry(void 0, {
|
|
1161
|
-
...payload,
|
|
1162
|
-
event: "item",
|
|
1163
|
-
itemKind: payload.kind
|
|
1164
|
-
})?.trim();
|
|
1165
|
-
if (line) return line;
|
|
1166
|
-
const head = payload.name?.trim() || payload.title?.trim();
|
|
1167
|
-
const text = payload.progressText?.trim() || payload.summary?.trim();
|
|
1168
|
-
if (head && text) return `**${head}**\n\n${text}`;
|
|
1169
|
-
return text || head || payload.status?.trim() || payload.kind?.trim() || "";
|
|
1170
|
-
}
|
|
1171
1019
|
/**
|
|
1172
1020
|
* Creates a per-turn activity publisher. Publishing is best-effort: transport
|
|
1173
1021
|
* failures are reported through `onError` and never interrupt the reply turn.
|
|
1174
1022
|
*/
|
|
1175
1023
|
function createClickClackActivityPublisher(params) {
|
|
1176
|
-
const flushMs = params.flushMs ?? CLICKCLACK_COMMENTARY_FLUSH_MS;
|
|
1177
1024
|
const commentaryByItem = /* @__PURE__ */ new Map();
|
|
1178
1025
|
const toolRows = /* @__PURE__ */ new Map();
|
|
1179
1026
|
let provenance;
|
|
@@ -1195,10 +1042,8 @@ function createClickClackActivityPublisher(params) {
|
|
|
1195
1042
|
const flushCommentary = (segmentKey) => {
|
|
1196
1043
|
const segment = commentaryByItem.get(segmentKey);
|
|
1197
1044
|
if (!segment) return Promise.resolve();
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
segment.timer = void 0;
|
|
1201
|
-
}
|
|
1045
|
+
clearTimeout(segment.timer);
|
|
1046
|
+
segment.timer = void 0;
|
|
1202
1047
|
if (!segment.dirty || !segment.body) return Promise.resolve();
|
|
1203
1048
|
segment.dirty = false;
|
|
1204
1049
|
const body = segment.body;
|
|
@@ -1216,7 +1061,8 @@ function createClickClackActivityPublisher(params) {
|
|
|
1216
1061
|
return Promise.all(flushes).then(() => void 0);
|
|
1217
1062
|
};
|
|
1218
1063
|
const handleCommentary = (payload) => {
|
|
1219
|
-
const
|
|
1064
|
+
const text = payload.progressText?.trim() || payload.summary?.trim() || payload.meta?.trim() || "";
|
|
1065
|
+
const body = text && THINKING_ITEM_KINDS.has(normalizedItemKind(payload)) ? `**Thinking**\n\n${text}` : text;
|
|
1220
1066
|
const key = payload.itemId?.trim() || "turn";
|
|
1221
1067
|
let segment = commentaryByItem.get(key);
|
|
1222
1068
|
if (!body) {
|
|
@@ -1243,13 +1089,22 @@ function createClickClackActivityPublisher(params) {
|
|
|
1243
1089
|
if (!segment.timer) segment.timer = setTimeout(() => {
|
|
1244
1090
|
segment.timer = void 0;
|
|
1245
1091
|
flushCommentary(key);
|
|
1246
|
-
},
|
|
1092
|
+
}, CLICKCLACK_COMMENTARY_FLUSH_MS);
|
|
1247
1093
|
};
|
|
1248
1094
|
const toolRowKey = (payload) => {
|
|
1249
1095
|
return payload.itemId?.trim() || payload.toolCallId?.trim() || "";
|
|
1250
1096
|
};
|
|
1251
1097
|
const handleDiscreteItem = (payload) => {
|
|
1252
|
-
|
|
1098
|
+
let body = formatChannelProgressDraftLineForEntry(void 0, {
|
|
1099
|
+
...payload,
|
|
1100
|
+
event: "item",
|
|
1101
|
+
itemKind: payload.kind
|
|
1102
|
+
});
|
|
1103
|
+
if (!body) {
|
|
1104
|
+
const head = payload.name?.trim() || payload.title?.trim();
|
|
1105
|
+
const text = payload.progressText?.trim() || payload.summary?.trim();
|
|
1106
|
+
body = head && text ? `**${head}**\n\n${text}` : text || head || payload.status?.trim() || payload.kind?.trim() || "";
|
|
1107
|
+
}
|
|
1253
1108
|
if (!body) return;
|
|
1254
1109
|
const kind = TOOL_ITEM_KINDS.has(normalizedItemKind(payload)) ? "agent_tool" : "agent_commentary";
|
|
1255
1110
|
flushAllCommentary();
|
|
@@ -1260,9 +1115,10 @@ function createClickClackActivityPublisher(params) {
|
|
|
1260
1115
|
const row = { body };
|
|
1261
1116
|
if (itemKey) toolRows.set(key, row);
|
|
1262
1117
|
enqueue(async () => {
|
|
1263
|
-
const
|
|
1118
|
+
const submittedBody = row.body;
|
|
1119
|
+
const posted = await postRow(kind, submittedBody);
|
|
1264
1120
|
row.messageId = posted.id;
|
|
1265
|
-
row.sentBody =
|
|
1121
|
+
row.sentBody = submittedBody;
|
|
1266
1122
|
});
|
|
1267
1123
|
return;
|
|
1268
1124
|
}
|
|
@@ -1270,8 +1126,9 @@ function createClickClackActivityPublisher(params) {
|
|
|
1270
1126
|
existing.body = body;
|
|
1271
1127
|
enqueue(async () => {
|
|
1272
1128
|
if (existing.messageId && existing.body !== existing.sentBody) {
|
|
1273
|
-
|
|
1274
|
-
existing.
|
|
1129
|
+
const submittedBody = existing.body;
|
|
1130
|
+
await params.client.updateMessageBody(existing.messageId, submittedBody);
|
|
1131
|
+
existing.sentBody = submittedBody;
|
|
1275
1132
|
}
|
|
1276
1133
|
});
|
|
1277
1134
|
};
|
|
@@ -1309,8 +1166,7 @@ function createClickClackActivityPublisher(params) {
|
|
|
1309
1166
|
}
|
|
1310
1167
|
};
|
|
1311
1168
|
}
|
|
1312
|
-
|
|
1313
|
-
//#region extensions/clickclack/src/outbound.ts
|
|
1169
|
+
// extensions/clickclack/src/outbound.ts
|
|
1314
1170
|
const CLICKCLACK_MAX_UPLOAD_BYTES = 67108864;
|
|
1315
1171
|
async function createTargetMessage(params) {
|
|
1316
1172
|
const parsed = parseClickClackTarget(params.to);
|
|
@@ -1346,7 +1202,7 @@ async function createTargetMessage(params) {
|
|
|
1346
1202
|
function durableDeliveryDigest(params) {
|
|
1347
1203
|
if (!params.deliveryQueueId) return;
|
|
1348
1204
|
if (!Number.isSafeInteger(params.deliveryPartIndex) || (params.deliveryPartIndex ?? -1) < 0) throw new Error("ClickClack durable delivery requires a stable delivery part index");
|
|
1349
|
-
return
|
|
1205
|
+
return sha256Hex(`${params.deliveryQueueId}\n${params.deliveryPartIndex}`);
|
|
1350
1206
|
}
|
|
1351
1207
|
function mediaDeliveryNonces(params) {
|
|
1352
1208
|
const digest = durableDeliveryDigest(params);
|
|
@@ -1581,8 +1437,7 @@ async function reconcileClickClackUnknownSend(ctx) {
|
|
|
1581
1437
|
receipt
|
|
1582
1438
|
};
|
|
1583
1439
|
}
|
|
1584
|
-
|
|
1585
|
-
//#region extensions/clickclack/src/progress.ts
|
|
1440
|
+
// extensions/clickclack/src/progress.ts
|
|
1586
1441
|
function normalizedKind(payload) {
|
|
1587
1442
|
const kind = payload.kind?.trim().toLowerCase();
|
|
1588
1443
|
if (!kind || kind === "preamble" || kind === "analysis" || kind === "thinking" || kind === "reasoning" || kind === "missing") return "commentary";
|
|
@@ -1594,7 +1449,7 @@ function progressText(payload) {
|
|
|
1594
1449
|
...payload,
|
|
1595
1450
|
event: "item",
|
|
1596
1451
|
itemKind: payload.kind
|
|
1597
|
-
})?.text
|
|
1452
|
+
})?.text;
|
|
1598
1453
|
if (line) return line;
|
|
1599
1454
|
return payload.progressText?.trim() || payload.summary?.trim() || payload.title?.trim() || payload.name?.trim() || payload.meta?.trim() || payload.status?.trim() || "Working";
|
|
1600
1455
|
}
|
|
@@ -1639,25 +1494,18 @@ function createClickClackAgentProgressPublisher(params) {
|
|
|
1639
1494
|
const drain = () => {
|
|
1640
1495
|
if (drainPromise) return drainPromise;
|
|
1641
1496
|
drainPromise = (async () => {
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
}
|
|
1655
|
-
});
|
|
1656
|
-
} catch (error) {
|
|
1657
|
-
try {
|
|
1658
|
-
params.onError?.(error);
|
|
1659
|
-
} catch {}
|
|
1660
|
-
}
|
|
1497
|
+
for (let frame = queue.shift(); frame; frame = queue.shift()) try {
|
|
1498
|
+
await params.client.publishEphemeral({
|
|
1499
|
+
...params.target,
|
|
1500
|
+
type: "agent.progress",
|
|
1501
|
+
payload: {
|
|
1502
|
+
turn_id: params.turnId,
|
|
1503
|
+
seq: ++sequence,
|
|
1504
|
+
...frame.payload
|
|
1505
|
+
}
|
|
1506
|
+
});
|
|
1507
|
+
} catch (error) {
|
|
1508
|
+
params.onError?.(error);
|
|
1661
1509
|
}
|
|
1662
1510
|
})().finally(() => {
|
|
1663
1511
|
drainPromise = void 0;
|
|
@@ -1723,25 +1571,26 @@ function createClickClackAgentProgressPublisher(params) {
|
|
|
1723
1571
|
if (!started || cleared) return false;
|
|
1724
1572
|
if (payload.suppressChannelProgress || payload.kind === "preamble" && !isCompleteAgentPreamble(payload)) return false;
|
|
1725
1573
|
const id = resolveLineId(payload);
|
|
1726
|
-
|
|
1574
|
+
const kind = normalizedKind(payload);
|
|
1575
|
+
const hidesLine = payload.hideFromChannelProgress || payload.kind === "model-wait" && payload.phase === "end";
|
|
1576
|
+
const retractsExistingCommentary = kind === "commentary" && seenLines.has(id) && payload.progressText !== void 0 && payload.progressText.trim() === "";
|
|
1577
|
+
if ((hidesLine || retractsExistingCommentary) && queuedLines.get(id)?.payload.op === "append") {
|
|
1578
|
+
queuedLines.delete(id);
|
|
1579
|
+
seenLines.delete(id);
|
|
1580
|
+
return false;
|
|
1581
|
+
}
|
|
1582
|
+
if (hidesLine) {
|
|
1727
1583
|
if (seenLines.delete(id)) enqueueLine(id, {
|
|
1728
1584
|
op: "update",
|
|
1729
1585
|
line: {
|
|
1730
1586
|
id,
|
|
1731
|
-
kind
|
|
1587
|
+
kind,
|
|
1732
1588
|
text: ""
|
|
1733
1589
|
}
|
|
1734
1590
|
});
|
|
1735
1591
|
return false;
|
|
1736
1592
|
}
|
|
1737
1593
|
const final = isFinal(payload);
|
|
1738
|
-
const kind = normalizedKind(payload);
|
|
1739
|
-
const retractsExistingCommentary = kind === "commentary" && seenLines.has(id) && payload.progressText !== void 0 && payload.progressText.trim() === "";
|
|
1740
|
-
if (retractsExistingCommentary && queuedLines.get(id)?.payload.op === "append") {
|
|
1741
|
-
queuedLines.delete(id);
|
|
1742
|
-
seenLines.delete(id);
|
|
1743
|
-
return false;
|
|
1744
|
-
}
|
|
1745
1594
|
const line = {
|
|
1746
1595
|
id,
|
|
1747
1596
|
kind,
|
|
@@ -1769,8 +1618,7 @@ function createClickClackAgentProgressPublisher(params) {
|
|
|
1769
1618
|
}
|
|
1770
1619
|
};
|
|
1771
1620
|
}
|
|
1772
|
-
|
|
1773
|
-
//#region extensions/clickclack/src/inbound.ts
|
|
1621
|
+
// extensions/clickclack/src/inbound.ts
|
|
1774
1622
|
const CHANNEL_ID$1 = "clickclack";
|
|
1775
1623
|
const CLICKCLACK_MESSAGE_ID_PATTERN = /^msg_[0-9a-hjkmnp-tv-z]{26}$/u;
|
|
1776
1624
|
function hasClickClackReplyMedia(payload) {
|
|
@@ -1779,49 +1627,6 @@ function hasClickClackReplyMedia(payload) {
|
|
|
1779
1627
|
function resolveClickClackAgentRunId(messageId) {
|
|
1780
1628
|
return CLICKCLACK_MESSAGE_ID_PATTERN.test(messageId) ? `${CHANNEL_ID$1}:${messageId}` : void 0;
|
|
1781
1629
|
}
|
|
1782
|
-
async function dispatchModelReply(params) {
|
|
1783
|
-
const runtime = getClickClackRuntime();
|
|
1784
|
-
const result = await runtime.llm.complete({
|
|
1785
|
-
agentId: params.route.agentId,
|
|
1786
|
-
model: params.account.model,
|
|
1787
|
-
purpose: "clickclack bot reply",
|
|
1788
|
-
systemPrompt: params.account.systemPrompt,
|
|
1789
|
-
messages: [{
|
|
1790
|
-
role: "user",
|
|
1791
|
-
content: params.message.body
|
|
1792
|
-
}]
|
|
1793
|
-
});
|
|
1794
|
-
const completion = result.text.trim();
|
|
1795
|
-
if (!completion) {
|
|
1796
|
-
runtime.logging.getChildLogger({
|
|
1797
|
-
plugin: "clickclack",
|
|
1798
|
-
feature: "model-reply"
|
|
1799
|
-
}).warn(`[${params.account.accountId}] ClickClack model reply produced no sendable text`);
|
|
1800
|
-
return;
|
|
1801
|
-
}
|
|
1802
|
-
const replyPipeline = createChannelMessageReplyPipeline({
|
|
1803
|
-
cfg: params.cfg,
|
|
1804
|
-
agentId: params.route.agentId,
|
|
1805
|
-
channel: CHANNEL_ID$1,
|
|
1806
|
-
accountId: params.account.accountId
|
|
1807
|
-
});
|
|
1808
|
-
replyPipeline.onModelSelected?.({
|
|
1809
|
-
provider: result.provider,
|
|
1810
|
-
model: result.model,
|
|
1811
|
-
thinkLevel: void 0
|
|
1812
|
-
});
|
|
1813
|
-
const responsePrefix = replyPipeline.resolveResponsePrefix?.();
|
|
1814
|
-
const text = responsePrefix && !completion.startsWith(responsePrefix) ? `${responsePrefix} ${completion}` : completion;
|
|
1815
|
-
await sendClickClackText({
|
|
1816
|
-
cfg: params.cfg,
|
|
1817
|
-
accountId: params.account.accountId,
|
|
1818
|
-
to: params.target,
|
|
1819
|
-
text,
|
|
1820
|
-
threadId: params.message.parent_message_id ? params.message.thread_root_id : void 0,
|
|
1821
|
-
replyToId: params.message.id,
|
|
1822
|
-
correlationId: params.correlationId
|
|
1823
|
-
});
|
|
1824
|
-
}
|
|
1825
1630
|
async function handleClickClackInbound(params) {
|
|
1826
1631
|
const runtime = getClickClackRuntime();
|
|
1827
1632
|
const message = params.message;
|
|
@@ -1848,7 +1653,7 @@ async function handleClickClackInbound(params) {
|
|
|
1848
1653
|
conversationId
|
|
1849
1654
|
},
|
|
1850
1655
|
turnId: message.id,
|
|
1851
|
-
agentLabel: params.account.name
|
|
1656
|
+
agentLabel: params.account.name || params.account.botHandle?.trim() || params.account.agentId || params.account.accountId,
|
|
1852
1657
|
onError: (error) => {
|
|
1853
1658
|
runtime.logging.getChildLogger({
|
|
1854
1659
|
plugin: "clickclack",
|
|
@@ -1869,13 +1674,49 @@ async function handleClickClackInbound(params) {
|
|
|
1869
1674
|
}
|
|
1870
1675
|
progress?.start();
|
|
1871
1676
|
try {
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1677
|
+
const modelAccount = params.account;
|
|
1678
|
+
const modelConfig = params.config;
|
|
1679
|
+
const correlationId = params.correlationId;
|
|
1680
|
+
const modelRuntime = getClickClackRuntime();
|
|
1681
|
+
const result = await modelRuntime.llm.complete({
|
|
1682
|
+
agentId: route.agentId,
|
|
1683
|
+
model: modelAccount.model,
|
|
1684
|
+
purpose: "clickclack bot reply",
|
|
1685
|
+
systemPrompt: modelAccount.systemPrompt,
|
|
1686
|
+
messages: [{
|
|
1687
|
+
role: "user",
|
|
1688
|
+
content: message.body
|
|
1689
|
+
}]
|
|
1690
|
+
});
|
|
1691
|
+
const completion = result.text.trim();
|
|
1692
|
+
if (!completion) {
|
|
1693
|
+
modelRuntime.logging.getChildLogger({
|
|
1694
|
+
plugin: "clickclack",
|
|
1695
|
+
feature: "model-reply"
|
|
1696
|
+
}).warn(`[${modelAccount.accountId}] ClickClack model reply produced no sendable text`);
|
|
1697
|
+
return;
|
|
1698
|
+
}
|
|
1699
|
+
const replyPipeline = createChannelMessageReplyPipeline({
|
|
1700
|
+
cfg: modelConfig,
|
|
1701
|
+
agentId: route.agentId,
|
|
1702
|
+
channel: CHANNEL_ID$1,
|
|
1703
|
+
accountId: modelAccount.accountId
|
|
1704
|
+
});
|
|
1705
|
+
replyPipeline.onModelSelected?.({
|
|
1706
|
+
provider: result.provider,
|
|
1707
|
+
model: result.model,
|
|
1708
|
+
thinkLevel: void 0
|
|
1709
|
+
});
|
|
1710
|
+
const responsePrefix = replyPipeline.resolveResponsePrefix?.();
|
|
1711
|
+
const text = responsePrefix && !completion.startsWith(responsePrefix) ? `${responsePrefix} ${completion}` : completion;
|
|
1712
|
+
await sendClickClackText({
|
|
1713
|
+
cfg: modelConfig,
|
|
1714
|
+
accountId: modelAccount.accountId,
|
|
1715
|
+
to: target,
|
|
1716
|
+
text,
|
|
1717
|
+
threadId: message.parent_message_id ? message.thread_root_id : void 0,
|
|
1718
|
+
replyToId: message.id,
|
|
1719
|
+
correlationId
|
|
1879
1720
|
});
|
|
1880
1721
|
} finally {
|
|
1881
1722
|
await progress?.finalize();
|
|
@@ -2040,9 +1881,39 @@ async function handleClickClackInbound(params) {
|
|
|
2040
1881
|
await activity?.finalize();
|
|
2041
1882
|
}
|
|
2042
1883
|
}
|
|
2043
|
-
|
|
2044
|
-
//#region extensions/clickclack/src/gateway.ts
|
|
1884
|
+
// extensions/clickclack/src/gateway.ts
|
|
2045
1885
|
const CLICKCLACK_EVENT_PAGE_LIMIT = 500;
|
|
1886
|
+
const CLICKCLACK_COMMAND_PATTERN = /^[a-z0-9_-]{1,32}$/u;
|
|
1887
|
+
const CLICKCLACK_MAX_COMMANDS = 100;
|
|
1888
|
+
const CLICKCLACK_MAX_DESCRIPTION_LENGTH = 100;
|
|
1889
|
+
const CLICKCLACK_MAX_ARGS_HINT_LENGTH = 100;
|
|
1890
|
+
function commandArgsHint(spec) {
|
|
1891
|
+
if (spec.args?.length) return truncateCodePoints(spec.args.map((arg) => arg.required ? `<${arg.name}>` : `[${arg.name}]`).join(" "), CLICKCLACK_MAX_ARGS_HINT_LENGTH);
|
|
1892
|
+
return spec.acceptsArgs ? "[args]" : "";
|
|
1893
|
+
}
|
|
1894
|
+
function mapNativeCommandSpecsToClickClackMenu(specs, log) {
|
|
1895
|
+
const commands = [];
|
|
1896
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1897
|
+
const invalidNames = /* @__PURE__ */ new Set();
|
|
1898
|
+
for (const spec of specs) {
|
|
1899
|
+
if (spec.isAlias) continue;
|
|
1900
|
+
const command = spec.name.trim().toLowerCase();
|
|
1901
|
+
if (!CLICKCLACK_COMMAND_PATTERN.test(command)) {
|
|
1902
|
+
invalidNames.add(spec.name.trim() || "<empty>");
|
|
1903
|
+
continue;
|
|
1904
|
+
}
|
|
1905
|
+
if (seen.has(command)) continue;
|
|
1906
|
+
seen.add(command);
|
|
1907
|
+
const description = spec.description.trim() || command;
|
|
1908
|
+
commands.push({
|
|
1909
|
+
command,
|
|
1910
|
+
description: truncateCodePoints(description, CLICKCLACK_MAX_DESCRIPTION_LENGTH),
|
|
1911
|
+
args_hint: commandArgsHint(spec)
|
|
1912
|
+
});
|
|
1913
|
+
}
|
|
1914
|
+
if (invalidNames.size > 0) log?.warn?.(`ClickClack command menu skipped invalid native command names: ${[...invalidNames].map((name) => JSON.stringify(name)).join(", ")}`);
|
|
1915
|
+
return commands.slice(0, CLICKCLACK_MAX_COMMANDS);
|
|
1916
|
+
}
|
|
2046
1917
|
function payloadString(event, key) {
|
|
2047
1918
|
return readStringField(event.payload, key) ?? "";
|
|
2048
1919
|
}
|
|
@@ -2056,66 +1927,6 @@ async function resolveEventMessage(params) {
|
|
|
2056
1927
|
throw error;
|
|
2057
1928
|
}
|
|
2058
1929
|
}
|
|
2059
|
-
function parseSocketEvent(data) {
|
|
2060
|
-
try {
|
|
2061
|
-
return JSON.parse(rawDataToString(data));
|
|
2062
|
-
} catch {
|
|
2063
|
-
return null;
|
|
2064
|
-
}
|
|
2065
|
-
}
|
|
2066
|
-
async function processEvent(params) {
|
|
2067
|
-
if (params.event.type !== "message.created" && params.event.type !== "thread.reply_created") return;
|
|
2068
|
-
if (params.abortSignal.aborted || payloadString(params.event, "author_id") === params.botUserId) return;
|
|
2069
|
-
const correlationId = normalizeClickClackCorrelationId(params.event.payload?.correlation_id);
|
|
2070
|
-
const message = await resolveEventMessage({
|
|
2071
|
-
client: correlationId ? createClickClackClient({
|
|
2072
|
-
baseUrl: params.account.apiEndpoint,
|
|
2073
|
-
token: params.account.token,
|
|
2074
|
-
correlationId
|
|
2075
|
-
}) : params.client,
|
|
2076
|
-
event: params.event
|
|
2077
|
-
});
|
|
2078
|
-
if (!message) {
|
|
2079
|
-
params.log?.warn?.(`[${params.account.accountId}] skipped unreadable ClickClack message before agent dispatch: type=${params.event.type} messageId=${payloadString(params.event, "message_id") || "unknown"}`);
|
|
2080
|
-
return;
|
|
2081
|
-
}
|
|
2082
|
-
if (params.abortSignal.aborted || message.author_id === params.botUserId) return;
|
|
2083
|
-
const access = await resolveClickClackInboundAccess({
|
|
2084
|
-
account: params.account,
|
|
2085
|
-
config: params.config,
|
|
2086
|
-
message
|
|
2087
|
-
});
|
|
2088
|
-
if (params.abortSignal.aborted) return;
|
|
2089
|
-
if (!access.shouldDispatch) {
|
|
2090
|
-
params.log?.info(`[${params.account.accountId}] skipped ClickClack message before agent dispatch: kind=${message.direct_conversation_id ? "dm" : "group"} requireMention=${access.requireMention ?? "unknown"} wasMentioned=${access.mentionFacts.wasMentioned} hasAnyMention=${access.mentionFacts.hasAnyMention ?? "unknown"} commandAuthorized=${access.commandAuthorized}`);
|
|
2091
|
-
return;
|
|
2092
|
-
}
|
|
2093
|
-
await handleClickClackInbound({
|
|
2094
|
-
account: params.account,
|
|
2095
|
-
config: params.config,
|
|
2096
|
-
message,
|
|
2097
|
-
access,
|
|
2098
|
-
buildContext: params.buildContext,
|
|
2099
|
-
...correlationId ? { correlationId } : {}
|
|
2100
|
-
});
|
|
2101
|
-
}
|
|
2102
|
-
async function drainEventBacklog(params) {
|
|
2103
|
-
let afterCursor = params.afterCursor;
|
|
2104
|
-
while (!params.abortSignal.aborted) {
|
|
2105
|
-
const page = await params.client.eventPage(params.workspaceId, {
|
|
2106
|
-
afterCursor,
|
|
2107
|
-
limit: CLICKCLACK_EVENT_PAGE_LIMIT
|
|
2108
|
-
});
|
|
2109
|
-
for (const event of page.events) {
|
|
2110
|
-
if (params.abortSignal.aborted) return afterCursor;
|
|
2111
|
-
if (!event.cursor || event.cursor === afterCursor) throw new Error("ClickClack event backlog returned a non-advancing cursor");
|
|
2112
|
-
await params.onEvent(event);
|
|
2113
|
-
afterCursor = event.cursor;
|
|
2114
|
-
}
|
|
2115
|
-
if (page.events.length === 0) return afterCursor;
|
|
2116
|
-
}
|
|
2117
|
-
return afterCursor;
|
|
2118
|
-
}
|
|
2119
1930
|
async function startClickClackGatewayAccount(ctx) {
|
|
2120
1931
|
const configuredAccount = resolveClickClackAccount({
|
|
2121
1932
|
cfg: ctx.cfg,
|
|
@@ -2134,22 +1945,55 @@ async function startClickClackGatewayAccount(ctx) {
|
|
|
2134
1945
|
botUserId: configuredAccount.botUserId ?? me.id,
|
|
2135
1946
|
botHandle: me.handle
|
|
2136
1947
|
};
|
|
2137
|
-
const processIncomingEvent = (event) =>
|
|
2138
|
-
abortSignal: ctx
|
|
2139
|
-
account
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
event,
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
1948
|
+
const processIncomingEvent = async (event) => {
|
|
1949
|
+
const { abortSignal, cfg: config, log } = ctx;
|
|
1950
|
+
const botUserId = account.botUserId;
|
|
1951
|
+
const buildContext = ctx.channelRuntime?.inbound.buildContext;
|
|
1952
|
+
if (event.type !== "message.created" && event.type !== "thread.reply_created") return;
|
|
1953
|
+
if (abortSignal.aborted || payloadString(event, "author_id") === botUserId) return;
|
|
1954
|
+
const correlationId = normalizeClickClackCorrelationId(event.payload?.correlation_id);
|
|
1955
|
+
const message = await resolveEventMessage({
|
|
1956
|
+
client: correlationId ? createClickClackClient({
|
|
1957
|
+
baseUrl: account.apiEndpoint,
|
|
1958
|
+
token: account.token,
|
|
1959
|
+
correlationId
|
|
1960
|
+
}) : client,
|
|
1961
|
+
event
|
|
1962
|
+
});
|
|
1963
|
+
if (!message) {
|
|
1964
|
+
log?.warn?.(`[${account.accountId}] skipped unreadable ClickClack message before agent dispatch: type=${event.type} messageId=${payloadString(event, "message_id") || "unknown"}`);
|
|
1965
|
+
return;
|
|
1966
|
+
}
|
|
1967
|
+
if (abortSignal.aborted || message.author_id === botUserId) return;
|
|
1968
|
+
const access = await resolveClickClackInboundAccess({
|
|
1969
|
+
account,
|
|
1970
|
+
config,
|
|
1971
|
+
message
|
|
1972
|
+
});
|
|
1973
|
+
if (abortSignal.aborted) return;
|
|
1974
|
+
if (!access.shouldDispatch) {
|
|
1975
|
+
log?.info(`[${account.accountId}] skipped ClickClack message before agent dispatch: kind=${message.direct_conversation_id ? "dm" : "group"} requireMention=${access.requireMention ?? "unknown"} wasMentioned=${access.mentionFacts.wasMentioned} hasAnyMention=${access.mentionFacts.hasAnyMention ?? "unknown"} commandAuthorized=${access.commandAuthorized}`);
|
|
1976
|
+
return;
|
|
1977
|
+
}
|
|
1978
|
+
await handleClickClackInbound({
|
|
1979
|
+
account,
|
|
1980
|
+
config,
|
|
1981
|
+
message,
|
|
1982
|
+
access,
|
|
1983
|
+
buildContext,
|
|
1984
|
+
...correlationId ? { correlationId } : {}
|
|
1985
|
+
});
|
|
1986
|
+
};
|
|
1987
|
+
if (account.commandMenu) try {
|
|
1988
|
+
const commands = mapNativeCommandSpecsToClickClackMenu(listNativeCommandSpecsForConfig(ctx.cfg, { provider: "clickclack" }), ctx.log);
|
|
1989
|
+
await client.setBotCommands(commands);
|
|
1990
|
+
} catch (error) {
|
|
1991
|
+
const status = error instanceof ClickClackHttpError ? error.status : void 0;
|
|
1992
|
+
const messagePrefix = `[${account.accountId}] ClickClack command menu sync`;
|
|
1993
|
+
if (status === 403) ctx.log?.warn?.(`${messagePrefix} skipped: ${formatErrorMessage(error)}; verify token/workspace command permissions or set commandMenu: false if menus are not needed`);
|
|
1994
|
+
else if (status === 404) ctx.log?.debug?.(`${messagePrefix} skipped: server does not support /api/bots/self/commands`);
|
|
1995
|
+
else ctx.log?.warn?.(`${messagePrefix} failed: ${formatErrorMessage(error)}`);
|
|
1996
|
+
}
|
|
2153
1997
|
ctx.setStatus({
|
|
2154
1998
|
accountId: account.accountId,
|
|
2155
1999
|
running: true,
|
|
@@ -2167,13 +2011,19 @@ async function startClickClackGatewayAccount(ctx) {
|
|
|
2167
2011
|
if (page.tailCursor !== void 0) afterCursor = page.tailCursor;
|
|
2168
2012
|
else for (const event of page.events) afterCursor = event.cursor || afterCursor;
|
|
2169
2013
|
initialized = true;
|
|
2170
|
-
} else
|
|
2171
|
-
client,
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2014
|
+
} else while (!ctx.abortSignal.aborted) {
|
|
2015
|
+
const page = await client.eventPage(workspaceId, {
|
|
2016
|
+
afterCursor,
|
|
2017
|
+
limit: CLICKCLACK_EVENT_PAGE_LIMIT
|
|
2018
|
+
});
|
|
2019
|
+
for (const event of page.events) {
|
|
2020
|
+
if (ctx.abortSignal.aborted) break;
|
|
2021
|
+
if (!event.cursor || event.cursor === afterCursor) throw new Error("ClickClack event backlog returned a non-advancing cursor");
|
|
2022
|
+
await processIncomingEvent(event);
|
|
2023
|
+
afterCursor = event.cursor;
|
|
2024
|
+
}
|
|
2025
|
+
if (page.events.length === 0) break;
|
|
2026
|
+
}
|
|
2177
2027
|
if (ctx.abortSignal.aborted) break;
|
|
2178
2028
|
const socket = client.websocket(workspaceId, afterCursor);
|
|
2179
2029
|
await new Promise((resolve) => {
|
|
@@ -2182,9 +2032,11 @@ async function startClickClackGatewayAccount(ctx) {
|
|
|
2182
2032
|
let loggedMessageFailure = false;
|
|
2183
2033
|
let messageQueue = Promise.resolve();
|
|
2184
2034
|
let removeAbortListener;
|
|
2035
|
+
let stopKeepalive;
|
|
2185
2036
|
const finishSocketCycle = () => {
|
|
2186
2037
|
if (settled) return;
|
|
2187
2038
|
settled = true;
|
|
2039
|
+
stopKeepalive?.();
|
|
2188
2040
|
removeAbortListener?.();
|
|
2189
2041
|
removeAbortListener = void 0;
|
|
2190
2042
|
resolve();
|
|
@@ -2211,12 +2063,16 @@ async function startClickClackGatewayAccount(ctx) {
|
|
|
2211
2063
|
removeAbortListener = () => ctx.abortSignal.removeEventListener("abort", abort);
|
|
2212
2064
|
socket.on("open", () => {
|
|
2213
2065
|
ctx.setStatus(channelReadyPatch({ accountId: account.accountId }));
|
|
2066
|
+
stopKeepalive = startWebSocketKeepalive(socket, () => {
|
|
2067
|
+
ctx.log?.warn?.(`[${account.accountId}] ClickClack websocket heartbeat timed out; reconnecting`);
|
|
2068
|
+
socket.terminate();
|
|
2069
|
+
});
|
|
2214
2070
|
});
|
|
2215
2071
|
socket.on("message", (data) => {
|
|
2216
2072
|
if (closing || settled) return;
|
|
2217
2073
|
messageQueue = messageQueue.then(async () => {
|
|
2218
2074
|
if (ctx.abortSignal.aborted) return;
|
|
2219
|
-
const event =
|
|
2075
|
+
const event = safeParseJson(rawDataToString(data));
|
|
2220
2076
|
if (!event) {
|
|
2221
2077
|
ctx.log?.warn?.(`[${account.accountId}] skipped malformed ClickClack websocket event`);
|
|
2222
2078
|
return;
|
|
@@ -2262,9 +2118,12 @@ async function startClickClackGatewayAccount(ctx) {
|
|
|
2262
2118
|
ctx.setStatus(channelStoppedPatch({ accountId: account.accountId }));
|
|
2263
2119
|
}
|
|
2264
2120
|
}
|
|
2265
|
-
|
|
2266
|
-
//#region extensions/clickclack/src/channel.ts
|
|
2121
|
+
// extensions/clickclack/src/channel.ts
|
|
2267
2122
|
const CHANNEL_ID = CLICKCLACK_CHANNEL_ID;
|
|
2123
|
+
const clickClackTextMessageAdapter = createChannelMessageAdapterFromOutbound({ outbound: { sendText: async (ctx) => ({
|
|
2124
|
+
channel: CHANNEL_ID,
|
|
2125
|
+
...await sendClickClackText(ctx)
|
|
2126
|
+
}) } });
|
|
2268
2127
|
const clickClackMessageAdapter = defineChannelMessageAdapter({
|
|
2269
2128
|
id: CHANNEL_ID,
|
|
2270
2129
|
durableFinal: {
|
|
@@ -2283,26 +2142,7 @@ const clickClackMessageAdapter = defineChannelMessageAdapter({
|
|
|
2283
2142
|
reconcileUnknownSend: reconcileClickClackUnknownSend
|
|
2284
2143
|
},
|
|
2285
2144
|
send: {
|
|
2286
|
-
|
|
2287
|
-
const result = await sendClickClackText({
|
|
2288
|
-
...ctx,
|
|
2289
|
-
cfg: ctx.cfg
|
|
2290
|
-
});
|
|
2291
|
-
const threadId = ctx.threadId == null ? void 0 : String(ctx.threadId);
|
|
2292
|
-
const replyToId = ctx.replyToId ?? void 0;
|
|
2293
|
-
return {
|
|
2294
|
-
...result,
|
|
2295
|
-
receipt: createMessageReceiptFromOutboundResults({
|
|
2296
|
-
results: "messageId" in result ? [{
|
|
2297
|
-
channel: CHANNEL_ID,
|
|
2298
|
-
messageId: result.messageId
|
|
2299
|
-
}] : [],
|
|
2300
|
-
threadId,
|
|
2301
|
-
replyToId,
|
|
2302
|
-
kind: "text"
|
|
2303
|
-
})
|
|
2304
|
-
};
|
|
2305
|
-
},
|
|
2145
|
+
...clickClackTextMessageAdapter.send,
|
|
2306
2146
|
media: async (ctx) => {
|
|
2307
2147
|
const messageId = await sendClickClackMedia({
|
|
2308
2148
|
...ctx,
|
|
@@ -2346,10 +2186,10 @@ const clickClackPlugin = createChatChannelPlugin({
|
|
|
2346
2186
|
},
|
|
2347
2187
|
messaging: {
|
|
2348
2188
|
targetPrefixes: ["clickclack", "cc"],
|
|
2349
|
-
normalizeTarget:
|
|
2189
|
+
normalizeTarget: (raw) => buildClickClackTarget(parseClickClackTarget(raw)),
|
|
2350
2190
|
inferTargetChatType: ({ to }) => parseClickClackTarget(to).chatType,
|
|
2351
2191
|
targetResolver: {
|
|
2352
|
-
looksLikeId:
|
|
2192
|
+
looksLikeId: (raw) => raw.trim().length > 0,
|
|
2353
2193
|
hint: "<channel:name|dm:usr_id|thread:msg_id>"
|
|
2354
2194
|
},
|
|
2355
2195
|
resolveOutboundSessionRoute: ({ cfg, agentId, accountId, target, replyToId, threadId, currentSessionKey }) => {
|
|
@@ -2438,5 +2278,4 @@ const clickClackPlugin = createChatChannelPlugin({
|
|
|
2438
2278
|
}
|
|
2439
2279
|
}
|
|
2440
2280
|
});
|
|
2441
|
-
|
|
2442
|
-
export { clearPendingDiscussionOpen as A, truncateDiscussionDisplayTitle as C, getClickClackDiscussionBindingStore as D, bindingMatchesActiveSessionIncarnation as E, listPendingDiscussionOpens as M, recordPendingDiscussionOpen as N, readDiscussionSessionEntry as O, reserveDiscussionBindingGeneration as P, slugifyDiscussionLabel as S, attachBindingToCurrentActiveSession as T, discussionExternalRef as _, setClickClackRuntime as a, isDiscussionSessionKey as b, isClickClackDiscussionChannelRevokedAsync as c, prepareClickClackDiscussionChannelRevocation as d, discussionAccounts as f, discussionCredentialFingerprint as g, resolveDiscussionBindingAccount as h, getClickClackRuntime as i, getPendingDiscussionOpen as j, clearDiscussionBindingGeneration as k, markClickClackDiscussionChannelIdentityRevoked as l, normalizedServerBaseUrl as m, buildClickClackTarget as n, clearClickClackDiscussionChannelRevoked as o, discussionInfoForBinding as p, parseClickClackTarget as r, isClickClackDiscussionChannelRevoked as s, clickClackPlugin as t, markClickClackDiscussionChannelRevoked as u, discussionSessionKey as v, MAX_RETAINED_DETACHED_DISCUSSION_BINDINGS as w, resolveDiscussionLabel as x, fallbackDiscussionLabel as y };
|
|
2281
|
+
export { clearPendingDiscussionOpen as A, slugifyDiscussionLabel as C, getClickClackDiscussionBindingStore as D, bindingMatchesActiveSessionIncarnation as E, listPendingDiscussionOpens as M, recordPendingDiscussionOpen as N, readDiscussionSessionEntry as O, reserveDiscussionBindingGeneration as P, resolveDiscussionLabel as S, attachBindingToCurrentActiveSession as T, discussionCredentialFingerprint as _, setClickClackRuntime as a, fallbackDiscussionLabel as b, isClickClackDiscussionChannelRevoked as c, markClickClackDiscussionChannelRevoked as d, prepareClickClackDiscussionChannelRevocation as f, resolveDiscussionBindingAccount as g, normalizedServerBaseUrl as h, getClickClackRuntime as i, getPendingDiscussionOpen as j, clearDiscussionBindingGeneration as k, isClickClackDiscussionChannelRevokedAsync as l, discussionInfoForBinding as m, buildClickClackTarget as n, prepareDiscussionSessionEntry as o, discussionAccounts as p, parseClickClackTarget as r, clearClickClackDiscussionChannelRevoked as s, clickClackPlugin as t, markClickClackDiscussionChannelIdentityRevoked as u, discussionExternalRef as v, truncateDiscussionDisplayTitle as w, isDiscussionSessionKey as x, discussionSessionKey as y };
|