Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/CodexAcpServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1351,9 +1351,24 @@ export class CodexAcpServer {

const threadUpdates: UpdateSessionEvent[] = [];
for (const turn of thread.turns) {
const turnTiming = turn.startedAt !== null || turn.completedAt !== null
? {startedAt: turn.startedAt, completedAt: turn.completedAt}
: null;
for (const item of turn.items) {
const updates = await this.createHistoryUpdates(item, sessionState);
threadUpdates.push(...updates);
threadUpdates.push(...updates.map(update => {
if (!turnTiming) return update;
return {
...update,
_meta: {
...update._meta,
codex: {
...(update._meta?.["codex"] as Record<string, unknown> | undefined),
...turnTiming,
},
},
};
}));
}
}

Expand Down
74 changes: 70 additions & 4 deletions src/__tests__/CodexACPAgent/data/load-session-history.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@
"content": {
"type": "text",
"text": "Hi"
},
"_meta": {
"codex": {
"startedAt": 1710000000,
"completedAt": 1710000005
}
}
}
}
Expand All @@ -146,6 +152,12 @@
"content": {
"type": "text",
"text": "[@image](https://example.com/image.png)"
},
"_meta": {
"codex": {
"startedAt": 1710000000,
"completedAt": 1710000005
}
}
}
}
Expand All @@ -162,6 +174,12 @@
"content": {
"type": "text",
"text": "Hello!"
},
"_meta": {
"codex": {
"startedAt": 1710000000,
"completedAt": 1710000005
}
}
}
}
Expand All @@ -178,6 +196,12 @@
"content": {
"type": "text",
"text": "Thinking..."
},
"_meta": {
"codex": {
"startedAt": 1710000000,
"completedAt": 1710000005
}
}
}
}
Expand Down Expand Up @@ -208,6 +232,10 @@
"terminal_info": {
"cwd": "/test/project",
"terminal_id": "item-cmd-1"
},
"codex": {
"startedAt": 1710000000,
"completedAt": 1710000005
}
}
}
Expand Down Expand Up @@ -236,6 +264,10 @@
"exit_code": 0,
"signal": null,
"terminal_id": "item-cmd-1"
},
"codex": {
"startedAt": 1710000000,
"completedAt": 1710000005
}
}
}
Expand Down Expand Up @@ -263,7 +295,13 @@
"kind": "add"
}
}
]
],
"_meta": {
"codex": {
"startedAt": 1710000000,
"completedAt": 1710000005
}
}
}
}
]
Expand All @@ -285,7 +323,11 @@
"arguments": {}
},
"_meta": {
"is_mcp_tool_call": true
"is_mcp_tool_call": true,
"codex": {
"startedAt": 1710000000,
"completedAt": 1710000005
}
}
}
}
Expand All @@ -306,6 +348,12 @@
"arguments": {
"includeDisabled": false
}
},
"_meta": {
"codex": {
"startedAt": 1710000000,
"completedAt": 1710000005
}
}
}
}
Expand Down Expand Up @@ -339,6 +387,12 @@
],
"rawInput": {
"path": "/test/project/input.png"
},
"_meta": {
"codex": {
"startedAt": 1710000000,
"completedAt": 1710000005
}
}
}
}
Expand Down Expand Up @@ -378,6 +432,12 @@
"revisedPrompt": "A tiny blue square",
"result": "iVBORw0KGgo=",
"savedPath": "/test/project/generated-blue-square.png"
},
"_meta": {
"codex": {
"startedAt": 1710000000,
"completedAt": 1710000005
}
}
}
}
Expand All @@ -395,7 +455,11 @@
"title": "Context compacted",
"status": "completed",
"_meta": {
"contextCompaction": true
"contextCompaction": true,
"codex": {
"startedAt": 1710000000,
"completedAt": 1710000005
}
}
}
}
Expand Down Expand Up @@ -423,7 +487,9 @@
"threadId": "thread-child-1",
"path": "/root/test_audit",
"activity": "started"
}
},
"startedAt": 1710000000,
"completedAt": 1710000005
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/CodexACPAgent/load-session.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ describe("CodexACPAgent - loadSession", () => {
itemsView: "full",
status: "completed",
error: null,
startedAt: null,
completedAt: null,
startedAt: 1710000000,
completedAt: 1710000005,
durationMs: null,
items: [
{
Expand Down