openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
3 lines • 3.05 kB
JavaScript
import{r as defaultRuntime,t as ExitError}from"./runtime-DIcLIHcp.mjs";import{t as formatErrorMessage}from"./errors-D37BJTfI.mjs";import{t as normalizeAcpProvenanceMode}from"./types-CgFZsPcc.mjs";import{n as inheritOptionFromParent}from"./command-options-Cl1CohDr.mjs";import{t as formatDocsHelp}from"./help-format-DLfgiheF.mjs";import"./types-06_QcB8l.mjs";import{t as resolveGatewayAuthOptions}from"./gateway-secret-options-UPUoON4Q.mjs";
//!src/cli/acp-cli.ts
function registerAcpCli(e){const t=e.command(`acp`).description(`Run an ACP bridge backed by the Gateway`);t.option(`--url <url>`,`Gateway WebSocket URL (defaults to gateway.remote.url when configured)`).option(`--token <token>`,`Gateway token (if required)`).option(`--token-file <path>`,`Read gateway token from file`).option(`--password <password>`,`Gateway password (if required)`).option(`--password-file <path>`,`Read gateway password from file`).option(`--session <key>`,`Default session key (e.g. agent:main:main)`).option(`--session-label <label>`,`Default session label to resolve`).option(`--require-existing`,`Fail if the session key/label does not exist`,false).option(`--reset-session`,`Reset the session key before first use`,false).option(`--no-prefix-cwd`,`Do not prefix prompts with the working directory`).option(`--provenance <mode>`,`ACP provenance mode: off, meta, or meta+receipt`).option(`-v, --verbose`,`Verbose logging to stderr`,false).addHelpText(`after`,()=>formatDocsHelp(`/cli/acp`)).action(async e=>{try{const{gatewayToken:t,gatewayPassword:n}=resolveGatewayAuthOptions(e);const r=normalizeAcpProvenanceMode(e.provenance);if(e.provenance&&!r)throw new Error(`Invalid --provenance. Use "off", "meta", or "meta+receipt".`);const{serveAcpGateway:i}=await import(`./server-BuC2QNKG.mjs`);await i({gatewayUrl:e.url,gatewayToken:t,gatewayPassword:n,defaultSessionKey:e.session,defaultSessionLabel:e.sessionLabel,requireExistingSession:Boolean(e.requireExisting),resetSession:Boolean(e.resetSession),prefixCwd:e.prefixCwd!==false,provenanceMode:r,verbose:Boolean(e.verbose)})}catch(e){defaultRuntime.error(`ACP bridge failed: ${formatErrorMessage(e)}`);defaultRuntime.exit(1)}});t.command(`client`).description(`Run an interactive ACP client against the local ACP bridge`).option(`--cwd <dir>`,`Working directory for the ACP session`).option(`--server <command>`,`ACP server command (default: openclaw)`).option(`--server-args <args...>`,`Extra arguments for the ACP server`).option(`--server-verbose`,`Enable verbose logging on the ACP server`,false).option(`-v, --verbose`,`Verbose client logging`,false).action(async(e,t)=>{const n=inheritOptionFromParent(t,`verbose`);try{const{runAcpClientInteractive:t}=await import(`./client-DmhIeUdM.mjs`);const r=await t({cwd:e.cwd,serverCommand:e.server,serverArgs:e.serverArgs,serverVerbose:Boolean(e.serverVerbose),verbose:Boolean(e.verbose||n)});if(r!==0)defaultRuntime.exit(r)}catch(e){if(e instanceof ExitError)throw e;defaultRuntime.error(formatErrorMessage(e));defaultRuntime.exit(1)}})}export{registerAcpCli};