/**
 * Test adapter for the tiny runtime-valued SDK surface used by pi-goal-x.
 * The unbundled compatibility suite still imports the real package.
 */
export function defineTool<T>(definition: T): T {
	return definition;
}

export function createExtensionRuntime(): Record<string, never> {
	return {};
}

export const SessionManager = {
	inMemory: (cwd: string) => ({ cwd }),
};

export const SettingsManager = {
	inMemory: (settings: unknown) => ({ settings }),
	create: (cwd: string, agentDir: string) => ({ cwd, agentDir, fromDisk: true }),
};

export function getAgentDir(): string {
	return process.env.PI_CODING_AGENT_DIR ?? "/tmp/pi-agent-stub";
}

/** Records how it was built. The real loader runs in tests/e2e/child-session-resources-sdk.test.ts. */
export class DefaultResourceLoader {
	readonly options: Record<string, unknown>;
	reloaded = false;
	constructor(options: Record<string, unknown>) {
		this.options = options;
	}
	async reload(): Promise<void> {
		this.reloaded = true;
	}
	getSystemPrompt(): string | undefined {
		return this.options.systemPrompt as string | undefined;
	}
}

export async function createAgentSession(): Promise<never> {
	throw new Error("Real agent sessions are disabled in bundled tests; inject a session fixture.");
}
