@openclaw/clickclack 2026.11.7 → 2026.11.10-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.setup/{channel-3wsXl9ET.mjs → channel-BH4RFKFX.mjs} +62 -74
- package/dist/.setup/{resolve-CQPynbSo.mjs → resolve-qeIY2bou.mjs} +2 -4
- package/dist/.setup/{rolldown-runtime-BBjsoOtd.mjs → rolldown-runtime-782esTHO.mjs} +1 -2
- package/dist/.setup/{runtime-api-CBg2jSuv.mjs → runtime-api-QLQR94SM.mjs} +79 -85
- 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-DIxK2B4k.mjs → setup-claim-DDJ9VKhn.mjs} +2 -3
- package/dist/.setup/{setup-plugin-api-DpZ0Nefw.mjs → setup-plugin-api-Bv07Jgqa.mjs} +2 -3
- package/dist/.setup/setup-plugin-api-rftn825R.mjs +1 -0
- package/dist/.setup/{setup-surface-Pr3hq4WA.mjs → setup-surface-DSbHN_QA.mjs} +94 -36
- package/dist/.setup/{setup-verify-Da87HOCY.mjs → setup-verify-BRmRzZD7.mjs} +4 -5
- 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/openclaw.plugin.json +5 -1
- package/package.json +4 -4
- package/dist/.setup/setup-plugin-api-kQj1X9_C.mjs +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A as
|
|
3
|
-
import { a as createClickClackClient, i as ClickClackHttpError, o as isClickClackChannelNameConflict, t as findClickClackWorkspace } from "./resolve-
|
|
1
|
+
import { g as resolveClickClackAccountAsync, p as listClickClackAccountIds, v as resolveClickClackAccountMetadata } from "./setup-surface-DSbHN_QA.mjs";
|
|
2
|
+
import { A as bindingMatchesActiveSessionIncarnation, C as discussionSessionKey, D as slugifyDiscussionLabel, E as resolveDiscussionLabel, F as getPendingDiscussionOpen, I as listPendingDiscussionOpens, L as recordPendingDiscussionOpen, M as readDiscussionSessionEntry, N as clearDiscussionBindingGeneration, O as truncateDiscussionDisplayTitle, P as clearPendingDiscussionOpen, R as reserveDiscussionBindingGeneration, S as discussionExternalRef, T as isDiscussionSessionKey, _ as normalizedServerBaseUrl, b as resolvePreparedDiscussionBindingAccount, c as clearClickClackDiscussionChannelRevoked, d as markClickClackDiscussionChannelIdentityRevoked, f as markClickClackDiscussionChannelRevoked, g as isDiscussionAccountCurrent, h as discussionInfoForBinding, j as getClickClackDiscussionBindingStore, k as attachBindingToCurrentActiveSession, l as isClickClackDiscussionChannelRevoked, m as discussionAccounts, o as prepareDiscussionSessionEntry, p as prepareClickClackDiscussionChannelRevocation, s as adoptLegacyMarkers, u as isClickClackDiscussionChannelRevokedAsync, v as prepareDiscussionBindingAccount, w as fallbackDiscussionLabel, x as discussionCredentialFingerprint, y as resolveDiscussionBindingAccount } from "./channel-BH4RFKFX.mjs";
|
|
3
|
+
import { a as createClickClackClient, i as ClickClackHttpError, o as isClickClackChannelNameConflict, t as findClickClackWorkspace } from "./resolve-qeIY2bou.mjs";
|
|
4
4
|
import "../api.js";
|
|
5
5
|
import { isDeepStrictEqual } from "node:util";
|
|
6
6
|
import { randomUUID } from "node:crypto";
|
|
@@ -10,7 +10,7 @@ import { buildControlUiSessionPath, registerSessionDiscussionProvider } from "op
|
|
|
10
10
|
import { createSessionVisibilityChecker } from "openclaw/plugin-sdk/session-visibility";
|
|
11
11
|
import { textResult } from "openclaw/plugin-sdk/tool-results";
|
|
12
12
|
import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
|
|
13
|
-
|
|
13
|
+
// extensions/clickclack/src/discussions/binding-retention.ts
|
|
14
14
|
const MAX_RETAINED_DETACHED_DISCUSSION_BINDINGS = 1e3;
|
|
15
15
|
var DetachedDiscussionBindingRetention = class {
|
|
16
16
|
#runtime;
|
|
@@ -59,8 +59,7 @@ var DetachedDiscussionBindingRetention = class {
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
|
-
|
|
63
|
-
//#region extensions/clickclack/src/discussions/control-session-url.ts
|
|
62
|
+
// extensions/clickclack/src/discussions/control-session-url.ts
|
|
64
63
|
function controlSessionUrl(baseUrl, sessionKey, fallbackAgentId, mainKey, displayName) {
|
|
65
64
|
if (!baseUrl) return;
|
|
66
65
|
const url = new URL(baseUrl);
|
|
@@ -77,8 +76,7 @@ function controlSessionUrl(baseUrl, sessionKey, fallbackAgentId, mainKey, displa
|
|
|
77
76
|
url.hash = "";
|
|
78
77
|
return url.toString();
|
|
79
78
|
}
|
|
80
|
-
|
|
81
|
-
//#region extensions/clickclack/src/discussions/installation.ts
|
|
79
|
+
// extensions/clickclack/src/discussions/installation.ts
|
|
82
80
|
const INSTALLATION_NAMESPACE = "discussion-installation";
|
|
83
81
|
const INSTALLATION_KEY = "current";
|
|
84
82
|
/** Returns the durable installation namespace used in server-visible ownership refs. */
|
|
@@ -96,8 +94,7 @@ async function getClickClackDiscussionInstallationId(runtime) {
|
|
|
96
94
|
if (!persisted) throw new Error("ClickClack discussion installation identity is unavailable; retry opening the discussion");
|
|
97
95
|
return persisted;
|
|
98
96
|
}
|
|
99
|
-
|
|
100
|
-
//#region extensions/clickclack/src/discussions/service-history.ts
|
|
97
|
+
// extensions/clickclack/src/discussions/service-history.ts
|
|
101
98
|
function discussionRecordJson(value) {
|
|
102
99
|
return JSON.stringify(value).replace(/[\u0085\u2028\u2029]/gu, (separator) => `\\u${separator.charCodeAt(0).toString(16).padStart(4, "0")}`);
|
|
103
100
|
}
|
|
@@ -128,7 +125,7 @@ async function readDiscussionHistory(params) {
|
|
|
128
125
|
sessionEntry.source();
|
|
129
126
|
const current = bindingFacts.read();
|
|
130
127
|
const config = runtime.config.current();
|
|
131
|
-
return current !== void 0 && current.externalRef === binding.externalRef && current.serverBaseUrl === binding.serverBaseUrl && current.channelId === binding.channelId && sessionEntry.entry?.sessionId === binding.sessionId && sessionEntry.entry.archivedAt === void 0 &&
|
|
128
|
+
return current !== void 0 && current.externalRef === binding.externalRef && current.serverBaseUrl === binding.serverBaseUrl && current.channelId === binding.channelId && sessionEntry.entry?.sessionId === binding.sessionId && sessionEntry.entry.archivedAt === void 0 && resolvePreparedDiscussionBindingAccount(config, binding, params.account).state === "active" && !channelRevocation.isRevoked(current);
|
|
132
129
|
} catch {
|
|
133
130
|
return false;
|
|
134
131
|
}
|
|
@@ -146,8 +143,7 @@ async function readDiscussionHistory(params) {
|
|
|
146
143
|
bindingFacts.release();
|
|
147
144
|
}
|
|
148
145
|
}
|
|
149
|
-
|
|
150
|
-
//#region extensions/clickclack/src/discussions/service-open.ts
|
|
146
|
+
// extensions/clickclack/src/discussions/service-open.ts
|
|
151
147
|
const CHANNEL_NAME_MUTATION_ATTEMPTS = 4;
|
|
152
148
|
function isDefinitiveNoCreateHttpError(error) {
|
|
153
149
|
if (!(error instanceof ClickClackHttpError) || error.status < 400 || error.status >= 500) return false;
|
|
@@ -267,22 +263,13 @@ async function openClickClackDiscussionBinding(params) {
|
|
|
267
263
|
const displayTitle = label === fallback ? "" : truncateDiscussionDisplayTitle(label);
|
|
268
264
|
const section = entry.category?.trim() || account.discussions.section;
|
|
269
265
|
const externalUrl = controlSessionUrl(account.discussions.controlUrlBase, sessionKey, account.agentId ?? agentId, config.session?.mainKey, label);
|
|
270
|
-
const
|
|
271
|
-
const
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
const currentEntry = session.entry;
|
|
278
|
-
if (!currentAccount || currentAccount.accountId !== account.accountId || normalizedServerBaseUrl(currentAccount) !== serverBaseUrl || currentAccount.apiEndpoint !== account.apiEndpoint || discussionCredentialFingerprint(currentAccount.token) !== credentialFingerprint || currentAccount.discussions.workspace !== account.discussions.workspace || !currentEntry?.sessionId || currentEntry.archivedAt !== void 0) throw new Error("ClickClack discussion authority changed while opening the channel");
|
|
279
|
-
return currentEntry;
|
|
280
|
-
};
|
|
281
|
-
assertCurrentAuthority();
|
|
282
|
-
return await operation(assertCurrentAuthority);
|
|
283
|
-
} finally {
|
|
284
|
-
session.release();
|
|
285
|
-
}
|
|
266
|
+
const assertCurrentAuthority = () => {
|
|
267
|
+
const currentEntry = runtime.agent.session.getSessionEntry({
|
|
268
|
+
sessionKey,
|
|
269
|
+
readConsistency: "latest"
|
|
270
|
+
});
|
|
271
|
+
if (!isDiscussionAccountCurrent(runtime.config.current(), account) || !currentEntry?.sessionId || currentEntry.archivedAt !== void 0) throw new Error("ClickClack discussion authority changed while opening the channel");
|
|
272
|
+
return currentEntry;
|
|
286
273
|
};
|
|
287
274
|
return await params.withChannelMutationLock(async () => {
|
|
288
275
|
await params.ensureBindingCapacity(sessionKey);
|
|
@@ -307,7 +294,7 @@ async function openClickClackDiscussionBinding(params) {
|
|
|
307
294
|
let resolved;
|
|
308
295
|
for (let attempt = 0; attempt < CHANNEL_NAME_MUTATION_ATTEMPTS; attempt += 1) {
|
|
309
296
|
adopted = channels.find((candidate) => candidate.external_managed === true && candidate.external_ref === externalRef);
|
|
310
|
-
|
|
297
|
+
managedFields = {
|
|
311
298
|
name: await resolveAvailableChannelName({
|
|
312
299
|
client,
|
|
313
300
|
workspaceId: workspace.id,
|
|
@@ -323,7 +310,6 @@ async function openClickClackDiscussionBinding(params) {
|
|
|
323
310
|
sidebar_section: section,
|
|
324
311
|
display_title: displayTitle
|
|
325
312
|
};
|
|
326
|
-
managedFields = fields;
|
|
327
313
|
await recordPendingDiscussionOpen({
|
|
328
314
|
runtime,
|
|
329
315
|
sessionKey,
|
|
@@ -338,37 +324,36 @@ async function openClickClackDiscussionBinding(params) {
|
|
|
338
324
|
}
|
|
339
325
|
});
|
|
340
326
|
await params.ensureTimer();
|
|
341
|
-
|
|
342
|
-
const channelId = adopted.id;
|
|
343
|
-
await withCurrentAuthority(() => revokeChannel(channelId));
|
|
344
|
-
}
|
|
345
|
-
let attempted = false;
|
|
327
|
+
assertCurrentAuthority();
|
|
346
328
|
try {
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
329
|
+
if (adopted) {
|
|
330
|
+
await revokeChannel(adopted.id);
|
|
331
|
+
assertCurrentAuthority();
|
|
332
|
+
resolved = await client.updateChannel(adopted.id, managedFields);
|
|
333
|
+
} else {
|
|
334
|
+
resolved = await client.createChannel(workspace.id, {
|
|
335
|
+
...managedFields,
|
|
351
336
|
kind: "public"
|
|
352
337
|
});
|
|
353
|
-
|
|
354
|
-
|
|
338
|
+
await revokeChannel(resolved.id);
|
|
339
|
+
}
|
|
355
340
|
break;
|
|
356
341
|
} catch (error) {
|
|
357
|
-
if (!attempted) throw error;
|
|
358
342
|
if (isClickClackChannelNameConflict(error) && attempt < 3) {
|
|
359
|
-
channels = await
|
|
343
|
+
channels = await client.channels(workspace.id);
|
|
360
344
|
assertManagedChannelListContract(channels);
|
|
361
345
|
continue;
|
|
362
346
|
}
|
|
363
347
|
const definitiveNoCreate = isDefinitiveNoCreateHttpError(error);
|
|
364
348
|
try {
|
|
365
|
-
const relisted = await
|
|
349
|
+
const relisted = await client.channels(workspace.id);
|
|
366
350
|
assertManagedChannelListContract(relisted);
|
|
367
351
|
const recovered = relisted.find((candidate) => candidate.external_managed === true && candidate.external_ref === externalRef);
|
|
368
352
|
if (recovered) {
|
|
369
353
|
adopted = recovered;
|
|
370
354
|
await revokeChannel(recovered.id);
|
|
371
|
-
|
|
355
|
+
assertCurrentAuthority();
|
|
356
|
+
resolved = await client.updateChannel(recovered.id, managedFields);
|
|
372
357
|
break;
|
|
373
358
|
}
|
|
374
359
|
if (definitiveNoCreate) await clearDiscussionBindingGeneration(generationScope);
|
|
@@ -419,12 +404,10 @@ async function openClickClackDiscussionBinding(params) {
|
|
|
419
404
|
...channel.display_title !== void 0 ? { displayTitle: channel.display_title } : {}
|
|
420
405
|
};
|
|
421
406
|
try {
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
} });
|
|
427
|
-
})) {
|
|
407
|
+
nextBinding.sessionId = assertCurrentAuthority().sessionId;
|
|
408
|
+
if (!await store.setIfCurrent(sessionKey, void 0, nextBinding, { assertCurrent: () => {
|
|
409
|
+
if (assertCurrentAuthority().sessionId !== nextBinding.sessionId) throw new Error("ClickClack discussion session changed before binding committed");
|
|
410
|
+
} })) {
|
|
428
411
|
await clearPendingDiscussionOpen(generationScope);
|
|
429
412
|
params.warn(`superseded discussion channel remains quarantined: ${channel.id}`);
|
|
430
413
|
return;
|
|
@@ -447,15 +430,18 @@ async function reconcilePendingDiscussionOpen(params) {
|
|
|
447
430
|
return false;
|
|
448
431
|
}
|
|
449
432
|
const cfg = params.runtime.config.current();
|
|
450
|
-
const
|
|
433
|
+
const candidates = listClickClackAccountIds(cfg).map((accountId) => resolveClickClackAccountMetadata({
|
|
451
434
|
cfg,
|
|
452
435
|
accountId
|
|
453
|
-
})).
|
|
436
|
+
})).filter((account) => normalizedServerBaseUrl(account) === pending.serverBaseUrl);
|
|
437
|
+
const account = (await Promise.all(candidates.map(({ accountId }) => resolveClickClackAccountAsync({
|
|
438
|
+
cfg,
|
|
439
|
+
accountId
|
|
440
|
+
})))).find((candidate) => candidate.configured && normalizedServerBaseUrl(candidate) === pending.serverBaseUrl && discussionCredentialFingerprint(candidate.token) === pending.credentialFingerprint);
|
|
454
441
|
if (!account) return false;
|
|
455
442
|
const client = params.clientFactory(account);
|
|
456
443
|
const entry = await readDiscussionSessionEntry(params.runtime, pending.sessionKey);
|
|
457
|
-
const
|
|
458
|
-
const retryAccount = activeAccounts.length === 1 ? activeAccounts[0] : void 0;
|
|
444
|
+
const retryAccount = isDiscussionAccountCurrent(params.runtime.config.current(), account) ? account : void 0;
|
|
459
445
|
if (params.allowRetry !== false && entry?.sessionId && entry.archivedAt === void 0 && retryAccount && normalizedServerBaseUrl(retryAccount) === pending.serverBaseUrl && discussionCredentialFingerprint(retryAccount.token) === pending.credentialFingerprint) {
|
|
460
446
|
const workspaces = await params.clientFactory(retryAccount).workspaces();
|
|
461
447
|
if (findClickClackWorkspace(workspaces, retryAccount.discussions.workspace)?.id === pending.workspaceId) return true;
|
|
@@ -484,8 +470,7 @@ async function reconcilePendingDiscussionOpen(params) {
|
|
|
484
470
|
});
|
|
485
471
|
return false;
|
|
486
472
|
}
|
|
487
|
-
|
|
488
|
-
//#region extensions/clickclack/src/discussions/service.ts
|
|
473
|
+
// extensions/clickclack/src/discussions/service.ts
|
|
489
474
|
const RECONCILE_INTERVAL_MS = 6e4;
|
|
490
475
|
const RECONCILE_DEBOUNCE_MS = 250;
|
|
491
476
|
const RECONCILE_RETRY_MS = 1e3;
|
|
@@ -592,8 +577,9 @@ var ClickClackDiscussionService = class {
|
|
|
592
577
|
hasEnabledAccount() {
|
|
593
578
|
return discussionAccounts(this.#currentConfig()).length === 1;
|
|
594
579
|
}
|
|
595
|
-
|
|
596
|
-
|
|
580
|
+
async prepareBindingAccount(binding) {
|
|
581
|
+
const resolved = await prepareDiscussionBindingAccount(this.#currentConfig(), binding);
|
|
582
|
+
return resolved.state === "active" ? resolvePreparedDiscussionBindingAccount(this.#currentConfig(), binding, resolved.account) : resolved;
|
|
597
583
|
}
|
|
598
584
|
async info(sessionKey) {
|
|
599
585
|
return await this.#withOperation(() => this.#sessionQueue.enqueue(sessionKey, async () => {
|
|
@@ -629,11 +615,16 @@ var ClickClackDiscussionService = class {
|
|
|
629
615
|
this.#installationId ??= await getClickClackDiscussionInstallationId(this.#runtime);
|
|
630
616
|
const accounts = discussionAccounts(this.#currentConfig());
|
|
631
617
|
if (accounts.length > 1) throw new Error("ClickClack discussions require exactly one enabled discussion account");
|
|
632
|
-
const
|
|
633
|
-
if (!
|
|
618
|
+
const selected = accounts[0];
|
|
619
|
+
if (!selected) return { state: "none" };
|
|
620
|
+
const account = await resolveClickClackAccountAsync({
|
|
621
|
+
cfg: this.#currentConfig(),
|
|
622
|
+
accountId: selected.accountId
|
|
623
|
+
});
|
|
624
|
+
if (!isDiscussionAccountCurrent(this.#currentConfig(), account)) return { state: "none" };
|
|
634
625
|
const existing = await this.#store.getAsync(sessionKey);
|
|
635
626
|
if (existing) {
|
|
636
|
-
const resolved = await this.#resolveBindingForUse(existing);
|
|
627
|
+
const resolved = await this.#resolveBindingForUse(existing, account);
|
|
637
628
|
if (resolved.state === "retargeted") {
|
|
638
629
|
if (!await this.#revokeAndDeleteBinding(sessionKey, existing)) return { state: "available" };
|
|
639
630
|
} else if (resolved.state === "stale") {
|
|
@@ -714,6 +705,7 @@ var ClickClackDiscussionService = class {
|
|
|
714
705
|
store: this.#store,
|
|
715
706
|
sessionKey,
|
|
716
707
|
binding: attached,
|
|
708
|
+
account: resolved.account,
|
|
717
709
|
client: this.#clientFactory(resolved.account),
|
|
718
710
|
limit
|
|
719
711
|
});
|
|
@@ -746,7 +738,7 @@ var ClickClackDiscussionService = class {
|
|
|
746
738
|
}
|
|
747
739
|
const activeBinding = await this.#detachedBindings.clear(sessionKey, binding);
|
|
748
740
|
if (!activeBinding) return;
|
|
749
|
-
const resolved = resolvedAccount ? this
|
|
741
|
+
const resolved = resolvedAccount ? resolvePreparedDiscussionBindingAccount(this.#currentConfig(), activeBinding, resolvedAccount) : await this.#resolveBindingForUse(activeBinding);
|
|
750
742
|
if (resolved.state === "retargeted") {
|
|
751
743
|
await this.#revokeAndDeleteBinding(sessionKey, activeBinding);
|
|
752
744
|
return;
|
|
@@ -778,7 +770,7 @@ var ClickClackDiscussionService = class {
|
|
|
778
770
|
bindingForAttachment = freshBinding;
|
|
779
771
|
observedSiblingTitleSupport = bindings.some(({ binding: candidate }) => candidate.displayTitle !== void 0 && candidate.serverBaseUrl === freshBinding.serverBaseUrl && candidate.accountId === freshBinding.accountId);
|
|
780
772
|
}
|
|
781
|
-
const current = this
|
|
773
|
+
const current = resolvePreparedDiscussionBindingAccount(this.#currentConfig(), bindingForAttachment, resolved.account);
|
|
782
774
|
if (current.state !== "active") return;
|
|
783
775
|
const account = current.account;
|
|
784
776
|
const attached = await this.#refreshSessionAttachment(sessionKey, bindingForAttachment);
|
|
@@ -813,7 +805,7 @@ var ClickClackDiscussionService = class {
|
|
|
813
805
|
const assertCurrentAuthority = () => {
|
|
814
806
|
sessionAuthority.source();
|
|
815
807
|
const bound = bindingFacts.read();
|
|
816
|
-
if (!bound || bound.externalRef !== currentBinding.externalRef || bound.serverBaseUrl !== currentBinding.serverBaseUrl || bound.channelId !== currentBinding.channelId || sessionAuthority.entry?.sessionId !== currentBinding.sessionId || sessionAuthority.entry.archivedAt !== void 0 || this
|
|
808
|
+
if (!bound || bound.externalRef !== currentBinding.externalRef || bound.serverBaseUrl !== currentBinding.serverBaseUrl || bound.channelId !== currentBinding.channelId || sessionAuthority.entry?.sessionId !== currentBinding.sessionId || sessionAuthority.entry.archivedAt !== void 0 || resolvePreparedDiscussionBindingAccount(this.#currentConfig(), currentBinding, account).state !== "active" || isRevoked(bound)) throw new Error("ClickClack discussion authority changed before channel update");
|
|
817
809
|
};
|
|
818
810
|
let updated;
|
|
819
811
|
if (labelChanged) updated = await this.#withChannelMutationLock(() => renameDiscussionChannel({
|
|
@@ -872,12 +864,12 @@ var ClickClackDiscussionService = class {
|
|
|
872
864
|
if (!await markClickClackDiscussionChannelRevoked(this.#runtime, sessionKey, binding)) return false;
|
|
873
865
|
return await this.#store.deleteIfCurrent(sessionKey, binding);
|
|
874
866
|
}
|
|
875
|
-
async #resolveBindingForUse(binding) {
|
|
876
|
-
const resolved = this.
|
|
867
|
+
async #resolveBindingForUse(binding, account) {
|
|
868
|
+
const resolved = account ? resolvePreparedDiscussionBindingAccount(this.#currentConfig(), binding, account) : await this.prepareBindingAccount(binding);
|
|
877
869
|
if (resolved.state !== "active") return resolved;
|
|
878
870
|
const workspaces = await this.#clientFactory(resolved.account).workspaces();
|
|
879
871
|
const workspace = findClickClackWorkspace(workspaces, resolved.account.discussions.workspace);
|
|
880
|
-
const current = this
|
|
872
|
+
const current = resolvePreparedDiscussionBindingAccount(this.#currentConfig(), binding, resolved.account);
|
|
881
873
|
if (current.state !== "active") return current;
|
|
882
874
|
return workspace?.id === binding.workspaceId ? current : { state: "retargeted" };
|
|
883
875
|
}
|
|
@@ -922,10 +914,19 @@ var ClickClackDiscussionService = class {
|
|
|
922
914
|
return operation;
|
|
923
915
|
}
|
|
924
916
|
};
|
|
925
|
-
|
|
926
|
-
//#region extensions/clickclack/src/discussions/register.ts
|
|
917
|
+
// extensions/clickclack/src/discussions/register.ts
|
|
927
918
|
const DEFAULT_MESSAGE_LIMIT = 30;
|
|
928
919
|
const MAX_MESSAGE_LIMIT = 200;
|
|
920
|
+
const DiscussionParameters = {
|
|
921
|
+
type: "object",
|
|
922
|
+
properties: { limit: {
|
|
923
|
+
type: "integer",
|
|
924
|
+
minimum: 1,
|
|
925
|
+
maximum: MAX_MESSAGE_LIMIT,
|
|
926
|
+
description: `Maximum messages to return (default ${DEFAULT_MESSAGE_LIMIT}).`
|
|
927
|
+
} },
|
|
928
|
+
additionalProperties: false
|
|
929
|
+
};
|
|
929
930
|
const TARGETED_SESSION_TOOLS = /* @__PURE__ */ new Set([
|
|
930
931
|
"sessions_history",
|
|
931
932
|
"sessions_send",
|
|
@@ -963,13 +964,14 @@ function registerClickClackDiscussions(api) {
|
|
|
963
964
|
binding: current
|
|
964
965
|
}), (current) => bindingMatchesActiveSessionIncarnation(runtime, targetSessionKey, current));
|
|
965
966
|
}
|
|
966
|
-
function currentDiscussionTarget(params, binding, isRevoked, isActiveSession) {
|
|
967
|
+
function currentDiscussionTarget(params, binding, isRevoked, isActiveSession, preparedAccount) {
|
|
967
968
|
const { targetSessionKey } = params;
|
|
969
|
+
const cfg = runtime.config.current();
|
|
968
970
|
if (binding && discussionSessionKey({
|
|
969
971
|
runtime,
|
|
970
972
|
mainSessionKey: targetSessionKey,
|
|
971
973
|
...binding
|
|
972
|
-
}) === params.requesterSessionKey && !isRevoked(binding) && isActiveSession(binding) &&
|
|
974
|
+
}) === params.requesterSessionKey && !isRevoked(binding) && isActiveSession(binding) && (preparedAccount ? resolvePreparedDiscussionBindingAccount(cfg, binding, preparedAccount) : resolveDiscussionBindingAccount(cfg, binding)).state === "active") return {
|
|
973
975
|
sessionKey: targetSessionKey,
|
|
974
976
|
binding
|
|
975
977
|
};
|
|
@@ -987,10 +989,12 @@ function registerClickClackDiscussions(api) {
|
|
|
987
989
|
runtime,
|
|
988
990
|
...binding
|
|
989
991
|
});
|
|
992
|
+
const resolved = await service.prepareBindingAccount(binding);
|
|
993
|
+
if (resolved.state !== "active") return;
|
|
990
994
|
session = await prepareDiscussionSessionEntry(runtime, params.targetSessionKey);
|
|
991
995
|
session.source();
|
|
992
996
|
const entry = session.entry;
|
|
993
|
-
return currentDiscussionTarget(params, facts.read(), revocation.isRevoked, (current) => entry?.sessionId === current.sessionId && entry.archivedAt === void 0);
|
|
997
|
+
return currentDiscussionTarget(params, facts.read(), revocation.isRevoked, (current) => entry?.sessionId === current.sessionId && entry.archivedAt === void 0, resolved.account);
|
|
994
998
|
} catch {
|
|
995
999
|
return;
|
|
996
1000
|
} finally {
|
|
@@ -1009,16 +1013,7 @@ function registerClickClackDiscussions(api) {
|
|
|
1009
1013
|
name: "discussion",
|
|
1010
1014
|
label: "Discussion",
|
|
1011
1015
|
description: "Read the latest messages from the ClickClack discussion bound to this session.",
|
|
1012
|
-
parameters:
|
|
1013
|
-
type: "object",
|
|
1014
|
-
properties: { limit: {
|
|
1015
|
-
type: "integer",
|
|
1016
|
-
minimum: 1,
|
|
1017
|
-
maximum: MAX_MESSAGE_LIMIT,
|
|
1018
|
-
description: `Maximum messages to return (default ${DEFAULT_MESSAGE_LIMIT}).`
|
|
1019
|
-
} },
|
|
1020
|
-
additionalProperties: false
|
|
1021
|
-
},
|
|
1016
|
+
parameters: DiscussionParameters,
|
|
1022
1017
|
async execute(_toolCallId, input) {
|
|
1023
1018
|
if (!sessionKey) return textResult("No discussion is bound to this session.", { bound: false });
|
|
1024
1019
|
const requested = typeof input === "object" && input !== null && "limit" in input ? Number(input.limit) : DEFAULT_MESSAGE_LIMIT;
|
|
@@ -1071,5 +1066,4 @@ function registerClickClackDiscussions(api) {
|
|
|
1071
1066
|
}
|
|
1072
1067
|
});
|
|
1073
1068
|
}
|
|
1074
|
-
//#endregion
|
|
1075
1069
|
export { registerClickClackDiscussions as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
2
2
|
import { collectConditionalChannelFieldAssignments, createChannelSecretContract, hasConfiguredSecretInputValue } from "openclaw/plugin-sdk/channel-secret-basic-runtime";
|
|
3
|
-
|
|
3
|
+
// extensions/clickclack/src/secret-contract.ts
|
|
4
4
|
const channelSecrets = createChannelSecretContract({
|
|
5
5
|
channelKey: "clickclack",
|
|
6
6
|
account: ["token"],
|
|
@@ -22,5 +22,4 @@ const channelSecrets = createChannelSecretContract({
|
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
const { secretTargetRegistryEntries, collectRuntimeConfigAssignments } = channelSecrets;
|
|
25
|
-
//#endregion
|
|
26
25
|
export { collectRuntimeConfigAssignments as n, secretTargetRegistryEntries as r, channelSecrets as t };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { t as channelSecrets, n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-
|
|
1
|
+
export { t as channelSecrets, n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-Dj8nibUr.mjs";
|
|
2
2
|
import "../secret-contract-api.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as isClickClackSetupLoopbackHost, i as buildClickClackSetupClaimUrl, o as requireClickClackSetupApiBaseUrl } from "./setup-surface-
|
|
1
|
+
import { a as isClickClackSetupLoopbackHost, i as buildClickClackSetupClaimUrl, o as requireClickClackSetupApiBaseUrl } from "./setup-surface-DSbHN_QA.mjs";
|
|
2
2
|
import { withTimeout } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
3
3
|
import { createProviderOperationDeadline, readProviderJsonResponse, readResponseTextLimited, resolveProviderOperationTimeoutMs } from "openclaw/plugin-sdk/provider-http";
|
|
4
4
|
import { fetchWithSsrFGuard, resolvePinnedHostnameWithPolicy, ssrfPolicyFromHttpBaseUrlAllowedHostname } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
5
5
|
import { isStringArray } from "openclaw/plugin-sdk/collection-input-runtime";
|
|
6
|
-
|
|
6
|
+
// extensions/clickclack/src/setup-claim.ts
|
|
7
7
|
const CLICKCLACK_ERROR_BODY_LIMIT_BYTES = 8192;
|
|
8
8
|
const CLICKCLACK_SETUP_CODE_CLAIM_JSON_LIMIT_BYTES = 65536;
|
|
9
9
|
const CLICKCLACK_SETUP_CODE_CLAIM_TIMEOUT_MS = 3e4;
|
|
@@ -122,5 +122,4 @@ async function claimClickClackSetupCode(params) {
|
|
|
122
122
|
await release();
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
//#endregion
|
|
126
125
|
export { claimClickClackSetupCode };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as clickClackConfigAdapter, n as clickClackSetupContract, s as clickClackConfigSchema, t as clickClackSetupWizard, u as clickClackMeta } from "./setup-surface-
|
|
2
|
-
|
|
1
|
+
import { l as clickClackConfigAdapter, n as clickClackSetupContract, s as clickClackConfigSchema, t as clickClackSetupWizard, u as clickClackMeta } from "./setup-surface-DSbHN_QA.mjs";
|
|
2
|
+
// extensions/clickclack/src/channel.setup.ts
|
|
3
3
|
const clickClackSetupPlugin = {
|
|
4
4
|
id: "clickclack",
|
|
5
5
|
meta: clickClackMeta,
|
|
@@ -14,5 +14,4 @@ const clickClackSetupPlugin = {
|
|
|
14
14
|
setupContract: clickClackSetupContract,
|
|
15
15
|
setupWizard: clickClackSetupWizard
|
|
16
16
|
};
|
|
17
|
-
//#endregion
|
|
18
17
|
export { clickClackSetupPlugin as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as clickClackSetupPlugin } from "./setup-plugin-api-Bv07Jgqa.mjs";
|