codebuff 1.0.169 → 1.0.170
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-runner.js +17 -7
- package/dist/browser-runner.js.map +1 -1
- package/dist/chat-storage.d.ts +2 -27
- package/dist/chat-storage.js +73 -139
- package/dist/chat-storage.js.map +1 -1
- package/dist/checkpoint-file-manager.d.ts +8 -0
- package/dist/checkpoint-file-manager.js +125 -0
- package/dist/checkpoint-file-manager.js.map +1 -0
- package/dist/checkpoints.d.ts +61 -0
- package/dist/checkpoints.js +171 -0
- package/dist/checkpoints.js.map +1 -0
- package/dist/cli.d.ts +7 -8
- package/dist/cli.js +127 -155
- package/dist/cli.js.map +1 -1
- package/dist/client.d.ts +179 -28
- package/dist/client.js +154 -150
- package/dist/client.js.map +1 -1
- package/dist/code-map/languages.js +17 -7
- package/dist/code-map/languages.js.map +1 -1
- package/dist/code-map/parse.js +17 -7
- package/dist/code-map/parse.js.map +1 -1
- package/dist/code-map/tsconfig.tsbuildinfo +1 -1
- package/dist/common/actions.d.ts +2121 -560
- package/dist/common/actions.js +58 -81
- package/dist/common/actions.js.map +1 -1
- package/dist/common/constants/tools.d.ts +13 -0
- package/dist/common/constants/tools.js +22 -0
- package/dist/common/constants/tools.js.map +1 -0
- package/dist/common/constants.d.ts +0 -1
- package/dist/common/constants.js +3 -3
- package/dist/common/constants.js.map +1 -1
- package/dist/common/logger.d.ts +1 -0
- package/dist/common/logger.js +7 -0
- package/dist/common/logger.js.map +1 -0
- package/dist/common/types/agent-state.d.ts +461 -0
- package/dist/common/types/agent-state.js +30 -0
- package/dist/common/types/agent-state.js.map +1 -0
- package/dist/common/types/message.d.ts +311 -0
- package/dist/common/types/message.js +54 -0
- package/dist/common/types/message.js.map +1 -0
- package/dist/common/types/tools.d.ts +5 -0
- package/dist/common/types/tools.js +3 -0
- package/dist/common/types/tools.js.map +1 -0
- package/dist/common/util/changes.js +3 -3
- package/dist/common/util/changes.js.map +1 -1
- package/dist/common/util/constants.d.ts +1 -0
- package/dist/common/util/constants.js +7 -0
- package/dist/common/util/constants.js.map +1 -0
- package/dist/common/util/credentials.d.ts +4 -4
- package/dist/common/util/file.d.ts +6 -2
- package/dist/common/util/file.js +25 -24
- package/dist/common/util/file.js.map +1 -1
- package/dist/common/util/git.js +1 -1
- package/dist/common/util/git.js.map +1 -1
- package/dist/common/util/helpers.d.ts +1 -0
- package/dist/common/util/helpers.js +6 -0
- package/dist/common/util/helpers.js.map +1 -0
- package/dist/common/util/messages.d.ts +1 -1
- package/dist/common/util/promise.d.ts +8 -0
- package/dist/common/util/promise.js +25 -2
- package/dist/common/util/promise.js.map +1 -1
- package/dist/common/util/saxy.d.ts +158 -0
- package/dist/common/util/saxy.js +450 -0
- package/dist/common/util/saxy.js.map +1 -0
- package/dist/common/util/string.d.ts +13 -0
- package/dist/common/util/string.js +21 -1
- package/dist/common/util/string.js.map +1 -1
- package/dist/common/util/token-counter.d.ts +3 -0
- package/dist/common/util/token-counter.js +27 -0
- package/dist/common/util/token-counter.js.map +1 -0
- package/dist/common/websockets/websocket-schema.d.ts +3646 -530
- package/dist/create-template-project.js +17 -7
- package/dist/create-template-project.js.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/menu.js +31 -19
- package/dist/menu.js.map +1 -1
- package/dist/project-files.d.ts +40 -2
- package/dist/project-files.js +94 -34
- package/dist/project-files.js.map +1 -1
- package/dist/tool-handlers.d.ts +21 -7
- package/dist/tool-handlers.js +99 -37
- package/dist/tool-handlers.js.map +1 -1
- package/dist/utils/__tests__/xml-stream-parser.test.js +221 -0
- package/dist/utils/__tests__/xml-stream-parser.test.js.map +1 -0
- package/dist/utils/spinner.d.ts +1 -0
- package/dist/utils/spinner.js +28 -7
- package/dist/utils/spinner.js.map +1 -1
- package/dist/utils/terminal.d.ts +23 -3
- package/dist/utils/terminal.js +68 -45
- package/dist/utils/terminal.js.map +1 -1
- package/dist/utils/tool-renderers.d.ts +16 -0
- package/dist/utils/tool-renderers.js +105 -0
- package/dist/utils/tool-renderers.js.map +1 -0
- package/dist/utils/xml-stream-parser.d.ts +9 -0
- package/dist/utils/xml-stream-parser.js +128 -0
- package/dist/utils/xml-stream-parser.js.map +1 -0
- package/dist/worker-script-project-context.js +1 -1
- package/dist/worker-script-project-context.js.map +1 -1
- package/package.json +2 -1
- package/dist/__tests__/browser-runner.test.js +0 -15
- package/dist/__tests__/browser-runner.test.js.map +0 -1
- /package/dist/{__tests__/browser-runner.test.d.ts → utils/__tests__/xml-stream-parser.test.d.ts} +0 -0
|
@@ -0,0 +1,461 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ProjectFileContext } from '../util/file';
|
|
3
|
+
export declare const ToolCallSchema: z.ZodObject<{
|
|
4
|
+
name: z.ZodString;
|
|
5
|
+
parameters: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
6
|
+
id: z.ZodString;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
name: string;
|
|
9
|
+
id: string;
|
|
10
|
+
parameters: Record<string, string>;
|
|
11
|
+
}, {
|
|
12
|
+
name: string;
|
|
13
|
+
id: string;
|
|
14
|
+
parameters: Record<string, string>;
|
|
15
|
+
}>;
|
|
16
|
+
export type ToolCall = z.infer<typeof ToolCallSchema>;
|
|
17
|
+
export declare const ToolResultSchema: z.ZodObject<{
|
|
18
|
+
name: z.ZodString;
|
|
19
|
+
result: z.ZodString;
|
|
20
|
+
id: z.ZodString;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
name: string;
|
|
23
|
+
id: string;
|
|
24
|
+
result: string;
|
|
25
|
+
}, {
|
|
26
|
+
name: string;
|
|
27
|
+
id: string;
|
|
28
|
+
result: string;
|
|
29
|
+
}>;
|
|
30
|
+
export type ToolResult = z.infer<typeof ToolResultSchema>;
|
|
31
|
+
export declare const AgentStateSchema: z.ZodObject<{
|
|
32
|
+
agentContext: z.ZodString;
|
|
33
|
+
fileContext: z.ZodObject<{
|
|
34
|
+
currentWorkingDirectory: z.ZodString;
|
|
35
|
+
fileTree: z.ZodArray<z.ZodType<import("../util/file").FileTreeNode, z.ZodTypeDef, import("../util/file").FileTreeNode>, "many">;
|
|
36
|
+
fileTokenScores: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
37
|
+
knowledgeFiles: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
38
|
+
userKnowledgeFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
39
|
+
gitChanges: z.ZodObject<{
|
|
40
|
+
status: z.ZodString;
|
|
41
|
+
diff: z.ZodString;
|
|
42
|
+
diffCached: z.ZodString;
|
|
43
|
+
lastCommitMessages: z.ZodString;
|
|
44
|
+
}, "strip", z.ZodTypeAny, {
|
|
45
|
+
status: string;
|
|
46
|
+
diff: string;
|
|
47
|
+
diffCached: string;
|
|
48
|
+
lastCommitMessages: string;
|
|
49
|
+
}, {
|
|
50
|
+
status: string;
|
|
51
|
+
diff: string;
|
|
52
|
+
diffCached: string;
|
|
53
|
+
lastCommitMessages: string;
|
|
54
|
+
}>;
|
|
55
|
+
changesSinceLastChat: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
56
|
+
shellConfigFiles: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
57
|
+
systemInfo: z.ZodObject<{
|
|
58
|
+
platform: z.ZodString;
|
|
59
|
+
shell: z.ZodString;
|
|
60
|
+
nodeVersion: z.ZodString;
|
|
61
|
+
arch: z.ZodString;
|
|
62
|
+
homedir: z.ZodString;
|
|
63
|
+
cpus: z.ZodNumber;
|
|
64
|
+
}, "strip", z.ZodTypeAny, {
|
|
65
|
+
platform: string;
|
|
66
|
+
shell: string;
|
|
67
|
+
nodeVersion: string;
|
|
68
|
+
arch: string;
|
|
69
|
+
homedir: string;
|
|
70
|
+
cpus: number;
|
|
71
|
+
}, {
|
|
72
|
+
platform: string;
|
|
73
|
+
shell: string;
|
|
74
|
+
nodeVersion: string;
|
|
75
|
+
arch: string;
|
|
76
|
+
homedir: string;
|
|
77
|
+
cpus: number;
|
|
78
|
+
}>;
|
|
79
|
+
fileVersions: z.ZodArray<z.ZodArray<z.ZodObject<{
|
|
80
|
+
path: z.ZodString;
|
|
81
|
+
content: z.ZodString;
|
|
82
|
+
}, "strip", z.ZodTypeAny, {
|
|
83
|
+
path: string;
|
|
84
|
+
content: string;
|
|
85
|
+
}, {
|
|
86
|
+
path: string;
|
|
87
|
+
content: string;
|
|
88
|
+
}>, "many">, "many">;
|
|
89
|
+
}, "strip", z.ZodTypeAny, {
|
|
90
|
+
currentWorkingDirectory: string;
|
|
91
|
+
fileTree: import("../util/file").FileTreeNode[];
|
|
92
|
+
fileTokenScores: Record<string, Record<string, number>>;
|
|
93
|
+
knowledgeFiles: Record<string, string>;
|
|
94
|
+
gitChanges: {
|
|
95
|
+
status: string;
|
|
96
|
+
diff: string;
|
|
97
|
+
diffCached: string;
|
|
98
|
+
lastCommitMessages: string;
|
|
99
|
+
};
|
|
100
|
+
changesSinceLastChat: Record<string, string>;
|
|
101
|
+
shellConfigFiles: Record<string, string>;
|
|
102
|
+
systemInfo: {
|
|
103
|
+
platform: string;
|
|
104
|
+
shell: string;
|
|
105
|
+
nodeVersion: string;
|
|
106
|
+
arch: string;
|
|
107
|
+
homedir: string;
|
|
108
|
+
cpus: number;
|
|
109
|
+
};
|
|
110
|
+
fileVersions: {
|
|
111
|
+
path: string;
|
|
112
|
+
content: string;
|
|
113
|
+
}[][];
|
|
114
|
+
userKnowledgeFiles?: Record<string, string> | undefined;
|
|
115
|
+
}, {
|
|
116
|
+
currentWorkingDirectory: string;
|
|
117
|
+
fileTree: import("../util/file").FileTreeNode[];
|
|
118
|
+
fileTokenScores: Record<string, Record<string, number>>;
|
|
119
|
+
knowledgeFiles: Record<string, string>;
|
|
120
|
+
gitChanges: {
|
|
121
|
+
status: string;
|
|
122
|
+
diff: string;
|
|
123
|
+
diffCached: string;
|
|
124
|
+
lastCommitMessages: string;
|
|
125
|
+
};
|
|
126
|
+
changesSinceLastChat: Record<string, string>;
|
|
127
|
+
shellConfigFiles: Record<string, string>;
|
|
128
|
+
systemInfo: {
|
|
129
|
+
platform: string;
|
|
130
|
+
shell: string;
|
|
131
|
+
nodeVersion: string;
|
|
132
|
+
arch: string;
|
|
133
|
+
homedir: string;
|
|
134
|
+
cpus: number;
|
|
135
|
+
};
|
|
136
|
+
fileVersions: {
|
|
137
|
+
path: string;
|
|
138
|
+
content: string;
|
|
139
|
+
}[][];
|
|
140
|
+
userKnowledgeFiles?: Record<string, string> | undefined;
|
|
141
|
+
}>;
|
|
142
|
+
messageHistory: z.ZodArray<z.ZodObject<{
|
|
143
|
+
role: z.ZodUnion<[z.ZodLiteral<"user">, z.ZodLiteral<"assistant">]>;
|
|
144
|
+
content: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
145
|
+
type: z.ZodLiteral<"text">;
|
|
146
|
+
text: z.ZodString;
|
|
147
|
+
cache_control: z.ZodOptional<z.ZodObject<{
|
|
148
|
+
type: z.ZodLiteral<"ephemeral">;
|
|
149
|
+
}, "strip", z.ZodTypeAny, {
|
|
150
|
+
type: "ephemeral";
|
|
151
|
+
}, {
|
|
152
|
+
type: "ephemeral";
|
|
153
|
+
}>>;
|
|
154
|
+
}, "strip", z.ZodTypeAny, {
|
|
155
|
+
type: "text";
|
|
156
|
+
text: string;
|
|
157
|
+
cache_control?: {
|
|
158
|
+
type: "ephemeral";
|
|
159
|
+
} | undefined;
|
|
160
|
+
}, {
|
|
161
|
+
type: "text";
|
|
162
|
+
text: string;
|
|
163
|
+
cache_control?: {
|
|
164
|
+
type: "ephemeral";
|
|
165
|
+
} | undefined;
|
|
166
|
+
}>, z.ZodObject<{
|
|
167
|
+
type: z.ZodLiteral<"tool_use">;
|
|
168
|
+
id: z.ZodString;
|
|
169
|
+
name: z.ZodString;
|
|
170
|
+
input: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
171
|
+
cache_control: z.ZodOptional<z.ZodObject<{
|
|
172
|
+
type: z.ZodLiteral<"ephemeral">;
|
|
173
|
+
}, "strip", z.ZodTypeAny, {
|
|
174
|
+
type: "ephemeral";
|
|
175
|
+
}, {
|
|
176
|
+
type: "ephemeral";
|
|
177
|
+
}>>;
|
|
178
|
+
}, "strip", z.ZodTypeAny, {
|
|
179
|
+
type: "tool_use";
|
|
180
|
+
name: string;
|
|
181
|
+
id: string;
|
|
182
|
+
input: Record<string, any>;
|
|
183
|
+
cache_control?: {
|
|
184
|
+
type: "ephemeral";
|
|
185
|
+
} | undefined;
|
|
186
|
+
}, {
|
|
187
|
+
type: "tool_use";
|
|
188
|
+
name: string;
|
|
189
|
+
id: string;
|
|
190
|
+
input: Record<string, any>;
|
|
191
|
+
cache_control?: {
|
|
192
|
+
type: "ephemeral";
|
|
193
|
+
} | undefined;
|
|
194
|
+
}>, z.ZodObject<{
|
|
195
|
+
type: z.ZodLiteral<"tool_result">;
|
|
196
|
+
tool_use_id: z.ZodString;
|
|
197
|
+
content: z.ZodString;
|
|
198
|
+
cache_control: z.ZodOptional<z.ZodObject<{
|
|
199
|
+
type: z.ZodLiteral<"ephemeral">;
|
|
200
|
+
}, "strip", z.ZodTypeAny, {
|
|
201
|
+
type: "ephemeral";
|
|
202
|
+
}, {
|
|
203
|
+
type: "ephemeral";
|
|
204
|
+
}>>;
|
|
205
|
+
}, "strip", z.ZodTypeAny, {
|
|
206
|
+
content: string;
|
|
207
|
+
type: "tool_result";
|
|
208
|
+
tool_use_id: string;
|
|
209
|
+
cache_control?: {
|
|
210
|
+
type: "ephemeral";
|
|
211
|
+
} | undefined;
|
|
212
|
+
}, {
|
|
213
|
+
content: string;
|
|
214
|
+
type: "tool_result";
|
|
215
|
+
tool_use_id: string;
|
|
216
|
+
cache_control?: {
|
|
217
|
+
type: "ephemeral";
|
|
218
|
+
} | undefined;
|
|
219
|
+
}>, z.ZodObject<{
|
|
220
|
+
type: z.ZodLiteral<"image">;
|
|
221
|
+
source: z.ZodObject<{
|
|
222
|
+
type: z.ZodLiteral<"base64">;
|
|
223
|
+
media_type: z.ZodLiteral<"image/jpeg">;
|
|
224
|
+
data: z.ZodString;
|
|
225
|
+
}, "strip", z.ZodTypeAny, {
|
|
226
|
+
type: "base64";
|
|
227
|
+
media_type: "image/jpeg";
|
|
228
|
+
data: string;
|
|
229
|
+
}, {
|
|
230
|
+
type: "base64";
|
|
231
|
+
media_type: "image/jpeg";
|
|
232
|
+
data: string;
|
|
233
|
+
}>;
|
|
234
|
+
cache_control: z.ZodOptional<z.ZodObject<{
|
|
235
|
+
type: z.ZodLiteral<"ephemeral">;
|
|
236
|
+
}, "strip", z.ZodTypeAny, {
|
|
237
|
+
type: "ephemeral";
|
|
238
|
+
}, {
|
|
239
|
+
type: "ephemeral";
|
|
240
|
+
}>>;
|
|
241
|
+
}, "strip", z.ZodTypeAny, {
|
|
242
|
+
type: "image";
|
|
243
|
+
source: {
|
|
244
|
+
type: "base64";
|
|
245
|
+
media_type: "image/jpeg";
|
|
246
|
+
data: string;
|
|
247
|
+
};
|
|
248
|
+
cache_control?: {
|
|
249
|
+
type: "ephemeral";
|
|
250
|
+
} | undefined;
|
|
251
|
+
}, {
|
|
252
|
+
type: "image";
|
|
253
|
+
source: {
|
|
254
|
+
type: "base64";
|
|
255
|
+
media_type: "image/jpeg";
|
|
256
|
+
data: string;
|
|
257
|
+
};
|
|
258
|
+
cache_control?: {
|
|
259
|
+
type: "ephemeral";
|
|
260
|
+
} | undefined;
|
|
261
|
+
}>]>, "many">]>;
|
|
262
|
+
}, "strip", z.ZodTypeAny, {
|
|
263
|
+
content: string | ({
|
|
264
|
+
type: "text";
|
|
265
|
+
text: string;
|
|
266
|
+
cache_control?: {
|
|
267
|
+
type: "ephemeral";
|
|
268
|
+
} | undefined;
|
|
269
|
+
} | {
|
|
270
|
+
type: "tool_use";
|
|
271
|
+
name: string;
|
|
272
|
+
id: string;
|
|
273
|
+
input: Record<string, any>;
|
|
274
|
+
cache_control?: {
|
|
275
|
+
type: "ephemeral";
|
|
276
|
+
} | undefined;
|
|
277
|
+
} | {
|
|
278
|
+
content: string;
|
|
279
|
+
type: "tool_result";
|
|
280
|
+
tool_use_id: string;
|
|
281
|
+
cache_control?: {
|
|
282
|
+
type: "ephemeral";
|
|
283
|
+
} | undefined;
|
|
284
|
+
} | {
|
|
285
|
+
type: "image";
|
|
286
|
+
source: {
|
|
287
|
+
type: "base64";
|
|
288
|
+
media_type: "image/jpeg";
|
|
289
|
+
data: string;
|
|
290
|
+
};
|
|
291
|
+
cache_control?: {
|
|
292
|
+
type: "ephemeral";
|
|
293
|
+
} | undefined;
|
|
294
|
+
})[];
|
|
295
|
+
role: "user" | "assistant";
|
|
296
|
+
}, {
|
|
297
|
+
content: string | ({
|
|
298
|
+
type: "text";
|
|
299
|
+
text: string;
|
|
300
|
+
cache_control?: {
|
|
301
|
+
type: "ephemeral";
|
|
302
|
+
} | undefined;
|
|
303
|
+
} | {
|
|
304
|
+
type: "tool_use";
|
|
305
|
+
name: string;
|
|
306
|
+
id: string;
|
|
307
|
+
input: Record<string, any>;
|
|
308
|
+
cache_control?: {
|
|
309
|
+
type: "ephemeral";
|
|
310
|
+
} | undefined;
|
|
311
|
+
} | {
|
|
312
|
+
content: string;
|
|
313
|
+
type: "tool_result";
|
|
314
|
+
tool_use_id: string;
|
|
315
|
+
cache_control?: {
|
|
316
|
+
type: "ephemeral";
|
|
317
|
+
} | undefined;
|
|
318
|
+
} | {
|
|
319
|
+
type: "image";
|
|
320
|
+
source: {
|
|
321
|
+
type: "base64";
|
|
322
|
+
media_type: "image/jpeg";
|
|
323
|
+
data: string;
|
|
324
|
+
};
|
|
325
|
+
cache_control?: {
|
|
326
|
+
type: "ephemeral";
|
|
327
|
+
} | undefined;
|
|
328
|
+
})[];
|
|
329
|
+
role: "user" | "assistant";
|
|
330
|
+
}>, "many">;
|
|
331
|
+
}, "strip", z.ZodTypeAny, {
|
|
332
|
+
agentContext: string;
|
|
333
|
+
fileContext: {
|
|
334
|
+
currentWorkingDirectory: string;
|
|
335
|
+
fileTree: import("../util/file").FileTreeNode[];
|
|
336
|
+
fileTokenScores: Record<string, Record<string, number>>;
|
|
337
|
+
knowledgeFiles: Record<string, string>;
|
|
338
|
+
gitChanges: {
|
|
339
|
+
status: string;
|
|
340
|
+
diff: string;
|
|
341
|
+
diffCached: string;
|
|
342
|
+
lastCommitMessages: string;
|
|
343
|
+
};
|
|
344
|
+
changesSinceLastChat: Record<string, string>;
|
|
345
|
+
shellConfigFiles: Record<string, string>;
|
|
346
|
+
systemInfo: {
|
|
347
|
+
platform: string;
|
|
348
|
+
shell: string;
|
|
349
|
+
nodeVersion: string;
|
|
350
|
+
arch: string;
|
|
351
|
+
homedir: string;
|
|
352
|
+
cpus: number;
|
|
353
|
+
};
|
|
354
|
+
fileVersions: {
|
|
355
|
+
path: string;
|
|
356
|
+
content: string;
|
|
357
|
+
}[][];
|
|
358
|
+
userKnowledgeFiles?: Record<string, string> | undefined;
|
|
359
|
+
};
|
|
360
|
+
messageHistory: {
|
|
361
|
+
content: string | ({
|
|
362
|
+
type: "text";
|
|
363
|
+
text: string;
|
|
364
|
+
cache_control?: {
|
|
365
|
+
type: "ephemeral";
|
|
366
|
+
} | undefined;
|
|
367
|
+
} | {
|
|
368
|
+
type: "tool_use";
|
|
369
|
+
name: string;
|
|
370
|
+
id: string;
|
|
371
|
+
input: Record<string, any>;
|
|
372
|
+
cache_control?: {
|
|
373
|
+
type: "ephemeral";
|
|
374
|
+
} | undefined;
|
|
375
|
+
} | {
|
|
376
|
+
content: string;
|
|
377
|
+
type: "tool_result";
|
|
378
|
+
tool_use_id: string;
|
|
379
|
+
cache_control?: {
|
|
380
|
+
type: "ephemeral";
|
|
381
|
+
} | undefined;
|
|
382
|
+
} | {
|
|
383
|
+
type: "image";
|
|
384
|
+
source: {
|
|
385
|
+
type: "base64";
|
|
386
|
+
media_type: "image/jpeg";
|
|
387
|
+
data: string;
|
|
388
|
+
};
|
|
389
|
+
cache_control?: {
|
|
390
|
+
type: "ephemeral";
|
|
391
|
+
} | undefined;
|
|
392
|
+
})[];
|
|
393
|
+
role: "user" | "assistant";
|
|
394
|
+
}[];
|
|
395
|
+
}, {
|
|
396
|
+
agentContext: string;
|
|
397
|
+
fileContext: {
|
|
398
|
+
currentWorkingDirectory: string;
|
|
399
|
+
fileTree: import("../util/file").FileTreeNode[];
|
|
400
|
+
fileTokenScores: Record<string, Record<string, number>>;
|
|
401
|
+
knowledgeFiles: Record<string, string>;
|
|
402
|
+
gitChanges: {
|
|
403
|
+
status: string;
|
|
404
|
+
diff: string;
|
|
405
|
+
diffCached: string;
|
|
406
|
+
lastCommitMessages: string;
|
|
407
|
+
};
|
|
408
|
+
changesSinceLastChat: Record<string, string>;
|
|
409
|
+
shellConfigFiles: Record<string, string>;
|
|
410
|
+
systemInfo: {
|
|
411
|
+
platform: string;
|
|
412
|
+
shell: string;
|
|
413
|
+
nodeVersion: string;
|
|
414
|
+
arch: string;
|
|
415
|
+
homedir: string;
|
|
416
|
+
cpus: number;
|
|
417
|
+
};
|
|
418
|
+
fileVersions: {
|
|
419
|
+
path: string;
|
|
420
|
+
content: string;
|
|
421
|
+
}[][];
|
|
422
|
+
userKnowledgeFiles?: Record<string, string> | undefined;
|
|
423
|
+
};
|
|
424
|
+
messageHistory: {
|
|
425
|
+
content: string | ({
|
|
426
|
+
type: "text";
|
|
427
|
+
text: string;
|
|
428
|
+
cache_control?: {
|
|
429
|
+
type: "ephemeral";
|
|
430
|
+
} | undefined;
|
|
431
|
+
} | {
|
|
432
|
+
type: "tool_use";
|
|
433
|
+
name: string;
|
|
434
|
+
id: string;
|
|
435
|
+
input: Record<string, any>;
|
|
436
|
+
cache_control?: {
|
|
437
|
+
type: "ephemeral";
|
|
438
|
+
} | undefined;
|
|
439
|
+
} | {
|
|
440
|
+
content: string;
|
|
441
|
+
type: "tool_result";
|
|
442
|
+
tool_use_id: string;
|
|
443
|
+
cache_control?: {
|
|
444
|
+
type: "ephemeral";
|
|
445
|
+
} | undefined;
|
|
446
|
+
} | {
|
|
447
|
+
type: "image";
|
|
448
|
+
source: {
|
|
449
|
+
type: "base64";
|
|
450
|
+
media_type: "image/jpeg";
|
|
451
|
+
data: string;
|
|
452
|
+
};
|
|
453
|
+
cache_control?: {
|
|
454
|
+
type: "ephemeral";
|
|
455
|
+
} | undefined;
|
|
456
|
+
})[];
|
|
457
|
+
role: "user" | "assistant";
|
|
458
|
+
}[];
|
|
459
|
+
}>;
|
|
460
|
+
export type AgentState = z.infer<typeof AgentStateSchema>;
|
|
461
|
+
export declare function getInitialAgentState(fileContext: ProjectFileContext): AgentState;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AgentStateSchema = exports.ToolResultSchema = exports.ToolCallSchema = void 0;
|
|
4
|
+
exports.getInitialAgentState = getInitialAgentState;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const file_1 = require("../util/file");
|
|
7
|
+
const message_1 = require("./message");
|
|
8
|
+
exports.ToolCallSchema = zod_1.z.object({
|
|
9
|
+
name: zod_1.z.string(),
|
|
10
|
+
parameters: zod_1.z.record(zod_1.z.string(), zod_1.z.string()),
|
|
11
|
+
id: zod_1.z.string(),
|
|
12
|
+
});
|
|
13
|
+
exports.ToolResultSchema = zod_1.z.object({
|
|
14
|
+
name: zod_1.z.string(),
|
|
15
|
+
result: zod_1.z.string(),
|
|
16
|
+
id: zod_1.z.string(),
|
|
17
|
+
});
|
|
18
|
+
exports.AgentStateSchema = zod_1.z.object({
|
|
19
|
+
agentContext: zod_1.z.string(),
|
|
20
|
+
fileContext: file_1.ProjectFileContextSchema,
|
|
21
|
+
messageHistory: zod_1.z.array(message_1.MessageSchema),
|
|
22
|
+
});
|
|
23
|
+
function getInitialAgentState(fileContext) {
|
|
24
|
+
return {
|
|
25
|
+
agentContext: '',
|
|
26
|
+
messageHistory: [],
|
|
27
|
+
fileContext,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=agent-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-state.js","sourceRoot":"","sources":["../../src/types/agent-state.ts"],"names":[],"mappings":";;;AAwBA,oDAQC;AAhCD,6BAAuB;AACvB,uCAA2E;AAC3E,uCAAyC;AAE5B,QAAA,cAAc,GAAG,OAAC,CAAC,MAAM,CAAC;IACrC,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,UAAU,EAAE,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,MAAM,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC;IAC5C,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;CACf,CAAC,CAAA;AAEW,QAAA,gBAAgB,GAAG,OAAC,CAAC,MAAM,CAAC;IACvC,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE;IAClB,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;CACf,CAAC,CAAA;AAGW,QAAA,gBAAgB,GAAG,OAAC,CAAC,MAAM,CAAC;IACvC,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE;IACxB,WAAW,EAAE,+BAAwB;IACrC,cAAc,EAAE,OAAC,CAAC,KAAK,CAAC,uBAAa,CAAC;CACvC,CAAC,CAAA;AAGF,SAAgB,oBAAoB,CAClC,WAA+B;IAE/B,OAAO;QACL,YAAY,EAAE,EAAE;QAChB,cAAc,EAAE,EAAE;QAClB,WAAW;KACZ,CAAA;AACH,CAAC"}
|