mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-23 10:55:31 -06:00
30 lines
981 B
TypeScript
30 lines
981 B
TypeScript
/**
|
|
* Session store target resolution wrapper for CLI commands.
|
|
*
|
|
* The config helper throws on invalid agent/store combinations; this module
|
|
* converts those errors into command output and exit codes.
|
|
*/
|
|
import {
|
|
resolveSessionStoreTargets,
|
|
type SessionStoreSelectionOptions,
|
|
type SessionStoreTarget,
|
|
} from "../config/sessions.js";
|
|
import type { OpenClawConfig } from "../config/types.openclaw.js";
|
|
import { formatErrorMessage } from "../infra/errors.js";
|
|
import type { RuntimeEnv } from "../runtime.js";
|
|
|
|
/** Resolves session store targets or exits the current command on validation errors. */
|
|
export function resolveSessionStoreTargetsOrExit(params: {
|
|
cfg: OpenClawConfig;
|
|
opts: SessionStoreSelectionOptions;
|
|
runtime: RuntimeEnv;
|
|
}): SessionStoreTarget[] | null {
|
|
try {
|
|
return resolveSessionStoreTargets(params.cfg, params.opts);
|
|
} catch (error) {
|
|
params.runtime.error(formatErrorMessage(error));
|
|
params.runtime.exit(1);
|
|
return null;
|
|
}
|
|
}
|