sparkecoder 0.1.4 → 0.1.6

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/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
- import { R as ResolvedConfig } from './index-DkR9Ln_7.js';
2
- export { A as Agent, a as AgentOptions, b as AgentRunOptions, c as AgentStreamResult, S as SparkcoderConfig, T as ToolApprovalConfig } from './index-DkR9Ln_7.js';
1
+ import { R as ResolvedConfig } from './index-BeKylVnB.js';
2
+ export { A as Agent, a as AgentOptions, b as AgentRunOptions, c as AgentStreamResult, S as SparkcoderConfig, T as ToolApprovalConfig } from './index-BeKylVnB.js';
3
3
  export { ServerOptions, createApp, startServer, stopServer } from './server/index.js';
4
- export { closeDatabase, getDb, initDatabase, messageQueries, sessionQueries, skillQueries, todoQueries, toolExecutionQueries } from './db/index.js';
5
- export { a as Message, M as ModelMessage, S as Session, b as SessionConfig, g as Terminal, T as TodoItem, e as ToolExecution } from './schema-cUDLVN-b.js';
4
+ export { checkpointQueries, closeDatabase, fileBackupQueries, getDb, initDatabase, messageQueries, sessionQueries, skillQueries, todoQueries, toolExecutionQueries } from './db/index.js';
5
+ import { F as FileBackup, C as Checkpoint } from './schema-CkrIadxa.js';
6
+ export { a as Message, M as ModelMessage, S as Session, b as SessionConfig, g as Terminal, T as TodoItem, e as ToolExecution } from './schema-CkrIadxa.js';
6
7
  export { createLoadSkillTool, createReadFileTool, createTodoTool, createTools, createWriteFileTool } from './tools/index.js';
7
8
  export { c as createBashTool } from './bash-CGAqW7HR.js';
8
9
  import 'ai';
@@ -18,6 +19,68 @@ import 'drizzle-orm/sqlite-core';
18
19
  */
19
20
  declare function loadConfig(configPath?: string, workingDirectory?: string): ResolvedConfig;
20
21
 
22
+ /**
23
+ * Checkpoint system for session revert functionality
24
+ *
25
+ * Creates checkpoints before each user message, backs up modified files,
26
+ * and allows reverting to any previous checkpoint.
27
+ */
28
+
29
+ interface CheckpointManager {
30
+ sessionId: string;
31
+ workingDirectory: string;
32
+ currentCheckpointId: string | null;
33
+ }
34
+ /**
35
+ * Get or create a checkpoint manager for a session
36
+ */
37
+ declare function getCheckpointManager(sessionId: string, workingDirectory: string): CheckpointManager;
38
+ /**
39
+ * Create a new checkpoint before processing a user message
40
+ * Called when a user message is about to be processed
41
+ */
42
+ declare function createCheckpoint(sessionId: string, workingDirectory: string, messageSequence: number): Promise<Checkpoint>;
43
+ /**
44
+ * Backup a file before it's modified
45
+ * Called by the write_file tool before writing
46
+ */
47
+ declare function backupFile(sessionId: string, workingDirectory: string, filePath: string): Promise<FileBackup | null>;
48
+ /**
49
+ * Revert a session to a specific checkpoint
50
+ * This will:
51
+ * 1. Restore all files to their state at that checkpoint
52
+ * 2. Delete all messages after the checkpoint's message sequence
53
+ * 3. Delete all tool executions after the checkpoint
54
+ * 4. Delete all checkpoints after this one
55
+ */
56
+ declare function revertToCheckpoint(sessionId: string, checkpointId: string): Promise<{
57
+ success: boolean;
58
+ filesRestored: number;
59
+ filesDeleted: number;
60
+ messagesDeleted: number;
61
+ checkpointsDeleted: number;
62
+ error?: string;
63
+ }>;
64
+ /**
65
+ * Get all checkpoints for a session
66
+ */
67
+ declare function getCheckpoints(sessionId: string): Checkpoint[];
68
+ /**
69
+ * Get the diff for an entire session (all file changes from start to now)
70
+ */
71
+ declare function getSessionDiff(sessionId: string): Promise<{
72
+ files: Array<{
73
+ path: string;
74
+ status: 'created' | 'modified' | 'deleted';
75
+ originalContent: string | null;
76
+ currentContent: string | null;
77
+ }>;
78
+ }>;
79
+ /**
80
+ * Clear the checkpoint manager for a session (called when session is deleted)
81
+ */
82
+ declare function clearCheckpointManager(sessionId: string): void;
83
+
21
84
  /**
22
85
  * tmux wrapper for terminal session management
23
86
  *
@@ -142,4 +205,4 @@ declare namespace tmux {
142
205
 
143
206
  declare const VERSION = "0.1.0";
144
207
 
145
- export { ResolvedConfig, VERSION, loadConfig, tmux };
208
+ export { Checkpoint, FileBackup, ResolvedConfig, VERSION, backupFile, clearCheckpointManager, createCheckpoint, getCheckpointManager, getCheckpoints, getSessionDiff, loadConfig, revertToCheckpoint, tmux };