centaurus-cli 3.0.0 → 3.0.1
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/cli-adapter.d.ts +3 -0
- package/dist/cli-adapter.d.ts.map +1 -1
- package/dist/cli-adapter.js +139 -18
- package/dist/cli-adapter.js.map +1 -1
- package/dist/services/checkpoint-manager.d.ts +81 -44
- package/dist/services/checkpoint-manager.d.ts.map +1 -1
- package/dist/services/checkpoint-manager.js +1219 -693
- package/dist/services/checkpoint-manager.js.map +1 -1
- package/dist/tools/file-ops.d.ts.map +1 -1
- package/dist/tools/file-ops.js +39 -0
- package/dist/tools/file-ops.js.map +1 -1
- package/dist/tools/get-diff.js +8 -2
- package/dist/tools/get-diff.js.map +1 -1
- package/dist/ui/components/App.d.ts.map +1 -1
- package/dist/ui/components/App.js +16 -2
- package/dist/ui/components/App.js.map +1 -1
- package/package.json +1 -1
|
@@ -62,7 +62,22 @@ export declare class CheckpointManager {
|
|
|
62
62
|
clear(): void;
|
|
63
63
|
list(): CheckpointMeta[];
|
|
64
64
|
/**
|
|
65
|
-
*
|
|
65
|
+
* Back up a single file before the AI modifies it.
|
|
66
|
+
* This is the core of the new checkpoint system: instead of copying the
|
|
67
|
+
* entire project at checkpoint start, we only back up the specific files
|
|
68
|
+
* that the AI actually touches, right before it touches them.
|
|
69
|
+
*
|
|
70
|
+
* If the file has already been backed up in this checkpoint, this is a no-op
|
|
71
|
+
* (we always want the ORIGINAL state, not intermediate states).
|
|
72
|
+
*/
|
|
73
|
+
backupFileBeforeChange(checkpointId: string, absoluteFilePath: string, cwd: string, handler?: RemoteFileHandler): Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* Record a file operation in the checkpoint's operation log.
|
|
76
|
+
* Called by file tools after successfully modifying a file.
|
|
77
|
+
*/
|
|
78
|
+
recordFileOperation(checkpointId: string, type: 'create' | 'modify' | 'delete', filePath: string, toolName: string): void;
|
|
79
|
+
/**
|
|
80
|
+
* Get session changes for a checkpoint (live calculation).
|
|
66
81
|
* Returns added/modified/deleted file lists plus per-file line stats.
|
|
67
82
|
*/
|
|
68
83
|
getSessionChanges(checkpointId: string, handler?: RemoteFileHandler): Promise<{
|
|
@@ -74,38 +89,37 @@ export declare class CheckpointManager {
|
|
|
74
89
|
}[];
|
|
75
90
|
} | null>;
|
|
76
91
|
/**
|
|
77
|
-
* Get
|
|
78
|
-
*
|
|
79
|
-
*/
|
|
80
|
-
getFileDiff(checkpointId: string, filePath: string, handler?: RemoteFileHandler): Promise<string | null>;
|
|
81
|
-
/**
|
|
82
|
-
* Get the initial checkpoint for the current chat session.
|
|
83
|
-
* This represents the state at the start of the conversation.
|
|
92
|
+
* Get session changes across ALL checkpoints (for session scope).
|
|
93
|
+
* Aggregates backups from all checkpoints to find the original state of each file.
|
|
84
94
|
*/
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
95
|
+
getAggregatedSessionChanges(handler?: RemoteFileHandler): Promise<{
|
|
96
|
+
changes: CheckpointChanges;
|
|
97
|
+
stats: {
|
|
98
|
+
filePath: string;
|
|
99
|
+
insertions: number;
|
|
100
|
+
deletions: number;
|
|
101
|
+
}[];
|
|
102
|
+
} | null>;
|
|
91
103
|
/**
|
|
92
|
-
*
|
|
104
|
+
* Get a unified diff for a single file within a checkpoint.
|
|
105
|
+
* For V2 checkpoints: compares the backed-up original to the current version.
|
|
106
|
+
* For V1 checkpoints: compares the full snapshot to the current version (legacy).
|
|
93
107
|
*/
|
|
94
|
-
|
|
108
|
+
getFileDiff(checkpointId: string, filePath: string, handler?: RemoteFileHandler): Promise<string | null>;
|
|
95
109
|
/**
|
|
96
|
-
*
|
|
110
|
+
* Get a session-wide diff for a single file (across all checkpoints).
|
|
111
|
+
* Finds the earliest backup of the file and compares to current state.
|
|
97
112
|
*/
|
|
98
|
-
|
|
113
|
+
getSessionFileDiff(filePath: string, handler?: RemoteFileHandler): Promise<string | null>;
|
|
99
114
|
/**
|
|
100
|
-
*
|
|
101
|
-
* Uses optimized approach for large files (limit LCS table size)
|
|
115
|
+
* Get the initial checkpoint for the current chat session.
|
|
102
116
|
*/
|
|
103
|
-
|
|
117
|
+
getInitialCheckpoint(): CheckpointMeta | null;
|
|
104
118
|
/**
|
|
105
|
-
*
|
|
119
|
+
* Start a new checkpoint. With V2 (backup-on-write), this is nearly instant:
|
|
120
|
+
* no file scanning or copying. Just creates the checkpoint metadata and an
|
|
121
|
+
* empty manifest.
|
|
106
122
|
*/
|
|
107
|
-
private simpleLCS;
|
|
108
|
-
markDiscarded(id: string): void;
|
|
109
123
|
startCheckpoint(params: {
|
|
110
124
|
prompt: string;
|
|
111
125
|
cwd: string;
|
|
@@ -118,45 +132,68 @@ export declare class CheckpointManager {
|
|
|
118
132
|
}): Promise<CheckpointMeta | null>;
|
|
119
133
|
finalizeCheckpoint(id: string): Promise<void>;
|
|
120
134
|
recordToolCall(id: string, toolCall: CheckpointToolCall): void;
|
|
135
|
+
/**
|
|
136
|
+
* Revert to a checkpoint. For V2 checkpoints, this is efficient:
|
|
137
|
+
* only the files the AI actually touched are restored.
|
|
138
|
+
*
|
|
139
|
+
* - Files the AI created (existed=false): deleted
|
|
140
|
+
* - Files the AI modified (existed=true): restored from backup
|
|
141
|
+
*/
|
|
121
142
|
revertToCheckpoint(id: string, handler?: RemoteFileHandler): Promise<{
|
|
122
143
|
checkpoint: CheckpointMeta;
|
|
123
144
|
restored: number;
|
|
124
145
|
removed: number;
|
|
125
146
|
errors: string[];
|
|
126
147
|
}>;
|
|
148
|
+
markDiscarded(id: string): void;
|
|
149
|
+
removeCheckpointsFrom(id: string): void;
|
|
150
|
+
discardCheckpointById(id: string): void;
|
|
151
|
+
deleteCheckpointsForChat(chatId: string): void;
|
|
152
|
+
private revertV2;
|
|
153
|
+
private getFileDiffV2;
|
|
127
154
|
/**
|
|
128
|
-
*
|
|
155
|
+
* V1 diff: uses full snapshot files (legacy checkpoints).
|
|
129
156
|
*/
|
|
130
|
-
private
|
|
131
|
-
|
|
157
|
+
private getFileDiffV1;
|
|
158
|
+
private getSessionChangesV1;
|
|
132
159
|
/**
|
|
133
|
-
*
|
|
134
|
-
* Used when a background/late checkpoint should not be kept.
|
|
160
|
+
* V1 local revert: legacy full-scan approach.
|
|
135
161
|
*/
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
162
|
+
private revertLocalCheckpointV1;
|
|
163
|
+
/**
|
|
164
|
+
* V1 remote revert: legacy full-scan approach.
|
|
165
|
+
*/
|
|
166
|
+
private revertRemoteCheckpointV1;
|
|
139
167
|
private calculateChanges;
|
|
140
|
-
private readManifest;
|
|
141
|
-
private createSnapshot;
|
|
142
168
|
/**
|
|
143
|
-
*
|
|
144
|
-
*
|
|
169
|
+
* V2: Calculate changes from backup entries only.
|
|
170
|
+
* No directory scanning needed — we only track files the AI touched.
|
|
145
171
|
*/
|
|
146
|
-
private
|
|
147
|
-
private scanFiles;
|
|
172
|
+
private calculateChangesV2;
|
|
148
173
|
/**
|
|
149
|
-
*
|
|
150
|
-
* Used by local revert to find directories that may need cleanup.
|
|
174
|
+
* V1 legacy: full directory scan approach.
|
|
151
175
|
*/
|
|
152
|
-
private
|
|
176
|
+
private calculateChangesV1;
|
|
153
177
|
/**
|
|
154
|
-
*
|
|
155
|
-
* Uses `find` with ignore patterns equivalent to DEFAULT_IGNORE_PATTERNS.
|
|
178
|
+
* Clean up empty directories after deleting files that the AI created.
|
|
156
179
|
*/
|
|
157
|
-
private
|
|
180
|
+
private cleanupEmptyDirectories;
|
|
181
|
+
private cleanupEmptyDirectoriesRemote;
|
|
182
|
+
private calculateLineStats;
|
|
183
|
+
private calculateLineStatsFromContent;
|
|
184
|
+
private generateUnifiedDiff;
|
|
185
|
+
private computeHunks;
|
|
186
|
+
private longestCommonSubsequence;
|
|
187
|
+
private simpleLCS;
|
|
158
188
|
private filesDiffer;
|
|
159
189
|
private removeFileOrDirSync;
|
|
190
|
+
private readManifest;
|
|
191
|
+
private readManifestV2;
|
|
192
|
+
private isV2Manifest;
|
|
193
|
+
private scanLocalFiles;
|
|
194
|
+
private scanLocalDirectories;
|
|
195
|
+
private scanRemoteFiles;
|
|
196
|
+
private discardCheckpoint;
|
|
160
197
|
private generateCheckpointId;
|
|
161
198
|
private ensureDirSync;
|
|
162
199
|
private getChatDir;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkpoint-manager.d.ts","sourceRoot":"","sources":["../../src/services/checkpoint-manager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"checkpoint-manager.d.ts","sourceRoot":"","sources":["../../src/services/checkpoint-manager.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,qBAAqB,GAAG,OAAO,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,CAAC;AAEvE;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACxC,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/F,WAAW,IAAI,OAAO,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,EAAE,MA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