refactor(extensions): remove unused helper facades · openclaw/openclaw@350aa7c
vincentkoc
·
2026-06-19
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -10,7 +10,6 @@ import {
|
10 | 10 | computeInteractionCallbackUrl, |
11 | 11 | createMattermostInteractionHandler, |
12 | 12 | generateInteractionToken, |
13 | | -getInteractionCallbackUrl, |
14 | 13 | getInteractionSecret, |
15 | 14 | resolveInteractionCallbackPath, |
16 | 15 | resolveInteractionCallbackUrl, |
@@ -197,21 +196,6 @@ describe("generateInteractionToken / verifyInteractionToken", () => {
|
197 | 196 | }); |
198 | 197 | }); |
199 | 198 | |
200 | | -// ── Callback URL registry ──────────────────────────────────────────── |
201 | | - |
202 | | -describe("callback URL registry", () => { |
203 | | -it("stores and retrieves callback URLs", () => { |
204 | | -setInteractionCallbackUrl("acct1", "http://localhost:18789/mattermost/interactions/acct1"); |
205 | | -expect(getInteractionCallbackUrl("acct1")).toBe( |
206 | | -"http://localhost:18789/mattermost/interactions/acct1", |
207 | | -); |
208 | | -}); |
209 | | - |
210 | | -it("returns undefined for unknown account", () => { |
211 | | -expect(getInteractionCallbackUrl("nonexistent-account-id")).toBeUndefined(); |
212 | | -}); |
213 | | -}); |
214 | | - |
215 | 199 | describe("resolveInteractionCallbackUrl", () => { |
216 | 200 | afterEach(() => { |
217 | 201 | for (const accountId of ["cached", "default", "acct", "myaccount"]) { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -66,10 +66,6 @@ export function setInteractionCallbackUrl(accountId: string, url: string): void
|
66 | 66 | callbackUrls.set(accountId, url); |
67 | 67 | } |
68 | 68 | |
69 | | -export function getInteractionCallbackUrl(accountId: string): string | undefined { |
70 | | -return callbackUrls.get(accountId); |
71 | | -} |
72 | | - |
73 | 69 | type InteractionCallbackConfig = Pick<OpenClawConfig, "gateway" | "channels"> & { |
74 | 70 | interactions?: { |
75 | 71 | callbackBaseUrl?: string; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -15,7 +15,6 @@ import type { ApiClient } from "./api-client.js";
|
15 | 15 | import { |
16 | 16 | ChunkedMediaApi, |
17 | 17 | UploadDailyLimitExceededError, |
18 | | -isChunkedUploadImplemented, |
19 | 18 | } from "./media-chunked.js"; |
20 | 19 | import type { UploadCacheAdapter } from "./media.js"; |
21 | 20 | import { UPLOAD_PREPARE_FALLBACK_CODE } from "./retry.js"; |
@@ -115,12 +114,6 @@ describe("media-chunked: UploadDailyLimitExceededError", () => {
|
115 | 114 | }); |
116 | 115 | }); |
117 | 116 | |
118 | | -describe("media-chunked: isChunkedUploadImplemented", () => { |
119 | | -it("returns true for the filled-in module", () => { |
120 | | -expect(isChunkedUploadImplemented()).toBe(true); |
121 | | -}); |
122 | | -}); |
123 | | - |
124 | 117 | describe("media-chunked: ChunkedMediaApi.uploadChunked", () => { |
125 | 118 | beforeEach(() => { |
126 | 119 | originalFetch = globalThis.fetch; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -411,19 +411,6 @@ export class ChunkedMediaApi {
|
411 | 411 | } |
412 | 412 | } |
413 | 413 | |
414 | | -// ============ Legacy functional facade ============ |
415 | | - |
416 | | -/** |
417 | | - * @deprecated The chunked uploader is always implemented. |
418 | | - * |
419 | | - * Legacy feature flag. The chunked uploader is fully implemented, so this |
420 | | - * returns `true`. Retained so that older call sites can be converted |
421 | | - * progressively. |
422 | | - */ |
423 | | -export function isChunkedUploadImplemented(): boolean { |
424 | | -return true; |
425 | | -} |
426 | | - |
427 | 414 | // ============ Source resolution ============ |
428 | 415 | |
429 | 416 | /** |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | // Whatsapp tests cover approval reactions plugin behavior. |
2 | 2 | import { beforeEach, describe, expect, it, vi } from "vitest"; |
3 | 3 | import { |
4 | | -buildWhatsAppApprovalReactionHint, |
5 | 4 | clearWhatsAppApprovalReactionTargetsForTest, |
6 | 5 | extractWhatsAppApprovalPromptBinding, |
7 | 6 | maybeResolveWhatsAppApprovalReaction, |
@@ -29,18 +28,6 @@ describe("WhatsApp approval reactions", () => {
|
29 | 28 | resolverMocks.isApprovalNotFoundError.mockReturnValue(false); |
30 | 29 | }); |
31 | 30 | |
32 | | -it("renders thumbs-only reaction choices for allowed decisions", () => { |
33 | | -expect(buildWhatsAppApprovalReactionHint(["allow-once", "deny"])).toBe( |
34 | | -"React with:\n\n👍 Allow Once\n👎 Deny", |
35 | | -); |
36 | | -}); |
37 | | - |
38 | | -it("exposes allow-always as a reaction choice when allowed", () => { |
39 | | -expect(buildWhatsAppApprovalReactionHint(["allow-once", "allow-always", "deny"])).toBe( |
40 | | -"React with:\n\n👍 Allow Once\n♾️ Allow Always\n👎 Deny", |
41 | | -); |
42 | | -}); |
43 | | - |
44 | 31 | it("registers reaction state when only allow-always is available", async () => { |
45 | 32 | expect( |
46 | 33 | registerWhatsAppApprovalReactionTarget({ |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | // Whatsapp plugin module implements approval reactions behavior. |
2 | 2 | import type { WAMessage } from "baileys"; |
3 | 3 | import { |
4 | | -buildApprovalReactionHint, |
5 | 4 | createApprovalReactionTargetStore, |
6 | 5 | listApprovalReactionBindings, |
7 | 6 | resolveApprovalReactionTarget, |
@@ -94,12 +93,6 @@ export function listWhatsAppApprovalReactionBindings(
|
94 | 93 | return listApprovalReactionBindings({ allowedDecisions }); |
95 | 94 | } |
96 | 95 | |
97 | | -export function buildWhatsAppApprovalReactionHint( |
98 | | -allowedDecisions: readonly ExecApprovalReplyDecision[], |
99 | | -): string | null { |
100 | | -return buildApprovalReactionHint({ allowedDecisions }); |
101 | | -} |
102 | | - |
103 | 96 | function normalizeApprovalDecision(value: string): ExecApprovalReplyDecision | null { |
104 | 97 | const normalized = value.trim().toLowerCase(); |
105 | 98 | if (normalized === "always") { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -4,7 +4,6 @@ import { afterEach, describe, expect, it, vi } from "vitest";
|
4 | 4 | import { |
5 | 5 | isXaiToolEnabled, |
6 | 6 | resolveFallbackXaiAuth, |
7 | | -resolveFallbackXaiApiKey, |
8 | 7 | resolveXaiToolApiKey, |
9 | 8 | resolveXaiToolApiKeyWithAuth, |
10 | 9 | } from "./tool-auth-shared.js"; |
@@ -16,7 +15,7 @@ describe("xai tool auth helpers", () => {
|
16 | 15 | |
17 | 16 | it("prefers plugin web search keys over legacy grok keys", () => { |
18 | 17 | expect( |
19 | | -resolveFallbackXaiApiKey({ |
| 18 | +resolveFallbackXaiAuth({ |
20 | 19 | plugins: { |
21 | 20 | entries: { |
22 | 21 | xai: { |
@@ -38,7 +37,10 @@ describe("xai tool auth helpers", () => {
|
38 | 37 | }, |
39 | 38 | }, |
40 | 39 | }), |
41 | | -).toBe("plugin-key"); |
| 40 | +).toEqual({ |
| 41 | +apiKey: "plugin-key", |
| 42 | +source: "plugins.entries.xai.config.webSearch.apiKey", |
| 43 | +}); |
42 | 44 | }); |
43 | 45 | |
44 | 46 | it("returns source metadata and managed markers for fallback auth", () => { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -157,18 +157,6 @@ export function resolveFallbackXaiAuth(cfg?: OpenClawConfig): XaiFallbackAuth |
|
157 | 157 | return readLegacyGrokFallbackAuth(cfg); |
158 | 158 | } |
159 | 159 | |
160 | | -export function resolveFallbackXaiApiKey(cfg?: OpenClawConfig): string | undefined { |
161 | | -const plugin = readPluginXaiWebSearchApiKeyResult(cfg); |
162 | | -if (plugin.status === "available") { |
163 | | -return plugin.value; |
164 | | -} |
165 | | -if (plugin.status === "blocked") { |
166 | | -return undefined; |
167 | | -} |
168 | | -const legacy = readLegacyGrokApiKeyResult(cfg); |
169 | | -return legacy.status === "available" ? legacy.value : undefined; |
170 | | -} |
171 | | - |
172 | 160 | export function resolveXaiToolApiKey(params: { |
173 | 161 | runtimeConfig?: OpenClawConfig; |
174 | 162 | sourceConfig?: OpenClawConfig; |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。