feat: Complete Pi Harness Rebuild - Phases 1 till 7.2
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import ReactMarkdown from 'react-markdown';
|
||||
import remarkGfm from 'remark-gfm';
|
||||
import rehypeRaw from 'rehype-raw';
|
||||
import type { ChatMessage } from './types';
|
||||
import type { LegacyChatMessage } from './types';
|
||||
import { ToolActivity } from './ToolActivity';
|
||||
import { QuestionActivity } from './QuestionActivity';
|
||||
|
||||
@@ -21,7 +21,7 @@ const CollapsibleBlock = ({ label, content }: { label: string; content: string }
|
||||
);
|
||||
|
||||
type MessageBubbleProps = {
|
||||
message: ChatMessage;
|
||||
message: LegacyChatMessage;
|
||||
onAnswer?: (text: string) => void;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import type { RefObject } from 'react';
|
||||
import { ArrowDown } from 'lucide-react';
|
||||
import type { ChatMessage } from './types';
|
||||
import type { LegacyChatMessage } from './types';
|
||||
import { MessageBubble, StreamingBubble } from './MessageBubble';
|
||||
|
||||
type MessageListProps = {
|
||||
messages: ChatMessage[];
|
||||
messages: LegacyChatMessage[];
|
||||
streamingText: string;
|
||||
isGenerating: boolean;
|
||||
showJumpToBottom: boolean;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { useState } from 'react';
|
||||
import { MessageCircleQuestion, Check } from 'lucide-react';
|
||||
import type { ChatMessage } from './types';
|
||||
import type { LegacyChatMessage } from './types';
|
||||
|
||||
type ToolMessage = Extract<ChatMessage, { role: 'tool' }>;
|
||||
type ToolMessage = Extract<LegacyChatMessage, { role: 'tool' }>;
|
||||
|
||||
type QuestionOption = {
|
||||
label: string;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { useState } from 'react';
|
||||
import { FileText, Terminal, Pencil, Search, Globe, Wrench, ChevronRight } from 'lucide-react';
|
||||
import type { ChatMessage } from './types';
|
||||
import type { LegacyChatMessage } from './types';
|
||||
|
||||
type ToolMessage = Extract<ChatMessage, { role: 'tool' }>;
|
||||
type ToolMessage = Extract<LegacyChatMessage, { role: 'tool' }>;
|
||||
|
||||
type ToolActivityProps = {
|
||||
message: ToolMessage;
|
||||
|
||||
@@ -2,4 +2,16 @@ export { MessageList } from './MessageList';
|
||||
export { MessageBubble, StreamingBubble } from './MessageBubble';
|
||||
export { ToolActivity } from './ToolActivity';
|
||||
export { QuestionActivity } from './QuestionActivity';
|
||||
export type { ChatMessage, SessionEntry, ServerMessage, TaskInfo } from './types';
|
||||
|
||||
export type {
|
||||
ChatMessage,
|
||||
SessionEntry,
|
||||
GroupEntry,
|
||||
ServerMessage,
|
||||
Message,
|
||||
MessageCost,
|
||||
TaskInfo,
|
||||
LegacyChatMessage,
|
||||
LegacySessionEntry,
|
||||
LegacyServerMessage,
|
||||
} from './types';
|
||||
|
||||
@@ -1,4 +1,82 @@
|
||||
export type MessageCost = {
|
||||
inputTokens: number;
|
||||
outputTokens: number;
|
||||
totalUSD: number;
|
||||
};
|
||||
|
||||
export type SessionEntry = {
|
||||
id: string;
|
||||
title: string;
|
||||
model: string;
|
||||
cwd: string;
|
||||
createdAt: number;
|
||||
updatedAt: number;
|
||||
messageCount: number;
|
||||
cost: MessageCost;
|
||||
groupSlug?: string | null;
|
||||
};
|
||||
|
||||
export type GroupEntry = {
|
||||
name: string;
|
||||
slug: string;
|
||||
description?: string;
|
||||
createdAt: number;
|
||||
updatedAt: number;
|
||||
sessionCount: number;
|
||||
};
|
||||
|
||||
export type ChatMessage =
|
||||
| { role: 'user'; text: string; images?: { filename: string; dataUrl: string }[] }
|
||||
| { role: 'assistant'; text: string }
|
||||
| { role: 'system'; text: string }
|
||||
| {
|
||||
role: 'tool';
|
||||
toolName: string;
|
||||
toolInput: Record<string, unknown>;
|
||||
toolCallId: string;
|
||||
output?: string;
|
||||
isError?: boolean;
|
||||
}
|
||||
| { role: 'result'; cost: MessageCost }
|
||||
| { role: 'error'; text: string };
|
||||
|
||||
export type TaskInfo = {
|
||||
taskName: string;
|
||||
taskDirName: string;
|
||||
entryName: string;
|
||||
entryType: 'file' | 'directory';
|
||||
};
|
||||
|
||||
export type ServerMessage =
|
||||
| { type: 'session:init'; sessionId: string; model: string; cwd: string }
|
||||
| { type: 'assistant:text'; text: string }
|
||||
| { type: 'assistant:delta'; text: string }
|
||||
| { type: 'tool:start'; toolCallId: string; toolName: string; toolInput: Record<string, unknown> }
|
||||
| { type: 'tool:result'; toolCallId: string; output: string; isError: boolean }
|
||||
| { type: 'result'; sessionId: string; cost: MessageCost }
|
||||
| { type: 'sync:messages'; sessionId: string; messages: Message[]; isGenerating: boolean; streamingText: string }
|
||||
| { type: 'error'; message: string; errorCode?: string }
|
||||
| { type: 'stopped' };
|
||||
|
||||
export type Message = {
|
||||
id: string;
|
||||
timestamp: number;
|
||||
role: 'user' | 'assistant' | 'tool';
|
||||
text?: string;
|
||||
model?: string;
|
||||
cost?: MessageCost;
|
||||
toolCallId?: string;
|
||||
toolName?: string;
|
||||
toolInput?: Record<string, unknown>;
|
||||
output?: string;
|
||||
isError?: boolean;
|
||||
};
|
||||
|
||||
// Legacy type aliases for backward compatibility during migration
|
||||
// TODO: Remove after Phase 9 cleanup
|
||||
|
||||
/** @deprecated Use SessionEntry instead */
|
||||
export type LegacySessionEntry = {
|
||||
id: string;
|
||||
title: string;
|
||||
createdAt: number;
|
||||
@@ -6,7 +84,8 @@ export type SessionEntry = {
|
||||
model?: string | null;
|
||||
};
|
||||
|
||||
export type ChatMessage =
|
||||
/** @deprecated Use ChatMessage with toolCallId instead */
|
||||
export type LegacyChatMessage =
|
||||
| { role: 'user'; text: string; images?: { filename: string; dataUrl: string }[] }
|
||||
| { role: 'assistant'; text: string }
|
||||
| { role: 'system'; text: string }
|
||||
@@ -21,14 +100,8 @@ export type ChatMessage =
|
||||
| { role: 'result'; costUsd: number; durationMs: number; numTurns: number; isError: boolean }
|
||||
| { role: 'error'; text: string };
|
||||
|
||||
export type TaskInfo = {
|
||||
taskName: string;
|
||||
taskDirName: string;
|
||||
entryName: string;
|
||||
entryType: 'file' | 'directory';
|
||||
};
|
||||
|
||||
export type ServerMessage =
|
||||
/** @deprecated Use ServerMessage instead */
|
||||
export type LegacyServerMessage =
|
||||
| { type: 'session:init'; sessionId: string; model: string | null }
|
||||
| { type: 'system:prompt'; text: string }
|
||||
| { type: 'assistant:text'; text: string }
|
||||
@@ -38,4 +111,4 @@ export type ServerMessage =
|
||||
| { type: 'result'; costUsd: number; durationMs: number; numTurns: number; isError: boolean }
|
||||
| { type: 'error'; message: string }
|
||||
| { type: 'stopped' }
|
||||
| { type: 'messages:sync'; messages: ChatMessage[]; streamingText: string; isGenerating: boolean };
|
||||
| { type: 'messages:sync'; messages: LegacyChatMessage[]; streamingText: string; isGenerating: boolean };
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
export const config = {
|
||||
AUTH_URL: '/api/auth',
|
||||
API_URL: '/api',
|
||||
GAN_URL: '/api/gan',
|
||||
STATISTICS_URL: '/api/statistics',
|
||||
FILES_URL: '/api/files',
|
||||
WS_URL: '/api/ws',
|
||||
BILLING_URL: '/api/billing',
|
||||
EXPERIMENTS_URL: '/api/experiments',
|
||||
TRACKING_URL: '/api/tracking',
|
||||
BUILD_ENV: 'development',
|
||||
ENV: 'development',
|
||||
GOOGLE_AUTH_CLIENT_ID: '306475690020-b6j9ml8puphfi8261g7jv3hgsc1vc3l7.apps.googleusercontent.com',
|
||||
AUTH_URL: '',
|
||||
API_URL: '',
|
||||
GAN_URL: '',
|
||||
STATISTICS_URL: '',
|
||||
FILES_URL: '',
|
||||
WS_URL: '',
|
||||
BILLING_URL: '',
|
||||
EXPERIMENTS_URL: '',
|
||||
TRACKING_URL: '',
|
||||
BUILD_ENV: '',
|
||||
ENV: '',
|
||||
GOOGLE_AUTH_CLIENT_ID: '',
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user