feat(worker): OpenCodeAdapter runs opencode in the per-user box (no side container)
This commit is contained in:
@@ -3,6 +3,7 @@ import { describe, expect, test } from 'vitest';
|
||||
import {
|
||||
normalizeCodexJsonLine,
|
||||
normalizeOpenCodeEvent,
|
||||
normalizeOpenCodeRunLine,
|
||||
} from '../../src/agent-events';
|
||||
|
||||
describe('agent event normalization', () => {
|
||||
@@ -291,4 +292,41 @@ describe('agent event normalization', () => {
|
||||
externalMessageId: 'message-2',
|
||||
});
|
||||
});
|
||||
|
||||
test('normalizes opencode run --format json output lines', () => {
|
||||
expect(
|
||||
normalizeOpenCodeRunLine(
|
||||
JSON.stringify({
|
||||
type: 'message.part.delta',
|
||||
properties: { part: { text: 'hi' }, messageID: 'm1' },
|
||||
}),
|
||||
),
|
||||
).toContainEqual({
|
||||
kind: 'assistant_delta',
|
||||
content: 'hi',
|
||||
externalMessageId: 'm1',
|
||||
});
|
||||
|
||||
expect(
|
||||
normalizeOpenCodeRunLine(
|
||||
JSON.stringify({
|
||||
sessionID: 'ses_abc',
|
||||
parts: [{ text: 'final answer' }],
|
||||
}),
|
||||
),
|
||||
).toEqual(
|
||||
expect.arrayContaining([
|
||||
{ kind: 'session', sessionId: 'ses_abc' },
|
||||
expect.objectContaining({
|
||||
kind: 'assistant_completed',
|
||||
content: 'final answer',
|
||||
}),
|
||||
]),
|
||||
);
|
||||
|
||||
expect(normalizeOpenCodeRunLine('not json at all')).toContainEqual({
|
||||
kind: 'status',
|
||||
status: 'not json at all',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user