Skip to content
Merged
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"test:watch": "vitest"
},
"dependencies": {
"@inkbox/sdk": "^0.4.7",
"@inkbox/sdk": "^0.4.10",
"json5": "^2.2.3",
"qrcode-terminal": "^0.12.0",
"typebox": "^1.1.38"
Expand Down
4 changes: 2 additions & 2 deletions src/inbound/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -834,8 +834,8 @@ async function sendVoiceText(
);
}

const IMESSAGE_TYPING_REFRESH_MS = 40_000;
const IMESSAGE_TYPING_MAX_MS = 300_000;
export const IMESSAGE_TYPING_REFRESH_MS = 40_000;
export const IMESSAGE_TYPING_MAX_MS = 300_000;

export interface IMessageTypingPulse {
start(conversationId: string | undefined): void;
Expand Down
1 change: 1 addition & 0 deletions src/setup-wizard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1217,6 +1217,7 @@ async function runSelfSignup(params: {
{
humanEmail,
noteToHuman: SELF_SIGNUP_VERIFICATION_NOTE,
harness: "openclaw",
...(agentHandle ? { agentHandle } : {}),
...(displayName ? { displayName } : {}),
},
Expand Down
19 changes: 12 additions & 7 deletions tests/inbound/session.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ vi.mock("openclaw/plugin-sdk/realtime-voice", () => ({
}));

import {
IMESSAGE_TYPING_MAX_MS,
IMESSAGE_TYPING_REFRESH_MS,
InkboxRealtimeAudioPacer,
createIMessageTypingPulse,
createInkboxSessionBridge,
Expand Down Expand Up @@ -1924,16 +1926,16 @@ describe("createIMessageTypingPulse", () => {
await vi.advanceTimersByTimeAsync(0);
expect(sendIMessageTyping).toHaveBeenCalledTimes(1);

await vi.advanceTimersByTimeAsync(2000);
await vi.advanceTimersByTimeAsync(IMESSAGE_TYPING_REFRESH_MS);
expect(sendIMessageTyping).toHaveBeenCalledTimes(2);

// Starting again for the same conversation does not double-pulse.
pulse.start("imconv-1");
await vi.advanceTimersByTimeAsync(2000);
await vi.advanceTimersByTimeAsync(IMESSAGE_TYPING_REFRESH_MS);
expect(sendIMessageTyping).toHaveBeenCalledTimes(3);

pulse.stop("imconv-1");
await vi.advanceTimersByTimeAsync(10_000);
await vi.advanceTimersByTimeAsync(IMESSAGE_TYPING_REFRESH_MS * 3);
expect(sendIMessageTyping).toHaveBeenCalledTimes(3);
});

Expand All @@ -1947,12 +1949,15 @@ describe("createIMessageTypingPulse", () => {
const pulse = createIMessageTypingPulse(runtime as any);

pulse.start("imconv-1");
await vi.advanceTimersByTimeAsync(400_000);
await vi.advanceTimersByTimeAsync(IMESSAGE_TYPING_MAX_MS + IMESSAGE_TYPING_REFRESH_MS * 2);
const countAtCap = sendIMessageTyping.mock.calls.length;
// 1 immediate + one per 2s tick until the 300s cap.
expect(countAtCap).toBe(150);
// 1 immediate pulse + one per refresh tick, until elapsed hits the cap (the
// capping tick stops without pulsing).
const expectedAtCap =
1 + Math.floor((IMESSAGE_TYPING_MAX_MS - 1) / IMESSAGE_TYPING_REFRESH_MS);
expect(countAtCap).toBe(expectedAtCap);

await vi.advanceTimersByTimeAsync(20_000);
await vi.advanceTimersByTimeAsync(IMESSAGE_TYPING_REFRESH_MS * 2);
expect(sendIMessageTyping).toHaveBeenCalledTimes(countAtCap);
});
});
1 change: 1 addition & 0 deletions tests/setup-wizard.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,7 @@ describe("runSetupWizard", () => {
{
humanEmail: "dima@example.com",
noteToHuman: "OpenClaw Inkbox plugin setup",
harness: "openclaw",
agentHandle: "new-agent",
displayName: "New Agent",
},
Expand Down
Loading