feat(worker): OpenCodeAdapter runs opencode in the per-user box (no side container)

This commit is contained in:
Gabriel Brown committed 2026-07-11 10:07:58 -04:00
1 parent 949a036d13
commit ff0425cf4b
5 files changed
+334

No files matched your search

@@ -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',
});
});
});