mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 12:41:23 +00:00
chore: Fix TypeScript errors 2/n.
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user