codebuff 1.0.175 → 1.0.177

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 (58) hide show
  1. package/dist/checkpoints/checkpoint-manager.d.ts +73 -0
  2. package/dist/checkpoints/checkpoint-manager.js +193 -0
  3. package/dist/checkpoints/checkpoint-manager.js.map +1 -0
  4. package/dist/{checkpoint-file-manager.d.ts → checkpoints/file-manager.d.ts} +10 -0
  5. package/dist/{checkpoint-file-manager.js → checkpoints/file-manager.js} +92 -35
  6. package/dist/checkpoints/file-manager.js.map +1 -0
  7. package/dist/cli.d.ts +0 -1
  8. package/dist/cli.js +35 -58
  9. package/dist/cli.js.map +1 -1
  10. package/dist/client.d.ts +6 -4
  11. package/dist/client.js +28 -16
  12. package/dist/client.js.map +1 -1
  13. package/dist/code-map/tsconfig.tsbuildinfo +1 -1
  14. package/dist/common/actions.d.ts +36 -36
  15. package/dist/common/advanced-analyzer.d.ts +19 -0
  16. package/dist/common/advanced-analyzer.js +140 -0
  17. package/dist/common/advanced-analyzer.js.map +1 -0
  18. package/dist/common/browser-actions.d.ts +48 -48
  19. package/dist/common/constants.d.ts +0 -1
  20. package/dist/common/constants.js +1 -44
  21. package/dist/common/constants.js.map +1 -1
  22. package/dist/common/message-image-handling.d.ts +41 -0
  23. package/dist/common/message-image-handling.js +57 -0
  24. package/dist/common/message-image-handling.js.map +1 -0
  25. package/dist/common/project-file-tree.d.ts +1 -0
  26. package/dist/common/project-file-tree.js +3 -1
  27. package/dist/common/project-file-tree.js.map +1 -1
  28. package/dist/common/types/agent-state.d.ts +22 -22
  29. package/dist/common/types/message.d.ts +18 -18
  30. package/dist/common/util/file.d.ts +4 -4
  31. package/dist/common/util/process-stream.d.ts +8 -0
  32. package/dist/common/util/process-stream.js +102 -0
  33. package/dist/common/util/process-stream.js.map +1 -0
  34. package/dist/common/websockets/websocket-schema.d.ts +72 -72
  35. package/dist/menu.js +1 -1
  36. package/dist/menu.js.map +1 -1
  37. package/dist/project-files.d.ts +2 -2
  38. package/dist/project-files.js +2 -2
  39. package/dist/project-files.js.map +1 -1
  40. package/dist/tool-handlers.d.ts +2 -1
  41. package/dist/tool-handlers.js +3 -3
  42. package/dist/tool-handlers.js.map +1 -1
  43. package/dist/utils/terminal.js +4 -40
  44. package/dist/utils/terminal.js.map +1 -1
  45. package/dist/utils/tool-renderers.js +14 -2
  46. package/dist/utils/tool-renderers.js.map +1 -1
  47. package/dist/workers/checkpoint-worker.js +47 -0
  48. package/dist/workers/checkpoint-worker.js.map +1 -0
  49. package/dist/workers/project-context.d.ts +1 -0
  50. package/dist/{worker-script-project-context.js → workers/project-context.js} +5 -5
  51. package/dist/workers/project-context.js.map +1 -0
  52. package/package.json +1 -1
  53. package/dist/checkpoint-file-manager.js.map +0 -1
  54. package/dist/checkpoints.d.ts +0 -63
  55. package/dist/checkpoints.js +0 -159
  56. package/dist/checkpoints.js.map +0 -1
  57. package/dist/worker-script-project-context.js.map +0 -1
  58. /package/dist/{worker-script-project-context.d.ts → workers/checkpoint-worker.d.ts} +0 -0
@@ -1,159 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.checkpointManager = exports.CheckpointManager = void 0;
4
- const picocolors_1 = require("picocolors");
5
- const project_file_tree_1 = require("./common/project-file-tree");
6
- const checkpoint_file_manager_1 = require("./checkpoint-file-manager");
7
- const project_files_1 = require("./project-files");
8
- /**
9
- * Simple in-memory checkpoint manager for agent states
10
- */
11
- class CheckpointManager {
12
- checkpoints = new Map();
13
- nextId = 1;
14
- bareRepoPath = null;
15
- getBareRepoPath() {
16
- if (!this.bareRepoPath) {
17
- this.bareRepoPath = (0, checkpoint_file_manager_1.getBareRepoPath)((0, project_files_1.getProjectRoot)());
18
- }
19
- return this.bareRepoPath;
20
- }
21
- /**
22
- * Add a new checkpoint
23
- * @param agentState - The agent state to checkpoint
24
- * @param userInput - The user input associated with this checkpoint
25
- * @returns The ID of the created checkpoint
26
- */
27
- async addCheckpoint(agentState, userInput) {
28
- // Use incremental ID starting at 1
29
- const id = this.nextId++;
30
- const fileStateIdPromise = (0, checkpoint_file_manager_1.storeFileState)({
31
- projectDir: (0, project_files_1.getProjectRoot)(),
32
- bareRepoPath: this.getBareRepoPath(),
33
- message: `Checkpoint ${id}`,
34
- relativeFilepaths: (0, project_file_tree_1.getAllFilePaths)(agentState.fileContext.fileTree),
35
- });
36
- const checkpoint = {
37
- agentStateString: JSON.stringify(agentState), // Deep clone to prevent reference issues
38
- fileStateIdPromise,
39
- historyLength: agentState.messageHistory.length,
40
- id,
41
- timestamp: Date.now(),
42
- userInput,
43
- };
44
- // Add to map
45
- this.checkpoints.set(id, checkpoint);
46
- return id;
47
- }
48
- /**
49
- * Get a checkpoint by ID
50
- * @param id The checkpoint ID
51
- * @returns The checkpoint or null if not found
52
- */
53
- getCheckpoint(id) {
54
- if (id === null) {
55
- return null;
56
- }
57
- const checkpoint = this.checkpoints.get(id);
58
- return checkpoint || null;
59
- }
60
- /**
61
- * Get all checkpoints
62
- * @returns Array of all checkpoints
63
- */
64
- getAllCheckpoints() {
65
- return Array.from(this.checkpoints.values());
66
- }
67
- /**
68
- * Get the most recent checkpoint
69
- * @returns The most recent checkpoint or null if none exist
70
- */
71
- getLatestCheckpoint() {
72
- return this.checkpoints.get(this.nextId - 1) || null;
73
- }
74
- async restoreCheckointFileState(id) {
75
- const checkpoint = this.getCheckpoint(id);
76
- if (!checkpoint) {
77
- return false;
78
- }
79
- const relativeFilepaths = (0, project_file_tree_1.getAllFilePaths)(JSON.parse(checkpoint.agentStateString).fileContext
80
- .fileTree);
81
- await (0, checkpoint_file_manager_1.restoreFileState)({
82
- projectDir: (0, project_files_1.getProjectRoot)(),
83
- bareRepoPath: this.getBareRepoPath(),
84
- commit: await checkpoint.fileStateIdPromise,
85
- relativeFilepaths,
86
- });
87
- return true;
88
- }
89
- /**
90
- * Clear all checkpoints
91
- */
92
- clearCheckpoints() {
93
- this.checkpoints.clear();
94
- this.nextId = 1; // Reset the ID counter when clearing
95
- }
96
- /**
97
- * Get a formatted string representation of all checkpoints
98
- * @param detailed Whether to include detailed information about each checkpoint
99
- * @returns A formatted string representation of all checkpoints
100
- */
101
- getCheckpointsAsString(detailed = false) {
102
- const checkpoints = this.getAllCheckpoints().sort((a, b) => a.id - b.id);
103
- if (checkpoints.length === 0) {
104
- return (0, picocolors_1.yellow)('No checkpoints available.');
105
- }
106
- const lines = [(0, picocolors_1.bold)((0, picocolors_1.underline)('Agent State Checkpoints:')), ''];
107
- checkpoints.forEach((checkpoint) => {
108
- const date = new Date(checkpoint.timestamp);
109
- const formattedDate = date.toLocaleString();
110
- const userInputOneLine = checkpoint.userInput.replaceAll('\n', ' ');
111
- const userInput = userInputOneLine.length > 50
112
- ? userInputOneLine.substring(0, 47) + '...'
113
- : userInputOneLine;
114
- lines.push(`${(0, picocolors_1.cyan)((0, picocolors_1.bold)(`#${checkpoint.id}`))} ${(0, picocolors_1.gray)(`[${formattedDate}]`)}:`);
115
- lines.push(` ${(0, picocolors_1.blue)('Input')}: ${userInput}`);
116
- if (detailed) {
117
- // Add more details about the agent state if needed
118
- const messageCount = checkpoint.historyLength;
119
- lines.push(` ${(0, picocolors_1.blue)('Messages')}: ${messageCount}`);
120
- // You can add more detailed information here as needed
121
- // For example, file context information, etc.
122
- }
123
- lines.push(''); // Empty line between checkpoints
124
- });
125
- return lines.join('\n');
126
- }
127
- /**
128
- * Get detailed information about a specific checkpoint
129
- * @param id The checkpoint ID
130
- * @returns A formatted string with detailed information about the checkpoint, or an error message if not found
131
- */
132
- getCheckpointDetails(id) {
133
- const checkpoint = this.getCheckpoint(id);
134
- if (!checkpoint) {
135
- return (0, picocolors_1.cyan)(`\nCheckpoint #${id} not found.`);
136
- }
137
- const lines = [
138
- (0, picocolors_1.cyan)(`Detailed information for checkpoint #${id}:`),
139
- ];
140
- const date = new Date(checkpoint.timestamp);
141
- const formattedDate = date.toLocaleString();
142
- lines.push(`${(0, picocolors_1.blue)('Created at')}: ${formattedDate}`);
143
- if (checkpoint.userInput) {
144
- lines.push(`${(0, picocolors_1.blue)('User input')}: ${checkpoint.userInput}`);
145
- }
146
- // Display more detailed information about the agent state
147
- const messageCount = checkpoint.historyLength;
148
- lines.push(`${(0, picocolors_1.blue)('Message history')}: ${messageCount} messages`);
149
- // You could add more detailed information here as needed
150
- return lines.join('\n');
151
- }
152
- getNextId() {
153
- return this.nextId;
154
- }
155
- }
156
- exports.CheckpointManager = CheckpointManager;
157
- // Export a singleton instance for use throughout the application
158
- exports.checkpointManager = new CheckpointManager();
159
- //# sourceMappingURL=checkpoints.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"checkpoints.js","sourceRoot":"","sources":["../src/checkpoints.ts"],"names":[],"mappings":";;;AAAA,2CAAsE;AAEtE,gEAA0D;AAE1D,uEAIkC;AAClC,mDAAgD;AAchD;;GAEG;AACH,MAAa,iBAAiB;IACpB,WAAW,GAA4B,IAAI,GAAG,EAAE,CAAA;IAChD,MAAM,GAAW,CAAC,CAAA;IAClB,YAAY,GAAkB,IAAI,CAAA;IAE1C,eAAe;QACb,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YACvB,IAAI,CAAC,YAAY,GAAG,IAAA,yCAAe,EAAC,IAAA,8BAAc,GAAE,CAAC,CAAA;QACvD,CAAC;QACD,OAAO,IAAI,CAAC,YAAY,CAAA;IAC1B,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,aAAa,CACjB,UAAsB,EACtB,SAAiB;QAEjB,mCAAmC;QACnC,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAA;QAExB,MAAM,kBAAkB,GAAG,IAAA,wCAAc,EAAC;YACxC,UAAU,EAAE,IAAA,8BAAc,GAAE;YAC5B,YAAY,EAAE,IAAI,CAAC,eAAe,EAAE;YACpC,OAAO,EAAE,cAAc,EAAE,EAAE;YAC3B,iBAAiB,EAAE,IAAA,mCAAe,EAAC,UAAU,CAAC,WAAW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SAAS,EAAE,CAAC;YACzB,KAAK,CAAC,IAAI,CAAC,GAAG,IAAA,iBAAI,EAAC,YAAY,CAAC,KAAK,UAAU,CAAC,SAAS,EAAE,CAAC,CAAA;QAC9D,CAAC;QAED,0DAA0D;QAC1D,MAAM,YAAY,GAAG,UAAU,CAAC,aAAa,CAAA;QAC7C,KAAK,CAAC,IAAI,CAAC,GAAG,IAAA,iBAAI,EAAC,iBAAiB,CAAC,KAAK,YAAY,WAAW,CAAC,CAAA;QAElE,yDAAyD;QAEzD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACzB,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAA;IACpB,CAAC;CACF;AAxLD,8CAwLC;AAED,iEAAiE;AACpD,QAAA,iBAAiB,GAAG,IAAI,iBAAiB,EAAE,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"worker-script-project-context.js","sourceRoot":"","sources":["../src/worker-script-project-context.ts"],"names":[],"mappings":";;AAAA,mDAA8D;AAC9D,mDAAuE;AACvE,uEAA2E;AAC3E,gEAA0D;AAE1D,IAAI,2BAAe,EAAE,CAAC;IACpB,MAAM,UAAU,GAAG,2BAAe,CAAA;IAElC,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE;QACzC,IAAA,8BAAc,EAAC,GAAG,CAAC,CAAA;QACnB,MAAM,eAAe,GAAG,MAAM,IAAA,qCAAqB,EAAC,GAAG,EAAE,EAAE,CAAC,CAAA;QAE5D,MAAM,iBAAiB,GAAG,IAAA,mCAAe,EAAC,eAAe,CAAC,QAAQ,CAAC,CAAA;QACnE,MAAM,IAAA,yDAA+B,EAAC,EAAE,UAAU,EAAE,GAAG,EAAE,iBAAiB,EAAE,CAAC,CAAA;QAE7E,UAAU,CAAC,WAAW,CAAC,eAAe,CAAC,CAAA;IACzC,CAAC,CAAC,CAAA;AACJ,CAAC"}