Skip to content

Commit 98c207b

Browse files
committed
WIP
1 parent 1d5266b commit 98c207b

File tree

7 files changed

+145
-105
lines changed

7 files changed

+145
-105
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import type { ChatSuggestion } from '../suggestion';
2+
3+
export enum AgentType {
4+
ROOT = "root",
5+
USER = "user",
6+
}
7+
8+
export interface ChatConversation {
9+
id: string;
10+
agentType: AgentType;
11+
title: string | null;
12+
projectId: string;
13+
createdAt: Date;
14+
updatedAt: Date;
15+
suggestions: ChatSuggestion[];
16+
}

packages/models/src/chat/index.ts

Lines changed: 4 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,4 @@
1-
import type { Branch } from '../branching';
2-
import { z } from 'zod';
3-
4-
// Message Context Types
5-
export enum MessageContextType {
6-
FILE = 'file',
7-
HIGHLIGHT = 'highlight',
8-
IMAGE = 'image',
9-
ERROR = 'error',
10-
BRANCH = 'branch',
11-
AGENT_RULE = 'agent_rule',
12-
}
13-
14-
type BaseMessageContext = {
15-
type: MessageContextType;
16-
content: string;
17-
displayName: string;
18-
};
19-
20-
export type FileMessageContext = BaseMessageContext & {
21-
type: MessageContextType.FILE;
22-
path: string;
23-
branchId: string;
24-
};
25-
26-
export type HighlightMessageContext = BaseMessageContext & {
27-
type: MessageContextType.HIGHLIGHT;
28-
path: string;
29-
start: number;
30-
end: number;
31-
oid?: string;
32-
branchId: string;
33-
};
34-
35-
export type ImageMessageContext = BaseMessageContext & {
36-
type: MessageContextType.IMAGE;
37-
mimeType: string;
38-
id?: string;
39-
source: 'external' | 'local';
40-
path?: string;
41-
branchId?: string;
42-
};
43-
44-
export type ErrorMessageContext = BaseMessageContext & {
45-
type: MessageContextType.ERROR;
46-
branchId: string;
47-
};
48-
49-
export type BranchMessageContext = BaseMessageContext & {
50-
type: MessageContextType.BRANCH;
51-
branch: Branch;
52-
};
53-
54-
export type AgentRuleMessageContext = BaseMessageContext & {
55-
type: MessageContextType.AGENT_RULE;
56-
path: string;
57-
};
58-
59-
export type MessageContext =
60-
| FileMessageContext
61-
| HighlightMessageContext
62-
| ImageMessageContext
63-
| ErrorMessageContext
64-
| BranchMessageContext
65-
| AgentRuleMessageContext;
66-
67-
// Message Checkpoint Types
68-
export enum MessageCheckpointType {
69-
GIT = 'git',
70-
}
71-
72-
interface BaseMessageCheckpoint {
73-
type: MessageCheckpointType;
74-
createdAt: Date;
75-
}
76-
77-
export interface GitMessageCheckpoint extends BaseMessageCheckpoint {
78-
type: MessageCheckpointType.GIT;
79-
oid: string;
80-
branchId?: string;
81-
}
82-
83-
export type MessageCheckpoints = GitMessageCheckpoint;
84-
85-
// Agent Types
86-
export enum AgentType {
87-
ROOT = "root",
88-
USER = "user",
89-
}
90-
91-
// Chat Suggestion
92-
export interface ChatSuggestion {
93-
title: string;
94-
prompt: string;
95-
}
96-
97-
export const ChatSuggestionsSchema = z.object({
98-
suggestions: z.array(z.object({
99-
title: z.string(),
100-
prompt: z.string(),
101-
})),
102-
});
103-
104-
// Message parts type (generic - actual structure defined by AI SDK)
105-
export type MessagePart = any;
1+
export * from './conversation/';
2+
export * from './message/';
3+
export * from './response';
4+
export * from './suggestion';
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
export enum MessageCheckpointType {
2+
GIT = 'git',
3+
}
4+
5+
interface BaseMessageCheckpoint {
6+
type: MessageCheckpointType;
7+
createdAt: Date;
8+
}
9+
10+
export interface GitMessageCheckpoint extends BaseMessageCheckpoint {
11+
type: MessageCheckpointType.GIT;
12+
oid: string;
13+
branchId?: string;
14+
}
15+
16+
export type MessageCheckpoints = GitMessageCheckpoint;
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import type { Branch } from '../../project/branch';
2+
3+
export enum MessageContextType {
4+
FILE = 'file',
5+
HIGHLIGHT = 'highlight',
6+
IMAGE = 'image',
7+
ERROR = 'error',
8+
BRANCH = 'branch',
9+
AGENT_RULE = 'agent_rule',
10+
}
11+
12+
type BaseMessageContext = {
13+
type: MessageContextType;
14+
content: string;
15+
displayName: string;
16+
};
17+
18+
export type BranchMessageContext = BaseMessageContext & {
19+
type: MessageContextType.BRANCH;
20+
branch: Branch;
21+
};
22+
23+
export type FileMessageContext = BaseMessageContext & {
24+
type: MessageContextType.FILE;
25+
path: string;
26+
branchId: string;
27+
};
28+
29+
export type HighlightMessageContext = BaseMessageContext & {
30+
type: MessageContextType.HIGHLIGHT;
31+
path: string;
32+
start: number;
33+
end: number;
34+
oid?: string;
35+
branchId: string;
36+
};
37+
38+
export type ImageMessageContext = BaseMessageContext & {
39+
type: MessageContextType.IMAGE;
40+
mimeType: string;
41+
id?: string;
42+
source: 'external' | 'local';
43+
path?: string;
44+
branchId?: string;
45+
};
46+
47+
export type ErrorMessageContext = BaseMessageContext & {
48+
type: MessageContextType.ERROR;
49+
branchId: string;
50+
};
51+
52+
export type AgentRuleMessageContext = BaseMessageContext & {
53+
type: MessageContextType.AGENT_RULE;
54+
path: string;
55+
};
56+
57+
export type MessageContext =
58+
| HighlightMessageContext
59+
| ImageMessageContext
60+
| ErrorMessageContext
61+
| AgentRuleMessageContext
62+
| BranchMessageContext
63+
| FileMessageContext;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export * from './checkpoint';
2+
export * from './context';
3+
4+
// MessagePart type (generic - actual structure defined by AI SDK)
5+
export type MessagePart = any;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export interface Usage {
2+
period: 'day' | 'month';
3+
usageCount: number;
4+
limitCount: number;
5+
}
6+
7+
export interface UsageResult {
8+
daily: Usage;
9+
monthly: Usage;
10+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { z } from 'zod';
2+
3+
export interface ProjectSuggestions {
4+
id: string;
5+
projectId: string;
6+
suggestions: ChatSuggestion[];
7+
}
8+
9+
export interface ChatSuggestion {
10+
title: string;
11+
prompt: string;
12+
}
13+
14+
export const ChatSuggestionsSchema = z.object({
15+
suggestions: z
16+
.array(
17+
z.object({
18+
title: z
19+
.string()
20+
.describe(
21+
'The display title of the suggestion. This will be shown to the user. Keep it concise but descriptive.',
22+
),
23+
prompt: z
24+
.string()
25+
.describe(
26+
'The prompt for the suggestion. This will be used to generate the suggestion. Make this as detailed and specific as possible.',
27+
),
28+
}),
29+
)
30+
.length(3),
31+
});

0 commit comments

Comments
 (0)