Skip to content
Merged
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
15 changes: 8 additions & 7 deletions apps/desktop/e2e/workhub-reconstruction.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ test('WorkHub rebuilds Session conversation after navigating away and back', asy
).toBeVisible();
});

test('WorkHub handles a first natural-language correction', async ({
test('WorkHub defers destructive correction until linked delegation exists', async ({
window: page,
}) => {
const sourceSessionName = '检查支付回调重复投递时的幂等性';
Expand Down Expand Up @@ -107,10 +107,11 @@ test('WorkHub handles a first natural-language correction', async ({
).toBeEnabled();
await workHubComposer.press('Enter');

await expect(page.locator('.workhub-correction-note').last()).toBeVisible();
await expect(
page.locator('.workhub-turn', {
hasText: '不是这个,换成登录稳定性,补充刷新令牌失败判定。',
}).locator('.workhub-submitted-session strong'),
).toHaveText('登录稳定性');
const correctionTurn = page.locator('.workhub-turn', {
hasText: '不是这个,换成登录稳定性,补充刷新令牌失败判定。',
});
await expect(correctionTurn.locator('.workhub-error')).toContainText(
'跨 Session 更正将在持久委托关联完成后开放',
);
await expect(correctionTurn.locator('.workhub-submitted')).toHaveCount(0);
});
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