mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-11 08:01:40 +00:00
refactor(commands): dedupe session target resolution and fs tool test setup
This commit is contained in:
@@ -2,6 +2,7 @@ import { listAgentIds, resolveDefaultAgentId } from "../agents/agent-scope.js";
|
||||
import { resolveStorePath } from "../config/sessions.js";
|
||||
import type { OpenClawConfig } from "../config/types.openclaw.js";
|
||||
import { normalizeAgentId } from "../routing/session-key.js";
|
||||
import type { RuntimeEnv } from "../runtime.js";
|
||||
|
||||
export type SessionStoreSelectionOptions = {
|
||||
store?: string;
|
||||
@@ -78,3 +79,17 @@ export function resolveSessionStoreTargets(
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
export function resolveSessionStoreTargetsOrExit(params: {
|
||||
cfg: OpenClawConfig;
|
||||
opts: SessionStoreSelectionOptions;
|
||||
runtime: RuntimeEnv;
|
||||
}): SessionStoreTarget[] | null {
|
||||
try {
|
||||
return resolveSessionStoreTargets(params.cfg, params.opts);
|
||||
} catch (error) {
|
||||
params.runtime.error(error instanceof Error ? error.message : String(error));
|
||||
params.runtime.exit(1);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user