feat: implement PI core chat timeline

This commit is contained in:
2026-08-24 00:34:03 +08:00
parent 54d8bb2e4a
commit 612135f911
40 changed files with 3881 additions and 119 deletions

View File

@@ -1,21 +1,15 @@
import { randomUUID } from 'node:crypto';
import path from 'node:path';
import type { CodingConversationMetadata } from '../../shared/coding-project-contracts';
import type { ConversationModelState, ProductModelRef } from '../coding-runtime/contracts';
import { atomicWriteJson, readJsonFile, type JsonFileWriter } from './atomic-json';
import { normalizeProductModelRef } from './project-config';
export const CODING_CONVERSATIONS_PATH = '.niancode/conversations.json';
export interface CodingConversationV2 extends ConversationModelState {
id: string;
agentId: string;
title: string;
export interface CodingConversationV2 extends CodingConversationMetadata, ConversationModelState {
piSessionId?: string;
sessionKey?: string;
archivedAt: string | null;
unread: boolean;
createdAt: string;
updatedAt: string;
}
export interface CodingConversationFileV2 {

View File

@@ -6,6 +6,10 @@ import {
type ProjectAgentResponsibility,
type ProjectType,
} from '../../shared/project-config';
import type {
CodingProjectAgent,
CodingProjectConfig,
} from '../../shared/coding-project-contracts';
import type {
ConversationModelState,
ConversationThinkingLevel,
@@ -17,32 +21,11 @@ export const CODING_PROJECT_CONFIG_PATH = '.niancode/project.json';
export const LEGACY_CONVERSATION_NOTICE_VALUES = ['none', 'pending', 'acknowledged'] as const;
export type LegacyConversationNotice = (typeof LEGACY_CONVERSATION_NOTICE_VALUES)[number];
export interface CodingProjectAgentV2 extends ConversationModelState {
id: string;
avatarId: string;
avatarDataUrl?: string;
roleName: string;
name: string;
builtIn: boolean;
enabled: boolean;
skillIds: string[];
responsibility: ProjectAgentResponsibility;
prompt: string;
archivedAt: string | null;
pinned: boolean;
createdAt: string;
updatedAt: string;
}
export interface CodingProjectAgentV2 extends CodingProjectAgent, ConversationModelState {}
export interface CodingProjectConfigV2 {
schemaVersion: 2;
projectType: ProjectType;
initialized: boolean;
export interface CodingProjectConfigV2 extends CodingProjectConfig {
agents: CodingProjectAgentV2[];
knowledgeDirectory: 'knowledge';
legacyConversationNotice: LegacyConversationNotice;
createdAt: string;
updatedAt: string;
}
export type CodingProjectConfigReadResult =

View File

@@ -1,18 +1,14 @@
import { randomUUID } from 'node:crypto';
import path from 'node:path';
import type { ProjectType } from '../../shared/project-config';
import type { CodingProjectSummary } from '../../shared/coding-project-contracts';
import {
createCodingProjectMetadata,
type CodingProjectConfigV2,
} from './project-config';
export interface CodingProject {
id: string;
export interface CodingProject extends CodingProjectSummary {
path: string;
name: string;
createdAt: string;
updatedAt: string;
lastOpenedAt: string;
}
export interface CodingProjectStoreData {