From 1ce9ab36dfce8a7caf951d262ca2c87b9a515d79 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Tue, 7 Apr 2026 00:32:59 +0100 Subject: [PATCH] fix(test): restore doctor and acpx type guards --- extensions/acpx/src/acpx-runtime.d.ts | 56 +++++++++++++++++++ .../shared/legacy-config-record-shared.ts | 2 + 2 files changed, 58 insertions(+) create mode 100644 extensions/acpx/src/acpx-runtime.d.ts diff --git a/extensions/acpx/src/acpx-runtime.d.ts b/extensions/acpx/src/acpx-runtime.d.ts new file mode 100644 index 00000000000..aff0bdfd66c --- /dev/null +++ b/extensions/acpx/src/acpx-runtime.d.ts @@ -0,0 +1,56 @@ +declare module "acpx/dist/runtime.js" { + import type { + AcpRuntimeCapabilities, + AcpRuntimeDoctorReport, + AcpRuntimeEvent, + AcpRuntimeHandle, + AcpRuntimeStatus, + } from "../../../src/acp/runtime/types.js"; + + export const ACPX_BACKEND_ID: string; + export type { AcpRuntimeDoctorReport, AcpRuntimeEvent, AcpRuntimeHandle, AcpRuntimeStatus }; + + export type AcpSessionRecord = { + name?: string; + [key: string]: unknown; + }; + + export type AcpSessionStore = { + load: (sessionId: string) => Promise; + save: (record: AcpSessionRecord) => Promise; + }; + + export type AcpAgentRegistry = { + resolve: (agentId: string) => string; + list: () => string[]; + }; + + export type AcpRuntimeOptions = { + cwd: string; + sessionStore: AcpSessionStore; + agentRegistry: AcpAgentRegistry; + permissionMode?: string; + [key: string]: unknown; + }; + + export class AcpxRuntime { + constructor(options: AcpRuntimeOptions, testOptions?: unknown); + isHealthy(): boolean; + probeAvailability(): Promise; + doctor(): Promise; + ensureSession(input: unknown): Promise; + runTurn(input: unknown): AsyncIterable; + getCapabilities(input?: { handle?: AcpRuntimeHandle }): AcpRuntimeCapabilities; + getStatus(input: unknown): Promise; + setMode(input: unknown): Promise; + setConfigOption(input: unknown): Promise; + cancel(input: unknown): Promise; + close(input: unknown): Promise; + } + + export function createAcpRuntime(...args: unknown[]): AcpxRuntime; + export function createAgentRegistry(...args: unknown[]): AcpAgentRegistry; + export function createFileSessionStore(...args: unknown[]): AcpSessionStore; + export function decodeAcpxRuntimeHandleState(...args: unknown[]): unknown; + export function encodeAcpxRuntimeHandleState(...args: unknown[]): unknown; +} diff --git a/src/commands/doctor/shared/legacy-config-record-shared.ts b/src/commands/doctor/shared/legacy-config-record-shared.ts index dd635c1ac9a..31121d263e4 100644 --- a/src/commands/doctor/shared/legacy-config-record-shared.ts +++ b/src/commands/doctor/shared/legacy-config-record-shared.ts @@ -2,6 +2,8 @@ import { isRecord } from "../../../utils.js"; type JsonRecord = Record; +import { isRecord } from "../../../utils.js"; + export type { JsonRecord }; export { isRecord };