@neovate/code 0.27.0 → 0.28.0
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.mjs +713 -711
- package/dist/index.d.ts +401 -0
- package/dist/index.mjs +791 -789
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -301,6 +301,14 @@ declare type Config = {
|
|
|
301
301
|
* - 'maxOrXhigh': Prefer xhigh if available, otherwise max
|
|
302
302
|
*/
|
|
303
303
|
thinkingLevel?: 'low' | 'medium' | 'high' | 'max' | 'xhigh' | 'maxOrXhigh';
|
|
304
|
+
/**
|
|
305
|
+
* Controls whether rewind checkpoints are enabled.
|
|
306
|
+
* When enabled, snapshots are created after each AI response to allow
|
|
307
|
+
* rewinding to previous states with code restoration.
|
|
308
|
+
*
|
|
309
|
+
* @default true
|
|
310
|
+
*/
|
|
311
|
+
checkpoints?: boolean;
|
|
304
312
|
};
|
|
305
313
|
|
|
306
314
|
declare type ConfigGetInput = {
|
|
@@ -369,6 +377,7 @@ export declare class Context {
|
|
|
369
377
|
argvConfig: Record<string, any>;
|
|
370
378
|
mcpManager: MCPManager;
|
|
371
379
|
backgroundTaskManager: BackgroundTaskManager;
|
|
380
|
+
fileHistoryManager: FileHistoryManager;
|
|
372
381
|
skillManager?: SkillManager;
|
|
373
382
|
messageBus?: MessageBus;
|
|
374
383
|
agentManager?: AgentManager;
|
|
@@ -403,6 +412,7 @@ declare type ContextOpts = {
|
|
|
403
412
|
argvConfig: Record<string, any>;
|
|
404
413
|
mcpManager: MCPManager;
|
|
405
414
|
backgroundTaskManager: BackgroundTaskManager;
|
|
415
|
+
fileHistoryManager: FileHistoryManager;
|
|
406
416
|
skillManager?: SkillManager;
|
|
407
417
|
messageBus?: MessageBus;
|
|
408
418
|
agentManager?: AgentManager;
|
|
@@ -466,6 +476,177 @@ declare type EventMessage = BaseMessage & {
|
|
|
466
476
|
data: any;
|
|
467
477
|
};
|
|
468
478
|
|
|
479
|
+
/**
|
|
480
|
+
* Backup metadata for a single file
|
|
481
|
+
*/
|
|
482
|
+
declare type FileBackupMeta = {
|
|
483
|
+
/** Backup file name, format: {hash}@v{version}, null means file was deleted */
|
|
484
|
+
backupFileName: string | null;
|
|
485
|
+
/** Version number (incremental) */
|
|
486
|
+
version: number;
|
|
487
|
+
/** Backup time */
|
|
488
|
+
backupTime: Date;
|
|
489
|
+
};
|
|
490
|
+
|
|
491
|
+
declare type FileDiff = {
|
|
492
|
+
path: string;
|
|
493
|
+
oldContent: string;
|
|
494
|
+
newContent: string;
|
|
495
|
+
};
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* File diff content for UI display
|
|
499
|
+
*/
|
|
500
|
+
declare type FileDiff_2 = {
|
|
501
|
+
path: string;
|
|
502
|
+
oldContent: string;
|
|
503
|
+
newContent: string;
|
|
504
|
+
};
|
|
505
|
+
|
|
506
|
+
declare class FileHistory {
|
|
507
|
+
private cwd;
|
|
508
|
+
private sessionId;
|
|
509
|
+
private backupDir;
|
|
510
|
+
private snapshots;
|
|
511
|
+
private trackedFiles;
|
|
512
|
+
private pendingBackups;
|
|
513
|
+
constructor(opts: {
|
|
514
|
+
cwd: string;
|
|
515
|
+
sessionId: string;
|
|
516
|
+
backupRoot?: string;
|
|
517
|
+
snapshots?: Snapshot[];
|
|
518
|
+
});
|
|
519
|
+
/**
|
|
520
|
+
* Factory method: Create FileHistory instance from session data
|
|
521
|
+
*/
|
|
522
|
+
static fromSession(opts: {
|
|
523
|
+
cwd: string;
|
|
524
|
+
sessionId: string;
|
|
525
|
+
snapshots: SerializedSnapshot_2[];
|
|
526
|
+
backupRoot?: string;
|
|
527
|
+
}): FileHistory;
|
|
528
|
+
/**
|
|
529
|
+
* Add file to tracking list and create immediate backup.
|
|
530
|
+
* Accepts either absolute path or relative path (relative to cwd).
|
|
531
|
+
*
|
|
532
|
+
* This should be called BEFORE the file is modified, so we backup the OLD content.
|
|
533
|
+
*/
|
|
534
|
+
trackFile(filePath: string): void;
|
|
535
|
+
/**
|
|
536
|
+
* Track a new file (does not exist yet) before it gets created.
|
|
537
|
+
* Records backupFileName as null to indicate the file was newly created.
|
|
538
|
+
*/
|
|
539
|
+
trackNewFile(filePath: string): void;
|
|
540
|
+
/**
|
|
541
|
+
* Check if message has a snapshot
|
|
542
|
+
*/
|
|
543
|
+
hasSnapshot(messageId: string): boolean;
|
|
544
|
+
/**
|
|
545
|
+
* Generate backup file name: SHA256(relativePath).slice(0,16)@v{version}
|
|
546
|
+
*/
|
|
547
|
+
private generateBackupFileName;
|
|
548
|
+
/**
|
|
549
|
+
* Detect if file has changed compared to backup (metadata-first)
|
|
550
|
+
*/
|
|
551
|
+
private hasFileChanged;
|
|
552
|
+
/**
|
|
553
|
+
* Create file backup
|
|
554
|
+
*/
|
|
555
|
+
private createBackup;
|
|
556
|
+
/**
|
|
557
|
+
* Check if there are pending backups waiting to be snapshotted.
|
|
558
|
+
* Use this to determine if a snapshot should be created for this turn.
|
|
559
|
+
*/
|
|
560
|
+
hasPendingBackups(): boolean;
|
|
561
|
+
/**
|
|
562
|
+
* Create snapshot using pending backups created by trackFile.
|
|
563
|
+
* Only files with pending backups (modified this turn) are included.
|
|
564
|
+
* Returns null if no files were modified this turn.
|
|
565
|
+
*/
|
|
566
|
+
createSnapshot(messageId: string): Snapshot | null;
|
|
567
|
+
/**
|
|
568
|
+
* Get all snapshot previews
|
|
569
|
+
*/
|
|
570
|
+
getSnapshotPreviews(): SnapshotPreview_2[];
|
|
571
|
+
/**
|
|
572
|
+
* Calculate file diff using real line-by-line comparison
|
|
573
|
+
*/
|
|
574
|
+
private calculateDiff;
|
|
575
|
+
/**
|
|
576
|
+
* Restore single file
|
|
577
|
+
*/
|
|
578
|
+
private restoreFile;
|
|
579
|
+
/**
|
|
580
|
+
* Rewind to specified message's snapshot.
|
|
581
|
+
* Restores files to the state AT the target snapshot, reverting all changes
|
|
582
|
+
* made by snapshots after the target.
|
|
583
|
+
*/
|
|
584
|
+
rewindToMessage(messageId: string, dryRun?: boolean): RewindResult_2;
|
|
585
|
+
/**
|
|
586
|
+
* Read file content safely, returns empty string if file doesn't exist
|
|
587
|
+
*/
|
|
588
|
+
private readFileContent;
|
|
589
|
+
/**
|
|
590
|
+
* Get file contents for diff display
|
|
591
|
+
*/
|
|
592
|
+
private getFileDiffContents;
|
|
593
|
+
/**
|
|
594
|
+
* Preview rewind (dry run)
|
|
595
|
+
* @param cumulative - If true, calculates changes from this point to current state (for UI display)
|
|
596
|
+
* If false, only shows changes in this specific snapshot
|
|
597
|
+
*/
|
|
598
|
+
previewRewind(messageId: string, cumulative?: boolean): RewindResult_2;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
declare class FileHistoryManager {
|
|
602
|
+
private instances;
|
|
603
|
+
private cwd;
|
|
604
|
+
private backupRoot;
|
|
605
|
+
constructor(opts: FileHistoryManagerOpts);
|
|
606
|
+
/**
|
|
607
|
+
* Gets or creates a FileHistory instance for the given sessionId.
|
|
608
|
+
* If sessionLogPath is provided, attempts to load existing snapshots from session.jsonl.
|
|
609
|
+
*
|
|
610
|
+
* @param sessionId - Session ID (can be main session or agent session like 'agent-xxx')
|
|
611
|
+
* @param sessionLogPath - Optional path to session.jsonl for loading existing snapshots
|
|
612
|
+
* @returns FileHistory instance for the session
|
|
613
|
+
*/
|
|
614
|
+
getOrCreate(sessionId: string, sessionLogPath?: string): FileHistory;
|
|
615
|
+
/**
|
|
616
|
+
* Directly sets a FileHistory instance for a session.
|
|
617
|
+
* Used by snapshot.loadFromSession handler.
|
|
618
|
+
*
|
|
619
|
+
* @param sessionId - Session ID
|
|
620
|
+
* @param fileHistory - FileHistory instance to set
|
|
621
|
+
*/
|
|
622
|
+
set(sessionId: string, fileHistory: FileHistory): void;
|
|
623
|
+
/**
|
|
624
|
+
* Gets a FileHistory instance without creating it.
|
|
625
|
+
* Returns undefined if no instance exists.
|
|
626
|
+
*
|
|
627
|
+
* @param sessionId - Session ID
|
|
628
|
+
* @returns FileHistory instance or undefined
|
|
629
|
+
*/
|
|
630
|
+
get(sessionId: string): FileHistory | undefined;
|
|
631
|
+
/**
|
|
632
|
+
* Clears FileHistory instance(s).
|
|
633
|
+
*
|
|
634
|
+
* @param sessionId - Optional session ID. If provided, clears only that session.
|
|
635
|
+
* If not provided, clears all sessions.
|
|
636
|
+
*/
|
|
637
|
+
clear(sessionId?: string): void;
|
|
638
|
+
/**
|
|
639
|
+
* Destroys all FileHistory instances.
|
|
640
|
+
* Called when the Context is destroyed.
|
|
641
|
+
*/
|
|
642
|
+
destroy(): void;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
declare interface FileHistoryManagerOpts {
|
|
646
|
+
cwd: string;
|
|
647
|
+
backupRoot: string;
|
|
648
|
+
}
|
|
649
|
+
|
|
469
650
|
declare type GitCloneInput = {
|
|
470
651
|
url: string;
|
|
471
652
|
destination: string;
|
|
@@ -691,6 +872,10 @@ declare type HandlerMap = {
|
|
|
691
872
|
input: ModelsTestInput;
|
|
692
873
|
output: ModelsTestOutput;
|
|
693
874
|
};
|
|
875
|
+
'models.getVariants': {
|
|
876
|
+
input: ModelsGetVariantsInput;
|
|
877
|
+
output: ModelsGetVariantsOutput;
|
|
878
|
+
};
|
|
694
879
|
'outputStyles.list': {
|
|
695
880
|
input: OutputStylesListInput;
|
|
696
881
|
output: OutputStylesListOutput;
|
|
@@ -947,6 +1132,34 @@ declare type HandlerMap = {
|
|
|
947
1132
|
input: ToolApprovalInput;
|
|
948
1133
|
output: ToolApprovalOutput;
|
|
949
1134
|
};
|
|
1135
|
+
'snapshot.trackFile': {
|
|
1136
|
+
input: SnapshotTrackFileInput;
|
|
1137
|
+
output: SuccessResponse;
|
|
1138
|
+
};
|
|
1139
|
+
'snapshot.create': {
|
|
1140
|
+
input: SnapshotCreateInput;
|
|
1141
|
+
output: SnapshotCreateOutput;
|
|
1142
|
+
};
|
|
1143
|
+
'snapshot.list': {
|
|
1144
|
+
input: SnapshotListInput;
|
|
1145
|
+
output: SnapshotListOutput;
|
|
1146
|
+
};
|
|
1147
|
+
'snapshot.has': {
|
|
1148
|
+
input: SnapshotHasInput;
|
|
1149
|
+
output: SnapshotHasOutput;
|
|
1150
|
+
};
|
|
1151
|
+
'snapshot.rewind': {
|
|
1152
|
+
input: SnapshotRewindInput;
|
|
1153
|
+
output: SnapshotRewindOutput;
|
|
1154
|
+
};
|
|
1155
|
+
'snapshot.previewRewind': {
|
|
1156
|
+
input: SnapshotPreviewRewindInput;
|
|
1157
|
+
output: SnapshotPreviewRewindOutput;
|
|
1158
|
+
};
|
|
1159
|
+
'snapshot.loadFromSession': {
|
|
1160
|
+
input: SnapshotLoadFromSessionInput;
|
|
1161
|
+
output: SuccessResponse;
|
|
1162
|
+
};
|
|
950
1163
|
};
|
|
951
1164
|
|
|
952
1165
|
declare type ImagePart = {
|
|
@@ -1212,6 +1425,22 @@ declare interface ModelModalities {
|
|
|
1212
1425
|
output: ('text' | 'audio' | 'image')[];
|
|
1213
1426
|
}
|
|
1214
1427
|
|
|
1428
|
+
declare type ModelsGetVariantsInput = {
|
|
1429
|
+
cwd?: string;
|
|
1430
|
+
model: string;
|
|
1431
|
+
};
|
|
1432
|
+
|
|
1433
|
+
declare type ModelsGetVariantsOutput = {
|
|
1434
|
+
success: true;
|
|
1435
|
+
data: {
|
|
1436
|
+
model: string;
|
|
1437
|
+
variants: Record<string, any>;
|
|
1438
|
+
};
|
|
1439
|
+
} | {
|
|
1440
|
+
success: false;
|
|
1441
|
+
error: string;
|
|
1442
|
+
};
|
|
1443
|
+
|
|
1215
1444
|
declare type ModelsListInput = {
|
|
1216
1445
|
cwd: string;
|
|
1217
1446
|
};
|
|
@@ -1325,6 +1554,7 @@ declare class Paths {
|
|
|
1325
1554
|
globalConfigDir: string;
|
|
1326
1555
|
globalProjectDir: string;
|
|
1327
1556
|
projectConfigDir: string;
|
|
1557
|
+
fileHistoryDir: string;
|
|
1328
1558
|
constructor(opts: {
|
|
1329
1559
|
productName: string;
|
|
1330
1560
|
cwd: string;
|
|
@@ -1855,6 +2085,30 @@ export declare function resumeSession(sessionId: string, options: SDKSessionOpti
|
|
|
1855
2085
|
|
|
1856
2086
|
declare type ReturnDisplay = string | DiffViewerReturnDisplay | TodoWriteReturnDisplay | AgentResultReturnDisplay | PlanModeExitReturnDisplay;
|
|
1857
2087
|
|
|
2088
|
+
declare type RewindResult = {
|
|
2089
|
+
success: boolean;
|
|
2090
|
+
error?: string;
|
|
2091
|
+
filesChanged: string[];
|
|
2092
|
+
insertions: number;
|
|
2093
|
+
deletions: number;
|
|
2094
|
+
fileDiffs?: FileDiff[];
|
|
2095
|
+
};
|
|
2096
|
+
|
|
2097
|
+
/**
|
|
2098
|
+
* Rewind operation result
|
|
2099
|
+
*/
|
|
2100
|
+
declare type RewindResult_2 = {
|
|
2101
|
+
success: boolean;
|
|
2102
|
+
error?: string;
|
|
2103
|
+
/** List of restored files */
|
|
2104
|
+
filesChanged: string[];
|
|
2105
|
+
/** Change statistics */
|
|
2106
|
+
insertions: number;
|
|
2107
|
+
deletions: number;
|
|
2108
|
+
/** File diffs for UI display (only in preview mode) */
|
|
2109
|
+
fileDiffs?: FileDiff_2[];
|
|
2110
|
+
};
|
|
2111
|
+
|
|
1858
2112
|
export declare function runNeovate(opts: {
|
|
1859
2113
|
productName: string;
|
|
1860
2114
|
productASCIIArt?: string;
|
|
@@ -1945,6 +2199,29 @@ export declare type SDKUserMessage = {
|
|
|
1945
2199
|
sessionId: string;
|
|
1946
2200
|
};
|
|
1947
2201
|
|
|
2202
|
+
declare type SerializedSnapshot = {
|
|
2203
|
+
messageId: string;
|
|
2204
|
+
timestamp: string;
|
|
2205
|
+
trackedFileBackups: Record<string, {
|
|
2206
|
+
backupFileName: string | null;
|
|
2207
|
+
version: number;
|
|
2208
|
+
backupTime: string;
|
|
2209
|
+
}>;
|
|
2210
|
+
};
|
|
2211
|
+
|
|
2212
|
+
/**
|
|
2213
|
+
* Serialized snapshot data (for JSONL storage)
|
|
2214
|
+
*/
|
|
2215
|
+
declare type SerializedSnapshot_2 = {
|
|
2216
|
+
messageId: string;
|
|
2217
|
+
timestamp: string;
|
|
2218
|
+
trackedFileBackups: Record<string, {
|
|
2219
|
+
backupFileName: string | null;
|
|
2220
|
+
version: number;
|
|
2221
|
+
backupTime: string;
|
|
2222
|
+
}>;
|
|
2223
|
+
};
|
|
2224
|
+
|
|
1948
2225
|
declare type SessionAddMessagesInput = {
|
|
1949
2226
|
cwd: string;
|
|
1950
2227
|
sessionId: string;
|
|
@@ -2428,6 +2705,129 @@ declare type SlashCommandListOutput = {
|
|
|
2428
2705
|
};
|
|
2429
2706
|
};
|
|
2430
2707
|
|
|
2708
|
+
/**
|
|
2709
|
+
* File state snapshot at a specific message point
|
|
2710
|
+
*/
|
|
2711
|
+
declare type Snapshot = {
|
|
2712
|
+
/** Associated message UUID */
|
|
2713
|
+
messageId: string;
|
|
2714
|
+
/** Snapshot creation time */
|
|
2715
|
+
timestamp: Date;
|
|
2716
|
+
/** Relative path -> backup metadata mapping */
|
|
2717
|
+
trackedFileBackups: Record<string, FileBackupMeta>;
|
|
2718
|
+
};
|
|
2719
|
+
|
|
2720
|
+
declare type SnapshotCreateInput = {
|
|
2721
|
+
cwd: string;
|
|
2722
|
+
sessionId: string;
|
|
2723
|
+
messageId: string;
|
|
2724
|
+
description?: string;
|
|
2725
|
+
};
|
|
2726
|
+
|
|
2727
|
+
declare type SnapshotCreateOutput = {
|
|
2728
|
+
success: boolean;
|
|
2729
|
+
data: {
|
|
2730
|
+
snapshot: SnapshotPreview | null;
|
|
2731
|
+
};
|
|
2732
|
+
};
|
|
2733
|
+
|
|
2734
|
+
declare type SnapshotHasInput = {
|
|
2735
|
+
cwd: string;
|
|
2736
|
+
sessionId: string;
|
|
2737
|
+
messageId: string;
|
|
2738
|
+
};
|
|
2739
|
+
|
|
2740
|
+
declare type SnapshotHasOutput = {
|
|
2741
|
+
success: boolean;
|
|
2742
|
+
data: {
|
|
2743
|
+
hasSnapshot: boolean;
|
|
2744
|
+
};
|
|
2745
|
+
};
|
|
2746
|
+
|
|
2747
|
+
declare type SnapshotListInput = {
|
|
2748
|
+
cwd: string;
|
|
2749
|
+
sessionId: string;
|
|
2750
|
+
};
|
|
2751
|
+
|
|
2752
|
+
declare type SnapshotListOutput = {
|
|
2753
|
+
success: boolean;
|
|
2754
|
+
data: {
|
|
2755
|
+
snapshots: SnapshotPreview[];
|
|
2756
|
+
};
|
|
2757
|
+
};
|
|
2758
|
+
|
|
2759
|
+
declare type SnapshotLoadFromSessionInput = {
|
|
2760
|
+
cwd: string;
|
|
2761
|
+
sessionId: string;
|
|
2762
|
+
snapshots: SerializedSnapshot[];
|
|
2763
|
+
};
|
|
2764
|
+
|
|
2765
|
+
declare type SnapshotPreview = {
|
|
2766
|
+
messageId: string;
|
|
2767
|
+
timestamp: Date;
|
|
2768
|
+
fileCount: number;
|
|
2769
|
+
changes?: {
|
|
2770
|
+
insertions: number;
|
|
2771
|
+
deletions: number;
|
|
2772
|
+
filesChanged: number;
|
|
2773
|
+
};
|
|
2774
|
+
};
|
|
2775
|
+
|
|
2776
|
+
/**
|
|
2777
|
+
* Snapshot preview info (for UI display)
|
|
2778
|
+
*/
|
|
2779
|
+
declare type SnapshotPreview_2 = {
|
|
2780
|
+
messageId: string;
|
|
2781
|
+
timestamp: Date;
|
|
2782
|
+
fileCount: number;
|
|
2783
|
+
/** Change statistics relative to previous snapshot */
|
|
2784
|
+
changes?: {
|
|
2785
|
+
insertions: number;
|
|
2786
|
+
deletions: number;
|
|
2787
|
+
filesChanged: number;
|
|
2788
|
+
};
|
|
2789
|
+
};
|
|
2790
|
+
|
|
2791
|
+
declare type SnapshotPreviewRewindInput = {
|
|
2792
|
+
cwd: string;
|
|
2793
|
+
sessionId: string;
|
|
2794
|
+
messageId: string;
|
|
2795
|
+
cumulative?: boolean;
|
|
2796
|
+
};
|
|
2797
|
+
|
|
2798
|
+
declare type SnapshotPreviewRewindOutput = {
|
|
2799
|
+
success: true;
|
|
2800
|
+
data: {
|
|
2801
|
+
result: RewindResult;
|
|
2802
|
+
};
|
|
2803
|
+
} | {
|
|
2804
|
+
success: false;
|
|
2805
|
+
error: string;
|
|
2806
|
+
};
|
|
2807
|
+
|
|
2808
|
+
declare type SnapshotRewindInput = {
|
|
2809
|
+
cwd: string;
|
|
2810
|
+
sessionId: string;
|
|
2811
|
+
messageId: string;
|
|
2812
|
+
};
|
|
2813
|
+
|
|
2814
|
+
declare type SnapshotRewindOutput = {
|
|
2815
|
+
success: true;
|
|
2816
|
+
data: {
|
|
2817
|
+
result: RewindResult;
|
|
2818
|
+
};
|
|
2819
|
+
} | {
|
|
2820
|
+
success: false;
|
|
2821
|
+
error: string;
|
|
2822
|
+
};
|
|
2823
|
+
|
|
2824
|
+
declare type SnapshotTrackFileInput = {
|
|
2825
|
+
cwd: string;
|
|
2826
|
+
sessionId: string;
|
|
2827
|
+
filePath: string;
|
|
2828
|
+
isNewFile?: boolean;
|
|
2829
|
+
};
|
|
2830
|
+
|
|
2431
2831
|
declare type Status = Record<string, {
|
|
2432
2832
|
description?: string;
|
|
2433
2833
|
items: string[];
|
|
@@ -2774,6 +3174,7 @@ declare type WorkspaceData = {
|
|
|
2774
3174
|
repoPath: string;
|
|
2775
3175
|
branch: string;
|
|
2776
3176
|
worktreePath: string;
|
|
3177
|
+
globalProjectDir: string;
|
|
2777
3178
|
sessionIds: string[];
|
|
2778
3179
|
gitState: {
|
|
2779
3180
|
currentCommit: string;
|