fix(test): restore doctor and acpx type guards

This commit is contained in:
Peter Steinberger
2026-04-07 00:32:59 +01:00
parent 1f6e303e41
commit 1ce9ab36df
2 changed files with 58 additions and 0 deletions

56
extensions/acpx/src/acpx-runtime.d.ts vendored Normal file
View File

@@ -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<AcpSessionRecord | undefined>;
save: (record: AcpSessionRecord) => Promise<void>;
};
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<void>;
doctor(): Promise<AcpRuntimeDoctorReport>;
ensureSession(input: unknown): Promise<AcpRuntimeHandle>;
runTurn(input: unknown): AsyncIterable<AcpRuntimeEvent>;
getCapabilities(input?: { handle?: AcpRuntimeHandle }): AcpRuntimeCapabilities;
getStatus(input: unknown): Promise<AcpRuntimeStatus>;
setMode(input: unknown): Promise<void>;
setConfigOption(input: unknown): Promise<void>;
cancel(input: unknown): Promise<void>;
close(input: unknown): Promise<void>;
}
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;
}

View File

@@ -2,6 +2,8 @@ import { isRecord } from "../../../utils.js";
type JsonRecord = Record<string, unknown>;
import { isRecord } from "../../../utils.js";
export type { JsonRecord };
export { isRecord };