mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-29 19:01:44 +00:00
60 lines
1.5 KiB
TypeScript
60 lines
1.5 KiB
TypeScript
import type { CliBackendPlugin, CliBackendConfig } from "openclaw/plugin-sdk/cli-backend";
|
|
import {
|
|
CLI_FRESH_WATCHDOG_DEFAULTS,
|
|
CLI_RESUME_WATCHDOG_DEFAULTS,
|
|
} from "openclaw/plugin-sdk/cli-backend";
|
|
import {
|
|
CLAUDE_CLI_BACKEND_ID,
|
|
CLAUDE_CLI_CLEAR_ENV,
|
|
CLAUDE_CLI_MODEL_ALIASES,
|
|
CLAUDE_CLI_SESSION_ID_FIELDS,
|
|
normalizeClaudeBackendConfig,
|
|
} from "./cli-shared.js";
|
|
|
|
export function buildAnthropicCliBackend(): CliBackendPlugin {
|
|
return {
|
|
id: CLAUDE_CLI_BACKEND_ID,
|
|
bundleMcp: true,
|
|
config: {
|
|
command: "claude",
|
|
args: [
|
|
"-p",
|
|
"--output-format",
|
|
"stream-json",
|
|
"--verbose",
|
|
"--permission-mode",
|
|
"bypassPermissions",
|
|
],
|
|
resumeArgs: [
|
|
"-p",
|
|
"--output-format",
|
|
"stream-json",
|
|
"--verbose",
|
|
"--permission-mode",
|
|
"bypassPermissions",
|
|
"--resume",
|
|
"{sessionId}",
|
|
],
|
|
output: "jsonl",
|
|
input: "arg",
|
|
modelArg: "--model",
|
|
modelAliases: CLAUDE_CLI_MODEL_ALIASES,
|
|
sessionArg: "--session-id",
|
|
sessionMode: "always",
|
|
sessionIdFields: [...CLAUDE_CLI_SESSION_ID_FIELDS],
|
|
systemPromptArg: "--append-system-prompt",
|
|
systemPromptMode: "append",
|
|
systemPromptWhen: "first",
|
|
clearEnv: [...CLAUDE_CLI_CLEAR_ENV],
|
|
reliability: {
|
|
watchdog: {
|
|
fresh: { ...CLI_FRESH_WATCHDOG_DEFAULTS },
|
|
resume: { ...CLI_RESUME_WATCHDOG_DEFAULTS },
|
|
},
|
|
},
|
|
serialize: true,
|
|
},
|
|
normalizeConfig: normalizeClaudeBackendConfig,
|
|
};
|
|
}
|