codebuff 1.0.174 → 1.0.176

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.
Files changed (57) hide show
  1. package/dist/checkpoint-file-manager.d.ts +17 -5
  2. package/dist/checkpoint-file-manager.js +115 -77
  3. package/dist/checkpoint-file-manager.js.map +1 -1
  4. package/dist/checkpoints.d.ts +3 -2
  5. package/dist/checkpoints.js +20 -32
  6. package/dist/checkpoints.js.map +1 -1
  7. package/dist/cli.d.ts +0 -1
  8. package/dist/cli.js +24 -49
  9. package/dist/cli.js.map +1 -1
  10. package/dist/client.d.ts +13 -12
  11. package/dist/client.js +8 -1
  12. package/dist/client.js.map +1 -1
  13. package/dist/common/actions.d.ts +182 -182
  14. package/dist/common/browser-actions.d.ts +44 -44
  15. package/dist/common/constants.d.ts +0 -1
  16. package/dist/common/constants.js +1 -44
  17. package/dist/common/constants.js.map +1 -1
  18. package/dist/common/logger.d.ts +1 -0
  19. package/dist/common/logger.js +7 -0
  20. package/dist/common/logger.js.map +1 -0
  21. package/dist/common/project-file-tree.d.ts +1 -0
  22. package/dist/common/project-file-tree.js +3 -1
  23. package/dist/common/project-file-tree.js.map +1 -1
  24. package/dist/common/types/agent-state.d.ts +26 -26
  25. package/dist/common/types/message.d.ts +14 -14
  26. package/dist/common/types/usage.d.ts +2 -2
  27. package/dist/common/util/constants.d.ts +1 -0
  28. package/dist/common/util/constants.js +7 -0
  29. package/dist/common/util/constants.js.map +1 -0
  30. package/dist/common/util/credentials.d.ts +2 -2
  31. package/dist/common/util/helpers.d.ts +1 -0
  32. package/dist/common/util/helpers.js +6 -0
  33. package/dist/common/util/helpers.js.map +1 -0
  34. package/dist/common/util/token-counter.d.ts +3 -0
  35. package/dist/common/util/token-counter.js +27 -0
  36. package/dist/common/util/token-counter.js.map +1 -0
  37. package/dist/common/websockets/websocket-schema.d.ts +364 -364
  38. package/dist/index.js +1 -1
  39. package/dist/tool-handlers.d.ts +2 -1
  40. package/dist/tool-handlers.js +3 -3
  41. package/dist/tool-handlers.js.map +1 -1
  42. package/dist/utils/terminal.js +4 -40
  43. package/dist/utils/terminal.js.map +1 -1
  44. package/dist/utils/tool-renderers.js +14 -2
  45. package/dist/utils/tool-renderers.js.map +1 -1
  46. package/dist/worker-script-project-context.js +4 -4
  47. package/dist/worker-script-project-context.js.map +1 -1
  48. package/package.json +1 -1
  49. package/dist/common/advanced-analyzer.d.ts +0 -19
  50. package/dist/common/advanced-analyzer.js +0 -140
  51. package/dist/common/advanced-analyzer.js.map +0 -1
  52. package/dist/common/message-image-handling.d.ts +0 -41
  53. package/dist/common/message-image-handling.js +0 -57
  54. package/dist/common/message-image-handling.js.map +0 -1
  55. package/dist/common/util/process-stream.d.ts +0 -8
  56. package/dist/common/util/process-stream.js +0 -102
  57. package/dist/common/util/process-stream.js.map +0 -1
@@ -5,12 +5,12 @@ export declare const ToolCallSchema: z.ZodObject<{
5
5
  parameters: z.ZodRecord<z.ZodString, z.ZodString>;
6
6
  id: z.ZodString;
7
7
  }, "strip", z.ZodTypeAny, {
8
- id: string;
9
8
  name: string;
9
+ id: string;
10
10
  parameters: Record<string, string>;
11
11
  }, {
12
- id: string;
13
12
  name: string;
13
+ id: string;
14
14
  parameters: Record<string, string>;
15
15
  }>;
16
16
  export type ToolCall = z.infer<typeof ToolCallSchema>;
@@ -19,12 +19,12 @@ export declare const ToolResultSchema: z.ZodObject<{
19
19
  result: z.ZodString;
20
20
  id: z.ZodString;
21
21
  }, "strip", z.ZodTypeAny, {
22
- id: string;
23
22
  name: string;
23
+ id: string;
24
24
  result: string;
25
25
  }, {
26
- id: string;
27
26
  name: string;
27
+ id: string;
28
28
  result: string;
29
29
  }>;
30
30
  export type ToolResult = z.infer<typeof ToolResultSchema>;
@@ -42,13 +42,13 @@ export declare const AgentStateSchema: z.ZodObject<{
42
42
  diffCached: z.ZodString;
43
43
  lastCommitMessages: z.ZodString;
44
44
  }, "strip", z.ZodTypeAny, {
45
- diff: string;
46
45
  status: string;
46
+ diff: string;
47
47
  diffCached: string;
48
48
  lastCommitMessages: string;
49
49
  }, {
50
- diff: string;
51
50
  status: string;
51
+ diff: string;
52
52
  diffCached: string;
53
53
  lastCommitMessages: string;
54
54
  }>;
@@ -92,8 +92,8 @@ export declare const AgentStateSchema: z.ZodObject<{
92
92
  fileTokenScores: Record<string, Record<string, number>>;
93
93
  knowledgeFiles: Record<string, string>;
94
94
  gitChanges: {
95
- diff: string;
96
95
  status: string;
96
+ diff: string;
97
97
  diffCached: string;
98
98
  lastCommitMessages: string;
99
99
  };
@@ -118,8 +118,8 @@ export declare const AgentStateSchema: z.ZodObject<{
118
118
  fileTokenScores: Record<string, Record<string, number>>;
119
119
  knowledgeFiles: Record<string, string>;
120
120
  gitChanges: {
121
- diff: string;
122
121
  status: string;
122
+ diff: string;
123
123
  diffCached: string;
124
124
  lastCommitMessages: string;
125
125
  };
@@ -177,16 +177,16 @@ export declare const AgentStateSchema: z.ZodObject<{
177
177
  }>>;
178
178
  }, "strip", z.ZodTypeAny, {
179
179
  type: "tool_use";
180
- id: string;
181
180
  name: string;
181
+ id: string;
182
182
  input: Record<string, any>;
183
183
  cache_control?: {
184
184
  type: "ephemeral";
185
185
  } | undefined;
186
186
  }, {
187
187
  type: "tool_use";
188
- id: string;
189
188
  name: string;
189
+ id: string;
190
190
  input: Record<string, any>;
191
191
  cache_control?: {
192
192
  type: "ephemeral";
@@ -203,15 +203,15 @@ export declare const AgentStateSchema: z.ZodObject<{
203
203
  type: "ephemeral";
204
204
  }>>;
205
205
  }, "strip", z.ZodTypeAny, {
206
- type: "tool_result";
207
206
  content: string;
207
+ type: "tool_result";
208
208
  tool_use_id: string;
209
209
  cache_control?: {
210
210
  type: "ephemeral";
211
211
  } | undefined;
212
212
  }, {
213
- type: "tool_result";
214
213
  content: string;
214
+ type: "tool_result";
215
215
  tool_use_id: string;
216
216
  cache_control?: {
217
217
  type: "ephemeral";
@@ -260,7 +260,6 @@ export declare const AgentStateSchema: z.ZodObject<{
260
260
  } | undefined;
261
261
  }>]>, "many">]>;
262
262
  }, "strip", z.ZodTypeAny, {
263
- role: "user" | "assistant";
264
263
  content: string | ({
265
264
  type: "text";
266
265
  text: string;
@@ -269,15 +268,15 @@ export declare const AgentStateSchema: z.ZodObject<{
269
268
  } | undefined;
270
269
  } | {
271
270
  type: "tool_use";
272
- id: string;
273
271
  name: string;
272
+ id: string;
274
273
  input: Record<string, any>;
275
274
  cache_control?: {
276
275
  type: "ephemeral";
277
276
  } | undefined;
278
277
  } | {
279
- type: "tool_result";
280
278
  content: string;
279
+ type: "tool_result";
281
280
  tool_use_id: string;
282
281
  cache_control?: {
283
282
  type: "ephemeral";
@@ -293,8 +292,8 @@ export declare const AgentStateSchema: z.ZodObject<{
293
292
  type: "ephemeral";
294
293
  } | undefined;
295
294
  })[];
296
- }, {
297
295
  role: "user" | "assistant";
296
+ }, {
298
297
  content: string | ({
299
298
  type: "text";
300
299
  text: string;
@@ -303,15 +302,15 @@ export declare const AgentStateSchema: z.ZodObject<{
303
302
  } | undefined;
304
303
  } | {
305
304
  type: "tool_use";
306
- id: string;
307
305
  name: string;
306
+ id: string;
308
307
  input: Record<string, any>;
309
308
  cache_control?: {
310
309
  type: "ephemeral";
311
310
  } | undefined;
312
311
  } | {
313
- type: "tool_result";
314
312
  content: string;
313
+ type: "tool_result";
315
314
  tool_use_id: string;
316
315
  cache_control?: {
317
316
  type: "ephemeral";
@@ -327,6 +326,7 @@ export declare const AgentStateSchema: z.ZodObject<{
327
326
  type: "ephemeral";
328
327
  } | undefined;
329
328
  })[];
329
+ role: "user" | "assistant";
330
330
  }>, "many">;
331
331
  }, "strip", z.ZodTypeAny, {
332
332
  agentContext: string;
@@ -336,8 +336,8 @@ export declare const AgentStateSchema: z.ZodObject<{
336
336
  fileTokenScores: Record<string, Record<string, number>>;
337
337
  knowledgeFiles: Record<string, string>;
338
338
  gitChanges: {
339
- diff: string;
340
339
  status: string;
340
+ diff: string;
341
341
  diffCached: string;
342
342
  lastCommitMessages: string;
343
343
  };
@@ -358,7 +358,6 @@ export declare const AgentStateSchema: z.ZodObject<{
358
358
  userKnowledgeFiles?: Record<string, string> | undefined;
359
359
  };
360
360
  messageHistory: {
361
- role: "user" | "assistant";
362
361
  content: string | ({
363
362
  type: "text";
364
363
  text: string;
@@ -367,15 +366,15 @@ export declare const AgentStateSchema: z.ZodObject<{
367
366
  } | undefined;
368
367
  } | {
369
368
  type: "tool_use";
370
- id: string;
371
369
  name: string;
370
+ id: string;
372
371
  input: Record<string, any>;
373
372
  cache_control?: {
374
373
  type: "ephemeral";
375
374
  } | undefined;
376
375
  } | {
377
- type: "tool_result";
378
376
  content: string;
377
+ type: "tool_result";
379
378
  tool_use_id: string;
380
379
  cache_control?: {
381
380
  type: "ephemeral";
@@ -391,6 +390,7 @@ export declare const AgentStateSchema: z.ZodObject<{
391
390
  type: "ephemeral";
392
391
  } | undefined;
393
392
  })[];
393
+ role: "user" | "assistant";
394
394
  }[];
395
395
  }, {
396
396
  agentContext: string;
@@ -400,8 +400,8 @@ export declare const AgentStateSchema: z.ZodObject<{
400
400
  fileTokenScores: Record<string, Record<string, number>>;
401
401
  knowledgeFiles: Record<string, string>;
402
402
  gitChanges: {
403
- diff: string;
404
403
  status: string;
404
+ diff: string;
405
405
  diffCached: string;
406
406
  lastCommitMessages: string;
407
407
  };
@@ -422,7 +422,6 @@ export declare const AgentStateSchema: z.ZodObject<{
422
422
  userKnowledgeFiles?: Record<string, string> | undefined;
423
423
  };
424
424
  messageHistory: {
425
- role: "user" | "assistant";
426
425
  content: string | ({
427
426
  type: "text";
428
427
  text: string;
@@ -431,15 +430,15 @@ export declare const AgentStateSchema: z.ZodObject<{
431
430
  } | undefined;
432
431
  } | {
433
432
  type: "tool_use";
434
- id: string;
435
433
  name: string;
434
+ id: string;
436
435
  input: Record<string, any>;
437
436
  cache_control?: {
438
437
  type: "ephemeral";
439
438
  } | undefined;
440
439
  } | {
441
- type: "tool_result";
442
440
  content: string;
441
+ type: "tool_result";
443
442
  tool_use_id: string;
444
443
  cache_control?: {
445
444
  type: "ephemeral";
@@ -455,6 +454,7 @@ export declare const AgentStateSchema: z.ZodObject<{
455
454
  type: "ephemeral";
456
455
  } | undefined;
457
456
  })[];
457
+ role: "user" | "assistant";
458
458
  }[];
459
459
  }>;
460
460
  export type AgentState = z.infer<typeof AgentStateSchema>;
@@ -35,16 +35,16 @@ declare const MessageContentObjectSchema: z.ZodUnion<[z.ZodObject<{
35
35
  }>>;
36
36
  }, "strip", z.ZodTypeAny, {
37
37
  type: "tool_use";
38
- id: string;
39
38
  name: string;
39
+ id: string;
40
40
  input: Record<string, any>;
41
41
  cache_control?: {
42
42
  type: "ephemeral";
43
43
  } | undefined;
44
44
  }, {
45
45
  type: "tool_use";
46
- id: string;
47
46
  name: string;
47
+ id: string;
48
48
  input: Record<string, any>;
49
49
  cache_control?: {
50
50
  type: "ephemeral";
@@ -61,15 +61,15 @@ declare const MessageContentObjectSchema: z.ZodUnion<[z.ZodObject<{
61
61
  type: "ephemeral";
62
62
  }>>;
63
63
  }, "strip", z.ZodTypeAny, {
64
- type: "tool_result";
65
64
  content: string;
65
+ type: "tool_result";
66
66
  tool_use_id: string;
67
67
  cache_control?: {
68
68
  type: "ephemeral";
69
69
  } | undefined;
70
70
  }, {
71
- type: "tool_result";
72
71
  content: string;
72
+ type: "tool_result";
73
73
  tool_use_id: string;
74
74
  cache_control?: {
75
75
  type: "ephemeral";
@@ -155,16 +155,16 @@ export declare const MessageSchema: z.ZodObject<{
155
155
  }>>;
156
156
  }, "strip", z.ZodTypeAny, {
157
157
  type: "tool_use";
158
- id: string;
159
158
  name: string;
159
+ id: string;
160
160
  input: Record<string, any>;
161
161
  cache_control?: {
162
162
  type: "ephemeral";
163
163
  } | undefined;
164
164
  }, {
165
165
  type: "tool_use";
166
- id: string;
167
166
  name: string;
167
+ id: string;
168
168
  input: Record<string, any>;
169
169
  cache_control?: {
170
170
  type: "ephemeral";
@@ -181,15 +181,15 @@ export declare const MessageSchema: z.ZodObject<{
181
181
  type: "ephemeral";
182
182
  }>>;
183
183
  }, "strip", z.ZodTypeAny, {
184
- type: "tool_result";
185
184
  content: string;
185
+ type: "tool_result";
186
186
  tool_use_id: string;
187
187
  cache_control?: {
188
188
  type: "ephemeral";
189
189
  } | undefined;
190
190
  }, {
191
- type: "tool_result";
192
191
  content: string;
192
+ type: "tool_result";
193
193
  tool_use_id: string;
194
194
  cache_control?: {
195
195
  type: "ephemeral";
@@ -238,7 +238,6 @@ export declare const MessageSchema: z.ZodObject<{
238
238
  } | undefined;
239
239
  }>]>, "many">]>;
240
240
  }, "strip", z.ZodTypeAny, {
241
- role: "user" | "assistant";
242
241
  content: string | ({
243
242
  type: "text";
244
243
  text: string;
@@ -247,15 +246,15 @@ export declare const MessageSchema: z.ZodObject<{
247
246
  } | undefined;
248
247
  } | {
249
248
  type: "tool_use";
250
- id: string;
251
249
  name: string;
250
+ id: string;
252
251
  input: Record<string, any>;
253
252
  cache_control?: {
254
253
  type: "ephemeral";
255
254
  } | undefined;
256
255
  } | {
257
- type: "tool_result";
258
256
  content: string;
257
+ type: "tool_result";
259
258
  tool_use_id: string;
260
259
  cache_control?: {
261
260
  type: "ephemeral";
@@ -271,8 +270,8 @@ export declare const MessageSchema: z.ZodObject<{
271
270
  type: "ephemeral";
272
271
  } | undefined;
273
272
  })[];
274
- }, {
275
273
  role: "user" | "assistant";
274
+ }, {
276
275
  content: string | ({
277
276
  type: "text";
278
277
  text: string;
@@ -281,15 +280,15 @@ export declare const MessageSchema: z.ZodObject<{
281
280
  } | undefined;
282
281
  } | {
283
282
  type: "tool_use";
284
- id: string;
285
283
  name: string;
284
+ id: string;
286
285
  input: Record<string, any>;
287
286
  cache_control?: {
288
287
  type: "ephemeral";
289
288
  } | undefined;
290
289
  } | {
291
- type: "tool_result";
292
290
  content: string;
291
+ type: "tool_result";
293
292
  tool_use_id: string;
294
293
  cache_control?: {
295
294
  type: "ephemeral";
@@ -305,6 +304,7 @@ export declare const MessageSchema: z.ZodObject<{
305
304
  type: "ephemeral";
306
305
  } | undefined;
307
306
  })[];
307
+ role: "user" | "assistant";
308
308
  }>;
309
309
  export type Message = z.infer<typeof MessageSchema>;
310
310
  export type MessageContentObject = z.infer<typeof MessageContentObjectSchema>;
@@ -8,17 +8,17 @@ export declare const usageDataSchema: z.ZodObject<{
8
8
  overageRate: z.ZodNullable<z.ZodNumber>;
9
9
  }, "strip", z.ZodTypeAny, {
10
10
  creditsUsed: number;
11
- overageRate: number | null;
12
11
  totalQuota: number;
13
12
  remainingCredits: number;
14
13
  subscriptionActive: boolean;
15
14
  nextQuotaReset: Date;
15
+ overageRate: number | null;
16
16
  }, {
17
17
  creditsUsed: number;
18
- overageRate: number | null;
19
18
  totalQuota: number;
20
19
  remainingCredits: number;
21
20
  subscriptionActive: boolean;
22
21
  nextQuotaReset: Date;
22
+ overageRate: number | null;
23
23
  }>;
24
24
  export type UsageData = z.infer<typeof usageDataSchema>;
@@ -0,0 +1 @@
1
+ export declare function getModelForMode(mode: string): string;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getModelForMode = getModelForMode;
4
+ function getModelForMode(mode) {
5
+ return 'claude-3-sonnet';
6
+ }
7
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/util/constants.ts"],"names":[],"mappings":";;AAAA,0CAEC;AAFD,SAAgB,eAAe,CAAC,IAAY;IAC1C,OAAO,iBAAiB,CAAA;AAC1B,CAAC"}
@@ -7,15 +7,15 @@ export declare const userSchema: z.ZodObject<{
7
7
  fingerprintId: z.ZodString;
8
8
  fingerprintHash: z.ZodString;
9
9
  }, "strip", z.ZodTypeAny, {
10
- name: string | null;
11
10
  email: string;
11
+ name: string | null;
12
12
  id: string;
13
13
  fingerprintId: string;
14
14
  authToken: string;
15
15
  fingerprintHash: string;
16
16
  }, {
17
- name: string | null;
18
17
  email: string;
18
+ name: string | null;
19
19
  id: string;
20
20
  fingerprintId: string;
21
21
  authToken: string;
@@ -0,0 +1 @@
1
+ export declare const sleep: (ms: number) => Promise<unknown>;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sleep = void 0;
4
+ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
5
+ exports.sleep = sleep;
6
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/util/helpers.ts"],"names":[],"mappings":";;;AAAO,MAAM,KAAK,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;AAA7D,QAAA,KAAK,SAAwD"}
@@ -0,0 +1,3 @@
1
+ export declare function countTokens(text: string): number;
2
+ export declare function countTokensJson(text: string | object): number;
3
+ export declare function countTokensForFiles(files: Record<string, string | null>): Record<string, number>;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.countTokens = countTokens;
4
+ exports.countTokensJson = countTokensJson;
5
+ exports.countTokensForFiles = countTokensForFiles;
6
+ const gpt_4o_1 = require("gpt-tokenizer/esm/model/gpt-4o");
7
+ const ANTHROPIC_TOKEN_FUDGE_FACTOR = 1.35;
8
+ function countTokens(text) {
9
+ try {
10
+ return Math.floor((0, gpt_4o_1.encode)(text).length * ANTHROPIC_TOKEN_FUDGE_FACTOR);
11
+ }
12
+ catch (e) {
13
+ console.error('Error counting tokens', e);
14
+ return Math.ceil(text.length / 3);
15
+ }
16
+ }
17
+ function countTokensJson(text) {
18
+ return countTokens(JSON.stringify(text));
19
+ }
20
+ function countTokensForFiles(files) {
21
+ const tokenCounts = {};
22
+ for (const [filePath, content] of Object.entries(files)) {
23
+ tokenCounts[filePath] = content ? countTokens(content) : 0;
24
+ }
25
+ return tokenCounts;
26
+ }
27
+ //# sourceMappingURL=token-counter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-counter.js","sourceRoot":"","sources":["../../src/util/token-counter.ts"],"names":[],"mappings":";;AAIA,kCAOC;AAED,0CAEC;AAED,kDAQC;AAzBD,2DAAuD;AAEvD,MAAM,4BAA4B,GAAG,IAAI,CAAA;AAEzC,SAAgB,WAAW,CAAC,IAAY;IACtC,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAA,eAAM,EAAC,IAAI,CAAC,CAAC,MAAM,GAAG,4BAA4B,CAAC,CAAA;IACvE,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,CAAC,KAAK,CAAC,uBAAuB,EAAE,CAAC,CAAC,CAAA;QACzC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;IACnC,CAAC;AACH,CAAC;AAED,SAAgB,eAAe,CAAC,IAAqB;IACnD,OAAO,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAA;AAC1C,CAAC;AAED,SAAgB,mBAAmB,CACjC,KAAoC;IAEpC,MAAM,WAAW,GAA2B,EAAE,CAAA;IAC9C,KAAK,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACxD,WAAW,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAC5D,CAAC;IACD,OAAO,WAAW,CAAA;AACpB,CAAC"}