mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-19 03:24:45 +00:00
fix: repair release validation type and lint gates
This commit is contained in:
@@ -19,10 +19,7 @@ import {
|
||||
import type { MessagePresentation } from "openclaw/plugin-sdk/interactive-runtime";
|
||||
import { createTelegramActionGate, resolveTelegramPollActionGateState } from "./accounts.js";
|
||||
import { resolveTelegramInlineButtons } from "./button-types.js";
|
||||
import {
|
||||
notifyTelegramInboundTurnOutboundSuccess,
|
||||
type TelegramInboundTurnDeliveryKind,
|
||||
} from "./inbound-turn-delivery.js";
|
||||
import { notifyTelegramInboundTurnOutboundSuccess } from "./inbound-turn-delivery.js";
|
||||
import {
|
||||
resolveTelegramInlineButtonsScope,
|
||||
resolveTelegramTargetChatType,
|
||||
@@ -243,7 +240,7 @@ export async function handleTelegramAction(
|
||||
mediaLocalRoots?: readonly string[];
|
||||
mediaReadFile?: (filePath: string) => Promise<Buffer>;
|
||||
sessionKey?: string | null;
|
||||
inboundTurnKind?: TelegramInboundTurnDeliveryKind | string;
|
||||
inboundTurnKind?: string;
|
||||
},
|
||||
): Promise<AgentToolResult<unknown>> {
|
||||
const { action, accountId } = {
|
||||
|
||||
@@ -41,7 +41,7 @@ function telegramDeliveryTargetsMatch(expected: string, actual: string): boolean
|
||||
|
||||
export function resolveTelegramInboundTurnDeliveryCorrelationKey(
|
||||
sessionKey: string | undefined,
|
||||
inboundTurnKind?: TelegramInboundTurnDeliveryKind | string,
|
||||
inboundTurnKind?: string,
|
||||
): string | undefined {
|
||||
const key = sessionKey?.trim();
|
||||
if (!key) {
|
||||
@@ -53,7 +53,7 @@ export function resolveTelegramInboundTurnDeliveryCorrelationKey(
|
||||
export function beginTelegramInboundTurnDeliveryCorrelation(
|
||||
sessionKey: string | undefined,
|
||||
turn: ActiveTurn,
|
||||
options?: { inboundTurnKind?: TelegramInboundTurnDeliveryKind | string },
|
||||
options?: { inboundTurnKind?: string },
|
||||
): TelegramInboundTurnDeliveryEnd {
|
||||
const key = resolveTelegramInboundTurnDeliveryCorrelationKey(
|
||||
sessionKey,
|
||||
@@ -74,7 +74,7 @@ export function notifyTelegramInboundTurnOutboundSuccess(params: {
|
||||
sessionKey: string | undefined;
|
||||
to: string;
|
||||
accountId?: string | null;
|
||||
inboundTurnKind?: TelegramInboundTurnDeliveryKind | string;
|
||||
inboundTurnKind?: string;
|
||||
}): void {
|
||||
const key = resolveTelegramInboundTurnDeliveryCorrelationKey(
|
||||
params.sessionKey,
|
||||
|
||||
@@ -81,7 +81,7 @@ const resolvePollingStallThresholdMs = (value: number | undefined): number => {
|
||||
|
||||
type TelegramPollingSessionOpts = {
|
||||
token: string;
|
||||
config: Parameters<typeof createTelegramBot>[0]["config"];
|
||||
config: NonNullable<Parameters<typeof createTelegramBot>[0]["config"]>;
|
||||
accountId: string;
|
||||
runtime: Parameters<typeof createTelegramBot>[0]["runtime"];
|
||||
proxyFetch: Parameters<typeof createTelegramBot>[0]["proxyFetch"];
|
||||
@@ -491,7 +491,7 @@ export class TelegramPollingSession {
|
||||
try {
|
||||
const drain = await this.#drainSpooledUpdates({ bot, spoolDir });
|
||||
consecutiveDrainFailures = 0;
|
||||
for (const handlerKey of [...stalledBacklogKeys]) {
|
||||
for (const handlerKey of stalledBacklogKeys) {
|
||||
if (
|
||||
!activeSpooledUpdateHandlersByLane.has(handlerKey) ||
|
||||
!drain.blockedByLane.has(handlerKey)
|
||||
|
||||
@@ -1,7 +1,24 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import type { ModelDefinitionConfig } from "../config/types.models.js";
|
||||
import type { OpenClawConfig } from "../config/types.openclaw.js";
|
||||
import { resolveModelRuntimePolicy } from "./model-runtime-policy.js";
|
||||
|
||||
const createModelConfig = (agentRuntimeId: string): ModelDefinitionConfig => ({
|
||||
id: "qwen-local",
|
||||
name: "Qwen Local",
|
||||
reasoning: false,
|
||||
input: ["text"],
|
||||
cost: {
|
||||
input: 0,
|
||||
output: 0,
|
||||
cacheRead: 0,
|
||||
cacheWrite: 0,
|
||||
},
|
||||
contextWindow: 32_768,
|
||||
maxTokens: 4096,
|
||||
agentRuntime: { id: agentRuntimeId },
|
||||
});
|
||||
|
||||
describe("resolveModelRuntimePolicy", () => {
|
||||
it("honors provider wildcard agent model runtime policy entries", () => {
|
||||
const config = {
|
||||
@@ -62,7 +79,8 @@ describe("resolveModelRuntimePolicy", () => {
|
||||
models: {
|
||||
providers: {
|
||||
vllm: {
|
||||
models: [{ id: "qwen-local", agentRuntime: { id: "codex" } }],
|
||||
baseUrl: "http://127.0.0.1:11434/v1",
|
||||
models: [createModelConfig("codex")],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -92,6 +110,7 @@ describe("resolveModelRuntimePolicy", () => {
|
||||
models: {
|
||||
providers: {
|
||||
vllm: {
|
||||
baseUrl: "http://127.0.0.1:11434/v1",
|
||||
agentRuntime: { id: "codex" },
|
||||
models: [],
|
||||
},
|
||||
|
||||
@@ -487,11 +487,13 @@ export function createFollowupRunner(params: {
|
||||
modelId: modelUsed,
|
||||
});
|
||||
} finally {
|
||||
for (const end of endDeliveryCorrelations.reverse()) {
|
||||
for (const end of endDeliveryCorrelations.toReversed()) {
|
||||
try {
|
||||
end();
|
||||
} catch (err) {
|
||||
defaultRuntime.error?.(`followup queue: delivery correlation cleanup failed: ${err}`);
|
||||
defaultRuntime.error?.(
|
||||
`followup queue: delivery correlation cleanup failed: ${formatErrorMessage(err)}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
completeFollowupRunLifecycle(queued);
|
||||
|
||||
@@ -20,6 +20,7 @@ export function createQueueTestRun(params: {
|
||||
originatingTo?: string;
|
||||
originatingAccountId?: string;
|
||||
originatingThreadId?: string | number;
|
||||
currentTurnKind?: FollowupRun["currentTurnKind"];
|
||||
}): FollowupRun {
|
||||
return {
|
||||
prompt: params.prompt,
|
||||
@@ -29,6 +30,7 @@ export function createQueueTestRun(params: {
|
||||
originatingTo: params.originatingTo,
|
||||
originatingAccountId: params.originatingAccountId,
|
||||
originatingThreadId: params.originatingThreadId,
|
||||
currentTurnKind: params.currentTurnKind,
|
||||
run: {
|
||||
agentId: "agent",
|
||||
agentDir: "/tmp",
|
||||
|
||||
@@ -267,7 +267,7 @@ async function dropAbortedFollowups(
|
||||
): Promise<number> {
|
||||
let dropped = 0;
|
||||
for (let index = items.length - 1; index >= 0; index -= 1) {
|
||||
const item = items[index]!;
|
||||
const item = items[index];
|
||||
if (isFollowupRunAborted(item)) {
|
||||
await runFollowup(item);
|
||||
completeFollowupRunLifecycle(item);
|
||||
|
||||
@@ -22,6 +22,7 @@ type ScopedToolsCall = {
|
||||
sessionKey?: string;
|
||||
accountId?: string;
|
||||
messageProvider?: string;
|
||||
inboundTurnKind?: string;
|
||||
senderIsOwner?: boolean;
|
||||
surface?: string;
|
||||
excludeToolNames?: Iterable<string>;
|
||||
|
||||
Reference in New Issue
Block a user