2026-02-18 13:53:03 -06:00
|
|
|
import type { ServerAdapterModule } from "./types.js";
|
2026-02-18 14:23:16 -06:00
|
|
|
import { execute as claudeExecute } from "@paperclip/adapter-claude-local/server";
|
|
|
|
|
import { models as claudeModels } from "@paperclip/adapter-claude-local";
|
|
|
|
|
import { execute as codexExecute } from "@paperclip/adapter-codex-local/server";
|
|
|
|
|
import { models as codexModels } from "@paperclip/adapter-codex-local";
|
2026-02-18 13:53:03 -06:00
|
|
|
import { processAdapter } from "./process/index.js";
|
|
|
|
|
import { httpAdapter } from "./http/index.js";
|
|
|
|
|
|
2026-02-18 14:23:16 -06:00
|
|
|
const claudeLocalAdapter: ServerAdapterModule = {
|
|
|
|
|
type: "claude_local",
|
|
|
|
|
execute: claudeExecute,
|
|
|
|
|
models: claudeModels,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const codexLocalAdapter: ServerAdapterModule = {
|
|
|
|
|
type: "codex_local",
|
|
|
|
|
execute: codexExecute,
|
|
|
|
|
models: codexModels,
|
|
|
|
|
};
|
|
|
|
|
|
2026-02-18 13:53:03 -06:00
|
|
|
const adaptersByType = new Map<string, ServerAdapterModule>(
|
|
|
|
|
[claudeLocalAdapter, codexLocalAdapter, processAdapter, httpAdapter].map((a) => [a.type, a]),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
export function getServerAdapter(type: string): ServerAdapterModule {
|
|
|
|
|
const adapter = adaptersByType.get(type);
|
|
|
|
|
if (!adapter) {
|
|
|
|
|
// Fall back to process adapter for unknown types
|
|
|
|
|
return processAdapter;
|
|
|
|
|
}
|
|
|
|
|
return adapter;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function listAdapterModels(type: string): { id: string; label: string }[] {
|
|
|
|
|
return adaptersByType.get(type)?.models ?? [];
|
|
|
|
|
}
|