cclawd 1.0.4 → 1.0.6
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/{active-listener-BLd27Pxd.js → active-listener-Dkhmfuwx.js} +1 -1
- package/dist/{api-key-rotation-Dg3JlNDQ.js → api-key-rotation-BOfI3cG3.js} +1 -1
- package/dist/{audio-preflight-eV5m9mMp.js → audio-preflight-CtkZ5SAs.js} +6 -6
- package/dist/{audio-transcription-runner-CQU4Eg1M.js → audio-transcription-runner-CbPqoiHX.js} +6 -6
- package/dist/build-info.json +3 -3
- package/dist/bundled/boot-md/handler.js +23 -23
- package/dist/bundled/session-memory/handler.js +23 -23
- package/dist/{channel-activity-dT3cYb0e.js → channel-activity-DWAER4wd.js} +1 -1
- package/dist/{commands-registry-CyLMCPuP.js → commands-registry-BUyiA7nE.js} +1 -1
- package/dist/compact.runtime-DpcZpcTl.js +39 -0
- package/dist/{deliver-B6eTtXSk.js → deliver-aHOaRbkt.js} +4 -4
- package/dist/{deliver-runtime-CLDpY6AW.js → deliver-runtime-D4bCsr6d.js} +7 -7
- package/dist/{deps-send-discord.runtime-CxADlame.js → deps-send-discord.runtime-BziKU-pE.js} +7 -7
- package/dist/{deps-send-imessage.runtime-Wi79xm6H.js → deps-send-imessage.runtime-CFRnDTqp.js} +7 -7
- package/dist/{deps-send-signal.runtime-BDtzvsnR.js → deps-send-signal.runtime-BuOtABJm.js} +6 -6
- package/dist/{deps-send-slack.runtime-CgX24hgT.js → deps-send-slack.runtime-BOLqvMxW.js} +5 -5
- package/dist/{deps-send-telegram.runtime-CEWc7ePn.js → deps-send-telegram.runtime-DeEoFLv5.js} +6 -6
- package/dist/deps-send-whatsapp.runtime-CG1uXYLY.js +43 -0
- package/dist/{diagnostic-BZmAxdu9.js → diagnostic-BdcXX9iJ.js} +1 -1
- package/dist/{fetch-CMLoICyN.js → fetch-D9NUULbj.js} +2 -2
- package/dist/{fetch-guard-DCj3k042.js → fetch-guard-B5ZMnGaN.js} +1 -1
- package/dist/{image-Bt49ybRv.js → image-4x07m4Jl.js} +2 -2
- package/dist/{image-runtime-Cilhq73U.js → image-runtime-smkMrIol.js} +2 -2
- package/dist/{ir-CVtBjUiL.js → ir-CsgNUpOU.js} +2 -2
- package/dist/llm-slug-generator.js +23 -23
- package/dist/{login-D0fUoX-p.js → login-p_O59TVQ.js} +2 -2
- package/dist/{login-qr-ClBxstxZ.js → login-qr-BCJpDsAy.js} +2 -2
- package/dist/{manager-DSfEj66R.js → manager-CwYv8O3T.js} +3 -3
- package/dist/{manager-runtime-BrZlGJsj.js → manager-runtime-D_jEoBr9.js} +4 -4
- package/dist/{model-selection-CMEj8bpy.js → model-selection-Cv2Puf5z.js} +11 -11
- package/dist/{outbound-BxIJyMzV.js → outbound-Chpiwybe.js} +4 -4
- package/dist/{outbound-attachment-CVJwpypG.js → outbound-attachment-BnAVJDLe.js} +2 -2
- package/dist/{pi-embedded-CHNPEUAv.js → pi-embedded-CJVNBk0y.js} +57 -57
- package/dist/{pi-model-discovery-D-r5y7kV.js → pi-model-discovery-7IzK0Uc3.js} +1 -1
- package/dist/{pi-model-discovery-runtime-DZQXYmdu.js → pi-model-discovery-runtime-DABef3qy.js} +2 -2
- package/dist/{pi-tools.before-tool-call.runtime-DagGpfw0.js → pi-tools.before-tool-call.runtime-BP2UvGJb.js} +2 -2
- package/dist/plugin-sdk/index.js +35 -35
- package/dist/plugin-sdk/signal.js +2 -2
- package/dist/{pw-ai-CoIUdns_.js → pw-ai-DwH5GpEO.js} +1 -1
- package/dist/{runtime-whatsapp-login.runtime-ChqE9BkX.js → runtime-whatsapp-login.runtime-BI3U306v.js} +3 -3
- package/dist/{runtime-whatsapp-outbound.runtime-yiy6jzKk.js → runtime-whatsapp-outbound.runtime-Bsc2uD09.js} +6 -6
- package/dist/{send-V1MRV7QF.js → send-BDnOgWIp.js} +3 -3
- package/dist/{send-EDBPXjTT.js → send-C-Q_WPMf.js} +3 -3
- package/dist/{send-K2mAG7KC.js → send-DUibfNQD.js} +4 -4
- package/dist/{send-4rRrSKp9.js → send-DtBvCnPQ.js} +4 -4
- package/dist/{send-BKO1-P1t.js → send-ORtn50qg.js} +3 -3
- package/dist/{session-CuVCho2m.js → session-B7imi6T5.js} +1 -1
- package/dist/{skill-commands-B55LOaMB.js → skill-commands-B9brPuiL.js} +2 -2
- package/dist/{slash-commands.runtime-BchS0VkW.js → slash-commands.runtime-Cf6ygfBp.js} +2 -2
- package/dist/{slash-dispatch.runtime-BIKRY3fr.js → slash-dispatch.runtime-CsmvhO5K.js} +23 -23
- package/dist/{slash-skill-commands.runtime-BP4jBHU9.js → slash-skill-commands.runtime-CX7stIEP.js} +3 -3
- package/dist/{subagent-registry-runtime-DjEYzSyM.js → subagent-registry-runtime-B_S1nf7y.js} +23 -23
- package/dist/{tables-BAGqh2XD.js → tables-CjQqTOdD.js} +1 -1
- package/dist/{target-errors-CeBF8Pws.js → target-errors-BZE1mc-W.js} +1 -1
- package/dist/{web-BRSmQdtm.js → web-Cd8yK1Zq.js} +27 -27
- package/dist/{whatsapp-actions-Dxb2K2Xh.js → whatsapp-actions-CYEzUMBI.js} +7 -7
- package/extensions/mfa-auth/index.ts +20 -39
- package/extensions/mfa-auth/src/auth-manager.ts +0 -4
- package/extensions/mfa-auth/src/notification-service.ts +3 -7
- package/package.json +1 -1
- package/dist/compact.runtime-DGRl4st4.js +0 -39
- package/dist/deps-send-whatsapp.runtime-B1KJ7YOp.js +0 -43
- package/dist/plugin-sdk/active-listener-CN-tMEvN.js +0 -35
- package/dist/plugin-sdk/api-key-rotation-CimGYMBc.js +0 -176
- package/dist/plugin-sdk/audio-preflight-C-xXBoE2.js +0 -51
- package/dist/plugin-sdk/audio-transcription-runner-CTIHpebA.js +0 -2173
- package/dist/plugin-sdk/audit-membership-runtime-BFatB2LJ.js +0 -58
- package/dist/plugin-sdk/channel-activity-DO0FEzyj.js +0 -95
- package/dist/plugin-sdk/channel-web-Da-__nUF.js +0 -2238
- package/dist/plugin-sdk/commands-registry-6no2NNrY.js +0 -1118
- package/dist/plugin-sdk/compact.runtime-CCoclu5e.js +0 -35
- package/dist/plugin-sdk/config-B9ODwgpz.js +0 -37426
- package/dist/plugin-sdk/deliver-B1fFpKjV.js +0 -1757
- package/dist/plugin-sdk/deliver-runtime-DB-VRMe1.js +0 -15
- package/dist/plugin-sdk/deps-send-discord.runtime-DklqycYG.js +0 -15
- package/dist/plugin-sdk/deps-send-imessage.runtime-Chs8zeon.js +0 -14
- package/dist/plugin-sdk/deps-send-signal.runtime-clW9aSJP.js +0 -13
- package/dist/plugin-sdk/deps-send-slack.runtime-BUx0LYY1.js +0 -13
- package/dist/plugin-sdk/deps-send-telegram.runtime-LECSHgMG.js +0 -16
- package/dist/plugin-sdk/deps-send-whatsapp.runtime-D2d65fw0.js +0 -40
- package/dist/plugin-sdk/diagnostic-CxIvS-C2.js +0 -315
- package/dist/plugin-sdk/dispatch-BqlR4dPx.js +0 -105863
- package/dist/plugin-sdk/env-b9k1PHMI.js +0 -34
- package/dist/plugin-sdk/fetch-PoxzAANT.js +0 -326
- package/dist/plugin-sdk/fetch-guard-4UVSZ0uS.js +0 -164
- package/dist/plugin-sdk/image-Ch6M4tnJ.js +0 -2420
- package/dist/plugin-sdk/image-runtime-CSh2o5wY.js +0 -8
- package/dist/plugin-sdk/ir-CugsqGH8.js +0 -1312
- package/dist/plugin-sdk/local-roots-adnEg9zb.js +0 -217
- package/dist/plugin-sdk/logger-D6zRubj0.js +0 -1164
- package/dist/plugin-sdk/login-CYvkQ0At.js +0 -54
- package/dist/plugin-sdk/login-qr-ll4NtaT5.js +0 -316
- package/dist/plugin-sdk/manager-CHy8IclH.js +0 -3959
- package/dist/plugin-sdk/manager-runtime-C70EkEr7.js +0 -11
- package/dist/plugin-sdk/outbound-Wzs2iN7X.js +0 -216
- package/dist/plugin-sdk/outbound-attachment-khXJwucX.js +0 -17
- package/dist/plugin-sdk/paths-BtVqCdw4.js +0 -3063
- package/dist/plugin-sdk/pi-model-discovery-Dh4ziodY.js +0 -131
- package/dist/plugin-sdk/pi-model-discovery-runtime-b83Xe-HT.js +0 -8
- package/dist/plugin-sdk/pi-tools.before-tool-call.runtime-C1z5CDBF.js +0 -349
- package/dist/plugin-sdk/proxy-fetch-CJEmoBxi.js +0 -54
- package/dist/plugin-sdk/pw-ai-Dj3Cvlzl.js +0 -1990
- package/dist/plugin-sdk/qmd-manager-egHUAseQ.js +0 -1581
- package/dist/plugin-sdk/resolve-outbound-target-BiICvIKs.js +0 -38
- package/dist/plugin-sdk/runtime-whatsapp-login.runtime-DNApufzW.js +0 -9
- package/dist/plugin-sdk/runtime-whatsapp-outbound.runtime-CBmtfIQ8.js +0 -13
- package/dist/plugin-sdk/send-CScblaI4.js +0 -532
- package/dist/plugin-sdk/send-CeHhnld6.js +0 -407
- package/dist/plugin-sdk/send-DP_c8JfR.js +0 -3277
- package/dist/plugin-sdk/send-Dc5fI6e8.js +0 -495
- package/dist/plugin-sdk/send-l-77_s1_.js +0 -2507
- package/dist/plugin-sdk/session-CkOKZaqa.js +0 -166
- package/dist/plugin-sdk/skill-commands-BohYCgkq.js +0 -336
- package/dist/plugin-sdk/slash-commands.runtime-DpLfVTM6.js +0 -8
- package/dist/plugin-sdk/slash-dispatch.runtime-CASMHwpm.js +0 -35
- package/dist/plugin-sdk/slash-skill-commands.runtime-D7rrJEci.js +0 -9
- package/dist/plugin-sdk/sqlite-CJE3X7Mv.js +0 -1005
- package/dist/plugin-sdk/subagent-registry-runtime-B1oo5bih.js +0 -35
- package/dist/plugin-sdk/tables-D5VgpTmm.js +0 -53
- package/dist/plugin-sdk/target-errors-C6zZ_OpA.js +0 -191
- package/dist/plugin-sdk/tokens-DUnJnpMS.js +0 -50
- package/dist/plugin-sdk/web-TfUM1nSi.js +0 -39
- package/dist/plugin-sdk/whatsapp-actions-DuWJ0j1r.js +0 -71
|
@@ -176,19 +176,16 @@ export default function register(api: OpenClawPluginApi) {
|
|
|
176
176
|
const targetSessionKey =
|
|
177
177
|
parsedChannel === "webchat" || parsedChannel === "web" ? userId : sessionKey;
|
|
178
178
|
|
|
179
|
-
|
|
180
|
-
await sendAuthMessage(
|
|
179
|
+
sendAuthMessage(
|
|
181
180
|
parsedChannel,
|
|
182
181
|
parsedAccountId,
|
|
183
182
|
parsedTo || userId,
|
|
184
183
|
"✅ 二次认证成功,请重新发送之前的命令(或回复'确认')即可执行。",
|
|
185
184
|
userId,
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
api.logger.error(`[mfa-auth] Failed to send success notification: ${err}`);
|
|
191
|
-
}
|
|
185
|
+
targetSessionKey,
|
|
186
|
+
).catch((err) =>
|
|
187
|
+
api.logger.error(`[mfa-auth] Failed to send success notification: ${err}`),
|
|
188
|
+
);
|
|
192
189
|
}
|
|
193
190
|
|
|
194
191
|
return undefined;
|
|
@@ -278,7 +275,7 @@ export default function register(api: OpenClawPluginApi) {
|
|
|
278
275
|
}
|
|
279
276
|
|
|
280
277
|
if (parsedChannel && parsedChannel !== "web") {
|
|
281
|
-
if (
|
|
278
|
+
if (parsedChannel !== "feishu") {
|
|
282
279
|
api.logger.warn(
|
|
283
280
|
`[mfa-auth] Channel ${parsedChannel} not supported, skipping auth notification`,
|
|
284
281
|
);
|
|
@@ -356,19 +353,16 @@ export default function register(api: OpenClawPluginApi) {
|
|
|
356
353
|
? "✅ 重新认证成功,请继续对话。"
|
|
357
354
|
: "✅ 首次认证成功,请继续对话。";
|
|
358
355
|
|
|
359
|
-
|
|
360
|
-
await sendAuthMessage(
|
|
356
|
+
sendAuthMessage(
|
|
361
357
|
parsedChannel,
|
|
362
358
|
parsedAccountId,
|
|
363
359
|
parsedTo || userId,
|
|
364
360
|
messageText,
|
|
365
361
|
userId,
|
|
366
362
|
sessionKey,
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
api.logger.error(`[mfa-auth] Failed to send success notification: ${err}`);
|
|
371
|
-
}
|
|
363
|
+
).catch((err) =>
|
|
364
|
+
api.logger.error(`[mfa-auth] Failed to send success notification: ${err}`),
|
|
365
|
+
);
|
|
372
366
|
}
|
|
373
367
|
|
|
374
368
|
return;
|
|
@@ -439,7 +433,7 @@ export default function register(api: OpenClawPluginApi) {
|
|
|
439
433
|
}
|
|
440
434
|
|
|
441
435
|
if (parsedChannel && parsedChannel !== "web") {
|
|
442
|
-
if (
|
|
436
|
+
if (parsedChannel !== "feishu") {
|
|
443
437
|
api.logger.warn(
|
|
444
438
|
`[mfa-auth] Channel ${parsedChannel} not supported, skipping auth notification`,
|
|
445
439
|
);
|
|
@@ -488,21 +482,11 @@ export default function register(api: OpenClawPluginApi) {
|
|
|
488
482
|
`[mfa-auth] Parsed: channel=${parsedChannel}, accountId=${parsedAccountId}, to=${parsedTo}`,
|
|
489
483
|
);
|
|
490
484
|
|
|
491
|
-
|
|
492
|
-
const contextSessionKey =
|
|
493
|
-
typeof ctxAny.sessionKey === "string" && ctxAny.sessionKey.trim().length > 0
|
|
494
|
-
? ctxAny.sessionKey.trim()
|
|
495
|
-
: typeof ctxAny.conversationId === "string" && ctxAny.conversationId.trim().length > 0
|
|
496
|
-
? ctxAny.conversationId.trim()
|
|
497
|
-
: "";
|
|
498
|
-
|
|
499
|
-
// Prefer real runtime session key from context to avoid injecting into
|
|
500
|
-
// synthetic IDs like "gateway-client" that have no transcript file.
|
|
485
|
+
// For webchat, use userId as sessionKey
|
|
501
486
|
const sessionKey =
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
: `${parsedChannel}:${parsedAccountId}:${userId}`);
|
|
487
|
+
parsedChannel === "webchat" || parsedChannel === "web"
|
|
488
|
+
? userId
|
|
489
|
+
: `${parsedChannel}:${parsedAccountId}:${userId}`;
|
|
506
490
|
|
|
507
491
|
api.logger.info(`[mfa-auth] Using sessionKey for reauth: ${sessionKey}`);
|
|
508
492
|
|
|
@@ -567,7 +551,7 @@ export default function register(api: OpenClawPluginApi) {
|
|
|
567
551
|
}
|
|
568
552
|
}
|
|
569
553
|
|
|
570
|
-
if (!parsedChannel) {
|
|
554
|
+
if (!parsedChannel || parsedChannel !== "feishu") {
|
|
571
555
|
api.logger.warn(`[mfa-auth] Channel ${parsedChannel} not supported`);
|
|
572
556
|
return { text: "❌ 当前渠道不支持认证。" };
|
|
573
557
|
}
|
|
@@ -672,19 +656,16 @@ function startPollingForAuth(
|
|
|
672
656
|
? "✅ 首次认证成功,请继续对话。"
|
|
673
657
|
: "✅ 二次认证成功,请重新发送之前的命令(或回复'确认')即可执行。";
|
|
674
658
|
|
|
675
|
-
|
|
676
|
-
await sendAuthMessage(
|
|
659
|
+
sendAuthMessage(
|
|
677
660
|
context.channel,
|
|
678
661
|
context.accountId,
|
|
679
662
|
context.to || userId,
|
|
680
663
|
messageText,
|
|
681
664
|
userId,
|
|
682
665
|
context.sessionKey,
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
api.logger.error(`[mfa-auth] Failed to send success notification from polling: ${err}`);
|
|
687
|
-
}
|
|
666
|
+
).catch((err) =>
|
|
667
|
+
api.logger.error(`[mfa-auth] Failed to send success notification from polling: ${err}`),
|
|
668
|
+
);
|
|
688
669
|
}
|
|
689
670
|
return;
|
|
690
671
|
}
|
|
@@ -252,10 +252,6 @@ export class AuthManager {
|
|
|
252
252
|
return null;
|
|
253
253
|
}
|
|
254
254
|
|
|
255
|
-
restoreNotification(userId: string, info: NotificationInfo): void {
|
|
256
|
-
this.pendingNotifications.set(userId, info);
|
|
257
|
-
}
|
|
258
|
-
|
|
259
255
|
isUserVerified(userId: string): boolean {
|
|
260
256
|
return this.isUserVerifiedForSensitiveOps(userId);
|
|
261
257
|
}
|
|
@@ -29,8 +29,8 @@ class NotificationService {
|
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
if (channel === "webchat" || channel === "web"
|
|
33
|
-
console.log(`[mfa-auth]
|
|
32
|
+
if (channel === "webchat" || channel === "web") {
|
|
33
|
+
console.log(`[mfa-auth] Web/webchat channel: sending notification via WebSocket`);
|
|
34
34
|
await this.sendToWebChat(session, message);
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
@@ -159,11 +159,7 @@ class NotificationService {
|
|
|
159
159
|
return;
|
|
160
160
|
}
|
|
161
161
|
const errMsg = String(response?.error?.message ?? "").toLowerCase();
|
|
162
|
-
const shouldTryNext =
|
|
163
|
-
errMsg.includes("session not found") ||
|
|
164
|
-
errMsg.includes("transcript file not found") ||
|
|
165
|
-
errMsg.includes("failed to write transcript") ||
|
|
166
|
-
errMsg.includes("unavailable");
|
|
162
|
+
const shouldTryNext = errMsg.includes("session not found");
|
|
167
163
|
if (shouldTryNext && injectIndex + 1 < candidateSessionKeys.length) {
|
|
168
164
|
injectIndex += 1;
|
|
169
165
|
sendInject(candidateSessionKeys[injectIndex]);
|
package/package.json
CHANGED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import "./paths-CehYKFsO.js";
|
|
2
|
-
import "./paths-DkxwiA8g.js";
|
|
3
|
-
import "./subsystem-DfXy5gUB.js";
|
|
4
|
-
import "./workspace-DGIcKCCW.js";
|
|
5
|
-
import "./logger-CbUVl62f.js";
|
|
6
|
-
import "./model-selection-CMEj8bpy.js";
|
|
7
|
-
import "./github-copilot-token-8N63GdbE.js";
|
|
8
|
-
import "./boolean-C7Ct_klp.js";
|
|
9
|
-
import "./env-lw2hsIUY.js";
|
|
10
|
-
import "./frontmatter-C_obXuTp.js";
|
|
11
|
-
import "./send-BKO1-P1t.js";
|
|
12
|
-
import "./send-4rRrSKp9.js";
|
|
13
|
-
import { n as compactEmbeddedPiSessionDirect } from "./pi-embedded-CHNPEUAv.js";
|
|
14
|
-
import "./tokens-6ul2IrzG.js";
|
|
15
|
-
import "./deliver-B6eTtXSk.js";
|
|
16
|
-
import "./diagnostic-BZmAxdu9.js";
|
|
17
|
-
import "./send-V1MRV7QF.js";
|
|
18
|
-
import "./pi-model-discovery-D-r5y7kV.js";
|
|
19
|
-
import "./image-Bt49ybRv.js";
|
|
20
|
-
import "./audio-transcription-runner-CQU4Eg1M.js";
|
|
21
|
-
import "./fetch-CMLoICyN.js";
|
|
22
|
-
import "./fetch-guard-DCj3k042.js";
|
|
23
|
-
import "./api-key-rotation-Dg3JlNDQ.js";
|
|
24
|
-
import "./proxy-fetch-BOh1PLOW.js";
|
|
25
|
-
import "./ir-CVtBjUiL.js";
|
|
26
|
-
import "./render-IRnn-2gt.js";
|
|
27
|
-
import "./target-errors-CeBF8Pws.js";
|
|
28
|
-
import "./commands-registry-CyLMCPuP.js";
|
|
29
|
-
import "./skill-commands-B55LOaMB.js";
|
|
30
|
-
import "./fetch-CeWULXBI.js";
|
|
31
|
-
import "./channel-activity-dT3cYb0e.js";
|
|
32
|
-
import "./tables-BAGqh2XD.js";
|
|
33
|
-
import "./send-EDBPXjTT.js";
|
|
34
|
-
import "./outbound-attachment-CVJwpypG.js";
|
|
35
|
-
import "./send-K2mAG7KC.js";
|
|
36
|
-
import "./fetch-C0iyt-Iz.js";
|
|
37
|
-
import "./manager-DSfEj66R.js";
|
|
38
|
-
import "./query-expansion-BErUY8P2.js";
|
|
39
|
-
export { compactEmbeddedPiSessionDirect };
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import "./paths-CehYKFsO.js";
|
|
2
|
-
import "./paths-DkxwiA8g.js";
|
|
3
|
-
import "./subsystem-DfXy5gUB.js";
|
|
4
|
-
import "./workspace-DGIcKCCW.js";
|
|
5
|
-
import "./logger-CbUVl62f.js";
|
|
6
|
-
import "./model-selection-CMEj8bpy.js";
|
|
7
|
-
import "./github-copilot-token-8N63GdbE.js";
|
|
8
|
-
import "./boolean-C7Ct_klp.js";
|
|
9
|
-
import "./env-lw2hsIUY.js";
|
|
10
|
-
import "./frontmatter-C_obXuTp.js";
|
|
11
|
-
import "./send-BKO1-P1t.js";
|
|
12
|
-
import "./send-4rRrSKp9.js";
|
|
13
|
-
import "./pi-embedded-CHNPEUAv.js";
|
|
14
|
-
import "./tokens-6ul2IrzG.js";
|
|
15
|
-
import "./deliver-B6eTtXSk.js";
|
|
16
|
-
import "./diagnostic-BZmAxdu9.js";
|
|
17
|
-
import "./send-V1MRV7QF.js";
|
|
18
|
-
import "./pi-model-discovery-D-r5y7kV.js";
|
|
19
|
-
import "./image-Bt49ybRv.js";
|
|
20
|
-
import "./audio-transcription-runner-CQU4Eg1M.js";
|
|
21
|
-
import "./fetch-CMLoICyN.js";
|
|
22
|
-
import "./fetch-guard-DCj3k042.js";
|
|
23
|
-
import "./api-key-rotation-Dg3JlNDQ.js";
|
|
24
|
-
import "./proxy-fetch-BOh1PLOW.js";
|
|
25
|
-
import "./ir-CVtBjUiL.js";
|
|
26
|
-
import "./render-IRnn-2gt.js";
|
|
27
|
-
import "./target-errors-CeBF8Pws.js";
|
|
28
|
-
import "./commands-registry-CyLMCPuP.js";
|
|
29
|
-
import "./skill-commands-B55LOaMB.js";
|
|
30
|
-
import "./fetch-CeWULXBI.js";
|
|
31
|
-
import "./channel-activity-dT3cYb0e.js";
|
|
32
|
-
import "./tables-BAGqh2XD.js";
|
|
33
|
-
import "./send-EDBPXjTT.js";
|
|
34
|
-
import "./outbound-attachment-CVJwpypG.js";
|
|
35
|
-
import "./send-K2mAG7KC.js";
|
|
36
|
-
import "./fetch-C0iyt-Iz.js";
|
|
37
|
-
import "./manager-DSfEj66R.js";
|
|
38
|
-
import "./query-expansion-BErUY8P2.js";
|
|
39
|
-
import { t as sendMessageWhatsApp } from "./outbound-BxIJyMzV.js";
|
|
40
|
-
import "./session-CuVCho2m.js";
|
|
41
|
-
import "./login-D0fUoX-p.js";
|
|
42
|
-
import "./web-BRSmQdtm.js";
|
|
43
|
-
export { sendMessageWhatsApp };
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Ft as DEFAULT_ACCOUNT_ID } from "./paths-BtVqCdw4.js";
|
|
2
|
-
import { Ul as formatCliCommand } from "./config-B9ODwgpz.js";
|
|
3
|
-
//#region src/web/active-listener.ts
|
|
4
|
-
const listeners = /* @__PURE__ */ new Map();
|
|
5
|
-
function resolveWebAccountId(accountId) {
|
|
6
|
-
return (accountId ?? "").trim() || "default";
|
|
7
|
-
}
|
|
8
|
-
function requireActiveWebListener(accountId) {
|
|
9
|
-
const id = resolveWebAccountId(accountId);
|
|
10
|
-
const listener = listeners.get(id) ?? null;
|
|
11
|
-
if (!listener) throw new Error(`No active WhatsApp Web listener (account: ${id}). Start the gateway, then link WhatsApp with: ${formatCliCommand(`openclaw channels login --channel whatsapp --account ${id}`)}.`);
|
|
12
|
-
return {
|
|
13
|
-
accountId: id,
|
|
14
|
-
listener
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
function setActiveWebListener(accountIdOrListener, maybeListener) {
|
|
18
|
-
const { accountId, listener } = typeof accountIdOrListener === "string" ? {
|
|
19
|
-
accountId: accountIdOrListener,
|
|
20
|
-
listener: maybeListener ?? null
|
|
21
|
-
} : {
|
|
22
|
-
accountId: DEFAULT_ACCOUNT_ID,
|
|
23
|
-
listener: accountIdOrListener ?? null
|
|
24
|
-
};
|
|
25
|
-
const id = resolveWebAccountId(accountId);
|
|
26
|
-
if (!listener) listeners.delete(id);
|
|
27
|
-
else listeners.set(id, listener);
|
|
28
|
-
if (id === "default") {}
|
|
29
|
-
}
|
|
30
|
-
function getActiveWebListener(accountId) {
|
|
31
|
-
const id = resolveWebAccountId(accountId);
|
|
32
|
-
return listeners.get(id) ?? null;
|
|
33
|
-
}
|
|
34
|
-
//#endregion
|
|
35
|
-
export { requireActiveWebListener as n, setActiveWebListener as r, getActiveWebListener as t };
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import { Hs as formatErrorMessage, Vt as normalizeProviderId } from "./config-B9ODwgpz.js";
|
|
2
|
-
//#region src/infra/gemini-auth.ts
|
|
3
|
-
/**
|
|
4
|
-
* Shared Gemini authentication utilities.
|
|
5
|
-
*
|
|
6
|
-
* Supports both traditional API keys and OAuth JSON format.
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Parse Gemini API key and return appropriate auth headers.
|
|
10
|
-
*
|
|
11
|
-
* OAuth format: `{"token": "...", "projectId": "..."}`
|
|
12
|
-
*
|
|
13
|
-
* @param apiKey - Either a traditional API key string or OAuth JSON
|
|
14
|
-
* @returns Headers object with appropriate authentication
|
|
15
|
-
*/
|
|
16
|
-
function parseGeminiAuth(apiKey) {
|
|
17
|
-
if (apiKey.startsWith("{")) try {
|
|
18
|
-
const parsed = JSON.parse(apiKey);
|
|
19
|
-
if (typeof parsed.token === "string" && parsed.token) return { headers: {
|
|
20
|
-
Authorization: `Bearer ${parsed.token}`,
|
|
21
|
-
"Content-Type": "application/json"
|
|
22
|
-
} };
|
|
23
|
-
} catch {}
|
|
24
|
-
return { headers: {
|
|
25
|
-
"x-goog-api-key": apiKey,
|
|
26
|
-
"Content-Type": "application/json"
|
|
27
|
-
} };
|
|
28
|
-
}
|
|
29
|
-
//#endregion
|
|
30
|
-
//#region src/agents/live-auth-keys.ts
|
|
31
|
-
const KEY_SPLIT_RE = /[\s,;]+/g;
|
|
32
|
-
const GOOGLE_LIVE_SINGLE_KEY = "OPENCLAW_LIVE_GEMINI_KEY";
|
|
33
|
-
const PROVIDER_PREFIX_OVERRIDES = {
|
|
34
|
-
google: "GEMINI",
|
|
35
|
-
"google-vertex": "GEMINI"
|
|
36
|
-
};
|
|
37
|
-
const PROVIDER_API_KEY_CONFIG = {
|
|
38
|
-
anthropic: {
|
|
39
|
-
liveSingle: "OPENCLAW_LIVE_ANTHROPIC_KEY",
|
|
40
|
-
listVar: "OPENCLAW_LIVE_ANTHROPIC_KEYS",
|
|
41
|
-
primaryVar: "ANTHROPIC_API_KEY",
|
|
42
|
-
prefixedVar: "ANTHROPIC_API_KEY_"
|
|
43
|
-
},
|
|
44
|
-
google: {
|
|
45
|
-
liveSingle: GOOGLE_LIVE_SINGLE_KEY,
|
|
46
|
-
listVar: "GEMINI_API_KEYS",
|
|
47
|
-
primaryVar: "GEMINI_API_KEY",
|
|
48
|
-
prefixedVar: "GEMINI_API_KEY_"
|
|
49
|
-
},
|
|
50
|
-
"google-vertex": {
|
|
51
|
-
liveSingle: GOOGLE_LIVE_SINGLE_KEY,
|
|
52
|
-
listVar: "GEMINI_API_KEYS",
|
|
53
|
-
primaryVar: "GEMINI_API_KEY",
|
|
54
|
-
prefixedVar: "GEMINI_API_KEY_"
|
|
55
|
-
},
|
|
56
|
-
openai: {
|
|
57
|
-
liveSingle: "OPENCLAW_LIVE_OPENAI_KEY",
|
|
58
|
-
listVar: "OPENAI_API_KEYS",
|
|
59
|
-
primaryVar: "OPENAI_API_KEY",
|
|
60
|
-
prefixedVar: "OPENAI_API_KEY_"
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
function parseKeyList(raw) {
|
|
64
|
-
if (!raw) return [];
|
|
65
|
-
return raw.split(KEY_SPLIT_RE).map((value) => value.trim()).filter(Boolean);
|
|
66
|
-
}
|
|
67
|
-
function collectEnvPrefixedKeys(prefix) {
|
|
68
|
-
const keys = [];
|
|
69
|
-
for (const [name, value] of Object.entries(process.env)) {
|
|
70
|
-
if (!name.startsWith(prefix)) continue;
|
|
71
|
-
const trimmed = value?.trim();
|
|
72
|
-
if (!trimmed) continue;
|
|
73
|
-
keys.push(trimmed);
|
|
74
|
-
}
|
|
75
|
-
return keys;
|
|
76
|
-
}
|
|
77
|
-
function resolveProviderApiKeyConfig(provider) {
|
|
78
|
-
const normalized = normalizeProviderId(provider);
|
|
79
|
-
const custom = PROVIDER_API_KEY_CONFIG[normalized];
|
|
80
|
-
const base = PROVIDER_PREFIX_OVERRIDES[normalized] ?? normalized.toUpperCase().replace(/-/g, "_");
|
|
81
|
-
const liveSingle = custom?.liveSingle ?? `OPENCLAW_LIVE_${base}_KEY`;
|
|
82
|
-
const listVar = custom?.listVar ?? `${base}_API_KEYS`;
|
|
83
|
-
const primaryVar = custom?.primaryVar ?? `${base}_API_KEY`;
|
|
84
|
-
const prefixedVar = custom?.prefixedVar ?? `${base}_API_KEY_`;
|
|
85
|
-
if (normalized === "google" || normalized === "google-vertex") return {
|
|
86
|
-
liveSingle,
|
|
87
|
-
listVar,
|
|
88
|
-
primaryVar,
|
|
89
|
-
prefixedVar,
|
|
90
|
-
fallbackVars: ["GOOGLE_API_KEY"]
|
|
91
|
-
};
|
|
92
|
-
return {
|
|
93
|
-
liveSingle,
|
|
94
|
-
listVar,
|
|
95
|
-
primaryVar,
|
|
96
|
-
prefixedVar,
|
|
97
|
-
fallbackVars: []
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
function collectProviderApiKeys(provider) {
|
|
101
|
-
const config = resolveProviderApiKeyConfig(provider);
|
|
102
|
-
const forcedSingle = config.liveSingle ? process.env[config.liveSingle]?.trim() : void 0;
|
|
103
|
-
if (forcedSingle) return [forcedSingle];
|
|
104
|
-
const fromList = parseKeyList(config.listVar ? process.env[config.listVar] : void 0);
|
|
105
|
-
const primary = config.primaryVar ? process.env[config.primaryVar]?.trim() : void 0;
|
|
106
|
-
const fromPrefixed = config.prefixedVar ? collectEnvPrefixedKeys(config.prefixedVar) : [];
|
|
107
|
-
const fallback = config.fallbackVars.map((envVar) => process.env[envVar]?.trim()).filter(Boolean);
|
|
108
|
-
const seen = /* @__PURE__ */ new Set();
|
|
109
|
-
const add = (value) => {
|
|
110
|
-
if (!value) return;
|
|
111
|
-
if (seen.has(value)) return;
|
|
112
|
-
seen.add(value);
|
|
113
|
-
};
|
|
114
|
-
for (const value of fromList) add(value);
|
|
115
|
-
add(primary);
|
|
116
|
-
for (const value of fromPrefixed) add(value);
|
|
117
|
-
for (const value of fallback) add(value);
|
|
118
|
-
return Array.from(seen);
|
|
119
|
-
}
|
|
120
|
-
function isApiKeyRateLimitError(message) {
|
|
121
|
-
const lower = message.toLowerCase();
|
|
122
|
-
if (lower.includes("rate_limit")) return true;
|
|
123
|
-
if (lower.includes("rate limit")) return true;
|
|
124
|
-
if (lower.includes("429")) return true;
|
|
125
|
-
if (lower.includes("quota exceeded") || lower.includes("quota_exceeded")) return true;
|
|
126
|
-
if (lower.includes("resource exhausted") || lower.includes("resource_exhausted")) return true;
|
|
127
|
-
if (lower.includes("too many requests")) return true;
|
|
128
|
-
return false;
|
|
129
|
-
}
|
|
130
|
-
//#endregion
|
|
131
|
-
//#region src/agents/api-key-rotation.ts
|
|
132
|
-
function dedupeApiKeys(raw) {
|
|
133
|
-
const seen = /* @__PURE__ */ new Set();
|
|
134
|
-
const keys = [];
|
|
135
|
-
for (const value of raw) {
|
|
136
|
-
const apiKey = value.trim();
|
|
137
|
-
if (!apiKey || seen.has(apiKey)) continue;
|
|
138
|
-
seen.add(apiKey);
|
|
139
|
-
keys.push(apiKey);
|
|
140
|
-
}
|
|
141
|
-
return keys;
|
|
142
|
-
}
|
|
143
|
-
function collectProviderApiKeysForExecution(params) {
|
|
144
|
-
const { primaryApiKey, provider } = params;
|
|
145
|
-
return dedupeApiKeys([primaryApiKey?.trim() ?? "", ...collectProviderApiKeys(provider)]);
|
|
146
|
-
}
|
|
147
|
-
async function executeWithApiKeyRotation(params) {
|
|
148
|
-
const keys = dedupeApiKeys(params.apiKeys);
|
|
149
|
-
if (keys.length === 0) throw new Error(`No API keys configured for provider "${params.provider}".`);
|
|
150
|
-
let lastError;
|
|
151
|
-
for (let attempt = 0; attempt < keys.length; attempt += 1) {
|
|
152
|
-
const apiKey = keys[attempt];
|
|
153
|
-
try {
|
|
154
|
-
return await params.execute(apiKey);
|
|
155
|
-
} catch (error) {
|
|
156
|
-
lastError = error;
|
|
157
|
-
const message = formatErrorMessage(error);
|
|
158
|
-
if (!(params.shouldRetry ? params.shouldRetry({
|
|
159
|
-
apiKey,
|
|
160
|
-
error,
|
|
161
|
-
attempt,
|
|
162
|
-
message
|
|
163
|
-
}) : isApiKeyRateLimitError(message)) || attempt + 1 >= keys.length) break;
|
|
164
|
-
params.onRetry?.({
|
|
165
|
-
apiKey,
|
|
166
|
-
error,
|
|
167
|
-
attempt,
|
|
168
|
-
message
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
if (lastError === void 0) throw new Error(`Failed to run API request for ${params.provider}.`);
|
|
173
|
-
throw lastError;
|
|
174
|
-
}
|
|
175
|
-
//#endregion
|
|
176
|
-
export { executeWithApiKeyRotation as n, parseGeminiAuth as r, collectProviderApiKeysForExecution as t };
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import "./paths-BtVqCdw4.js";
|
|
2
|
-
import "./config-B9ODwgpz.js";
|
|
3
|
-
import "./paths-eFexkPEh.js";
|
|
4
|
-
import "./github-copilot-token-Cxf8QYZb.js";
|
|
5
|
-
import { B as shouldLogVerbose, R as logVerbose } from "./logger-D6zRubj0.js";
|
|
6
|
-
import "./env-b9k1PHMI.js";
|
|
7
|
-
import "./fetch-guard-4UVSZ0uS.js";
|
|
8
|
-
import "./local-roots-adnEg9zb.js";
|
|
9
|
-
import { i as normalizeMediaAttachments, m as isAudioAttachment, o as resolveMediaAttachmentLocalRoots, t as runAudioTranscription } from "./audio-transcription-runner-CTIHpebA.js";
|
|
10
|
-
import "./image-Ch6M4tnJ.js";
|
|
11
|
-
import "./api-key-rotation-CimGYMBc.js";
|
|
12
|
-
import "./proxy-fetch-CJEmoBxi.js";
|
|
13
|
-
//#region src/media-understanding/audio-preflight.ts
|
|
14
|
-
/**
|
|
15
|
-
* Transcribes the first audio attachment BEFORE mention checking.
|
|
16
|
-
* This allows voice notes to be processed in group chats with requireMention: true.
|
|
17
|
-
* Returns the transcript or undefined if transcription fails or no audio is found.
|
|
18
|
-
*/
|
|
19
|
-
async function transcribeFirstAudio(params) {
|
|
20
|
-
const { ctx, cfg } = params;
|
|
21
|
-
const audioConfig = cfg.tools?.media?.audio;
|
|
22
|
-
if (!audioConfig || audioConfig.enabled === false) return;
|
|
23
|
-
const attachments = normalizeMediaAttachments(ctx);
|
|
24
|
-
if (!attachments || attachments.length === 0) return;
|
|
25
|
-
const firstAudio = attachments.find((att) => att && isAudioAttachment(att) && !att.alreadyTranscribed);
|
|
26
|
-
if (!firstAudio) return;
|
|
27
|
-
if (shouldLogVerbose()) logVerbose(`audio-preflight: transcribing attachment ${firstAudio.index} for mention check`);
|
|
28
|
-
try {
|
|
29
|
-
const { transcript } = await runAudioTranscription({
|
|
30
|
-
ctx,
|
|
31
|
-
cfg,
|
|
32
|
-
attachments,
|
|
33
|
-
agentDir: params.agentDir,
|
|
34
|
-
providers: params.providers,
|
|
35
|
-
activeModel: params.activeModel,
|
|
36
|
-
localPathRoots: resolveMediaAttachmentLocalRoots({
|
|
37
|
-
cfg,
|
|
38
|
-
ctx
|
|
39
|
-
})
|
|
40
|
-
});
|
|
41
|
-
if (!transcript) return;
|
|
42
|
-
firstAudio.alreadyTranscribed = true;
|
|
43
|
-
if (shouldLogVerbose()) logVerbose(`audio-preflight: transcribed ${transcript.length} chars from attachment ${firstAudio.index}`);
|
|
44
|
-
return transcript;
|
|
45
|
-
} catch (err) {
|
|
46
|
-
if (shouldLogVerbose()) logVerbose(`audio-preflight: transcription failed: ${String(err)}`);
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
//#endregion
|
|
51
|
-
export { transcribeFirstAudio };
|