2026-03-03 08:45:26 -06:00
|
|
|
import type { CLIAdapterModule } from "@paperclipai/adapter-utils";
|
|
|
|
|
import { printClaudeStreamEvent } from "@paperclipai/adapter-claude-local/cli";
|
|
|
|
|
import { printCodexStreamEvent } from "@paperclipai/adapter-codex-local/cli";
|
2026-03-05 06:31:22 -06:00
|
|
|
import { printCursorStreamEvent } from "@paperclipai/adapter-cursor-local/cli";
|
2026-03-04 16:48:54 -06:00
|
|
|
import { printOpenCodeStreamEvent } from "@paperclipai/adapter-opencode-local/cli";
|
2026-03-03 08:45:26 -06:00
|
|
|
import { printOpenClawStreamEvent } from "@paperclipai/adapter-openclaw/cli";
|
2026-03-07 08:59:29 -06:00
|
|
|
import { printOpenClawGatewayStreamEvent } from "@paperclipai/adapter-openclaw-gateway/cli";
|
2026-02-18 13:53:03 -06:00
|
|
|
import { processCLIAdapter } from "./process/index.js";
|
|
|
|
|
import { httpCLIAdapter } from "./http/index.js";
|
|
|
|
|
|
2026-02-18 14:23:16 -06:00
|
|
|
const claudeLocalCLIAdapter: CLIAdapterModule = {
|
|
|
|
|
type: "claude_local",
|
|
|
|
|
formatStdoutEvent: printClaudeStreamEvent,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const codexLocalCLIAdapter: CLIAdapterModule = {
|
|
|
|
|
type: "codex_local",
|
|
|
|
|
formatStdoutEvent: printCodexStreamEvent,
|
|
|
|
|
};
|
|
|
|
|
|
2026-03-05 15:24:20 +01:00
|
|
|
const openCodeLocalCLIAdapter: CLIAdapterModule = {
|
2026-03-04 16:48:54 -06:00
|
|
|
type: "opencode_local",
|
|
|
|
|
formatStdoutEvent: printOpenCodeStreamEvent,
|
|
|
|
|
};
|
|
|
|
|
|
2026-03-05 06:31:22 -06:00
|
|
|
const cursorLocalCLIAdapter: CLIAdapterModule = {
|
|
|
|
|
type: "cursor",
|
|
|
|
|
formatStdoutEvent: printCursorStreamEvent,
|
|
|
|
|
};
|
|
|
|
|
|
2026-02-26 16:32:59 -06:00
|
|
|
const openclawCLIAdapter: CLIAdapterModule = {
|
|
|
|
|
type: "openclaw",
|
|
|
|
|
formatStdoutEvent: printOpenClawStreamEvent,
|
|
|
|
|
};
|
|
|
|
|
|
2026-03-07 08:59:29 -06:00
|
|
|
const openclawGatewayCLIAdapter: CLIAdapterModule = {
|
|
|
|
|
type: "openclaw_gateway",
|
|
|
|
|
formatStdoutEvent: printOpenClawGatewayStreamEvent,
|
|
|
|
|
};
|
|
|
|
|
|
2026-02-18 13:53:03 -06:00
|
|
|
const adaptersByType = new Map<string, CLIAdapterModule>(
|
2026-03-07 08:59:29 -06:00
|
|
|
[
|
|
|
|
|
claudeLocalCLIAdapter,
|
|
|
|
|
codexLocalCLIAdapter,
|
|
|
|
|
openCodeLocalCLIAdapter,
|
|
|
|
|
cursorLocalCLIAdapter,
|
|
|
|
|
openclawCLIAdapter,
|
|
|
|
|
openclawGatewayCLIAdapter,
|
|
|
|
|
processCLIAdapter,
|
|
|
|
|
httpCLIAdapter,
|
|
|
|
|
].map((a) => [a.type, a]),
|
2026-02-18 13:53:03 -06:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
export function getCLIAdapter(type: string): CLIAdapterModule {
|
|
|
|
|
return adaptersByType.get(type) ?? processCLIAdapter;
|
|
|
|
|
}
|