返回 DeepSeek-Reasonix
sessionCatalogTypes.ts
根目录 / desktop / frontend / src / lib / sessionCatalogTypes.ts
1 import type { ProjectNode } from "./types";
2
3 export interface SessionCatalogStatus {
4 state: "opening" | "ready" | "degraded" | "rebuilding" | "closed" | string;
5 mode?: "disk" | "memory" | string;
6 revision: number;
7 indexed: number;
8 total: number;
9 repairPending: number;
10 repairActive?: number;
11 repairDeferred?: number;
12 repairBlocked?: number;
13 nextRepairAt?: number;
14 repairReason?: string;
15 sourceCount?: number;
16 unindexedTargetCount?: number;
17 lastRepairAt?: number;
18 canRebuild?: boolean;
19 lastError?: string;
20 quarantinedPath?: string;
21 }
22
23 export interface ProjectTreeSnapshot {
24 revision: number;
25 workspaceGeneration?: number | null;
26 projects: ProjectNode[];
27 catalog: SessionCatalogStatus;
28 indexed: number;
29 total: number;
30 indexingDone: boolean;
31 }
32
33 export interface ProjectTopicPageRequest {
34 scope: "global" | "project" | string;
35 workspaceRoot?: string;
36 cursor?: string;
37 limit?: number;
38 query?: string;
39 timeFilter?: string;
40 sortMode?: "created" | "updated" | string;
41 groupFilter?: "all" | "ungrouped" | "group" | string;
42 groupId?: string;
43 excludePinned?: boolean;
44 }
45
46 export interface ProjectTopicPage {
47 snapshotId?: string;
48 snapshotExpiresAt?: number;
49 replacedSnapshot?: boolean;
50 items: ProjectNode[];
51 nextCursor?: string;
52 revision: number;
53 complete?: boolean;
54 readyDirectories?: number;
55 pendingDirectories?: number;
56 failedDirectories?: number;
57 }
58
59 export interface ProjectTopicKey {
60 scope: "global" | "project" | string;
61 workspaceRoot?: string;
62 topicId: string;
63 path?: string;
64 recordClassification?: boolean;
65 }
66
67 export interface ProjectTreeChangedV2 {
68 revision: number;
69 roots: string[];
70 reason: string;
71 }
72
73 export interface ProjectRuntimeTopic {
74 scope: "global" | "project" | string;
75 workspaceRoot?: string;
76 node: ProjectNode;
77 }
78
79 export interface ProjectTreeRuntimeSnapshot {
80 revision: number;
81 topics: ProjectRuntimeTopic[];
82 }
83
84 export interface SessionGroup {
85 id: string;
86 title: string;
87 topicIds?: string[];
88 sessionKeys?: string[];
89 excludedSessionKeys?: string[];
90 }
91
92 export interface ProjectGroupsSnapshot {
93 groups: SessionGroup[];
94 revision: number;
95 applied: boolean;
96 }
97
98 export interface SessionCatalogBindings {
99 ReleaseReadSnapshot?(snapshotId: string): Promise<void>;
100 GetRuntimeStateSnapshot?(): Promise<import("./runtimeStateStore").RuntimeProjection>;
101 SyncRuntimeState?(): Promise<import("./runtimeStateStore").RuntimeProjection>;
102 GetProjectTreeSnapshot(): Promise<ProjectTreeSnapshot>;
103 GetProjectTreeRuntimeSnapshot?(): Promise<ProjectTreeRuntimeSnapshot>;
104 ListProjectTopics(req: ProjectTopicPageRequest): Promise<ProjectTopicPage>;
105 GetTopicSummary(key: ProjectTopicKey): Promise<ProjectNode>;
106 GetSessionCatalogStatus(): Promise<SessionCatalogStatus>;
107 RebuildSessionCatalog(): Promise<void>;
108 }
109
110 export interface ProjectTreeOrganizationBindings {
111 GetSessionOrganization?(workspace: import("../generated/desktopContract.generated").SessionOrganizationWorkspace): Promise<import("../generated/desktopContract.generated").SessionOrganizationSnapshot>;
112 UpdateSessionOrganization?(workspace: import("../generated/desktopContract.generated").SessionOrganizationWorkspace, expectedRevision: number,
113 mutation: import("../generated/desktopContract.generated").SessionOrganizationMutation): Promise<import("../generated/desktopContract.generated").SessionOrganizationSnapshot>;
114 ReorderTopics(scope: string, workspaceRoot: string, orderedTopicIDs: string[]): Promise<void>;
115 ReorderSessions?(scope: string, workspaceRoot: string, orderedSessionKeys: string[]): Promise<void>;
116 ListProjectGroups(scope: string, workspaceRoot: string): Promise<SessionGroup[]>;
117 SaveSessionGroups(scope: string, workspaceRoot: string, groups: SessionGroup[]): Promise<void>;
118 GetProjectGroups?(scope: string, workspaceRoot: string): Promise<ProjectGroupsSnapshot>;
119 SaveSessionGroupsVersioned?(
120 scope: string,
121 workspaceRoot: string,
122 expectedRevision: number,
123 groups: SessionGroup[],
124 ): Promise<ProjectGroupsSnapshot>;
125 }
126
127 // SessionReference is a session selected via @ past:chats for context injection.
128 export interface SessionReference {
129 path: string;
130 title: string;
131 preview?: string;
132 turns?: number;
133 turnsState?: "unknown" | "valid" | "corrupt" | string;
134 createdAt?: number;
135 lastActivityAt?: number;
136 }
137
137 lines TYPESCRIPT