Skip to content

Commit 467ccb5

Browse files
committed
Release version 1.1.5
1 parent e086a42 commit 467ccb5

6 files changed

Lines changed: 36 additions & 31 deletions

File tree

packages/happy-cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "happy",
3-
"version": "1.1.5-0",
3+
"version": "1.1.5",
44
"description": "Mobile and Web client for Claude Code and Codex",
55
"author": "Kirill Dubovitskiy",
66
"license": "MIT",

packages/happy-cli/src/api/apiSession.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,9 @@ describe('ApiSessionClient v3 messages API migration', () => {
293293
expect(mockAxiosPost).toHaveBeenCalledTimes(2);
294294
});
295295

296+
const firstPayload = mockAxiosPost.mock.calls[0][1];
297+
const secondPayload = mockAxiosPost.mock.calls[1][1];
298+
expect(secondPayload).toEqual(firstPayload);
296299
expect((client as any).pendingOutbox).toHaveLength(0);
297300
expect((client as any).lastSeq).toBe(1);
298301
});

packages/happy-cli/src/api/apiSession.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,8 @@ export class ApiSessionClient extends EventEmitter {
321321
// then backfill older messages in subsequent batches.
322322
while (this.pendingOutbox.length > 0) {
323323
const batchSize = Math.min(this.pendingOutbox.length, ApiSessionClient.MAX_OUTBOX_BATCH_SIZE);
324-
const batch = this.pendingOutbox.splice(-batchSize, batchSize);
324+
const batchStart = this.pendingOutbox.length - batchSize;
325+
const batch = this.pendingOutbox.slice(batchStart);
325326

326327
const response = await axios.post<V3PostSessionMessagesResponse>(
327328
`${configuration.serverUrl}/v3/sessions/${encodeURIComponent(this.sessionId)}/messages`,
@@ -339,6 +340,7 @@ export class ApiSessionClient extends EventEmitter {
339340
message.seq > acc ? message.seq : acc
340341
), this.lastSeq);
341342
this.lastSeq = maxSeq;
343+
this.pendingOutbox.splice(batchStart, batch.length);
342344
}
343345
}
344346

packages/happy-cli/src/codex/__tests__/emitReadyIfIdle.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, expect, it, vi } from 'vitest';
2-
import { emitReadyIfIdle } from '../runCodex';
2+
import { emitReadyIfIdle } from '../emitReadyIfIdle';
33

44
describe('emitReadyIfIdle', () => {
55
it('emits ready and notification when queue is idle', () => {
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
type ReadyEventOptions = {
2+
pending: unknown;
3+
queueSize: () => number;
4+
shouldExit: boolean;
5+
sendReady: () => void;
6+
notify?: () => void;
7+
};
8+
9+
/**
10+
* Notify connected clients when Codex finishes processing and the queue is idle.
11+
* Returns true when a ready event was emitted.
12+
*/
13+
export function emitReadyIfIdle({ pending, queueSize, shouldExit, sendReady, notify }: ReadyEventOptions): boolean {
14+
if (shouldExit) {
15+
return false;
16+
}
17+
if (pending) {
18+
return false;
19+
}
20+
if (queueSize() > 0) {
21+
return false;
22+
}
23+
24+
sendReady();
25+
notify?.();
26+
return true;
27+
}

packages/happy-cli/src/codex/runCodex.ts

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -31,34 +31,7 @@ import type { ApiSessionClient } from '@/api/apiSession';
3131
import { resolveCodexExecutionPolicy } from './executionPolicy';
3232
import { mapCodexMcpMessageToSessionEnvelopes, mapCodexProcessorMessageToSessionEnvelopes } from './utils/sessionProtocolMapper';
3333
import { resumeExistingThread } from './resumeExistingThread';
34-
35-
type ReadyEventOptions = {
36-
pending: unknown;
37-
queueSize: () => number;
38-
shouldExit: boolean;
39-
sendReady: () => void;
40-
notify?: () => void;
41-
};
42-
43-
/**
44-
* Notify connected clients when Codex finishes processing and the queue is idle.
45-
* Returns true when a ready event was emitted.
46-
*/
47-
export function emitReadyIfIdle({ pending, queueSize, shouldExit, sendReady, notify }: ReadyEventOptions): boolean {
48-
if (shouldExit) {
49-
return false;
50-
}
51-
if (pending) {
52-
return false;
53-
}
54-
if (queueSize() > 0) {
55-
return false;
56-
}
57-
58-
sendReady();
59-
notify?.();
60-
return true;
61-
}
34+
import { emitReadyIfIdle } from './emitReadyIfIdle';
6235

6336
/**
6437
* Main entry point for the codex command with ink UI

0 commit comments

Comments
 (0)