mirror of
https://github.com/MoonshotAI/kimi-code.git
synced 2026-07-09 17:29:12 +00:00
chore(lint): fix type-aware lint errors
This commit is contained in:
parent
14346b1d93
commit
8d2cfd1a10
9 changed files with 13 additions and 18 deletions
|
|
@ -59,7 +59,6 @@ import {
|
|||
type HeadlessGoalCreate,
|
||||
} from '../goal-prompt';
|
||||
import {
|
||||
type PromptProcess,
|
||||
type PromptRunIO,
|
||||
configuredModel,
|
||||
installPromptTerminationCleanup,
|
||||
|
|
@ -404,7 +403,7 @@ async function runNativeGoal(
|
|||
await runNativeTurn(app, session, agent, goal.objective, outputFormat, stdout, stderr);
|
||||
} finally {
|
||||
subscription.dispose();
|
||||
const snapshot = completedSnapshot ?? (await goalService.getGoal()).goal;
|
||||
const snapshot = completedSnapshot ?? goalService.getGoal().goal;
|
||||
if (outputFormat === 'stream-json') {
|
||||
stdout.write(`${JSON.stringify(goalSummaryJson(snapshot))}\n`);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import type {
|
|||
BeginOptions,
|
||||
} from './activity';
|
||||
import { IAgentActivityService, ISessionActivityKernel } from './activity';
|
||||
import { type LaneLastTurnState, LaneModel, setLane } from './activityOps';
|
||||
import { type LaneLastTurnState, setLane } from './activityOps';
|
||||
|
||||
let nextBackgroundId = 0;
|
||||
|
||||
|
|
@ -116,7 +116,7 @@ export class AgentActivityService extends Disposable implements IAgentActivitySe
|
|||
|
||||
begin(kind: 'turn', opts?: BeginOptions): ActivityLease {
|
||||
if (kind !== 'turn') {
|
||||
throw new KimiError(ErrorCodes.NOT_IMPLEMENTED, `Unsupported activity kind: ${kind}`);
|
||||
throw new KimiError(ErrorCodes.NOT_IMPLEMENTED, `Unsupported activity kind: ${String(kind)}`);
|
||||
}
|
||||
switch (this._lane) {
|
||||
case 'turn':
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
import {
|
||||
spawn,
|
||||
type ChildProcessWithoutNullStreams,
|
||||
type SpawnOptionsWithoutStdio,
|
||||
} from 'node:child_process';
|
||||
import { type SpawnOptionsWithoutStdio } from 'node:child_process';
|
||||
|
||||
import { z } from 'zod';
|
||||
|
||||
|
|
@ -127,12 +123,12 @@ export async function runHook(
|
|||
);
|
||||
|
||||
const timeout = setTimeout(() => {
|
||||
void killProcess(proc);
|
||||
killProcess(proc);
|
||||
settle(allowResult({ stdout, stderr, timedOut: true }));
|
||||
}, timeoutMs);
|
||||
|
||||
const onAbort = (): void => {
|
||||
void killProcess(proc);
|
||||
killProcess(proc);
|
||||
settle(allowResult({ stdout, stderr }));
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ export const TurnModel = defineModel<TurnModelState>('turn', () => ({ nextTurnId
|
|||
reducers: {
|
||||
'context.append_loop_event': (s, p: { event?: { turnId?: unknown } }): TurnModelState => {
|
||||
const raw = p?.event?.turnId;
|
||||
if (raw === undefined) return s;
|
||||
if (typeof raw !== 'string' && typeof raw !== 'number') return s;
|
||||
const turnId = Number.parseInt(String(raw), 10);
|
||||
if (Number.isInteger(turnId) && turnId >= s.nextTurnId) {
|
||||
return { nextTurnId: turnId + 1 };
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import { IAgentWireService } from '#/wire/tokens';
|
|||
import type { IWireService } from '#/wire/wireService';
|
||||
import type { Turn, TurnPromptInfo, TurnResult } from './turn';
|
||||
import { IAgentTurnService } from './turn';
|
||||
import { cancelTurn, promptTurn, steerTurn, TurnModel } from './turnOps';
|
||||
import { cancelTurn, promptTurn, steerTurn } from './turnOps';
|
||||
|
||||
declare module '#/app/event/eventBus' {
|
||||
interface DomainEventMap {
|
||||
|
|
|
|||
|
|
@ -319,7 +319,7 @@ export function resolveOutboundHeaders(
|
|||
hostHeaders: Readonly<Record<string, string>>,
|
||||
): Readonly<Record<string, string>> {
|
||||
const hostLayer = providerType === 'kimi' ? hostHeaders : userAgentOnly(hostHeaders);
|
||||
return { ...parseKimiCodeCustomHeaders(), ...hostLayer, ...(customHeaders ?? {}) };
|
||||
return { ...parseKimiCodeCustomHeaders(), ...hostLayer, ...customHeaders };
|
||||
}
|
||||
|
||||
function userAgentOnly(headers: Readonly<Record<string, string>>): Record<string, string> {
|
||||
|
|
|
|||
|
|
@ -236,9 +236,9 @@ export class SessionLifecycleService extends Disposable implements ISessionLifec
|
|||
const contextAfter = contextMemory.get();
|
||||
console.log(
|
||||
`[doResume] session=${sessionId} wireRecords=${records.length}` +
|
||||
` contextRecordTypes=[${records.filter((r) => r.type.startsWith('context.')).map((r) => r.type)}]` +
|
||||
` contextRecordTypes=[${records.filter((r) => r.type.startsWith('context.')).map((r) => r.type).join(',')}]` +
|
||||
` contextAfterReplay=${contextAfter.length}` +
|
||||
` roles=[${contextAfter.map((m) => `${m.role}:${m.origin?.kind ?? 'none'}`)}]`,
|
||||
` roles=[${contextAfter.map((m) => `${m.role}:${m.origin?.kind ?? 'none'}`).join(',')}]`,
|
||||
);
|
||||
}
|
||||
await this.announceCreated({ sessionId, handle, source: 'resume' });
|
||||
|
|
|
|||
|
|
@ -538,7 +538,7 @@ export class SessionFsService implements ISessionFsService {
|
|||
} finally {
|
||||
signal.removeEventListener('abort', onAbort);
|
||||
try {
|
||||
proc.dispose();
|
||||
void proc.dispose();
|
||||
} catch {
|
||||
/* best-effort cleanup */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1013,7 +1013,7 @@ describe('SessionSwarmService metadata compatibility', () => {
|
|||
[IAgentUserToolService, parentUserTools],
|
||||
])),
|
||||
);
|
||||
createAgent.mockImplementationOnce(async (opts: CreateAgentOptions = {}) => {
|
||||
createAgent.mockImplementationOnce((opts: CreateAgentOptions = {}) => {
|
||||
const id = opts.agentId ?? 'agent-new';
|
||||
const handle = agentHandle(
|
||||
id,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue