refactor(lint): tighten channel and config defaults

This commit is contained in:
Vincent Koc
2026-04-06 17:04:37 +01:00
parent 5d0e8336ab
commit a797068206
7 changed files with 20 additions and 12 deletions

View File

@@ -227,7 +227,9 @@ export async function probeTlonAccount(account: ConfiguredTlonAccount) {
}
export async function startTlonGatewayAccount(
ctx: Parameters<NonNullable<NonNullable<ChannelPlugin["gateway"]>["startAccount"]>>[0],
ctx: Parameters<
NonNullable<NonNullable<ChannelPlugin<ResolvedTlonAccount>["gateway"]>["startAccount"]>
>[0],
) {
const account = ctx.account;
ctx.setStatus({

View File

@@ -8,6 +8,7 @@ import {
} from "./runtime-api.js";
import { normalizeSecretInputString } from "./secret-input.js";
import { sendMessageZalo } from "./send.js";
import type { ResolvedZaloAccount } from "./types.js";
export async function notifyZaloPairingApproval(params: { cfg: OpenClawConfig; id: string }) {
const { resolveZaloAccount } = await import("./accounts.js");
@@ -41,7 +42,9 @@ export async function probeZaloAccount(params: {
}
export async function startZaloGatewayAccount(
ctx: Parameters<NonNullable<NonNullable<ChannelPlugin["gateway"]>["startAccount"]>>[0],
ctx: Parameters<
NonNullable<NonNullable<ChannelPlugin<ResolvedZaloAccount>["gateway"]>["startAccount"]>
>[0],
) {
const account = ctx.account;
const token = account.token.trim();

View File

@@ -1,4 +1 @@
import type { AgentTool } from "@mariozechner/pi-agent-core";
// oxlint-disable-next-line typescript/no-explicit-any
export type AnyAgentTool = AgentTool<any, unknown>;
export type { AnyAgentTool } from "./tools/common.js";

View File

@@ -79,8 +79,11 @@ export type ChannelConfigSchema = {
/** Full capability contract for a native channel plugin. */
type ChannelPluginSetupWizard = ChannelSetupWizard | ChannelSetupWizardAdapter;
// oxlint-disable-next-line typescript/no-explicit-any
export type ChannelPlugin<ResolvedAccount = any, Probe = unknown, Audit = unknown> = {
export type ChannelPlugin<
ResolvedAccount = Record<string, unknown>,
Probe = unknown,
Audit = unknown,
> = {
id: ChannelId;
meta: ChannelMeta;
capabilities: ChannelCapabilities;

View File

@@ -50,6 +50,5 @@ export interface ChannelsConfig {
/** Map provider -> channel id -> model override. */
modelByChannel?: ChannelModelByChannelConfig;
/** Channel sections are plugin-owned; concrete channel files augment this interface. */
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any;
[key: string]: unknown;
}

View File

@@ -100,7 +100,7 @@ function normalizeBundledChannelConfigs(
continue;
}
next ??= { ...value };
next[channelId] = parsed.data as ChannelsConfig[string];
next[channelId] = parsed.data;
}
return next ?? value;

View File

@@ -35,7 +35,11 @@ export async function getRecentSessionContent(
try {
const entry = JSON.parse(line);
if (entry.type === "message" && entry.message) {
const msg = entry.message as AgentMessage & { content?: unknown };
const msg = entry.message as {
role?: unknown;
content?: unknown;
provenance?: unknown;
};
const role = msg.role;
if ((role === "user" || role === "assistant") && "content" in msg && msg.content) {
if (role === "user" && hasInterSessionUserProvenance(msg)) {