mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-03 23:40:21 +00:00
fix: restore main ci type checks
This commit is contained in:
@@ -23,9 +23,7 @@ export function resolveDiscordDraftStreamingChunking(
|
||||
const accountCfg = resolveAccountEntry(cfg?.channels?.discord?.accounts, normalizedAccountId);
|
||||
const draftCfg =
|
||||
resolveChannelStreamingPreviewChunk(accountCfg) ??
|
||||
resolveChannelStreamingPreviewChunk(cfg?.channels?.discord) ??
|
||||
accountCfg?.draftChunk ??
|
||||
cfg?.channels?.discord?.draftChunk;
|
||||
resolveChannelStreamingPreviewChunk(cfg?.channels?.discord);
|
||||
|
||||
const maxRequested = Math.max(
|
||||
1,
|
||||
|
||||
@@ -22,7 +22,17 @@ import { initializeMemoryWikiVault } from "./vault.js";
|
||||
|
||||
const READ_SCOPE = "operator.read" as const;
|
||||
const WRITE_SCOPE = "operator.write" as const;
|
||||
type GatewayMethodContext = Parameters<
|
||||
Parameters<OpenClawPluginApi["registerGatewayMethod"]>[1]
|
||||
>[0];
|
||||
type GatewayRespond = GatewayMethodContext["respond"];
|
||||
|
||||
function readStringParam(params: Record<string, unknown>, key: string): string | undefined;
|
||||
function readStringParam(
|
||||
params: Record<string, unknown>,
|
||||
key: string,
|
||||
options: { required: true },
|
||||
): string;
|
||||
function readStringParam(
|
||||
params: Record<string, unknown>,
|
||||
key: string,
|
||||
@@ -67,16 +77,9 @@ function readEnumParam<T extends string>(
|
||||
throw new Error(`${key} must be one of: ${allowed.join(", ")}.`);
|
||||
}
|
||||
|
||||
function respondError(
|
||||
respond: Parameters<OpenClawPluginApi["registerGatewayMethod"]>[1] extends (
|
||||
ctx: infer T,
|
||||
) => unknown
|
||||
? T["respond"]
|
||||
: never,
|
||||
error: unknown,
|
||||
) {
|
||||
function respondError(respond: GatewayRespond, error: unknown) {
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
respond(false, undefined, { message });
|
||||
respond(false, undefined, { code: "internal_error", message });
|
||||
}
|
||||
|
||||
async function syncImportedSourcesIfNeeded(
|
||||
|
||||
@@ -15,12 +15,13 @@ describe("runObsidianSearch", () => {
|
||||
{ homedir: "/Users/tester" },
|
||||
);
|
||||
const calls: Array<{ command: string; argv: string[] }> = [];
|
||||
const exec: NonNullable<
|
||||
NonNullable<Parameters<typeof runObsidianSearch>[0]["deps"]>["exec"]
|
||||
> = async (command, argv) => {
|
||||
calls.push({ command, argv: [...argv] });
|
||||
const execImpl = async (command: string, argv?: readonly string[] | null) => {
|
||||
calls.push({ command, argv: argv ? [...argv] : [] });
|
||||
return { stdout: "search output\n", stderr: "" };
|
||||
};
|
||||
const exec = execImpl as unknown as NonNullable<
|
||||
NonNullable<Parameters<typeof runObsidianSearch>[0]["deps"]>["exec"]
|
||||
>;
|
||||
|
||||
const result = await runObsidianSearch({
|
||||
config,
|
||||
|
||||
@@ -405,7 +405,7 @@ describe("dispatchTelegramMessage draft streaming", () => {
|
||||
|
||||
await dispatchWithContext({
|
||||
context: createContext(),
|
||||
telegramCfg: { blockStreaming: true },
|
||||
telegramCfg: { streaming: { block: { enabled: true } } },
|
||||
});
|
||||
|
||||
expect(createTelegramDraftStream).not.toHaveBeenCalled();
|
||||
@@ -655,7 +655,10 @@ describe("dispatchTelegramMessage draft streaming", () => {
|
||||
|
||||
it.each([
|
||||
{ label: "default account config", telegramCfg: {} },
|
||||
{ label: "account blockStreaming override", telegramCfg: { blockStreaming: true } },
|
||||
{
|
||||
label: "account blockStreaming override",
|
||||
telegramCfg: { streaming: { block: { enabled: true } } },
|
||||
},
|
||||
])("disables block streaming when streamMode is off ($label)", async ({ telegramCfg }) => {
|
||||
dispatchReplyWithBufferedBlockDispatcher.mockImplementation(async ({ dispatcherOptions }) => {
|
||||
await dispatcherOptions.deliver({ text: "Hello" }, { kind: "final" });
|
||||
|
||||
@@ -55,10 +55,14 @@ describe("resolveTelegramDraftStreamingChunking", () => {
|
||||
accounts: {
|
||||
default: {
|
||||
allowFrom: ["*"],
|
||||
draftChunk: {
|
||||
minChars: 10,
|
||||
maxChars: 20,
|
||||
breakPreference: "sentence",
|
||||
streaming: {
|
||||
preview: {
|
||||
chunk: {
|
||||
minChars: 10,
|
||||
maxChars: 20,
|
||||
breakPreference: "sentence",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -23,9 +23,7 @@ export function resolveTelegramDraftStreamingChunking(
|
||||
const accountCfg = resolveAccountEntry(cfg?.channels?.telegram?.accounts, normalizedAccountId);
|
||||
const draftCfg =
|
||||
resolveChannelStreamingPreviewChunk(accountCfg) ??
|
||||
resolveChannelStreamingPreviewChunk(cfg?.channels?.telegram) ??
|
||||
accountCfg?.draftChunk ??
|
||||
cfg?.channels?.telegram?.draftChunk;
|
||||
resolveChannelStreamingPreviewChunk(cfg?.channels?.telegram);
|
||||
|
||||
const maxRequested = Math.max(
|
||||
1,
|
||||
|
||||
Reference in New Issue
Block a user