chore: Fix TypeScript errors 2/n.

This commit is contained in:
cpojer
2026-01-31 16:42:40 +09:00
parent e5eb9610dc
commit 952b0f8c48
8 changed files with 21 additions and 19 deletions

View File

@@ -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,

View File

@@ -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,

View File

@@ -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 },
});

View File

@@ -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 },
});

View File

@@ -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,