mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 19:30:44 +00:00
fix(cli): bound sessions list output
This commit is contained in:
@@ -191,6 +191,8 @@ describe("registerStatusHealthSessionsCommands", () => {
|
||||
"/tmp/sessions.json",
|
||||
"--active",
|
||||
"120",
|
||||
"--limit",
|
||||
"25",
|
||||
]);
|
||||
|
||||
expect(setVerbose).toHaveBeenCalledWith(true);
|
||||
@@ -199,6 +201,7 @@ describe("registerStatusHealthSessionsCommands", () => {
|
||||
json: true,
|
||||
store: "/tmp/sessions.json",
|
||||
active: "120",
|
||||
limit: "25",
|
||||
}),
|
||||
runtime,
|
||||
);
|
||||
|
||||
@@ -132,6 +132,7 @@ export function registerStatusHealthSessionsCommands(program: Command) {
|
||||
.option("--agent <id>", "Agent id to inspect (default: configured default agent)")
|
||||
.option("--all-agents", "Aggregate sessions across all configured agents", false)
|
||||
.option("--active <minutes>", "Only show sessions updated within the past N minutes")
|
||||
.option("--limit <count>", 'Max sessions to show (default: 100; use "all" for full output)')
|
||||
.addHelpText(
|
||||
"after",
|
||||
() =>
|
||||
@@ -140,6 +141,7 @@ export function registerStatusHealthSessionsCommands(program: Command) {
|
||||
["openclaw sessions --agent work", "List sessions for one agent."],
|
||||
["openclaw sessions --all-agents", "Aggregate sessions across agents."],
|
||||
["openclaw sessions --active 120", "Only last 2 hours."],
|
||||
["openclaw sessions --limit 25", "Show the newest 25 sessions."],
|
||||
["openclaw sessions --json", "Machine-readable output."],
|
||||
["openclaw sessions --store ./tmp/sessions.json", "Use a specific session store."],
|
||||
])}\n\n${theme.muted(
|
||||
@@ -160,6 +162,7 @@ export function registerStatusHealthSessionsCommands(program: Command) {
|
||||
agent: opts.agent as string | undefined,
|
||||
allAgents: Boolean(opts.allAgents),
|
||||
active: opts.active as string | undefined,
|
||||
limit: opts.limit as string | undefined,
|
||||
},
|
||||
defaultRuntime,
|
||||
);
|
||||
|
||||
@@ -96,6 +96,8 @@ describe("route-args", () => {
|
||||
"sqlite",
|
||||
"--active",
|
||||
"true",
|
||||
"--limit",
|
||||
"25",
|
||||
]),
|
||||
).toEqual({
|
||||
json: true,
|
||||
@@ -103,8 +105,10 @@ describe("route-args", () => {
|
||||
agent: "default",
|
||||
store: "sqlite",
|
||||
active: "true",
|
||||
limit: "25",
|
||||
});
|
||||
expect(parseSessionsRouteArgs(["node", "openclaw", "sessions", "--agent"])).toBeNull();
|
||||
expect(parseSessionsRouteArgs(["node", "openclaw", "sessions", "--limit"])).toBeNull();
|
||||
expect(
|
||||
parseAgentsListRouteArgs(["node", "openclaw", "agents", "list", "--json", "--bindings"]),
|
||||
).toEqual({
|
||||
|
||||
@@ -144,12 +144,17 @@ export function parseSessionsRouteArgs(argv: string[]) {
|
||||
if (!active.ok) {
|
||||
return null;
|
||||
}
|
||||
const limit = parseOptionalFlagValue(argv, "--limit");
|
||||
if (!limit.ok) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
json: hasFlag(argv, "--json"),
|
||||
allAgents: hasFlag(argv, "--all-agents"),
|
||||
agent: agent.value,
|
||||
store: store.value,
|
||||
active: active.value,
|
||||
limit: limit.value,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user