refactor: unify typing policy across services
This commit is contained in:
@@ -1480,7 +1480,8 @@ describe('createMessageRuntime', () => {
|
|||||||
expect(result).toBe(true);
|
expect(result).toBe(true);
|
||||||
expect(channel.sendMessage).not.toHaveBeenCalled();
|
expect(channel.sendMessage).not.toHaveBeenCalled();
|
||||||
expect(channel.sendAndTrack).not.toHaveBeenCalled();
|
expect(channel.sendAndTrack).not.toHaveBeenCalled();
|
||||||
expect(channel.setTyping).not.toHaveBeenCalledWith(chatJid, true);
|
expect(channel.setTyping).toHaveBeenCalledWith(chatJid, true);
|
||||||
|
expect(channel.setTyping).toHaveBeenCalledWith(chatJid, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('promotes the last visible progress to a final message when the final output is structured silent', async () => {
|
it('promotes the last visible progress to a final message when the final output is structured silent', async () => {
|
||||||
@@ -1577,7 +1578,7 @@ describe('createMessageRuntime', () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('defers typing-on until the first visible output for suppress-capable turns', async () => {
|
it('starts typing immediately for suppress-capable turns with visible output', async () => {
|
||||||
const chatJid = 'group@test';
|
const chatJid = 'group@test';
|
||||||
const group = makeGroup('claude-code');
|
const group = makeGroup('claude-code');
|
||||||
const channel = makeChannel(chatJid);
|
const channel = makeChannel(chatJid);
|
||||||
|
|||||||
@@ -279,7 +279,6 @@ export function createMessageRuntime(deps: MessageRuntimeDeps): {
|
|||||||
isClaudeService() || isReviewService()
|
isClaudeService() || isReviewService()
|
||||||
? createSuppressToken()
|
? createSuppressToken()
|
||||||
: undefined;
|
: undefined;
|
||||||
const deferTypingUntilVisible = Boolean(suppressToken) && isClaudeService();
|
|
||||||
|
|
||||||
const turnController = new MessageTurnController({
|
const turnController = new MessageTurnController({
|
||||||
chatJid,
|
chatJid,
|
||||||
@@ -289,7 +288,6 @@ export function createMessageRuntime(deps: MessageRuntimeDeps): {
|
|||||||
idleTimeout: deps.idleTimeout,
|
idleTimeout: deps.idleTimeout,
|
||||||
failureFinalText: FAILURE_FINAL_TEXT,
|
failureFinalText: FAILURE_FINAL_TEXT,
|
||||||
isClaudeCodeAgent,
|
isClaudeCodeAgent,
|
||||||
deferTypingUntilVisible,
|
|
||||||
suppressToken,
|
suppressToken,
|
||||||
clearSession: () => deps.clearSession(group.folder),
|
clearSession: () => deps.clearSession(group.folder),
|
||||||
requestClose: (reason) =>
|
requestClose: (reason) =>
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ interface MessageTurnControllerOptions {
|
|||||||
idleTimeout: number;
|
idleTimeout: number;
|
||||||
failureFinalText: string;
|
failureFinalText: string;
|
||||||
isClaudeCodeAgent: boolean;
|
isClaudeCodeAgent: boolean;
|
||||||
deferTypingUntilVisible?: boolean;
|
|
||||||
suppressToken?: string;
|
suppressToken?: string;
|
||||||
clearSession: () => void;
|
clearSession: () => void;
|
||||||
requestClose: (reason: string) => void;
|
requestClose: (reason: string) => void;
|
||||||
@@ -83,9 +82,6 @@ export class MessageTurnController {
|
|||||||
|
|
||||||
async start(): Promise<void> {
|
async start(): Promise<void> {
|
||||||
this.resetIdleTimer();
|
this.resetIdleTimer();
|
||||||
if (this.options.deferTypingUntilVisible) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
await this.activateTyping('turn:start');
|
await this.activateTyping('turn:start');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user