codecane 1.0.178 → 1.0.180

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 (43) hide show
  1. package/dist/chat-storage.d.ts +1 -26
  2. package/dist/chat-storage.js +56 -132
  3. package/dist/chat-storage.js.map +1 -1
  4. package/dist/checkpoint-file-manager.d.ts +8 -0
  5. package/dist/checkpoint-file-manager.js +115 -0
  6. package/dist/checkpoint-file-manager.js.map +1 -0
  7. package/dist/checkpoints.d.ts +3 -6
  8. package/dist/checkpoints.js +35 -21
  9. package/dist/checkpoints.js.map +1 -1
  10. package/dist/cli.d.ts +1 -2
  11. package/dist/cli.js +22 -46
  12. package/dist/cli.js.map +1 -1
  13. package/dist/client.d.ts +10 -13
  14. package/dist/client.js +19 -35
  15. package/dist/client.js.map +1 -1
  16. package/dist/code-map/tsconfig.tsbuildinfo +1 -1
  17. package/dist/common/actions.d.ts +195 -195
  18. package/dist/common/constants/tools.d.ts +13 -2
  19. package/dist/common/constants/tools.js +18 -12
  20. package/dist/common/constants/tools.js.map +1 -1
  21. package/dist/common/util/saxy.d.ts +9 -1
  22. package/dist/common/util/saxy.js +45 -72
  23. package/dist/common/util/saxy.js.map +1 -1
  24. package/dist/common/websockets/websocket-schema.d.ts +528 -528
  25. package/dist/index.js +3 -1
  26. package/dist/index.js.map +1 -1
  27. package/dist/project-files.d.ts +2 -3
  28. package/dist/project-files.js +17 -27
  29. package/dist/project-files.js.map +1 -1
  30. package/dist/utils/xml-stream-parser.js +2 -1
  31. package/dist/utils/xml-stream-parser.js.map +1 -1
  32. package/dist/worker-script-project-context.js +1 -1
  33. package/dist/worker-script-project-context.js.map +1 -1
  34. package/package.json +2 -1
  35. package/dist/common/advanced-analyzer.d.ts +0 -19
  36. package/dist/common/advanced-analyzer.js +0 -140
  37. package/dist/common/advanced-analyzer.js.map +0 -1
  38. package/dist/common/message-image-handling.d.ts +0 -41
  39. package/dist/common/message-image-handling.js +0 -57
  40. package/dist/common/message-image-handling.js.map +0 -1
  41. package/dist/common/util/process-stream.d.ts +0 -8
  42. package/dist/common/util/process-stream.js +0 -102
  43. package/dist/common/util/process-stream.js.map +0 -1
@@ -1,27 +1,2 @@
1
1
  import { Message } from './common/types/message';
2
- interface Chat {
3
- id: string;
4
- messages: Message[];
5
- fileVersions: FileVersion[];
6
- createdAt: string;
7
- updatedAt: string;
8
- timestamp: number;
9
- }
10
- interface FileVersion {
11
- files: Record<string, string>;
12
- }
13
- export declare class ChatStorage {
14
- private currentChat;
15
- private currentVersionIndex;
16
- constructor();
17
- getCurrentChat(): Chat;
18
- addMessage(chat: Chat, message: Message): void;
19
- private saveMessagesToFile;
20
- getCurrentVersion(): FileVersion | null;
21
- navigateVersion(direction: 'undo' | 'redo'): boolean;
22
- saveFilesChanged(filesChanged: string[]): string[];
23
- saveCurrentFileState(files: Record<string, string>): void;
24
- addNewFileState(files: Record<string, string>): void;
25
- private createChat;
26
- }
27
- export {};
2
+ export declare function setMessages(messages: Message[]): void;
@@ -23,147 +23,71 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.ChatStorage = void 0;
26
+ exports.setMessages = setMessages;
27
27
  const path = __importStar(require("path"));
28
28
  const fs = __importStar(require("fs"));
29
29
  const project_files_1 = require("./project-files");
30
30
  const string_1 = require("./common/util/string");
31
31
  const ts_pattern_1 = require("ts-pattern");
32
- class ChatStorage {
33
- currentChat;
34
- currentVersionIndex;
35
- constructor() {
36
- this.currentChat = this.createChat();
37
- this.currentVersionIndex = -1;
38
- }
39
- getCurrentChat() {
40
- return this.currentChat;
41
- }
42
- addMessage(chat, message) {
43
- // Before adding new message, clean up any screenshots and logs in previous messages
44
- // Skip the last message as it may not have been processed by the backend yet
45
- const lastIndex = chat.messages.length - 1;
46
- chat.messages = chat.messages.map((msg, index) => {
47
- if (index === lastIndex) {
48
- return msg; // Preserve the most recent message in its entirety
49
- }
50
- // Helper function to clean up message content
51
- const cleanContent = (content) => {
52
- // Keep only tool logs
53
- content = (0, string_1.transformJsonInString)(content, 'logs', (logs) => logs.filter((log) => log.source === 'tool'), '(LOGS_REMOVED)');
54
- // Remove metrics
55
- content = (0, string_1.transformJsonInString)(content, 'metrics', () => '(METRICS_REMOVED)', '(METRICS_REMOVED)');
56
- return content;
57
- };
58
- // Clean up message content
59
- if (!msg.content)
60
- return msg;
61
- return (0, ts_pattern_1.match)(msg)
62
- .with({ content: ts_pattern_1.P.array() }, (message) => ({
63
- ...message,
64
- content: message.content.reduce((acc, contentObj) => [
65
- ...acc,
66
- ...(0, ts_pattern_1.match)(contentObj)
67
- .with({ type: 'tool_result', content: ts_pattern_1.P.string }, (obj) => [
68
- {
69
- ...obj,
70
- content: cleanContent(obj.content),
71
- },
72
- ])
73
- .with({ type: 'text', text: ts_pattern_1.P.string }, (obj) => [
74
- {
75
- ...obj,
76
- text: cleanContent(obj.text),
77
- },
78
- ])
79
- .otherwise((obj) => [obj]),
80
- ], []),
81
- }))
82
- .with({ content: ts_pattern_1.P.string }, (message) => ({
83
- ...message,
84
- content: cleanContent(message.content),
85
- }))
86
- .otherwise((message) => message);
87
- });
88
- // Add the new message
89
- chat.messages.push(message);
90
- chat.updatedAt = new Date().toISOString();
91
- // Save messages to chat directory
92
- this.saveMessagesToFile(chat);
93
- }
94
- saveMessagesToFile(chat) {
95
- try {
96
- const chatDir = (0, project_files_1.getCurrentChatDir)();
97
- const messagesPath = path.join(chatDir, 'messages.json');
98
- const messagesData = {
99
- id: chat.id,
100
- messages: chat.messages,
101
- updatedAt: chat.updatedAt,
102
- };
103
- fs.writeFileSync(messagesPath, JSON.stringify(messagesData, null, 2));
104
- }
105
- catch (error) {
106
- console.error('Failed to save messages to file:', error);
107
- }
108
- }
109
- getCurrentVersion() {
110
- if (this.currentVersionIndex >= 0 &&
111
- this.currentVersionIndex < this.currentChat.fileVersions.length) {
112
- return this.currentChat.fileVersions[this.currentVersionIndex];
113
- }
114
- return null;
115
- }
116
- navigateVersion(direction) {
117
- if (direction === 'undo' && this.currentVersionIndex >= 0) {
118
- this.currentVersionIndex--;
119
- return true;
120
- }
121
- else if (direction === 'redo' &&
122
- this.currentVersionIndex < this.currentChat.fileVersions.length - 1) {
123
- this.currentVersionIndex++;
124
- return true;
32
+ function setMessages(messages) {
33
+ // Clean up any screenshots and logs in previous messages
34
+ // Skip the last message as it may not have been processed by the backend yet
35
+ const lastIndex = messages.length - 1;
36
+ const cleanedMessages = messages.map((msg, index) => {
37
+ if (index === lastIndex) {
38
+ return msg; // Preserve the most recent message in its entirety
125
39
  }
126
- return false;
127
- }
128
- saveFilesChanged(filesChanged) {
129
- let currentVersion = this.getCurrentVersion();
130
- if (!currentVersion) {
131
- this.addNewFileState({});
132
- currentVersion = this.getCurrentVersion();
133
- }
134
- const newFilesChanged = filesChanged.filter((f) => !currentVersion.files[f]);
135
- const updatedFiles = (0, project_files_1.getExistingFiles)(newFilesChanged);
136
- currentVersion.files = { ...currentVersion.files, ...updatedFiles };
137
- return Object.keys(currentVersion.files);
138
- }
139
- saveCurrentFileState(files) {
140
- const currentVersion = this.getCurrentVersion();
141
- if (currentVersion) {
142
- currentVersion.files = files;
143
- }
144
- else {
145
- this.addNewFileState(files);
146
- }
147
- }
148
- addNewFileState(files) {
149
- const newVersion = {
150
- files,
40
+ // Helper function to clean up message content
41
+ const cleanContent = (content) => {
42
+ // Keep only tool logs
43
+ content = (0, string_1.transformJsonInString)(content, 'logs', (logs) => logs.filter((log) => log.source === 'tool'), '(LOGS_REMOVED)');
44
+ // Remove metrics
45
+ content = (0, string_1.transformJsonInString)(content, 'metrics', () => '(METRICS_REMOVED)', '(METRICS_REMOVED)');
46
+ return content;
151
47
  };
152
- this.currentChat.fileVersions.push(newVersion);
153
- this.currentVersionIndex = this.currentChat.fileVersions.length - 1;
154
- }
155
- createChat(messages = []) {
156
- const now = new Date();
157
- const chat = {
48
+ // Clean up message content
49
+ if (!msg.content)
50
+ return msg;
51
+ return (0, ts_pattern_1.match)(msg)
52
+ .with({ content: ts_pattern_1.P.array() }, (message) => ({
53
+ ...message,
54
+ content: message.content.reduce((acc, contentObj) => [
55
+ ...acc,
56
+ ...(0, ts_pattern_1.match)(contentObj)
57
+ .with({ type: 'tool_result', content: ts_pattern_1.P.string }, (obj) => [
58
+ {
59
+ ...obj,
60
+ content: cleanContent(obj.content),
61
+ },
62
+ ])
63
+ .with({ type: 'text', text: ts_pattern_1.P.string }, (obj) => [
64
+ {
65
+ ...obj,
66
+ text: cleanContent(obj.text),
67
+ },
68
+ ])
69
+ .otherwise((obj) => [obj]),
70
+ ], []),
71
+ }))
72
+ .with({ content: ts_pattern_1.P.string }, (message) => ({
73
+ ...message,
74
+ content: cleanContent(message.content),
75
+ }))
76
+ .otherwise((message) => message);
77
+ });
78
+ // Save messages to chat directory
79
+ try {
80
+ const chatDir = (0, project_files_1.getCurrentChatDir)();
81
+ const messagesPath = path.join(chatDir, 'messages.json');
82
+ const messagesData = {
158
83
  id: project_files_1.currentChatId,
159
- messages,
160
- fileVersions: [],
161
- createdAt: now.toISOString(),
162
- updatedAt: now.toISOString(),
163
- timestamp: now.getTime(),
84
+ messages: cleanedMessages,
85
+ updatedAt: new Date().toISOString(),
164
86
  };
165
- return chat;
87
+ fs.writeFileSync(messagesPath, JSON.stringify(messagesData, null, 2));
88
+ }
89
+ catch (error) {
90
+ console.error('Failed to save messages to file:', error);
166
91
  }
167
92
  }
168
- exports.ChatStorage = ChatStorage;
169
93
  //# sourceMappingURL=chat-storage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"chat-storage.js","sourceRoot":"","sources":["../src/chat-storage.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA4B;AAC5B,uCAAwB;AAExB,mDAIwB;AACxB,+CAA0D;AAE1D,2CAAqC;AAerC,MAAa,WAAW;IACd,WAAW,CAAM;IACjB,mBAAmB,CAAQ;IAEnC;QACE,IAAI,CAAC,WAAW,G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CAAiB,GAAE,CAAA;QACnC,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,eAAe,CAAC,CAAA;QAExD,MAAM,YAAY,GAAG;YACnB,EAAE,EAAE,6BAAa;YACjB,QAAQ,EAAE,eAAe;YACzB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACpC,CAAA;QAED,EAAE,CAAC,aAAa,CAAC,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;IACvE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,kCAAkC,EAAE,KAAK,CAAC,CAAA;IAC1D,CAAC;AACH,CAAC"}
@@ -0,0 +1,8 @@
1
+ export declare function initializeCheckpointFileManager(): Promise<void>;
2
+ /**
3
+ * Stores the current state of all files in the project as a git commit
4
+ * @param message The commit message to use for this file state
5
+ * @returns A promise that resolves to the id hash that can be used to restore this file state
6
+ */
7
+ export declare function storeFileState(message: string): Promise<string>;
8
+ export declare function checkoutFileState(fileStateId: string): Promise<void>;
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.initializeCheckpointFileManager = initializeCheckpointFileManager;
27
+ exports.storeFileState = storeFileState;
28
+ exports.checkoutFileState = checkoutFileState;
29
+ const crypto = __importStar(require("crypto"));
30
+ const fs = __importStar(require("fs"));
31
+ const git = __importStar(require("isomorphic-git"));
32
+ const path = __importStar(require("path"));
33
+ const project_files_1 = require("./project-files");
34
+ let projectDir;
35
+ let bareRepoPath;
36
+ async function initializeCheckpointFileManager() {
37
+ projectDir = (0, project_files_1.getProjectRoot)();
38
+ const bareRepoName = crypto
39
+ .createHash('sha256')
40
+ .update(projectDir)
41
+ .digest('hex');
42
+ bareRepoPath = path.join((0, project_files_1.getProjectDataDir)(), bareRepoName);
43
+ // Create the bare repo directory if it doesn't exist
44
+ fs.mkdirSync(bareRepoPath, { recursive: true });
45
+ try {
46
+ // Check if it's already a valid Git repo
47
+ await git.resolveRef({ fs, dir: bareRepoPath, ref: 'HEAD' });
48
+ return; // Exit if the repository exists
49
+ }
50
+ catch (error) {
51
+ // Bare repo doesn't exist yet
52
+ }
53
+ // Initialize a bare repository
54
+ await git.init({ fs, dir: bareRepoPath, bare: true });
55
+ // Commit the files in the bare repo
56
+ await storeFileState('Initial Commit');
57
+ }
58
+ async function addFilesIndividually() {
59
+ // Get status of all files in the project directory
60
+ const statusMatrix = await git.statusMatrix({
61
+ fs,
62
+ dir: projectDir,
63
+ gitdir: bareRepoPath,
64
+ });
65
+ try {
66
+ for (const [filepath, headStatus, workdirStatus, stageStatus,] of statusMatrix) {
67
+ await git.add({
68
+ fs,
69
+ dir: projectDir,
70
+ gitdir: bareRepoPath,
71
+ filepath,
72
+ });
73
+ }
74
+ }
75
+ catch (error) {
76
+ // Could not add file
77
+ }
78
+ }
79
+ /**
80
+ * Stores the current state of all files in the project as a git commit
81
+ * @param message The commit message to use for this file state
82
+ * @returns A promise that resolves to the id hash that can be used to restore this file state
83
+ */
84
+ async function storeFileState(message) {
85
+ try {
86
+ await git.add({
87
+ fs,
88
+ dir: projectDir,
89
+ gitdir: bareRepoPath,
90
+ filepath: '.',
91
+ });
92
+ }
93
+ catch (error) {
94
+ await addFilesIndividually();
95
+ }
96
+ const commitHash = await git.commit({
97
+ fs,
98
+ dir: projectDir,
99
+ gitdir: bareRepoPath,
100
+ author: { name: 'codebuff' },
101
+ message,
102
+ });
103
+ return commitHash;
104
+ }
105
+ async function checkoutFileState(fileStateId) {
106
+ // Checkout the given hash
107
+ await git.checkout({
108
+ fs,
109
+ dir: projectDir,
110
+ gitdir: bareRepoPath,
111
+ ref: fileStateId,
112
+ force: true,
113
+ });
114
+ }
115
+ //# sourceMappingURL=checkpoint-file-manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkpoint-file-manager.js","sourceRoot":"","sources":["../src/checkpoint-file-manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAUA,0EAyBC;AAkCD,wCAqBC;AAED,8CASC;AArGD,+CAAgC;AAChC,uCAAwB;AACxB,oDAAqC;AACrC,2CAA4B;AAE5B,mDAAmE;AAEnE,IAAI,UAAkB,CAAA;AACtB,IAAI,YAAoB,CAAA;AAEjB,KAAK,UAAU,+BAA+B;IACnD,UAAU,GAAG,IAAA,8BAAc,GAAE,CAAA;IAE7B,MAAM,YAAY,GAAG,MAAM;SACxB,UAAU,CAAC,QAAQ,CAAC;SACpB,MAAM,CAAC,UAAU,CAAC;SAClB,MAAM,CAAC,KAAK,CAAC,CAAA;IAChB,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,IAAA,iCAAiB,GAAE,EAAE,YAAY,CAAC,CAAA;IAE3D,qDAAqD;IACrD,EAAE,CAAC,SAAS,CAAC,YAAY,EAAE,EAAE,SAAS,EAAE,IAAI,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;IAC9B,CAAC;IAED,MAAM,UAAU,GAAG,MAAM,GAAG,CAAC,MAAM,CAAC;QAClC,EAAE;QACF,GAAG,EAAE,UAAU;QACf,MAAM,EAAE,YAAY;QACpB,MAAM,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE;QAC5B,OAAO;KACR,CAAC,CAAA;IAEF,OAAO,UAAU,CAAA;AACnB,CAAC;AAEM,KAAK,UAAU,iBAAiB,CAAC,WAAmB;IACzD,0BAA0B;IAC1B,MAAM,GAAG,CAAC,QAAQ,CAAC;QACjB,EAAE;QACF,GAAG,EAAE,UAAU;QACf,MAAM,EAAE,YAAY;QACpB,GAAG,EAAE,WAAW;QAChB,KAAK,EAAE,IAAI;KACZ,CAAC,CAAA;AACJ,CAAC"}
@@ -4,7 +4,7 @@ import { AgentState } from './common/types/agent-state';
4
4
  */
5
5
  export interface Checkpoint {
6
6
  agentStateString: string;
7
- fileVersions: Record<string, string>;
7
+ fileStateIdPromise: Promise<string>;
8
8
  historyLength: number;
9
9
  id: number;
10
10
  timestamp: number;
@@ -15,18 +15,14 @@ export interface Checkpoint {
15
15
  */
16
16
  export declare class CheckpointManager {
17
17
  private checkpoints;
18
- private maxCheckpoints;
19
18
  private nextId;
20
- private oldestId;
21
- constructor(maxCheckpoints?: number);
22
19
  /**
23
20
  * Add a new checkpoint
24
- * TODO update this jsdoc and add comments to this function
25
21
  * @param agentState - The agent state to checkpoint
26
22
  * @param userInput - The user input associated with this checkpoint
27
23
  * @returns The ID of the created checkpoint
28
24
  */
29
- addCheckpoint(agentState: AgentState, userInput: string, parentId?: number | null): number;
25
+ addCheckpoint(agentState: AgentState, userInput: string): Promise<number>;
30
26
  /**
31
27
  * Get a checkpoint by ID
32
28
  * @param id The checkpoint ID
@@ -43,6 +39,7 @@ export declare class CheckpointManager {
43
39
  * @returns The most recent checkpoint or null if none exist
44
40
  */
45
41
  getLatestCheckpoint(): Checkpoint | null;
42
+ restoreFileState(id: number): Promise<boolean>;
46
43
  /**
47
44
  * Clear all checkpoints
48
45
  */
@@ -1,38 +1,50 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
26
  exports.checkpointManager = exports.CheckpointManager = void 0;
4
27
  const picocolors_1 = require("picocolors");
28
+ const checkpointFileManager = __importStar(require("./checkpoint-file-manager"));
5
29
  /**
6
30
  * Simple in-memory checkpoint manager for agent states
7
31
  */
8
32
  class CheckpointManager {
9
33
  checkpoints = new Map();
10
- maxCheckpoints;
11
34
  nextId = 1;
12
- oldestId = 1;
13
- constructor(maxCheckpoints = 100) {
14
- this.maxCheckpoints = maxCheckpoints;
15
- }
16
35
  /**
17
36
  * Add a new checkpoint
18
- * TODO update this jsdoc and add comments to this function
19
37
  * @param agentState - The agent state to checkpoint
20
38
  * @param userInput - The user input associated with this checkpoint
21
39
  * @returns The ID of the created checkpoint
22
40
  */
23
- addCheckpoint(agentState, userInput, parentId = null) {
41
+ async addCheckpoint(agentState, userInput) {
24
42
  // Use incremental ID starting at 1
25
43
  const id = this.nextId++;
26
- const parentFileVersions = this.getCheckpoint(parentId)?.fileVersions || {};
27
- const currentFileVersions = agentState.fileContext.fileVersions
28
- .flat()
29
- .reduce((acc, { path, content }) => {
30
- acc[path] = content;
31
- return acc;
32
- }, {});
44
+ const fileStateIdPromise = checkpointFileManager.storeFileState(`Checkpoint ${id}`);
33
45
  const checkpoint = {
34
46
  agentStateString: JSON.stringify(agentState), // Deep clone to prevent reference issues
35
- fileVersions: { ...parentFileVersions, ...currentFileVersions },
47
+ fileStateIdPromise,
36
48
  historyLength: agentState.messageHistory.length,
37
49
  id,
38
50
  timestamp: Date.now(),
@@ -40,11 +52,6 @@ class CheckpointManager {
40
52
  };
41
53
  // Add to map
42
54
  this.checkpoints.set(id, checkpoint);
43
- // If we exceed the maximum number of checkpoints, remove the oldest one
44
- if (this.checkpoints.size > this.maxCheckpoints) {
45
- this.checkpoints.delete(this.oldestId);
46
- this.oldestId++;
47
- }
48
55
  return id;
49
56
  }
50
57
  /**
@@ -73,13 +80,20 @@ class CheckpointManager {
73
80
  getLatestCheckpoint() {
74
81
  return this.checkpoints.get(this.nextId - 1) || null;
75
82
  }
83
+ async restoreFileState(id) {
84
+ const checkpoint = this.getCheckpoint(id);
85
+ if (!checkpoint) {
86
+ return false;
87
+ }
88
+ checkpointFileManager.checkoutFileState(await checkpoint.fileStateIdPromise);
89
+ return true;
90
+ }
76
91
  /**
77
92
  * Clear all checkpoints
78
93
  */
79
94
  clearCheckpoints() {
80
95
  this.checkpoints.clear();
81
96
  this.nextId = 1; // Reset the ID counter when clearing
82
- this.oldestId = 1;
83
97
  }
84
98
  /**
85
99
  * Get a formatted string representation of all checkpoints
@@ -1 +1 @@
1
- {"version":3,"file":"checkpoints.js","sourceRoot":"","sources":["../src/checkpoints.ts"],"names":[],"mappings":";;;AAAA,2CAAsE;AAgBtE;;GAEG;AACH,MAAa,iBAAiB;IACpB,WAAW,GAA4B,IAAI,GAAG,EAAE,CAAA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AC9D,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;AAnKD,8CAmKC;AAED,iEAAiE;AACpD,QAAA,iBAAiB,GAAG,IAAI,iBAAiB,EAAE,CAAA"}
package/dist/cli.d.ts CHANGED
@@ -2,7 +2,6 @@ import { ProjectFileContext } from './common/util/file';
2
2
  import { CliOptions } from './types';
3
3
  export declare class CLI {
4
4
  private client;
5
- private chatStorage;
6
5
  private readyPromise;
7
6
  private git;
8
7
  private costMode;
@@ -14,7 +13,7 @@ export declare class CLI {
14
13
  private consecutiveFastInputs;
15
14
  private pastedContent;
16
15
  private isPasting;
17
- constructor(readyPromise: Promise<[void, ProjectFileContext]>, { git, costMode }: CliOptions);
16
+ constructor(readyPromise: Promise<[void, ProjectFileContext, void]>, { git, costMode }: CliOptions);
18
17
  private setupSignalHandlers;
19
18
  private initReadlineInterface;
20
19
  private completer;