mirror of
https://github.com/clawdbot/clawdbot.git
synced 2026-01-31 19:37:45 +01:00
fix: honor config timeout in tui
This commit is contained in:
@@ -112,6 +112,7 @@
|
|||||||
- Docs: expand parameter descriptions for agent/wake hooks. (#532) — thanks @mcinteerj
|
- Docs: expand parameter descriptions for agent/wake hooks. (#532) — thanks @mcinteerj
|
||||||
- Docs: add community showcase entries from Discord. (#476) — thanks @gupsammy
|
- Docs: add community showcase entries from Discord. (#476) — thanks @gupsammy
|
||||||
- TUI: refresh status bar after think/verbose/reasoning changes. (#519) — thanks @jdrhyne
|
- TUI: refresh status bar after think/verbose/reasoning changes. (#519) — thanks @jdrhyne
|
||||||
|
- TUI: stop overriding agent timeout so config defaults apply. (#549)
|
||||||
- Status: show Verbose/Elevated only when enabled.
|
- Status: show Verbose/Elevated only when enabled.
|
||||||
- Status: filter usage summary to the active model provider.
|
- Status: filter usage summary to the active model provider.
|
||||||
- Status: map model providers to usage sources so unrelated usage doesn’t appear.
|
- Status: map model providers to usage sources so unrelated usage doesn’t appear.
|
||||||
|
|||||||
@@ -673,5 +673,5 @@ Options:
|
|||||||
- `--deliver`
|
- `--deliver`
|
||||||
- `--thinking <level>`
|
- `--thinking <level>`
|
||||||
- `--message <text>`
|
- `--message <text>`
|
||||||
- `--timeout-ms <ms>`
|
- `--timeout-ms <ms>` (defaults to `agents.defaults.timeoutSeconds`)
|
||||||
- `--history-limit <n>`
|
- `--history-limit <n>`
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ Session lifecycle:
|
|||||||
- `--session <key>`: Session key (default: `main`, or `global` when scope is global)
|
- `--session <key>`: Session key (default: `main`, or `global` when scope is global)
|
||||||
- `--deliver`: Deliver assistant replies to the provider (default off)
|
- `--deliver`: Deliver assistant replies to the provider (default off)
|
||||||
- `--thinking <level>`: Override thinking level for sends
|
- `--thinking <level>`: Override thinking level for sends
|
||||||
- `--timeout-ms <ms>`: Agent timeout (default 30000)
|
- `--timeout-ms <ms>`: Agent timeout (defaults to `agents.defaults.timeoutSeconds`)
|
||||||
- `--history-limit <n>`: History entries to load (default 200)
|
- `--history-limit <n>`: History entries to load (default 200)
|
||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ Use SSH tunneling or Tailscale to reach the Gateway WS.
|
|||||||
- `--session <key>`: Session key (default: `main`, or `global` when scope is global).
|
- `--session <key>`: Session key (default: `main`, or `global` when scope is global).
|
||||||
- `--deliver`: Deliver assistant replies to the provider (default off).
|
- `--deliver`: Deliver assistant replies to the provider (default off).
|
||||||
- `--thinking <level>`: Override thinking level for sends.
|
- `--thinking <level>`: Override thinking level for sends.
|
||||||
- `--timeout-ms <ms>`: Agent timeout in ms (default 30000).
|
- `--timeout-ms <ms>`: Agent timeout in ms (defaults to `agents.defaults.timeoutSeconds`).
|
||||||
- `--history-limit <n>`: History entries to load (default 200).
|
- `--history-limit <n>`: History entries to load (default 200).
|
||||||
|
|
||||||
## Controls
|
## Controls
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ const onboardCommand = vi.fn();
|
|||||||
const callGateway = vi.fn();
|
const callGateway = vi.fn();
|
||||||
const runProviderLogin = vi.fn();
|
const runProviderLogin = vi.fn();
|
||||||
const runProviderLogout = vi.fn();
|
const runProviderLogout = vi.fn();
|
||||||
|
const runTui = vi.fn();
|
||||||
|
|
||||||
const runtime = {
|
const runtime = {
|
||||||
log: vi.fn(),
|
log: vi.fn(),
|
||||||
@@ -30,6 +31,9 @@ vi.mock("./provider-auth.js", () => ({
|
|||||||
runProviderLogin,
|
runProviderLogin,
|
||||||
runProviderLogout,
|
runProviderLogout,
|
||||||
}));
|
}));
|
||||||
|
vi.mock("../tui/tui.js", () => ({
|
||||||
|
runTui,
|
||||||
|
}));
|
||||||
vi.mock("../gateway/call.js", () => ({
|
vi.mock("../gateway/call.js", () => ({
|
||||||
callGateway,
|
callGateway,
|
||||||
randomIdempotencyKey: () => "idem-test",
|
randomIdempotencyKey: () => "idem-test",
|
||||||
@@ -43,6 +47,7 @@ const { buildProgram } = await import("./program.js");
|
|||||||
describe("cli program", () => {
|
describe("cli program", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
vi.clearAllMocks();
|
vi.clearAllMocks();
|
||||||
|
runTui.mockResolvedValue(undefined);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("runs message with required options", async () => {
|
it("runs message with required options", async () => {
|
||||||
@@ -62,6 +67,24 @@ describe("cli program", () => {
|
|||||||
expect(statusCommand).toHaveBeenCalled();
|
expect(statusCommand).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("runs tui without overriding timeout", async () => {
|
||||||
|
const program = buildProgram();
|
||||||
|
await program.parseAsync(["tui"], { from: "user" });
|
||||||
|
expect(runTui).toHaveBeenCalledWith(
|
||||||
|
expect.objectContaining({ timeoutMs: undefined }),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("runs tui with explicit timeout override", async () => {
|
||||||
|
const program = buildProgram();
|
||||||
|
await program.parseAsync(["tui", "--timeout-ms", "45000"], {
|
||||||
|
from: "user",
|
||||||
|
});
|
||||||
|
expect(runTui).toHaveBeenCalledWith(
|
||||||
|
expect.objectContaining({ timeoutMs: 45000 }),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it("runs config alias as configure", async () => {
|
it("runs config alias as configure", async () => {
|
||||||
const program = buildProgram();
|
const program = buildProgram();
|
||||||
await program.parseAsync(["config"], { from: "user" });
|
await program.parseAsync(["config"], { from: "user" });
|
||||||
|
|||||||
@@ -19,14 +19,21 @@ export function registerTuiCli(program: Command) {
|
|||||||
.option("--deliver", "Deliver assistant replies", false)
|
.option("--deliver", "Deliver assistant replies", false)
|
||||||
.option("--thinking <level>", "Thinking level override")
|
.option("--thinking <level>", "Thinking level override")
|
||||||
.option("--message <text>", "Send an initial message after connecting")
|
.option("--message <text>", "Send an initial message after connecting")
|
||||||
.option("--timeout-ms <ms>", "Agent timeout in ms", "30000")
|
.option(
|
||||||
|
"--timeout-ms <ms>",
|
||||||
|
"Agent timeout in ms (defaults to agents.defaults.timeoutSeconds)",
|
||||||
|
)
|
||||||
.option("--history-limit <n>", "History entries to load", "200")
|
.option("--history-limit <n>", "History entries to load", "200")
|
||||||
.action(async (opts) => {
|
.action(async (opts) => {
|
||||||
try {
|
try {
|
||||||
const timeoutMs = Number.parseInt(
|
const timeoutMs =
|
||||||
String(opts.timeoutMs ?? "30000"),
|
typeof opts.timeoutMs === "undefined"
|
||||||
10,
|
? undefined
|
||||||
);
|
: Number.parseInt(String(opts.timeoutMs), 10);
|
||||||
|
const normalizedTimeoutMs =
|
||||||
|
typeof timeoutMs === "number" && Number.isFinite(timeoutMs)
|
||||||
|
? timeoutMs
|
||||||
|
: undefined;
|
||||||
const historyLimit = Number.parseInt(
|
const historyLimit = Number.parseInt(
|
||||||
String(opts.historyLimit ?? "200"),
|
String(opts.historyLimit ?? "200"),
|
||||||
10,
|
10,
|
||||||
@@ -39,7 +46,7 @@ export function registerTuiCli(program: Command) {
|
|||||||
deliver: Boolean(opts.deliver),
|
deliver: Boolean(opts.deliver),
|
||||||
thinking: opts.thinking as string | undefined,
|
thinking: opts.thinking as string | undefined,
|
||||||
message: opts.message as string | undefined,
|
message: opts.message as string | undefined,
|
||||||
timeoutMs: Number.isNaN(timeoutMs) ? undefined : timeoutMs,
|
timeoutMs: normalizedTimeoutMs,
|
||||||
historyLimit: Number.isNaN(historyLimit) ? undefined : historyLimit,
|
historyLimit: Number.isNaN(historyLimit) ? undefined : historyLimit,
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
Reference in New Issue
Block a user