surrogate-protocol-mcp 3.4.0 → 3.4.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/package.json +1 -1
- package/dist/utils/migrate-yaml-to-db.d.ts +0 -24
- package/dist/utils/migrate-yaml-to-db.d.ts.map +0 -1
- package/dist/utils/migrate-yaml-to-db.js +0 -274
- package/dist/utils/migrate-yaml-to-db.js.map +0 -1
- package/dist/utils/state-db.d.ts +0 -172
- package/dist/utils/state-db.d.ts.map +0 -1
- package/dist/utils/state-db.js +0 -465
- package/dist/utils/state-db.js.map +0 -1
- package/dist/utils/worktree.d.ts +0 -31
- package/dist/utils/worktree.d.ts.map +0 -1
- package/dist/utils/worktree.js +0 -339
- package/dist/utils/worktree.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Check if YAML file exists and needs migration.
|
|
3
|
-
*/
|
|
4
|
-
export declare function needsMigration(): boolean;
|
|
5
|
-
/**
|
|
6
|
-
* Migrate YAML state to SQLite database.
|
|
7
|
-
*/
|
|
8
|
-
export declare function migrateYamlToDatabase(): {
|
|
9
|
-
success: boolean;
|
|
10
|
-
error?: string;
|
|
11
|
-
stats?: {
|
|
12
|
-
surrogates_migrated: number;
|
|
13
|
-
locks_migrated: number;
|
|
14
|
-
mission_migrated: boolean;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* Rollback migration (restore from backup).
|
|
19
|
-
*/
|
|
20
|
-
export declare function rollbackMigration(): {
|
|
21
|
-
success: boolean;
|
|
22
|
-
error?: string;
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=migrate-yaml-to-db.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"migrate-yaml-to-db.d.ts","sourceRoot":"","sources":["../../src/utils/migrate-yaml-to-db.ts"],"names":[],"mappings":"AA+DA;;GAEG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAExC;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI;IACvC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE;QACN,mBAAmB,EAAE,MAAM,CAAC;QAC5B,cAAc,EAAE,MAAM,CAAC;QACvB,gBAAgB,EAAE,OAAO,CAAC;KAC3B,CAAC;CACH,CAoLA;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CA4BxE"}
|
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
// surrogate-tools/src/utils/migrate-yaml-to-db.ts
|
|
2
|
-
// P1: One-time migration utility from YAML to SQLite
|
|
3
|
-
import * as fs from 'fs';
|
|
4
|
-
import * as path from 'path';
|
|
5
|
-
import * as yaml from 'yaml';
|
|
6
|
-
import { PROJECT_ROOT } from './state.js';
|
|
7
|
-
import { getDatabase, createSurrogate, setMission, addLog, } from './state-db.js';
|
|
8
|
-
// ═══════════════════════════════════════════════════════════════════════════
|
|
9
|
-
// MIGRATION FUNCTIONS
|
|
10
|
-
// ═══════════════════════════════════════════════════════════════════════════
|
|
11
|
-
const YAML_PATH = path.join(PROJECT_ROOT, '.surrogate', 'flight_recorder.yaml');
|
|
12
|
-
const YAML_BACKUP_PATH = path.join(PROJECT_ROOT, '.surrogate', 'flight_recorder.yaml.pre-migration-backup');
|
|
13
|
-
/**
|
|
14
|
-
* Check if YAML file exists and needs migration.
|
|
15
|
-
*/
|
|
16
|
-
export function needsMigration() {
|
|
17
|
-
return fs.existsSync(YAML_PATH) && !fs.existsSync(YAML_BACKUP_PATH);
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Migrate YAML state to SQLite database.
|
|
21
|
-
*/
|
|
22
|
-
export function migrateYamlToDatabase() {
|
|
23
|
-
try {
|
|
24
|
-
// Check if YAML file exists
|
|
25
|
-
if (!fs.existsSync(YAML_PATH)) {
|
|
26
|
-
return {
|
|
27
|
-
success: false,
|
|
28
|
-
error: 'YAML file not found (already migrated or never existed)',
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
// Check if already migrated
|
|
32
|
-
if (fs.existsSync(YAML_BACKUP_PATH)) {
|
|
33
|
-
return {
|
|
34
|
-
success: false,
|
|
35
|
-
error: 'Migration already completed (backup exists)',
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
console.error('[Migration] Reading YAML state file...');
|
|
39
|
-
const yamlContent = fs.readFileSync(YAML_PATH, 'utf8');
|
|
40
|
-
const state = yaml.parse(yamlContent) || {};
|
|
41
|
-
console.error('[Migration] Initializing SQLite database...');
|
|
42
|
-
const db = getDatabase();
|
|
43
|
-
let surrogatesMigrated = 0;
|
|
44
|
-
let locksMigrated = 0;
|
|
45
|
-
let missionMigrated = false;
|
|
46
|
-
// Migrate mission
|
|
47
|
-
if (state.mission) {
|
|
48
|
-
console.error('[Migration] Migrating mission objective...');
|
|
49
|
-
const decomposition = state.mission.tasks
|
|
50
|
-
? JSON.stringify(state.mission.tasks)
|
|
51
|
-
: state.mission.decomposition || undefined;
|
|
52
|
-
setMission(state.mission.objective, decomposition);
|
|
53
|
-
missionMigrated = true;
|
|
54
|
-
}
|
|
55
|
-
// Migrate active surrogates
|
|
56
|
-
if (state.active_surrogates && state.active_surrogates.length > 0) {
|
|
57
|
-
console.error(`[Migration] Migrating ${state.active_surrogates.length} active surrogates...`);
|
|
58
|
-
for (const surrogate of state.active_surrogates) {
|
|
59
|
-
try {
|
|
60
|
-
const filesToLock = surrogate.files_locked || [];
|
|
61
|
-
// Create surrogate in SQLite
|
|
62
|
-
const result = createSurrogate({
|
|
63
|
-
id: surrogate.id,
|
|
64
|
-
role: surrogate.role,
|
|
65
|
-
task: surrogate.task,
|
|
66
|
-
worktree_path: surrogate.worktree_path,
|
|
67
|
-
branch: surrogate.branch,
|
|
68
|
-
agent_pid: surrogate.agent_pid,
|
|
69
|
-
files_to_lock: filesToLock,
|
|
70
|
-
});
|
|
71
|
-
if (!result.success) {
|
|
72
|
-
console.error(`[Migration] Warning: Failed to migrate surrogate ${surrogate.id}: ${result.error}`);
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
surrogatesMigrated++;
|
|
76
|
-
locksMigrated += filesToLock.length;
|
|
77
|
-
// Update status and timestamps using raw SQL (bypass helper functions)
|
|
78
|
-
const startedAt = surrogate.started_at ? new Date(surrogate.started_at).getTime() / 1000 : Math.floor(Date.now() / 1000);
|
|
79
|
-
const lastHeartbeat = surrogate.last_heartbeat ? new Date(surrogate.last_heartbeat).getTime() / 1000 : null;
|
|
80
|
-
db.prepare(`UPDATE surrogates
|
|
81
|
-
SET status = ?, started_at = ?, last_heartbeat = ?
|
|
82
|
-
WHERE id = ?`).run(normalizeStatus(surrogate.status), Math.floor(startedAt), lastHeartbeat ? Math.floor(lastHeartbeat) : null, surrogate.id);
|
|
83
|
-
// Add migration log
|
|
84
|
-
addLog(surrogate.id, 'INFO', 'Migrated from YAML to SQLite', {
|
|
85
|
-
original_status: surrogate.status,
|
|
86
|
-
migration_time: new Date().toISOString(),
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
catch (error) {
|
|
90
|
-
console.error(`[Migration] Error migrating surrogate ${surrogate.id}:`, error);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
// Migrate recent completed surrogates
|
|
95
|
-
if (state.recent_completed && state.recent_completed.length > 0) {
|
|
96
|
-
console.error(`[Migration] Migrating ${state.recent_completed.length} completed surrogates...`);
|
|
97
|
-
for (const surrogate of state.recent_completed) {
|
|
98
|
-
try {
|
|
99
|
-
// For completed surrogates, we don't lock files (they're done)
|
|
100
|
-
const result = createSurrogate({
|
|
101
|
-
id: surrogate.id,
|
|
102
|
-
role: surrogate.role,
|
|
103
|
-
task: surrogate.task,
|
|
104
|
-
worktree_path: surrogate.worktree_path,
|
|
105
|
-
branch: surrogate.branch,
|
|
106
|
-
agent_pid: surrogate.agent_pid,
|
|
107
|
-
files_to_lock: [], // No locks for completed surrogates
|
|
108
|
-
});
|
|
109
|
-
if (!result.success) {
|
|
110
|
-
console.error(`[Migration] Warning: Failed to migrate completed surrogate ${surrogate.id}: ${result.error}`);
|
|
111
|
-
continue;
|
|
112
|
-
}
|
|
113
|
-
surrogatesMigrated++;
|
|
114
|
-
// Update to completed status with timestamps
|
|
115
|
-
const startedAt = surrogate.started_at ? new Date(surrogate.started_at).getTime() / 1000 : Math.floor(Date.now() / 1000);
|
|
116
|
-
const completedAt = surrogate.completed_at ? new Date(surrogate.completed_at).getTime() / 1000 : Math.floor(Date.now() / 1000);
|
|
117
|
-
if (surrogate.status === 'FAILED' && surrogate.error_type) {
|
|
118
|
-
db.prepare(`UPDATE surrogates
|
|
119
|
-
SET status = 'FAILED', error_type = ?, error_message = ?, started_at = ?, completed_at = ?
|
|
120
|
-
WHERE id = ?`).run(normalizeErrorType(surrogate.error_type), surrogate.error_message || 'Migrated failed surrogate', Math.floor(startedAt), Math.floor(completedAt), surrogate.id);
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
db.prepare(`UPDATE surrogates
|
|
124
|
-
SET status = 'COMPLETE', started_at = ?, completed_at = ?
|
|
125
|
-
WHERE id = ?`).run(Math.floor(startedAt), Math.floor(completedAt), surrogate.id);
|
|
126
|
-
}
|
|
127
|
-
// Add migration log
|
|
128
|
-
addLog(surrogate.id, 'INFO', 'Migrated completed surrogate from YAML', {
|
|
129
|
-
original_status: surrogate.status,
|
|
130
|
-
migration_time: new Date().toISOString(),
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
catch (error) {
|
|
134
|
-
console.error(`[Migration] Error migrating completed surrogate ${surrogate.id}:`, error);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
// Create backup of YAML file
|
|
139
|
-
console.error('[Migration] Creating backup of YAML file...');
|
|
140
|
-
fs.copyFileSync(YAML_PATH, YAML_BACKUP_PATH);
|
|
141
|
-
// Optionally rename original YAML (keep for rollback)
|
|
142
|
-
const renamedPath = path.join(PROJECT_ROOT, '.surrogate', 'flight_recorder.yaml.migrated');
|
|
143
|
-
fs.renameSync(YAML_PATH, renamedPath);
|
|
144
|
-
console.error('[Migration] Migration completed successfully!');
|
|
145
|
-
console.error(`[Migration] - Surrogates migrated: ${surrogatesMigrated}`);
|
|
146
|
-
console.error(`[Migration] - File locks migrated: ${locksMigrated}`);
|
|
147
|
-
console.error(`[Migration] - Mission migrated: ${missionMigrated}`);
|
|
148
|
-
console.error(`[Migration] - YAML backup: ${YAML_BACKUP_PATH}`);
|
|
149
|
-
return {
|
|
150
|
-
success: true,
|
|
151
|
-
stats: {
|
|
152
|
-
surrogates_migrated: surrogatesMigrated,
|
|
153
|
-
locks_migrated: locksMigrated,
|
|
154
|
-
mission_migrated: missionMigrated,
|
|
155
|
-
},
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
catch (error) {
|
|
159
|
-
return {
|
|
160
|
-
success: false,
|
|
161
|
-
error: `Migration failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Rollback migration (restore from backup).
|
|
167
|
-
*/
|
|
168
|
-
export function rollbackMigration() {
|
|
169
|
-
try {
|
|
170
|
-
if (!fs.existsSync(YAML_BACKUP_PATH)) {
|
|
171
|
-
return {
|
|
172
|
-
success: false,
|
|
173
|
-
error: 'No backup found to rollback from',
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
console.error('[Rollback] Restoring YAML from backup...');
|
|
177
|
-
fs.copyFileSync(YAML_BACKUP_PATH, YAML_PATH);
|
|
178
|
-
console.error('[Rollback] Removing migrated file...');
|
|
179
|
-
const migratedPath = path.join(PROJECT_ROOT, '.surrogate', 'flight_recorder.yaml.migrated');
|
|
180
|
-
if (fs.existsSync(migratedPath)) {
|
|
181
|
-
fs.unlinkSync(migratedPath);
|
|
182
|
-
}
|
|
183
|
-
console.error('[Rollback] Rollback completed. YAML state restored.');
|
|
184
|
-
console.error('[Rollback] Note: SQLite database is NOT cleared. Set SURROGATE_USE_YAML=true to use YAML.');
|
|
185
|
-
return { success: true };
|
|
186
|
-
}
|
|
187
|
-
catch (error) {
|
|
188
|
-
return {
|
|
189
|
-
success: false,
|
|
190
|
-
error: `Rollback failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
// ═══════════════════════════════════════════════════════════════════════════
|
|
195
|
-
// HELPER FUNCTIONS
|
|
196
|
-
// ═══════════════════════════════════════════════════════════════════════════
|
|
197
|
-
/**
|
|
198
|
-
* Normalize status string to valid SurrogateStatus.
|
|
199
|
-
*/
|
|
200
|
-
function normalizeStatus(status) {
|
|
201
|
-
const upper = status.toUpperCase();
|
|
202
|
-
const validStatuses = [
|
|
203
|
-
'INITIALIZING',
|
|
204
|
-
'CODING',
|
|
205
|
-
'TESTING',
|
|
206
|
-
'REVIEWING',
|
|
207
|
-
'COMPLETE',
|
|
208
|
-
'FAILED',
|
|
209
|
-
];
|
|
210
|
-
if (validStatuses.includes(upper)) {
|
|
211
|
-
return upper;
|
|
212
|
-
}
|
|
213
|
-
// Map common variations
|
|
214
|
-
if (upper.includes('INIT'))
|
|
215
|
-
return 'INITIALIZING';
|
|
216
|
-
if (upper.includes('CODE') || upper.includes('WORK'))
|
|
217
|
-
return 'CODING';
|
|
218
|
-
if (upper.includes('TEST'))
|
|
219
|
-
return 'TESTING';
|
|
220
|
-
if (upper.includes('REVIEW'))
|
|
221
|
-
return 'REVIEWING';
|
|
222
|
-
if (upper.includes('COMPLETE') || upper.includes('SUCCESS') || upper.includes('DONE'))
|
|
223
|
-
return 'COMPLETE';
|
|
224
|
-
if (upper.includes('FAIL') || upper.includes('ERROR'))
|
|
225
|
-
return 'FAILED';
|
|
226
|
-
// Default to CODING if unclear
|
|
227
|
-
return 'CODING';
|
|
228
|
-
}
|
|
229
|
-
/**
|
|
230
|
-
* Normalize error type string to valid ErrorType.
|
|
231
|
-
*/
|
|
232
|
-
function normalizeErrorType(errorType) {
|
|
233
|
-
const upper = errorType.toUpperCase().replace(/[-_\s]/g, '_');
|
|
234
|
-
const validTypes = [
|
|
235
|
-
'AUTH',
|
|
236
|
-
'TIMEOUT',
|
|
237
|
-
'TOOLING_MISSING',
|
|
238
|
-
'GATE_FAILED',
|
|
239
|
-
'POLICY_VIOLATION',
|
|
240
|
-
'MERGE_CONFLICT',
|
|
241
|
-
'DEPENDENCY_ERROR',
|
|
242
|
-
'SYNTAX_ERROR',
|
|
243
|
-
'RUNTIME_ERROR',
|
|
244
|
-
'TASK_IMPOSSIBLE',
|
|
245
|
-
'EXTERNAL_BLOCKER',
|
|
246
|
-
];
|
|
247
|
-
if (validTypes.includes(upper)) {
|
|
248
|
-
return upper;
|
|
249
|
-
}
|
|
250
|
-
// Map common variations
|
|
251
|
-
if (upper.includes('TIMEOUT'))
|
|
252
|
-
return 'TIMEOUT';
|
|
253
|
-
if (upper.includes('AUTH'))
|
|
254
|
-
return 'AUTH';
|
|
255
|
-
if (upper.includes('TOOL'))
|
|
256
|
-
return 'TOOLING_MISSING';
|
|
257
|
-
if (upper.includes('GATE'))
|
|
258
|
-
return 'GATE_FAILED';
|
|
259
|
-
if (upper.includes('POLICY'))
|
|
260
|
-
return 'POLICY_VIOLATION';
|
|
261
|
-
if (upper.includes('CONFLICT') || upper.includes('MERGE'))
|
|
262
|
-
return 'MERGE_CONFLICT';
|
|
263
|
-
if (upper.includes('DEPEND'))
|
|
264
|
-
return 'DEPENDENCY_ERROR';
|
|
265
|
-
if (upper.includes('SYNTAX'))
|
|
266
|
-
return 'SYNTAX_ERROR';
|
|
267
|
-
if (upper.includes('RUNTIME'))
|
|
268
|
-
return 'RUNTIME_ERROR';
|
|
269
|
-
if (upper.includes('IMPOSSIBLE'))
|
|
270
|
-
return 'TASK_IMPOSSIBLE';
|
|
271
|
-
// Default to EXTERNAL_BLOCKER if unclear
|
|
272
|
-
return 'EXTERNAL_BLOCKER';
|
|
273
|
-
}
|
|
274
|
-
//# sourceMappingURL=migrate-yaml-to-db.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"migrate-yaml-to-db.js","sourceRoot":"","sources":["../../src/utils/migrate-yaml-to-db.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,qDAAqD;AAErD,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EACL,WAAW,EACX,eAAe,EACf,UAAU,EACV,MAAM,GAGP,MAAM,eAAe,CAAC;AA0CvB,8EAA8E;AAC9E,sBAAsB;AACtB,8EAA8E;AAE9E,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,YAAY,EAAE,sBAAsB,CAAC,CAAC;AAChF,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,YAAY,EAAE,2CAA2C,CAAC,CAAC;AAE5G;;GAEG;AACH,MAAM,UAAU,cAAc;IAC5B,OAAO,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC;AACtE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB;IASnC,IAAI,CAAC;QACH,4BAA4B;QAC5B,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YAC9B,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,yDAAyD;aACjE,CAAC;QACJ,CAAC;QAED,4BAA4B;QAC5B,IAAI,EA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QAAE,OAAO,SAAS,CAAC;IAChD,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,MAAM,CAAC;IAC1C,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,iBAAiB,CAAC;IACrD,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,aAAa,CAAC;IACjD,IAAI,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAAE,OAAO,kBAAkB,CAAC;IACxD,IAAI,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC;QAAE,OAAO,gBAAgB,CAAC;IACnF,IAAI,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAAE,OAAO,kBAAkB,CAAC;IACxD,IAAI,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAAE,OAAO,cAAc,CAAC;IACpD,IAAI,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC;QAAE,OAAO,eAAe,CAAC;IACtD,IAAI,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC;QAAE,OAAO,iBAAiB,CAAC;IAE3D,yCAAyC;IACzC,OAAO,kBAAkB,CAAC;AAC5B,CAAC"}
|
package/dist/utils/state-db.d.ts
DELETED
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import Database from 'better-sqlite3';
|
|
2
|
-
export type SurrogateStatus = 'INITIALIZING' | 'CODING' | 'TESTING' | 'REVIEWING' | 'COMPLETE' | 'FAILED';
|
|
3
|
-
export type ErrorType = 'AUTH' | 'TIMEOUT' | 'TOOLING_MISSING' | 'GATE_FAILED' | 'POLICY_VIOLATION' | 'MERGE_CONFLICT' | 'DEPENDENCY_ERROR' | 'SYNTAX_ERROR' | 'RUNTIME_ERROR' | 'TASK_IMPOSSIBLE' | 'EXTERNAL_BLOCKER';
|
|
4
|
-
export interface Surrogate {
|
|
5
|
-
id: string;
|
|
6
|
-
role: string;
|
|
7
|
-
task: string;
|
|
8
|
-
status: SurrogateStatus;
|
|
9
|
-
worktree_path: string;
|
|
10
|
-
branch: string;
|
|
11
|
-
agent_pid: number | null;
|
|
12
|
-
started_at: number;
|
|
13
|
-
last_heartbeat: number | null;
|
|
14
|
-
completed_at: number | null;
|
|
15
|
-
error_type: ErrorType | null;
|
|
16
|
-
error_message: string | null;
|
|
17
|
-
created_at: number;
|
|
18
|
-
updated_at: number;
|
|
19
|
-
}
|
|
20
|
-
export interface FileLock {
|
|
21
|
-
file_path: string;
|
|
22
|
-
surrogate_id: string;
|
|
23
|
-
lock_type: 'exclusive' | 'read_only';
|
|
24
|
-
acquired_at: number;
|
|
25
|
-
}
|
|
26
|
-
export interface LogEntry {
|
|
27
|
-
id: number;
|
|
28
|
-
surrogate_id: string;
|
|
29
|
-
level: 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
|
|
30
|
-
message: string;
|
|
31
|
-
metadata: string | null;
|
|
32
|
-
timestamp: number;
|
|
33
|
-
}
|
|
34
|
-
export interface Mission {
|
|
35
|
-
id: number;
|
|
36
|
-
objective: string;
|
|
37
|
-
decomposition: string | null;
|
|
38
|
-
created_at: number;
|
|
39
|
-
updated_at: number;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Get or create the SQLite database with WAL mode enabled.
|
|
43
|
-
* This is the secret sauce for concurrent performance.
|
|
44
|
-
*/
|
|
45
|
-
export declare function getDatabase(): Database.Database;
|
|
46
|
-
/**
|
|
47
|
-
* Close the database connection.
|
|
48
|
-
*/
|
|
49
|
-
export declare function closeDatabase(): void;
|
|
50
|
-
/**
|
|
51
|
-
* Run a function inside a database transaction (ACID).
|
|
52
|
-
*/
|
|
53
|
-
export declare function transaction<T>(fn: (db: Database.Database) => T): T;
|
|
54
|
-
/**
|
|
55
|
-
* Create a new surrogate with file locks atomically.
|
|
56
|
-
*/
|
|
57
|
-
export declare function createSurrogate(params: {
|
|
58
|
-
id: string;
|
|
59
|
-
role: string;
|
|
60
|
-
task: string;
|
|
61
|
-
worktree_path: string;
|
|
62
|
-
branch: string;
|
|
63
|
-
agent_pid?: number;
|
|
64
|
-
files_to_lock: string[];
|
|
65
|
-
}): {
|
|
66
|
-
success: boolean;
|
|
67
|
-
error?: string;
|
|
68
|
-
};
|
|
69
|
-
/**
|
|
70
|
-
* Get a surrogate by ID.
|
|
71
|
-
*/
|
|
72
|
-
export declare function getSurrogate(id: string): Surrogate | null;
|
|
73
|
-
/**
|
|
74
|
-
* Get all surrogates with optional status filter.
|
|
75
|
-
*/
|
|
76
|
-
export declare function getSurrogates(status?: SurrogateStatus): Surrogate[];
|
|
77
|
-
/**
|
|
78
|
-
* Get active surrogates (not COMPLETE or FAILED).
|
|
79
|
-
*/
|
|
80
|
-
export declare function getActiveSurrogates(): Surrogate[];
|
|
81
|
-
/**
|
|
82
|
-
* Transition surrogate status with compare-and-swap semantics.
|
|
83
|
-
* Returns true if successful, false if current status doesn't match.
|
|
84
|
-
*/
|
|
85
|
-
export declare function transitionStatus(id: string, from: SurrogateStatus, to: SurrogateStatus): boolean;
|
|
86
|
-
/**
|
|
87
|
-
* Update surrogate status (without compare-and-swap).
|
|
88
|
-
*/
|
|
89
|
-
export declare function updateStatus(id: string, status: SurrogateStatus): boolean;
|
|
90
|
-
/**
|
|
91
|
-
* Mark surrogate as complete.
|
|
92
|
-
*/
|
|
93
|
-
export declare function completeSurrogate(id: string): boolean;
|
|
94
|
-
/**
|
|
95
|
-
* Mark surrogate as failed with error details.
|
|
96
|
-
*/
|
|
97
|
-
export declare function failSurrogate(id: string, errorType: ErrorType, errorMessage: string): boolean;
|
|
98
|
-
/**
|
|
99
|
-
* Update heartbeat timestamp for a surrogate.
|
|
100
|
-
*/
|
|
101
|
-
export declare function updateHeartbeat(id: string): boolean;
|
|
102
|
-
/**
|
|
103
|
-
* Delete a surrogate (will cascade delete locks and logs).
|
|
104
|
-
*/
|
|
105
|
-
export declare function deleteSurrogate(id: string): boolean;
|
|
106
|
-
/**
|
|
107
|
-
* Get all file locks for a surrogate.
|
|
108
|
-
*/
|
|
109
|
-
export declare function getFileLocks(surrogateId: string): FileLock[];
|
|
110
|
-
/**
|
|
111
|
-
* Check if files are locked by other surrogates.
|
|
112
|
-
*/
|
|
113
|
-
export declare function checkFileLocks(files: string[]): {
|
|
114
|
-
locked: boolean;
|
|
115
|
-
conflicts: FileLock[];
|
|
116
|
-
};
|
|
117
|
-
/**
|
|
118
|
-
* Release all file locks for a surrogate.
|
|
119
|
-
*/
|
|
120
|
-
export declare function releaseAllLocks(surrogateId: string): number;
|
|
121
|
-
/**
|
|
122
|
-
* Force release locks for a surrogate (emergency use only).
|
|
123
|
-
*/
|
|
124
|
-
export declare function forceReleaseLocks(surrogateId: string): boolean;
|
|
125
|
-
/**
|
|
126
|
-
* Add a log entry for a surrogate.
|
|
127
|
-
*/
|
|
128
|
-
export declare function addLog(surrogateId: string, level: 'DEBUG' | 'INFO' | 'WARN' | 'ERROR', message: string, metadata?: Record<string, unknown>): boolean;
|
|
129
|
-
/**
|
|
130
|
-
* Get logs for a surrogate.
|
|
131
|
-
*/
|
|
132
|
-
export declare function getLogs(surrogateId: string, limit?: number): LogEntry[];
|
|
133
|
-
/**
|
|
134
|
-
* Get error logs for a surrogate.
|
|
135
|
-
*/
|
|
136
|
-
export declare function getErrorLogs(surrogateId: string, limit?: number): LogEntry[];
|
|
137
|
-
/**
|
|
138
|
-
* Delete old logs (cleanup utility).
|
|
139
|
-
*/
|
|
140
|
-
export declare function deleteOldLogs(olderThanDays: number): number;
|
|
141
|
-
/**
|
|
142
|
-
* Set or update the mission objective.
|
|
143
|
-
*/
|
|
144
|
-
export declare function setMission(objective: string, decomposition?: string): boolean;
|
|
145
|
-
/**
|
|
146
|
-
* Get the current mission.
|
|
147
|
-
*/
|
|
148
|
-
export declare function getMission(): Mission | null;
|
|
149
|
-
/**
|
|
150
|
-
* Clear the mission.
|
|
151
|
-
*/
|
|
152
|
-
export declare function clearMission(): boolean;
|
|
153
|
-
/**
|
|
154
|
-
* Get database statistics.
|
|
155
|
-
*/
|
|
156
|
-
export declare function getStats(): {
|
|
157
|
-
total_surrogates: number;
|
|
158
|
-
active_surrogates: number;
|
|
159
|
-
completed_surrogates: number;
|
|
160
|
-
failed_surrogates: number;
|
|
161
|
-
total_locks: number;
|
|
162
|
-
total_logs: number;
|
|
163
|
-
};
|
|
164
|
-
/**
|
|
165
|
-
* Vacuum the database to reclaim space.
|
|
166
|
-
*/
|
|
167
|
-
export declare function vacuum(): void;
|
|
168
|
-
/**
|
|
169
|
-
* Create a backup of the database.
|
|
170
|
-
*/
|
|
171
|
-
export declare function backupDatabase(backupPath: string): void;
|
|
172
|
-
//# sourceMappingURL=state-db.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"state-db.d.ts","sourceRoot":"","sources":["../../src/utils/state-db.ts"],"names":[],"mappings":"AAGA,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAkBtC,MAAM,MAAM,eAAe,GACvB,cAAc,GACd,QAAQ,GACR,SAAS,GACT,WAAW,GACX,UAAU,GACV,QAAQ,CAAC;AAEb,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,SAAS,GACT,iBAAiB,GACjB,aAAa,GACb,kBAAkB,GAClB,gBAAgB,GAChB,kBAAkB,GAClB,cAAc,GACd,eAAe,GACf,iBAAiB,GACjB,kBAAkB,CAAC;AAEvB,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,eAAe,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,YAAY,EAAE,MAAM,GAAG,IAAI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