@openclaw/clickclack 2026.7.2-beta.2 → 2026.7.2-beta.3
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/api.js +2 -2
- package/dist/{channel-BnREQIP8.js → channel-CEYthZ9N.js} +59 -42
- package/dist/channel-plugin-api.js +1 -1
- package/dist/runtime-api.js +2 -2
- package/dist/setup-claim-BUWvZjtu.js +114 -0
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-B346XaAu.js → setup-surface-CNjp76Xx.js} +84 -1
- package/npm-shrinkwrap.json +3 -3
- package/package.json +8 -4
package/dist/api.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as createClickClackClient, d as DEFAULT_ACCOUNT_ID, f as listClickClackAccountIds, h as resolveDefaultClickClackAccountId, m as resolveClickClackAccount, p as listEnabledClickClackAccounts, s as clickClackConfigSchema } from "./setup-surface-
|
|
2
|
-
import { a as setClickClackRuntime, i as getClickClackRuntime, n as buildClickClackTarget, r as parseClickClackTarget, t as clickClackPlugin } from "./channel-
|
|
1
|
+
import { a as createClickClackClient, d as DEFAULT_ACCOUNT_ID, f as listClickClackAccountIds, h as resolveDefaultClickClackAccountId, m as resolveClickClackAccount, p as listEnabledClickClackAccounts, s as clickClackConfigSchema } from "./setup-surface-CNjp76Xx.js";
|
|
2
|
+
import { a as setClickClackRuntime, i as getClickClackRuntime, n as buildClickClackTarget, r as parseClickClackTarget, t as clickClackPlugin } from "./channel-CEYthZ9N.js";
|
|
3
3
|
export { DEFAULT_ACCOUNT_ID, buildClickClackTarget, clickClackConfigSchema, clickClackPlugin, createClickClackClient, getClickClackRuntime, listClickClackAccountIds, listEnabledClickClackAccounts, parseClickClackTarget, resolveClickClackAccount, resolveDefaultClickClackAccountId, setClickClackRuntime };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as createClickClackClient, c as CLICKCLACK_CHANNEL_ID, d as DEFAULT_ACCOUNT_ID, i as resolveWorkspaceId, l as clickClackConfigAdapter, m as resolveClickClackAccount, n as clickClackSetupAdapter, o as normalizeClickClackCorrelationId, r as resolveChannelId, s as clickClackConfigSchema, t as clickClackSetupWizard, u as clickClackMeta } from "./setup-surface-
|
|
1
|
+
import { a as createClickClackClient, c as CLICKCLACK_CHANNEL_ID, d as DEFAULT_ACCOUNT_ID, i as resolveWorkspaceId, l as clickClackConfigAdapter, m as resolveClickClackAccount, n as clickClackSetupAdapter, o as normalizeClickClackCorrelationId, r as resolveChannelId, s as clickClackConfigSchema, t as clickClackSetupWizard, u as clickClackMeta } from "./setup-surface-CNjp76Xx.js";
|
|
2
2
|
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-BKkzzjBA.js";
|
|
3
3
|
import { buildChannelOutboundSessionRoute, buildThreadAwareOutboundSessionRoute, createChatChannelPlugin } from "openclaw/plugin-sdk/channel-core";
|
|
4
4
|
import { buildChannelProgressDraftLine, createMessageReceiptFromOutboundResults, defineChannelMessageAdapter, deriveDurableFinalDeliveryRequirements } from "openclaw/plugin-sdk/channel-outbound";
|
|
@@ -8,6 +8,7 @@ import { sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
|
|
|
8
8
|
import { resolveStableChannelMessageIngress } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
9
9
|
import { createPluginRuntimeStore } from "openclaw/plugin-sdk/runtime-store";
|
|
10
10
|
import { listNativeCommandSpecsForConfig } from "openclaw/plugin-sdk/native-command-registry";
|
|
11
|
+
import { createChannelInboundEnvelopeBuilder } from "openclaw/plugin-sdk/channel-inbound";
|
|
11
12
|
import { normalizeAgentId } from "openclaw/plugin-sdk/routing";
|
|
12
13
|
import { createHash } from "node:crypto";
|
|
13
14
|
import { loadOutboundMediaFromUrl } from "openclaw/plugin-sdk/outbound-media";
|
|
@@ -740,6 +741,8 @@ async function handleClickClackInbound(params) {
|
|
|
740
741
|
message
|
|
741
742
|
});
|
|
742
743
|
if (!access.shouldDispatch) return;
|
|
744
|
+
const conversationId = message.channel_id || message.direct_conversation_id;
|
|
745
|
+
if (!conversationId) return;
|
|
743
746
|
const isDirect = Boolean(message.direct_conversation_id);
|
|
744
747
|
const target = buildClickClackTarget(isDirect ? {
|
|
745
748
|
chatType: "direct",
|
|
@@ -785,46 +788,60 @@ async function handleClickClackInbound(params) {
|
|
|
785
788
|
}
|
|
786
789
|
});
|
|
787
790
|
const senderName = message.author?.display_name || message.author_id;
|
|
788
|
-
const
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
})
|
|
792
|
-
const body = runtime.channel.reply.formatAgentEnvelope({
|
|
791
|
+
const body = createChannelInboundEnvelopeBuilder({
|
|
792
|
+
cfg: params.config,
|
|
793
|
+
route
|
|
794
|
+
})({
|
|
793
795
|
channel: "ClickClack",
|
|
794
796
|
from: senderName,
|
|
795
797
|
timestamp: new Date(message.created_at),
|
|
796
|
-
previousTimestamp,
|
|
797
|
-
envelope: runtime.channel.reply.resolveEnvelopeFormatOptions(params.config),
|
|
798
798
|
body: message.body
|
|
799
799
|
});
|
|
800
|
-
const
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
800
|
+
const ctxPayload = runtime.channel.inbound.buildContext({
|
|
801
|
+
channel: CHANNEL_ID$1,
|
|
802
|
+
accountId: route.accountId ?? params.account.accountId,
|
|
803
|
+
messageId: message.id,
|
|
804
|
+
messageIdFull: message.id,
|
|
805
|
+
timestamp: new Date(message.created_at).getTime(),
|
|
806
|
+
from: target,
|
|
807
|
+
sender: {
|
|
808
|
+
id: message.author_id,
|
|
809
|
+
name: senderName
|
|
810
|
+
},
|
|
811
|
+
conversation: {
|
|
812
|
+
kind: isDirect ? "direct" : "group",
|
|
813
|
+
id: conversationId,
|
|
814
|
+
label: isDirect ? senderName : message.channel_id,
|
|
815
|
+
threadId: message.parent_message_id ? message.thread_root_id : void 0,
|
|
816
|
+
nativeChannelId: conversationId
|
|
817
|
+
},
|
|
818
|
+
route: {
|
|
819
|
+
agentId: route.agentId,
|
|
820
|
+
dmScope: route.dmScope,
|
|
821
|
+
accountId: route.accountId,
|
|
822
|
+
routeSessionKey: route.sessionKey
|
|
823
|
+
},
|
|
824
|
+
reply: {
|
|
825
|
+
to: target,
|
|
826
|
+
originatingTo: target,
|
|
827
|
+
replyToId: message.id,
|
|
828
|
+
messageThreadId: message.parent_message_id ? message.thread_root_id : void 0,
|
|
829
|
+
threadParentId: message.parent_message_id ? message.thread_root_id : void 0
|
|
830
|
+
},
|
|
831
|
+
message: {
|
|
832
|
+
body,
|
|
833
|
+
bodyForAgent: message.body,
|
|
834
|
+
rawBody: message.body,
|
|
835
|
+
commandBody: message.body
|
|
836
|
+
},
|
|
837
|
+
access: {
|
|
838
|
+
commands: { authorized: access.commandAuthorized },
|
|
839
|
+
mentions: {
|
|
840
|
+
canDetectMention: !isDirect,
|
|
841
|
+
wasMentioned: !isDirect
|
|
842
|
+
}
|
|
843
|
+
},
|
|
844
|
+
extra: { GroupChannel: message.channel_id }
|
|
828
845
|
});
|
|
829
846
|
const runId = resolveClickClackAgentRunId(message.id);
|
|
830
847
|
const activityReplyOptions = activity ? {
|
|
@@ -840,16 +857,16 @@ async function handleClickClackInbound(params) {
|
|
|
840
857
|
suppressDefaultToolProgressMessages: true,
|
|
841
858
|
allowProgressCallbacksWhenSourceDeliverySuppressed: true
|
|
842
859
|
} : void 0;
|
|
843
|
-
const dispatchPromise = runtime.channel.inbound.
|
|
860
|
+
const dispatchPromise = runtime.channel.inbound.dispatch({
|
|
844
861
|
cfg: params.config,
|
|
845
862
|
channel: CHANNEL_ID$1,
|
|
846
863
|
accountId: params.account.accountId,
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
864
|
+
route: {
|
|
865
|
+
agentId: route.agentId,
|
|
866
|
+
dmScope: route.dmScope,
|
|
867
|
+
sessionKey: route.sessionKey
|
|
868
|
+
},
|
|
850
869
|
ctxPayload,
|
|
851
|
-
recordInboundSession: runtime.channel.session.recordInboundSession,
|
|
852
|
-
dispatchReplyWithBufferedBlockDispatcher: runtime.channel.reply.dispatchReplyWithBufferedBlockDispatcher,
|
|
853
870
|
toolsAllow: params.account.toolsAllow,
|
|
854
871
|
replyOptions: runId || activityReplyOptions ? {
|
|
855
872
|
...runId ? { runId } : {},
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as clickClackPlugin } from "./channel-
|
|
1
|
+
import { t as clickClackPlugin } from "./channel-CEYthZ9N.js";
|
|
2
2
|
export { clickClackPlugin };
|
package/dist/runtime-api.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as createClickClackClient, m as resolveClickClackAccount } from "./setup-surface-
|
|
2
|
-
import { a as setClickClackRuntime, r as parseClickClackTarget } from "./channel-
|
|
1
|
+
import { a as createClickClackClient, m as resolveClickClackAccount } from "./setup-surface-CNjp76Xx.js";
|
|
2
|
+
import { a as setClickClackRuntime, r as parseClickClackTarget } from "./channel-CEYthZ9N.js";
|
|
3
3
|
import "./api.js";
|
|
4
4
|
export { createClickClackClient, parseClickClackTarget, resolveClickClackAccount, setClickClackRuntime };
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { createProviderOperationDeadline, readProviderJsonResponse, readResponseTextLimited, resolveProviderOperationTimeoutMs } from "openclaw/plugin-sdk/provider-http";
|
|
2
|
+
import { fetchWithSsrFGuard, isPrivateOrLoopbackHost, resolvePinnedHostnameWithPolicy, ssrfPolicyFromHttpBaseUrlAllowedHostname } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
3
|
+
import { withTimeout } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
4
|
+
//#region extensions/clickclack/src/setup-claim.ts
|
|
5
|
+
const CLICKCLACK_ERROR_BODY_LIMIT_BYTES = 8 * 1024;
|
|
6
|
+
const CLICKCLACK_SETUP_CODE_CLAIM_JSON_LIMIT_BYTES = 64 * 1024;
|
|
7
|
+
const CLICKCLACK_SETUP_CODE_CLAIM_TIMEOUT_MS = 3e4;
|
|
8
|
+
var ClickClackSetupCodeClaimError = class extends Error {
|
|
9
|
+
constructor(status, detail) {
|
|
10
|
+
super(`ClickClack setup code claim failed (${status}): ${detail}`);
|
|
11
|
+
this.status = status;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
function requireRecord(value, label) {
|
|
15
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error(`ClickClack setup code claim returned invalid ${label}`);
|
|
16
|
+
return value;
|
|
17
|
+
}
|
|
18
|
+
function requireString(record, key, label) {
|
|
19
|
+
const value = record[key];
|
|
20
|
+
if (typeof value !== "string" || !value.trim()) throw new Error(`ClickClack setup code claim returned invalid ${label}.${key}`);
|
|
21
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
function parseClickClackSetupCodeClaim(value) {
|
|
24
|
+
const claim = requireRecord(value, "response");
|
|
25
|
+
const bot = requireRecord(claim.bot, "bot");
|
|
26
|
+
const workspace = requireRecord(claim.workspace, "workspace");
|
|
27
|
+
const defaults = requireRecord(claim.defaults, "defaults");
|
|
28
|
+
const defaultTo = defaults.defaultTo;
|
|
29
|
+
const allowFrom = defaults.allowFrom;
|
|
30
|
+
const agentActivity = defaults.agentActivity;
|
|
31
|
+
if (defaultTo !== void 0 && typeof defaultTo !== "string") throw new Error("ClickClack setup code claim returned invalid defaults.defaultTo");
|
|
32
|
+
if (allowFrom !== void 0 && (!Array.isArray(allowFrom) || !allowFrom.every((entry) => typeof entry === "string"))) throw new Error("ClickClack setup code claim returned invalid defaults.allowFrom");
|
|
33
|
+
if (agentActivity !== void 0 && typeof agentActivity !== "boolean") throw new Error("ClickClack setup code claim returned invalid defaults.agentActivity");
|
|
34
|
+
return {
|
|
35
|
+
token: requireString(claim, "token", "response"),
|
|
36
|
+
bot: {
|
|
37
|
+
id: requireString(bot, "id", "bot"),
|
|
38
|
+
handle: requireString(bot, "handle", "bot"),
|
|
39
|
+
display_name: requireString(bot, "display_name", "bot")
|
|
40
|
+
},
|
|
41
|
+
workspace: {
|
|
42
|
+
id: requireString(workspace, "id", "workspace"),
|
|
43
|
+
route_id: requireString(workspace, "route_id", "workspace"),
|
|
44
|
+
slug: requireString(workspace, "slug", "workspace"),
|
|
45
|
+
name: requireString(workspace, "name", "workspace")
|
|
46
|
+
},
|
|
47
|
+
defaults: {
|
|
48
|
+
...defaultTo !== void 0 ? { defaultTo } : {},
|
|
49
|
+
...allowFrom !== void 0 ? { allowFrom } : {},
|
|
50
|
+
...agentActivity !== void 0 ? { agentActivity } : {}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/** Claims a one-time setup code without sending any existing bot credential. */
|
|
55
|
+
async function claimClickClackSetupCode(params) {
|
|
56
|
+
const baseUrl = params.baseUrl.replace(/\/+$/, "");
|
|
57
|
+
const parsedBaseUrl = new URL(baseUrl);
|
|
58
|
+
const deadline = createProviderOperationDeadline({
|
|
59
|
+
label: "ClickClack setup code claim",
|
|
60
|
+
timeoutMs: CLICKCLACK_SETUP_CODE_CLAIM_TIMEOUT_MS
|
|
61
|
+
});
|
|
62
|
+
let pinnedHttpTarget;
|
|
63
|
+
if (parsedBaseUrl.protocol === "http:") {
|
|
64
|
+
const resolveTimeoutMs = resolveProviderOperationTimeoutMs({
|
|
65
|
+
deadline,
|
|
66
|
+
defaultTimeoutMs: CLICKCLACK_SETUP_CODE_CLAIM_TIMEOUT_MS
|
|
67
|
+
});
|
|
68
|
+
const pinned = await withTimeout(resolvePinnedHostnameWithPolicy(parsedBaseUrl.hostname, {
|
|
69
|
+
lookupFn: params.lookupFn,
|
|
70
|
+
policy: { dangerouslyAllowPrivateNetwork: true }
|
|
71
|
+
}), resolveTimeoutMs, { message: `ClickClack setup code claim timed out after ${CLICKCLACK_SETUP_CODE_CLAIM_TIMEOUT_MS}ms` });
|
|
72
|
+
if (!pinned.addresses.every((address) => isPrivateOrLoopbackHost(address))) throw new Error("ClickClack setup codes require HTTPS unless the server is on a private or loopback network.");
|
|
73
|
+
pinnedHttpTarget = {
|
|
74
|
+
hostname: pinned.hostname,
|
|
75
|
+
addresses: pinned.addresses
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
const { response, release } = await fetchWithSsrFGuard({
|
|
79
|
+
url: `${baseUrl}/api/bot-setup-codes/claim`,
|
|
80
|
+
fetchImpl: params.fetch,
|
|
81
|
+
init: {
|
|
82
|
+
method: "POST",
|
|
83
|
+
headers: {
|
|
84
|
+
Accept: "application/json",
|
|
85
|
+
"Content-Type": "application/json"
|
|
86
|
+
},
|
|
87
|
+
body: JSON.stringify({ code: params.code })
|
|
88
|
+
},
|
|
89
|
+
maxRedirects: 0,
|
|
90
|
+
timeoutMs: resolveProviderOperationTimeoutMs({
|
|
91
|
+
deadline,
|
|
92
|
+
defaultTimeoutMs: CLICKCLACK_SETUP_CODE_CLAIM_TIMEOUT_MS
|
|
93
|
+
}),
|
|
94
|
+
requireHttps: parsedBaseUrl.protocol === "https:",
|
|
95
|
+
policy: ssrfPolicyFromHttpBaseUrlAllowedHostname(baseUrl),
|
|
96
|
+
lookupFn: params.lookupFn,
|
|
97
|
+
...pinnedHttpTarget ? { dispatcherPolicy: {
|
|
98
|
+
mode: "direct",
|
|
99
|
+
pinnedHostname: pinnedHttpTarget
|
|
100
|
+
} } : {},
|
|
101
|
+
auditContext: "ClickClack setup code claim"
|
|
102
|
+
});
|
|
103
|
+
try {
|
|
104
|
+
if (!response.ok) {
|
|
105
|
+
const detail = await readResponseTextLimited(response, CLICKCLACK_ERROR_BODY_LIMIT_BYTES);
|
|
106
|
+
throw new ClickClackSetupCodeClaimError(response.status, detail);
|
|
107
|
+
}
|
|
108
|
+
return parseClickClackSetupCodeClaim(await readProviderJsonResponse(response, "ClickClack setup code claim", { maxBytes: CLICKCLACK_SETUP_CODE_CLAIM_JSON_LIMIT_BYTES }));
|
|
109
|
+
} finally {
|
|
110
|
+
await release();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
//#endregion
|
|
114
|
+
export { claimClickClackSetupCode };
|
package/dist/setup-plugin-api.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as clickClackConfigAdapter, n as clickClackSetupAdapter, s as clickClackConfigSchema, t as clickClackSetupWizard, u as clickClackMeta } from "./setup-surface-
|
|
1
|
+
import { l as clickClackConfigAdapter, n as clickClackSetupAdapter, s as clickClackConfigSchema, t as clickClackSetupWizard, u as clickClackMeta } from "./setup-surface-CNjp76Xx.js";
|
|
2
2
|
//#region extensions/clickclack/src/channel.setup.ts
|
|
3
3
|
const clickClackSetupPlugin = {
|
|
4
4
|
id: "clickclack",
|
|
@@ -449,8 +449,11 @@ async function resolveChannelId(client, workspaceId, channel) {
|
|
|
449
449
|
//#endregion
|
|
450
450
|
//#region extensions/clickclack/src/setup-core.ts
|
|
451
451
|
const channel$1 = "clickclack";
|
|
452
|
+
const SETUP_CODE_ALPHABET = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
453
|
+
const SETUP_CODE_LENGTH = 12;
|
|
452
454
|
const REQUIRED_INPUT_ERROR = "ClickClack requires --token, --base-url, and --workspace (or --use-env).";
|
|
453
455
|
const INVALID_BASE_URL_ERROR = "ClickClack base URL must be a valid http(s) URL.";
|
|
456
|
+
const SETUP_CODE_CONFLICT_ERROR = "ClickClack --code cannot be combined with --token, --token-file, or --use-env.";
|
|
454
457
|
function normalizeClickClackBaseUrl(value) {
|
|
455
458
|
const trimmed = value?.trim();
|
|
456
459
|
if (!trimmed) return;
|
|
@@ -462,6 +465,58 @@ function normalizeClickClackBaseUrl(value) {
|
|
|
462
465
|
return;
|
|
463
466
|
}
|
|
464
467
|
}
|
|
468
|
+
function normalizeClickClackSetupCode(value) {
|
|
469
|
+
const normalized = value.trim().toUpperCase().replaceAll("-", "").replaceAll(" ", "");
|
|
470
|
+
if (normalized.length !== SETUP_CODE_LENGTH || Array.from(normalized).some((character) => !SETUP_CODE_ALPHABET.includes(character))) return;
|
|
471
|
+
return normalized;
|
|
472
|
+
}
|
|
473
|
+
function requireClickClackSetupCodeBaseUrl(value) {
|
|
474
|
+
const baseUrl = normalizeClickClackBaseUrl(value);
|
|
475
|
+
if (!baseUrl) throw new Error("ClickClack setup codes require a valid HTTP(S) base URL.");
|
|
476
|
+
return baseUrl;
|
|
477
|
+
}
|
|
478
|
+
function parseClickClackSetupCodeInput(params) {
|
|
479
|
+
const rawCode = params.code.trim();
|
|
480
|
+
if (!rawCode) throw new Error("ClickClack --code must not be empty.");
|
|
481
|
+
let code = rawCode;
|
|
482
|
+
let baseUrl;
|
|
483
|
+
if (/^[a-z][a-z\d+.-]*:\/\//iu.test(rawCode)) {
|
|
484
|
+
let setupUrl;
|
|
485
|
+
try {
|
|
486
|
+
setupUrl = new URL(rawCode);
|
|
487
|
+
} catch {
|
|
488
|
+
throw new Error("ClickClack --code must be a valid HTTP(S) setup URL or a bare setup code.");
|
|
489
|
+
}
|
|
490
|
+
if (setupUrl.protocol !== "http:" && setupUrl.protocol !== "https:") throw new Error("ClickClack setup codes require an HTTP(S) URL.");
|
|
491
|
+
if (setupUrl.username || setupUrl.password) throw new Error("ClickClack setup URLs must not include credentials.");
|
|
492
|
+
code = setupUrl.hash.slice(1);
|
|
493
|
+
if (!code) throw new Error("ClickClack setup URL is missing its #CODE fragment.");
|
|
494
|
+
setupUrl.hash = "";
|
|
495
|
+
setupUrl.search = "";
|
|
496
|
+
baseUrl = requireClickClackSetupCodeBaseUrl(setupUrl.toString());
|
|
497
|
+
if (params.baseUrl) {
|
|
498
|
+
if (requireClickClackSetupCodeBaseUrl(params.baseUrl) !== baseUrl) throw new Error("ClickClack --base-url does not match the server in the setup-code URL.");
|
|
499
|
+
}
|
|
500
|
+
} else {
|
|
501
|
+
code = code.startsWith("#") ? code.slice(1) : code;
|
|
502
|
+
if (!params.baseUrl) throw new Error("A bare ClickClack setup code requires --base-url.");
|
|
503
|
+
baseUrl = requireClickClackSetupCodeBaseUrl(params.baseUrl);
|
|
504
|
+
}
|
|
505
|
+
const normalizedCode = normalizeClickClackSetupCode(code);
|
|
506
|
+
if (!normalizedCode) throw new Error("ClickClack setup code must contain 12 valid base32 characters.");
|
|
507
|
+
return {
|
|
508
|
+
code: normalizedCode,
|
|
509
|
+
baseUrl
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
function formatClickClackSetupCodeClaimError(error) {
|
|
513
|
+
if (typeof error === "object" && error !== null && "status" in error) {
|
|
514
|
+
const status = error.status;
|
|
515
|
+
if (status === 404) return /* @__PURE__ */ new Error("ClickClack setup code is invalid, expired, or already used. Generate a new code and try again.");
|
|
516
|
+
if (status === 429) return /* @__PURE__ */ new Error("Too many ClickClack setup code attempts. Wait and try again.");
|
|
517
|
+
}
|
|
518
|
+
return /* @__PURE__ */ new Error(`Could not claim ClickClack setup code: ${formatErrorMessage(error)}`);
|
|
519
|
+
}
|
|
465
520
|
function applyClickClackSetupConfigPatch(params) {
|
|
466
521
|
const accountId = normalizeAccountId(params.accountId);
|
|
467
522
|
const namedConfig = applyAccountNameToChannelSection({
|
|
@@ -530,6 +585,31 @@ function applyClickClackCredentialConfig(params) {
|
|
|
530
585
|
}
|
|
531
586
|
const clickClackSetupAdapter = {
|
|
532
587
|
resolveAccountId: ({ accountId }) => normalizeAccountId(accountId),
|
|
588
|
+
prepareAccountConfigInput: async ({ input }) => {
|
|
589
|
+
if (!input.code?.trim()) return input;
|
|
590
|
+
if (input.token?.trim() || input.tokenFile?.trim() || input.useEnv) throw new Error(SETUP_CODE_CONFLICT_ERROR);
|
|
591
|
+
const setup = parseClickClackSetupCodeInput({
|
|
592
|
+
code: input.code,
|
|
593
|
+
baseUrl: input.baseUrl
|
|
594
|
+
});
|
|
595
|
+
let claim;
|
|
596
|
+
try {
|
|
597
|
+
const { claimClickClackSetupCode } = await import("./setup-claim-BUWvZjtu.js");
|
|
598
|
+
claim = await claimClickClackSetupCode(setup);
|
|
599
|
+
} catch (error) {
|
|
600
|
+
throw formatClickClackSetupCodeClaimError(error);
|
|
601
|
+
}
|
|
602
|
+
const { code: _code, tokenFile: _tokenFile, useEnv: _useEnv, ...remainingInput } = input;
|
|
603
|
+
return {
|
|
604
|
+
...remainingInput,
|
|
605
|
+
baseUrl: setup.baseUrl,
|
|
606
|
+
token: claim.token,
|
|
607
|
+
workspace: claim.workspace.id,
|
|
608
|
+
...claim.defaults.defaultTo !== void 0 ? { defaultTo: claim.defaults.defaultTo } : {},
|
|
609
|
+
...claim.defaults.allowFrom !== void 0 ? { allowFrom: [...claim.defaults.allowFrom] } : {},
|
|
610
|
+
...claim.defaults.agentActivity !== void 0 ? { agentActivity: claim.defaults.agentActivity } : {}
|
|
611
|
+
};
|
|
612
|
+
},
|
|
533
613
|
applyAccountName: ({ cfg, accountId, name }) => applyAccountNameToChannelSection({
|
|
534
614
|
cfg,
|
|
535
615
|
channelKey: channel$1,
|
|
@@ -577,7 +657,10 @@ const clickClackSetupAdapter = {
|
|
|
577
657
|
name: input.name,
|
|
578
658
|
patch: {
|
|
579
659
|
...baseUrl ? { baseUrl } : {},
|
|
580
|
-
...workspace ? { workspace } : {}
|
|
660
|
+
...workspace ? { workspace } : {},
|
|
661
|
+
...input.defaultTo?.trim() ? { defaultTo: input.defaultTo.trim() } : {},
|
|
662
|
+
...input.allowFrom ? { allowFrom: [...input.allowFrom] } : {},
|
|
663
|
+
...input.agentActivity !== void 0 ? { agentActivity: input.agentActivity } : {}
|
|
581
664
|
}
|
|
582
665
|
}),
|
|
583
666
|
accountId,
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/clickclack",
|
|
3
|
-
"version": "2026.7.2-beta.
|
|
3
|
+
"version": "2026.7.2-beta.3",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@openclaw/clickclack",
|
|
9
|
-
"version": "2026.7.2-beta.
|
|
9
|
+
"version": "2026.7.2-beta.3",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"ws": "8.21.0",
|
|
12
12
|
"zod": "4.4.3"
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"openclaw": ">=2026.7.2-beta.
|
|
15
|
+
"openclaw": ">=2026.7.2-beta.3"
|
|
16
16
|
},
|
|
17
17
|
"peerDependenciesMeta": {
|
|
18
18
|
"openclaw": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/clickclack",
|
|
3
|
-
"version": "2026.7.2-beta.
|
|
3
|
+
"version": "2026.7.2-beta.3",
|
|
4
4
|
"description": "OpenClaw ClickClack channel plugin",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"zod": "4.4.3"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
|
-
"openclaw": ">=2026.7.2-beta.
|
|
16
|
+
"openclaw": ">=2026.7.2-beta.3"
|
|
17
17
|
},
|
|
18
18
|
"peerDependenciesMeta": {
|
|
19
19
|
"openclaw": {
|
|
@@ -42,6 +42,10 @@
|
|
|
42
42
|
"nativeSkillsAutoEnabled": false
|
|
43
43
|
},
|
|
44
44
|
"cliAddOptions": [
|
|
45
|
+
{
|
|
46
|
+
"flags": "--code <code>",
|
|
47
|
+
"description": "ClickClack one-time setup code or setup URL"
|
|
48
|
+
},
|
|
45
49
|
{
|
|
46
50
|
"flags": "--workspace <workspace>",
|
|
47
51
|
"description": "ClickClack workspace id, slug, or name"
|
|
@@ -56,10 +60,10 @@
|
|
|
56
60
|
"allowInvalidConfigRecovery": true
|
|
57
61
|
},
|
|
58
62
|
"compat": {
|
|
59
|
-
"pluginApi": ">=2026.7.2-beta.
|
|
63
|
+
"pluginApi": ">=2026.7.2-beta.3"
|
|
60
64
|
},
|
|
61
65
|
"build": {
|
|
62
|
-
"openclawVersion": "2026.7.2-beta.
|
|
66
|
+
"openclawVersion": "2026.7.2-beta.3",
|
|
63
67
|
"bundledDist": false
|
|
64
68
|
},
|
|
65
69
|
"release": {
|