Clean up old stuff & fix ui errors
This commit is contained in:
@@ -51,6 +51,91 @@ describe('agent event normalization', () => {
|
||||
).toContainEqual({ kind: 'file_edited', path: 'src/app.ts' });
|
||||
});
|
||||
|
||||
test('normalizes current Codex item events', () => {
|
||||
expect(
|
||||
normalizeCodexJsonLine(
|
||||
JSON.stringify({
|
||||
type: 'item.completed',
|
||||
item: {
|
||||
id: 'item-1',
|
||||
type: 'agent_message',
|
||||
text: 'I updated the auth provider.',
|
||||
},
|
||||
}),
|
||||
),
|
||||
).toContainEqual({
|
||||
kind: 'assistant_delta',
|
||||
content: 'I updated the auth provider.',
|
||||
});
|
||||
|
||||
expect(
|
||||
normalizeCodexJsonLine(
|
||||
JSON.stringify({
|
||||
type: 'item.completed',
|
||||
item: {
|
||||
id: 'item-2',
|
||||
type: 'error',
|
||||
message: 'sandbox failed',
|
||||
},
|
||||
}),
|
||||
),
|
||||
).toContainEqual({
|
||||
kind: 'error',
|
||||
message: 'sandbox failed',
|
||||
});
|
||||
|
||||
expect(
|
||||
normalizeCodexJsonLine(
|
||||
JSON.stringify({
|
||||
type: 'turn.failed',
|
||||
error: { message: 'request failed' },
|
||||
}),
|
||||
),
|
||||
).toContainEqual({
|
||||
kind: 'error',
|
||||
message: '{\n "message": "request failed"\n}',
|
||||
});
|
||||
});
|
||||
|
||||
test('normalizes Codex tool item lifecycle events', () => {
|
||||
expect(
|
||||
normalizeCodexJsonLine(
|
||||
JSON.stringify({
|
||||
type: 'item.started',
|
||||
item: {
|
||||
id: 'tool-1',
|
||||
type: 'local_shell_call',
|
||||
command: ['bash', '-lc', 'rg Authentik'],
|
||||
},
|
||||
}),
|
||||
),
|
||||
).toContainEqual({
|
||||
kind: 'tool_started',
|
||||
name: 'local_shell_call',
|
||||
input: 'bash -lc rg Authentik',
|
||||
externalMessageId: 'tool-1',
|
||||
});
|
||||
|
||||
expect(
|
||||
normalizeCodexJsonLine(
|
||||
JSON.stringify({
|
||||
type: 'item.completed',
|
||||
item: {
|
||||
id: 'tool-1',
|
||||
type: 'local_shell_call',
|
||||
command: ['bash', '-lc', 'rg Authentik'],
|
||||
output: 'apps/web/auth.ts',
|
||||
},
|
||||
}),
|
||||
),
|
||||
).toContainEqual({
|
||||
kind: 'tool_completed',
|
||||
name: 'local_shell_call',
|
||||
output: 'apps/web/auth.ts',
|
||||
externalMessageId: 'tool-1',
|
||||
});
|
||||
});
|
||||
|
||||
test('normalizes OpenCode assistant, tool, and permission events', () => {
|
||||
expect(
|
||||
normalizeOpenCodeEvent({
|
||||
@@ -93,5 +178,21 @@ describe('agent event normalization', () => {
|
||||
body: 'Run bun test?',
|
||||
metadata: '{\n "permissionID": "perm-1",\n "message": "Run bun test?"\n}',
|
||||
});
|
||||
|
||||
expect(
|
||||
normalizeOpenCodeEvent({
|
||||
type: 'tool.output',
|
||||
properties: {
|
||||
tool: 'read',
|
||||
output: 'apps/web/auth.ts',
|
||||
messageID: 'message-2',
|
||||
},
|
||||
}),
|
||||
).toContainEqual({
|
||||
kind: 'tool_completed',
|
||||
name: 'read',
|
||||
output: 'apps/web/auth.ts',
|
||||
externalMessageId: 'message-2',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user