Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,27 @@ test('restarts a paginated catalog read instead of mixing revisions', async () =
test('resolves WorkHub coordination through the dedicated Host operation', async () => {
const { client, requests } = clientWithResponses([
{ sessionId: 'maka_workhub_coordination' },
{ candidateSetId: `sha256:${'a'.repeat(64)}`, candidates: [] },
{ disposition: 'answer_here', coordinationTurnId: 'action-turn' },
{ turnId: 'answer-turn' },
{ turnId: 'summary-turn' },
]);

assert.deepEqual(await client.resolveWorkHubCoordinationSession(), {
sessionId: 'maka_workhub_coordination',
});
assert.deepEqual(await client.listWorkHubCoordinationCandidates(), {
candidateSetId: `sha256:${'a'.repeat(64)}`,
candidates: [],
});
assert.deepEqual(
await client.actWorkHubCoordination({
actionId: 'action',
userText: 'Question',
proposal: { disposition: 'answer_here' },
}),
{ disposition: 'answer_here', coordinationTurnId: 'action-turn' },
);
assert.deepEqual(
await client.answerWorkHubCoordination({ turnId: 'answer-turn', text: 'Question' }),
{ turnId: 'answer-turn' },
Expand All @@ -119,6 +133,15 @@ test('resolves WorkHub coordination through the dedicated Host operation', async
);
assert.deepEqual(requests, [
{ operation: 'workhub.coordination.resolve', input: {} },
{ operation: 'workhub.coordination.candidates', input: {} },
{
operation: 'workhub.coordination.act',
input: {
actionId: 'action',
userText: 'Question',
proposal: { disposition: 'answer_here' },
},
},
{
operation: 'workhub.coordination.answer',
input: { turnId: 'answer-turn', text: 'Question' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ test('projects WorkHub coordination resolution through its dedicated IPC domain'
let resolveCalls = 0;
const answers: unknown[] = [];
const records: unknown[] = [];
const actions: unknown[] = [];
const changes: unknown[] = [];
const createdSessionId = 'runtime-created-session';
registerRuntimeHostWorkHubIpc(
{
resolveWorkHubCoordinationSession: async () => {
Expand All @@ -44,12 +47,31 @@ test('projects WorkHub coordination resolution through its dedicated IPC domain'
records.push(input);
return { turnId: input.turnId };
},
listWorkHubCoordinationCandidates: async () => ({
candidateSetId: `sha256:${'a'.repeat(64)}`,
candidates: [],
}),
actWorkHubCoordination: async (input: unknown) => {
actions.push(input);
return {
disposition: 'create_new',
targetSessionId: createdSessionId,
targetTurnId: 'created-turn',
};
},
} as never,
{
handle: (channel: string, handler: (...args: unknown[]) => unknown) => {
handlers.set(channel, handler);
},
} as never,
{
resolveCreateProject: async () => ({
kind: 'host_path',
path: '/tmp/workhub-project',
}),
emitSessionsChanged: (reason, sessionId) => changes.push({ reason, sessionId }),
},
);

const handler = handlers.get('workhub:resolveCoordinationSession');
Expand All @@ -74,4 +96,33 @@ test('projects WorkHub coordination resolution through its dedicated IPC domain'
userText: 'Request',
assistantText: 'Summary',
}]);
assert.deepEqual(await handlers.get('workhub:candidates')?.({}), {
candidateSetId: `sha256:${'a'.repeat(64)}`,
candidates: [],
});
assert.deepEqual(
await handlers.get('workhub:act')?.({}, {
actionId: 'create-action',
userText: 'Start accessibility review',
proposal: { disposition: 'create_new', title: 'Accessibility review' },
create: {
sessionId: 'renderer-invented',
workspace: { kind: 'host_path', path: '/renderer-path' },
},
}),
{
disposition: 'create_new',
targetSessionId: createdSessionId,
targetTurnId: 'created-turn',
},
);
assert.deepEqual(actions, [{
actionId: 'create-action',
userText: 'Start accessibility review',
proposal: { disposition: 'create_new', title: 'Accessibility review' },
create: {
workspace: { kind: 'host_path', path: '/tmp/workhub-project' },
},
}]);
assert.deepEqual(changes, [{ reason: 'created', sessionId: createdSessionId }]);
});
Loading