feat: integrate learning module
This commit is contained in:
@@ -10,7 +10,7 @@ import { hydrateOpenCodeSession } from '@/lib/opencode-session-state';
|
||||
import type { RawMessage, ToolStatus } from '@/types/chat';
|
||||
|
||||
describe('deriveTaskSteps', () => {
|
||||
it('uses canonical Part order to keep pre-subtask text in the execution trace', () => {
|
||||
it('keeps assistant text in the body while retaining native execution events', () => {
|
||||
const transcript = hydrateOpenCodeSession('ses_native', [{
|
||||
info: { id: 'msg_native', role: 'assistant', sessionID: 'ses_native' },
|
||||
parts: [
|
||||
@@ -34,9 +34,9 @@ describe('deriveTaskSteps', () => {
|
||||
});
|
||||
|
||||
expect(steps).toEqual(expect.arrayContaining([
|
||||
expect.objectContaining({ kind: 'message', detail: 'Inspecting the project.' }),
|
||||
expect.objectContaining({ kind: 'system', id: 'native-part_subtask' }),
|
||||
]));
|
||||
expect(steps.some((step) => step.kind === 'message')).toBe(false);
|
||||
expect(steps.some((step) => step.detail === 'The project is ready.')).toBe(false);
|
||||
});
|
||||
|
||||
@@ -255,7 +255,7 @@ describe('deriveTaskSteps', () => {
|
||||
});
|
||||
|
||||
expect(steps.some((step) => step.kind === 'thinking')).toBe(false);
|
||||
expect(steps.some((step) => step.kind === 'message')).toBe(true);
|
||||
expect(steps.some((step) => step.kind === 'message')).toBe(false);
|
||||
expect(steps.some((step) => step.kind === 'tool' && step.id === 'read-1')).toBe(true);
|
||||
});
|
||||
|
||||
@@ -534,7 +534,7 @@ describe('deriveTaskSteps', () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it('keeps earlier reply segments in the graph when the last streaming segment is rendered separately', () => {
|
||||
it('keeps progressive assistant text out of the execution graph', () => {
|
||||
const steps = deriveTaskSteps({
|
||||
messages: [],
|
||||
streamingMessage: {
|
||||
@@ -546,24 +546,12 @@ describe('deriveTaskSteps', () => {
|
||||
],
|
||||
},
|
||||
streamingTools: [],
|
||||
omitLastStreamingMessageSegment: true,
|
||||
});
|
||||
|
||||
expect(steps).toEqual([
|
||||
expect.objectContaining({
|
||||
id: 'stream-message-0',
|
||||
detail: 'Checked X.',
|
||||
status: 'completed',
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: 'stream-message-1',
|
||||
detail: 'Checked Snowball.',
|
||||
status: 'completed',
|
||||
}),
|
||||
]);
|
||||
expect(steps).toEqual([]);
|
||||
});
|
||||
|
||||
it('folds earlier reply segments into the graph but leaves the final answer for the chat bubble', () => {
|
||||
it('keeps all progressive reply segments out of the execution graph', () => {
|
||||
const steps = deriveTaskSteps({
|
||||
messages: [
|
||||
{
|
||||
@@ -580,18 +568,7 @@ describe('deriveTaskSteps', () => {
|
||||
streamingTools: [],
|
||||
});
|
||||
|
||||
expect(steps).toEqual([
|
||||
expect.objectContaining({
|
||||
id: 'history-message-assistant-reply-0',
|
||||
detail: 'Checked X.',
|
||||
status: 'completed',
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: 'history-message-assistant-reply-1',
|
||||
detail: 'Checked Snowball.',
|
||||
status: 'completed',
|
||||
}),
|
||||
]);
|
||||
expect(steps).toEqual([]);
|
||||
});
|
||||
|
||||
it('strips folded process narration from the final reply text', () => {
|
||||
|
||||
Reference in New Issue
Block a user