mirror of https://github.com/openclaw/openclaw.git
chore: Fix TypeScript errors 2/n.
This commit is contained in:
parent
e5eb9610dc
commit
952b0f8c48
|
|
@ -2,7 +2,7 @@ import fs from "node:fs/promises";
|
|||
import os from "node:os";
|
||||
|
||||
import type { AgentMessage } from "@mariozechner/pi-agent-core";
|
||||
import type { AssistantMessage, ImageContent } from "@mariozechner/pi-ai";
|
||||
import type { ImageContent } from "@mariozechner/pi-ai";
|
||||
import { streamSimple } from "@mariozechner/pi-ai";
|
||||
import {
|
||||
createAgentSession,
|
||||
|
|
@ -869,7 +869,7 @@ export async function runEmbeddedAttempt(
|
|||
const lastAssistant = messagesSnapshot
|
||||
.slice()
|
||||
.toReversed()
|
||||
.find((m) => m?.role === "assistant") as AssistantMessage | undefined;
|
||||
.find((m) => m?.role === "assistant");
|
||||
|
||||
const toolMetasNormalized = toolMetas
|
||||
.filter(
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import { getChannelPlugin, normalizeChannelId } from "../../channels/plugins/ind
|
|||
import { callGateway } from "../../gateway/call.js";
|
||||
import type { AnnounceTarget } from "./sessions-send-helpers.js";
|
||||
import { resolveAnnounceTargetFromKey } from "./sessions-send-helpers.js";
|
||||
import { SessionListRow } from "./sessions-helpers.js";
|
||||
|
||||
export async function resolveAnnounceTarget(params: {
|
||||
sessionKey: string;
|
||||
|
|
@ -20,7 +21,7 @@ export async function resolveAnnounceTarget(params: {
|
|||
}
|
||||
|
||||
try {
|
||||
const list = await callGateway({
|
||||
const list = await callGateway<{ sessions: Array<SessionListRow> }>({
|
||||
method: "sessions.list",
|
||||
params: {
|
||||
includeGlobal: true,
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ async function resolveSessionKeyFromSessionId(params: {
|
|||
}): Promise<SessionReferenceResolution> {
|
||||
try {
|
||||
// Resolve via gateway so we respect store routing and visibility rules.
|
||||
const result = await callGateway({
|
||||
const result = await callGateway<{ key?: string }>({
|
||||
method: "sessions.resolve",
|
||||
params: {
|
||||
sessionId: params.sessionId,
|
||||
|
|
@ -220,7 +220,7 @@ async function resolveSessionKeyFromKey(params: {
|
|||
}): Promise<SessionReferenceResolution | null> {
|
||||
try {
|
||||
// Try key-based resolution first so non-standard keys keep working.
|
||||
const result = await callGateway({
|
||||
const result = await callGateway<{ key?: string }>({
|
||||
method: "sessions.resolve",
|
||||
params: {
|
||||
key: params.key,
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import {
|
|||
resolveSessionReference,
|
||||
resolveMainSessionAlias,
|
||||
resolveInternalSessionKey,
|
||||
SessionListRow,
|
||||
stripToolMessages,
|
||||
} from "./sessions-helpers.js";
|
||||
|
||||
|
|
@ -28,7 +29,7 @@ async function isSpawnedSessionAllowed(params: {
|
|||
targetSessionKey: string;
|
||||
}): Promise<boolean> {
|
||||
try {
|
||||
const list = await callGateway({
|
||||
const list = await callGateway<{ sessions: Array<SessionListRow> }>({
|
||||
method: "sessions.list",
|
||||
params: {
|
||||
includeGlobal: false,
|
||||
|
|
@ -126,7 +127,7 @@ export function createSessionsHistoryTool(opts?: {
|
|||
? Math.max(1, Math.floor(params.limit))
|
||||
: undefined;
|
||||
const includeTools = Boolean(params.includeTools);
|
||||
const result = await callGateway({
|
||||
const result = await callGateway<{ messages: Array<unknown> }>({
|
||||
method: "chat.history",
|
||||
params: { sessionKey: resolvedKey, limit },
|
||||
});
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ export function createSessionsListTool(opts?: {
|
|||
: 0;
|
||||
const messageLimit = Math.min(messageLimitRaw, 20);
|
||||
|
||||
const list = await callGateway({
|
||||
const list = await callGateway<{ sessions: Array<SessionListRow>; path: string }>({
|
||||
method: "sessions.list",
|
||||
params: {
|
||||
limit,
|
||||
|
|
@ -196,7 +196,7 @@ export function createSessionsListTool(opts?: {
|
|||
alias,
|
||||
mainKey,
|
||||
});
|
||||
const history = await callGateway({
|
||||
const history = await callGateway<{ messages: Array<unknown> }>({
|
||||
method: "chat.history",
|
||||
params: { sessionKey: resolvedKey, limit: messageLimit },
|
||||
});
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ export async function runSessionsSendA2AFlow(params: {
|
|||
let latestReply = params.roundOneReply;
|
||||
if (!primaryReply && params.waitRunId) {
|
||||
const waitMs = Math.min(params.announceTimeoutMs, 60_000);
|
||||
const wait = await callGateway({
|
||||
const wait = await callGateway<{ status: string }>({
|
||||
method: "agent.wait",
|
||||
params: {
|
||||
runId: params.waitRunId,
|
||||
|
|
|
|||
|
|
@ -338,7 +338,7 @@ export const handleSubagentsCommand: CommandHandler = async (params, allowTextCo
|
|||
reply: { text: `⚠️ ${resolved.error ?? "Unknown subagent."}` },
|
||||
};
|
||||
}
|
||||
const history = await callGateway({
|
||||
const history = await callGateway<{ messages: Array<unknown> }>({
|
||||
method: "chat.history",
|
||||
params: { sessionKey: resolved.entry.childSessionKey, limit },
|
||||
});
|
||||
|
|
@ -371,7 +371,7 @@ export const handleSubagentsCommand: CommandHandler = async (params, allowTextCo
|
|||
const idempotencyKey = crypto.randomUUID();
|
||||
let runId: string = idempotencyKey;
|
||||
try {
|
||||
const response = await callGateway({
|
||||
const response = await callGateway<{ runId: string }>({
|
||||
method: "agent",
|
||||
params: {
|
||||
message,
|
||||
|
|
@ -393,7 +393,7 @@ export const handleSubagentsCommand: CommandHandler = async (params, allowTextCo
|
|||
}
|
||||
|
||||
const waitMs = 30_000;
|
||||
const wait = await callGateway({
|
||||
const wait = await callGateway<{ status?: string; error?: string }>({
|
||||
method: "agent.wait",
|
||||
params: { runId, timeoutMs: waitMs },
|
||||
timeoutMs: waitMs + 2000,
|
||||
|
|
@ -413,7 +413,7 @@ export const handleSubagentsCommand: CommandHandler = async (params, allowTextCo
|
|||
};
|
||||
}
|
||||
|
||||
const history = await callGateway({
|
||||
const history = await callGateway<{ messages: Array<unknown> }>({
|
||||
method: "chat.history",
|
||||
params: { sessionKey: resolved.entry.childSessionKey, limit: 50 },
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { normalizeGatewayTokenInput, randomToken } from "../commands/onboard-helpers.js";
|
||||
import type { GatewayAuthChoice } from "../commands/onboard-types.js";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import type { GatewayBindMode, GatewayTailscaleMode, OpenClawConfig } from "../config/config.js";
|
||||
import { findTailscaleBinary } from "../infra/tailscale.js";
|
||||
import type { RuntimeEnv } from "../runtime.js";
|
||||
import type {
|
||||
|
|
@ -226,11 +226,11 @@ export async function configureGatewayForOnboarding(
|
|||
gateway: {
|
||||
...nextConfig.gateway,
|
||||
port,
|
||||
bind,
|
||||
bind: bind as GatewayBindMode,
|
||||
...(bind === "custom" && customBindHost ? { customBindHost } : {}),
|
||||
tailscale: {
|
||||
...nextConfig.gateway?.tailscale,
|
||||
mode: tailscaleMode,
|
||||
mode: tailscaleMode as GatewayTailscaleMode,
|
||||
resetOnExit: tailscaleResetOnExit,
|
||||
},
|
||||
},
|
||||
|
|
@ -240,11 +240,11 @@ export async function configureGatewayForOnboarding(
|
|||
nextConfig,
|
||||
settings: {
|
||||
port,
|
||||
bind,
|
||||
bind: bind as GatewayBindMode,
|
||||
customBindHost: bind === "custom" ? customBindHost : undefined,
|
||||
authMode,
|
||||
gatewayToken,
|
||||
tailscaleMode,
|
||||
tailscaleMode: tailscaleMode as GatewayTailscaleMode,
|
||||
tailscaleResetOnExit,
|
||||
},
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue