Adds `agent.humanDelay` config option to create natural rhythm between
streamed message bubbles. When enabled, introduces a random delay
(default 800-2500ms) between block replies, making multi-message
responses feel more like natural human texting.
Config example:
```json
{
"agent": {
"blockStreamingDefault": "on",
"humanDelay": {
"enabled": true,
"minMs": 800,
"maxMs": 2500
}
}
}
```
- First message sends immediately
- Subsequent messages wait a random delay before sending
- Works with iMessage, Signal, and Discord providers
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
29 lines
820 B
TypeScript
29 lines
820 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import type { ClawdbotConfig } from "../config/config.js";
|
|
import { resolveHumanDelayConfig } from "./identity.js";
|
|
|
|
describe("resolveHumanDelayConfig", () => {
|
|
it("returns undefined when no humanDelay config is set", () => {
|
|
const cfg: ClawdbotConfig = {};
|
|
expect(resolveHumanDelayConfig(cfg, "main")).toBeUndefined();
|
|
});
|
|
|
|
it("merges defaults with per-agent overrides", () => {
|
|
const cfg: ClawdbotConfig = {
|
|
agents: {
|
|
defaults: {
|
|
humanDelay: { mode: "natural", minMs: 800, maxMs: 1800 },
|
|
},
|
|
list: [{ id: "main", humanDelay: { mode: "custom", minMs: 400 } }],
|
|
},
|
|
};
|
|
|
|
expect(resolveHumanDelayConfig(cfg, "main")).toEqual({
|
|
mode: "custom",
|
|
minMs: 400,
|
|
maxMs: 1800,
|
|
});
|
|
});
|
|
});
|