Skip to content

Open-source AI coworkers that each get a computer of their own: a browser, files and tools, with every action decided before it happens and recorded after. Bring any AG-UI agent.

fix(server): accept uppercase duration units in durationMs (#375)

Felix-Ayush455dcae5b0b1
diff --git a/server/src/config.ts b/server/src/config.ts
index 915fb170..162dc36b 100644
--- a/server/src/config.ts
+++ b/server/src/config.ts
@@ -735,14 +735,14 @@ function privateHostsAllowed(environment: Environment): boolean {
* its meaning.
*/
export function durationMs(value: string): number {
- const match = /^(\d+)\s*(ms|s|m|h)?$/.exec(value.trim());
+ const match = /^(\d+)\s*(ms|s|m|h)?$/i.exec(value.trim());
if (!match) {
throw new Error(
`"${value}" is not a duration. Write it as 30s, 30m, 2h, or a plain number of milliseconds.`,
);
}
const amount = Number(match[1]);
- switch (match[2]) {
+ switch (match[2]?.toLowerCase()) {
case "h":
return amount * 3_600_000;
case "m":