@sudocode-ai/types 0.1.7 → 0.1.8

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.
@@ -1 +1 @@
1
- {"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../src/migrations.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAE3C,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,KAAK,IAAI,CAAC;IACpC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,KAAK,IAAI,CAAC;CACxC;AA8GD;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,GAAG,MAAM,CAaxE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,SAAS,EAAE,SAAS,GACnB,IAAI,CAMN;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAwBzD"}
1
+ {"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../src/migrations.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAE3C,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,KAAK,IAAI,CAAC;IACpC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,KAAK,IAAI,CAAC;CACxC;AA2YD;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,GAAG,MAAM,CAaxE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,SAAS,EAAE,SAAS,GACnB,IAAI,CAMN;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAwBzD"}
@@ -97,6 +97,251 @@ const MIGRATIONS = [
97
97
  db.exec(`ALTER TABLE issue_feedback_old RENAME TO issue_feedback;`);
98
98
  },
99
99
  },
100
+ {
101
+ version: 2,
102
+ name: "add-normalized-entry-support",
103
+ up: (db) => {
104
+ // Check if normalized_entry column already exists
105
+ const tableInfo = db.pragma("table_info(execution_logs)");
106
+ const hasNormalizedColumn = tableInfo.some((col) => col.name === "normalized_entry");
107
+ if (hasNormalizedColumn) {
108
+ // Already migrated
109
+ return;
110
+ }
111
+ // Check if table exists
112
+ const tables = db
113
+ .prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='execution_logs'")
114
+ .all();
115
+ if (tables.length === 0) {
116
+ // Table doesn't exist yet, will be created with new schema
117
+ return;
118
+ }
119
+ // Create new table with updated schema
120
+ db.exec(`
121
+ CREATE TABLE IF NOT EXISTS execution_logs_new (
122
+ execution_id TEXT PRIMARY KEY,
123
+ raw_logs TEXT,
124
+ normalized_entry TEXT,
125
+ byte_size INTEGER NOT NULL DEFAULT 0,
126
+ line_count INTEGER NOT NULL DEFAULT 0,
127
+ created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
128
+ updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
129
+ FOREIGN KEY (execution_id) REFERENCES executions(id) ON DELETE CASCADE,
130
+ CHECK (raw_logs IS NOT NULL OR normalized_entry IS NOT NULL)
131
+ );
132
+ `);
133
+ // Copy existing data (raw_logs will preserve their values, normalized_entry will be NULL)
134
+ db.exec(`
135
+ INSERT INTO execution_logs_new (
136
+ execution_id, raw_logs, normalized_entry, byte_size, line_count,
137
+ created_at, updated_at
138
+ )
139
+ SELECT
140
+ execution_id, raw_logs, NULL, byte_size, line_count,
141
+ created_at, updated_at
142
+ FROM execution_logs;
143
+ `);
144
+ // Drop old table
145
+ db.exec(`DROP TABLE execution_logs;`);
146
+ // Rename new table
147
+ db.exec(`ALTER TABLE execution_logs_new RENAME TO execution_logs;`);
148
+ console.log(" ✓ Added normalized_entry column to execution_logs table");
149
+ },
150
+ down: (db) => {
151
+ // Rollback: remove normalized_entry column
152
+ db.exec(`
153
+ CREATE TABLE IF NOT EXISTS execution_logs_old (
154
+ execution_id TEXT PRIMARY KEY,
155
+ raw_logs TEXT NOT NULL DEFAULT '',
156
+ byte_size INTEGER NOT NULL DEFAULT 0,
157
+ line_count INTEGER NOT NULL DEFAULT 0,
158
+ created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
159
+ updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
160
+ FOREIGN KEY (execution_id) REFERENCES executions(id) ON DELETE CASCADE
161
+ );
162
+ `);
163
+ db.exec(`
164
+ INSERT INTO execution_logs_old (
165
+ execution_id, raw_logs, byte_size, line_count,
166
+ created_at, updated_at
167
+ )
168
+ SELECT
169
+ execution_id, COALESCE(raw_logs, ''), byte_size, line_count,
170
+ created_at, updated_at
171
+ FROM execution_logs;
172
+ `);
173
+ db.exec(`DROP TABLE execution_logs;`);
174
+ db.exec(`ALTER TABLE execution_logs_old RENAME TO execution_logs;`);
175
+ },
176
+ },
177
+ {
178
+ version: 3,
179
+ name: "remove-agent-type-constraints",
180
+ up: (db) => {
181
+ // Check if executions table exists
182
+ const tables = db
183
+ .prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='executions'")
184
+ .all();
185
+ if (tables.length === 0) {
186
+ // Table doesn't exist yet, will be created with new schema
187
+ return;
188
+ }
189
+ // Check if table has CHECK constraint on agent_type
190
+ // Get the CREATE TABLE statement to check for constraints
191
+ const tableSchema = db
192
+ .prepare("SELECT sql FROM sqlite_master WHERE type='table' AND name='executions'")
193
+ .get();
194
+ if (!tableSchema) {
195
+ return; // Table doesn't exist
196
+ }
197
+ // Check if already migrated (no CHECK constraint on agent_type)
198
+ const hasCheckConstraint = tableSchema.sql.includes("agent_type") &&
199
+ tableSchema.sql.match(/agent_type[^,]*CHECK/i);
200
+ const hasDefaultValue = tableSchema.sql.match(/agent_type[^,]*DEFAULT/i);
201
+ const hasNotNull = tableSchema.sql.match(/agent_type[^,]*NOT NULL/i);
202
+ // If no constraints on agent_type, already migrated
203
+ if (!hasCheckConstraint && !hasDefaultValue && !hasNotNull) {
204
+ return;
205
+ }
206
+ // SQLite doesn't support ALTER COLUMN, so we need to recreate the table
207
+ // Disable foreign keys temporarily for table recreation
208
+ db.exec(`PRAGMA foreign_keys = OFF;`);
209
+ // Create new table with nullable agent_type and no constraints
210
+ db.exec(`
211
+ CREATE TABLE executions_new (
212
+ id TEXT PRIMARY KEY,
213
+ issue_id TEXT,
214
+ issue_uuid TEXT,
215
+ mode TEXT CHECK(mode IN ('worktree', 'local')),
216
+ prompt TEXT,
217
+ config TEXT,
218
+ agent_type TEXT,
219
+ session_id TEXT,
220
+ workflow_execution_id TEXT,
221
+ target_branch TEXT NOT NULL,
222
+ branch_name TEXT NOT NULL,
223
+ before_commit TEXT,
224
+ after_commit TEXT,
225
+ worktree_path TEXT,
226
+ status TEXT NOT NULL CHECK(status IN (
227
+ 'preparing', 'pending', 'running', 'paused',
228
+ 'completed', 'failed', 'cancelled', 'stopped'
229
+ )),
230
+ created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
231
+ updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
232
+ started_at DATETIME,
233
+ completed_at DATETIME,
234
+ cancelled_at DATETIME,
235
+ exit_code INTEGER,
236
+ error_message TEXT,
237
+ error TEXT,
238
+ model TEXT,
239
+ summary TEXT,
240
+ files_changed TEXT,
241
+ parent_execution_id TEXT,
242
+ step_type TEXT,
243
+ step_index INTEGER,
244
+ step_config TEXT,
245
+ FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE SET NULL,
246
+ FOREIGN KEY (issue_uuid) REFERENCES issues(uuid) ON DELETE SET NULL,
247
+ FOREIGN KEY (parent_execution_id) REFERENCES executions(id) ON DELETE SET NULL
248
+ );
249
+ `);
250
+ // Copy data from old table as-is (preserve NULL values)
251
+ db.exec(`
252
+ INSERT INTO executions_new
253
+ SELECT
254
+ id, issue_id, issue_uuid, mode, prompt, config,
255
+ agent_type,
256
+ session_id, workflow_execution_id,
257
+ target_branch, branch_name, before_commit, after_commit, worktree_path,
258
+ status, created_at, updated_at, started_at, completed_at, cancelled_at,
259
+ exit_code, error_message, error, model, summary, files_changed,
260
+ parent_execution_id, step_type, step_index, step_config
261
+ FROM executions;
262
+ `);
263
+ // Drop old table
264
+ db.exec(`DROP TABLE executions;`);
265
+ // Rename new table
266
+ db.exec(`ALTER TABLE executions_new RENAME TO executions;`);
267
+ // Recreate indexes
268
+ db.exec(`
269
+ CREATE INDEX IF NOT EXISTS idx_executions_issue_id ON executions(issue_id);
270
+ CREATE INDEX IF NOT EXISTS idx_executions_issue_uuid ON executions(issue_uuid);
271
+ CREATE INDEX IF NOT EXISTS idx_executions_status ON executions(status);
272
+ CREATE INDEX IF NOT EXISTS idx_executions_session_id ON executions(session_id);
273
+ CREATE INDEX IF NOT EXISTS idx_executions_parent ON executions(parent_execution_id);
274
+ CREATE INDEX IF NOT EXISTS idx_executions_created_at ON executions(created_at);
275
+ CREATE INDEX IF NOT EXISTS idx_executions_workflow ON executions(workflow_execution_id);
276
+ CREATE INDEX IF NOT EXISTS idx_executions_workflow_step ON executions(workflow_execution_id, step_index);
277
+ CREATE INDEX IF NOT EXISTS idx_executions_step_type ON executions(step_type);
278
+ `);
279
+ // Re-enable foreign keys
280
+ db.exec(`PRAGMA foreign_keys = ON;`);
281
+ console.log(" ✓ Removed agent_type constraints (nullable, no default, validation handled by application)");
282
+ },
283
+ down: (db) => {
284
+ // Rollback: restore old schema (nullable agent_type without default)
285
+ db.exec(`
286
+ CREATE TABLE executions_old (
287
+ id TEXT PRIMARY KEY,
288
+ issue_id TEXT,
289
+ issue_uuid TEXT,
290
+ mode TEXT CHECK(mode IN ('worktree', 'local')),
291
+ prompt TEXT,
292
+ config TEXT,
293
+ agent_type TEXT,
294
+ session_id TEXT,
295
+ workflow_execution_id TEXT,
296
+ target_branch TEXT NOT NULL,
297
+ branch_name TEXT NOT NULL,
298
+ before_commit TEXT,
299
+ after_commit TEXT,
300
+ worktree_path TEXT,
301
+ status TEXT NOT NULL CHECK(status IN (
302
+ 'preparing', 'pending', 'running', 'paused',
303
+ 'completed', 'failed', 'cancelled', 'stopped'
304
+ )),
305
+ created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
306
+ updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
307
+ started_at DATETIME,
308
+ completed_at DATETIME,
309
+ cancelled_at DATETIME,
310
+ exit_code INTEGER,
311
+ error_message TEXT,
312
+ error TEXT,
313
+ model TEXT,
314
+ summary TEXT,
315
+ files_changed TEXT,
316
+ parent_execution_id TEXT,
317
+ step_type TEXT,
318
+ step_index INTEGER,
319
+ step_config TEXT,
320
+ FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE SET NULL,
321
+ FOREIGN KEY (issue_uuid) REFERENCES issues(uuid) ON DELETE SET NULL,
322
+ FOREIGN KEY (parent_execution_id) REFERENCES executions(id) ON DELETE SET NULL
323
+ );
324
+ `);
325
+ db.exec(`
326
+ INSERT INTO executions_old
327
+ SELECT * FROM executions;
328
+ `);
329
+ db.exec(`DROP TABLE executions;`);
330
+ db.exec(`ALTER TABLE executions_old RENAME TO executions;`);
331
+ // Recreate indexes
332
+ db.exec(`
333
+ CREATE INDEX IF NOT EXISTS idx_executions_issue_id ON executions(issue_id);
334
+ CREATE INDEX IF NOT EXISTS idx_executions_issue_uuid ON executions(issue_uuid);
335
+ CREATE INDEX IF NOT EXISTS idx_executions_status ON executions(status);
336
+ CREATE INDEX IF NOT EXISTS idx_executions_session_id ON executions(session_id);
337
+ CREATE INDEX IF NOT EXISTS idx_executions_parent ON executions(parent_execution_id);
338
+ CREATE INDEX IF NOT EXISTS idx_executions_created_at ON executions(created_at);
339
+ CREATE INDEX IF NOT EXISTS idx_executions_workflow ON executions(workflow_execution_id);
340
+ CREATE INDEX IF NOT EXISTS idx_executions_workflow_step ON executions(workflow_execution_id, step_index);
341
+ CREATE INDEX IF NOT EXISTS idx_executions_step_type ON executions(step_type);
342
+ `);
343
+ },
344
+ },
100
345
  ];
101
346
  /**
102
347
  * Get the current migration version from the database
@@ -1 +1 @@
1
- {"version":3,"file":"migrations.js","sourceRoot":"","sources":["../src/migrations.ts"],"names":[],"mappings":"AAAA;;GAEG;AAWH;;GAEG;AACH,MAAM,UAAU,GAAgB;IAC9B;QACE,OAAO,EAAE,CAAC;QACV,IAAI,EAAE,2BAA2B;QACjC,EAAE,EAAE,CAAC,EAAqB,EAAE,EAAE;YAC5B,6BAA6B;YAC7B,MAAM,SAAS,GAAG,EAAE,CAAC,MAAM,CAAC,4BAA4B,CAEtD,CAAC;YACH,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC;YAEvE,IAAI,CAAC,aAAa,EAAE,CAAC;gBACnB,mCAAmC;gBACnC,OAAO;YACT,CAAC;YAED,uCAAuC;YACvC,EAAE,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;OAiBP,CAAC,CAAC;YAEH,wCAAwC;YACxC,EAAE,CAAC,IAAI,CAAC;;;;;;;;;OASP,CAAC,CAAC;YAEH,iBAAiB;YACjB,EAAE,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;YAEtC,oCAAoC;YACpC,EAAE,CAAC,IAAI,CAAC,0DAA0D,CAAC,CAAC;YAEpE,mBAAmB;YACnB,EAAE,CAAC,IAAI,C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OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,iBAAiB,SAAS,CAAC,OAAO,UAAU,EAAE,KAAK,CAAC,CAAC;YACnE,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;AACH,CAAC"}
package/dist/schema.d.ts CHANGED
@@ -16,9 +16,9 @@ export declare const RELATIONSHIPS_TABLE = "\nCREATE TABLE IF NOT EXISTS relatio
16
16
  export declare const TAGS_TABLE = "\nCREATE TABLE IF NOT EXISTS tags (\n entity_id TEXT NOT NULL,\n entity_uuid TEXT NOT NULL,\n entity_type TEXT NOT NULL,\n tag TEXT NOT NULL,\n PRIMARY KEY (entity_id, entity_type, tag)\n);\n";
17
17
  export declare const EVENTS_TABLE = "\nCREATE TABLE IF NOT EXISTS events (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n entity_id TEXT NOT NULL,\n entity_uuid TEXT NOT NULL,\n entity_type TEXT NOT NULL,\n event_type TEXT NOT NULL,\n actor TEXT NOT NULL,\n old_value TEXT,\n new_value TEXT,\n comment TEXT,\n created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n git_commit_sha TEXT,\n source TEXT\n);\n";
18
18
  export declare const ISSUE_FEEDBACK_TABLE = "\nCREATE TABLE IF NOT EXISTS issue_feedback (\n id TEXT PRIMARY KEY,\n from_id TEXT NOT NULL,\n from_uuid TEXT NOT NULL,\n to_id TEXT NOT NULL,\n to_uuid TEXT NOT NULL,\n feedback_type TEXT NOT NULL CHECK(feedback_type IN ('comment', 'suggestion', 'request')),\n content TEXT NOT NULL,\n agent TEXT,\n anchor TEXT,\n dismissed INTEGER NOT NULL DEFAULT 0 CHECK(dismissed IN (0, 1)),\n created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n FOREIGN KEY (from_id) REFERENCES issues(id) ON DELETE CASCADE,\n FOREIGN KEY (from_uuid) REFERENCES issues(uuid) ON DELETE CASCADE\n);\n";
19
- export declare const EXECUTIONS_TABLE = "\nCREATE TABLE IF NOT EXISTS executions (\n id TEXT PRIMARY KEY,\n issue_id TEXT,\n issue_uuid TEXT,\n\n -- Execution mode and configuration\n mode TEXT CHECK(mode IN ('worktree', 'local')),\n prompt TEXT,\n config TEXT,\n\n -- Process information (legacy + new)\n agent_type TEXT CHECK(agent_type IN ('claude-code', 'codex')),\n session_id TEXT,\n workflow_execution_id TEXT,\n\n -- Git/branch information\n target_branch TEXT NOT NULL,\n branch_name TEXT NOT NULL,\n before_commit TEXT,\n after_commit TEXT,\n worktree_path TEXT,\n\n -- Status (unified - supports both old and new statuses)\n status TEXT NOT NULL CHECK(status IN (\n 'preparing', 'pending', 'running', 'paused',\n 'completed', 'failed', 'cancelled', 'stopped'\n )),\n\n -- Timing (consistent with other tables)\n created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n started_at DATETIME,\n completed_at DATETIME,\n cancelled_at DATETIME,\n\n -- Results and metadata\n exit_code INTEGER,\n error_message TEXT,\n error TEXT,\n model TEXT,\n summary TEXT,\n files_changed TEXT,\n\n -- Relationships\n parent_execution_id TEXT,\n\n -- Multi-step workflow support (future extension)\n step_type TEXT,\n step_index INTEGER,\n step_config TEXT,\n\n FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE SET NULL,\n FOREIGN KEY (issue_uuid) REFERENCES issues(uuid) ON DELETE SET NULL,\n FOREIGN KEY (parent_execution_id) REFERENCES executions(id) ON DELETE SET NULL\n);\n";
19
+ export declare const EXECUTIONS_TABLE = "\nCREATE TABLE IF NOT EXISTS executions (\n id TEXT PRIMARY KEY,\n issue_id TEXT,\n issue_uuid TEXT,\n\n -- Execution mode and configuration\n mode TEXT CHECK(mode IN ('worktree', 'local')),\n prompt TEXT,\n config TEXT,\n\n -- Process information (legacy + new)\n agent_type TEXT,\n session_id TEXT,\n workflow_execution_id TEXT,\n\n -- Git/branch information\n target_branch TEXT NOT NULL,\n branch_name TEXT NOT NULL,\n before_commit TEXT,\n after_commit TEXT,\n worktree_path TEXT,\n\n -- Status (unified - supports both old and new statuses)\n status TEXT NOT NULL CHECK(status IN (\n 'preparing', 'pending', 'running', 'paused',\n 'completed', 'failed', 'cancelled', 'stopped'\n )),\n\n -- Timing (consistent with other tables)\n created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n started_at DATETIME,\n completed_at DATETIME,\n cancelled_at DATETIME,\n\n -- Results and metadata\n exit_code INTEGER,\n error_message TEXT,\n error TEXT,\n model TEXT,\n summary TEXT,\n files_changed TEXT,\n\n -- Relationships\n parent_execution_id TEXT,\n\n -- Multi-step workflow support (future extension)\n step_type TEXT,\n step_index INTEGER,\n step_config TEXT,\n\n FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE SET NULL,\n FOREIGN KEY (issue_uuid) REFERENCES issues(uuid) ON DELETE SET NULL,\n FOREIGN KEY (parent_execution_id) REFERENCES executions(id) ON DELETE SET NULL\n);\n";
20
20
  export declare const PROMPT_TEMPLATES_TABLE = "\nCREATE TABLE IF NOT EXISTS prompt_templates (\n id TEXT PRIMARY KEY,\n name TEXT NOT NULL,\n description TEXT,\n type TEXT NOT NULL CHECK(type IN ('issue', 'spec', 'custom')),\n template TEXT NOT NULL,\n variables TEXT NOT NULL,\n is_default INTEGER NOT NULL DEFAULT 0 CHECK(is_default IN (0, 1)),\n created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP\n);\n";
21
- export declare const EXECUTION_LOGS_TABLE = "\nCREATE TABLE IF NOT EXISTS execution_logs (\n execution_id TEXT PRIMARY KEY,\n raw_logs TEXT NOT NULL DEFAULT '',\n byte_size INTEGER NOT NULL DEFAULT 0,\n line_count INTEGER NOT NULL DEFAULT 0,\n created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n FOREIGN KEY (execution_id) REFERENCES executions(id) ON DELETE CASCADE\n);\n";
21
+ export declare const EXECUTION_LOGS_TABLE = "\nCREATE TABLE IF NOT EXISTS execution_logs (\n execution_id TEXT PRIMARY KEY,\n raw_logs TEXT,\n normalized_entry TEXT,\n byte_size INTEGER NOT NULL DEFAULT 0,\n line_count INTEGER NOT NULL DEFAULT 0,\n created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n FOREIGN KEY (execution_id) REFERENCES executions(id) ON DELETE CASCADE,\n CHECK (raw_logs IS NOT NULL OR normalized_entry IS NOT NULL)\n);\n";
22
22
  /**
23
23
  * Index definitions
24
24
  */
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,cAAc,QAAQ,CAAC;AAEpC;;GAEG;AACH,eAAO,MAAM,SAAS,uSAarB,CAAC;AAEF;;GAEG;AAEH,eAAO,MAAM,WAAW,ysBAiBvB,CAAC;AAEF,eAAO,MAAM,YAAY,qwBAmBxB,CAAC;AAEF,eAAO,MAAM,mBAAmB,iaAa/B,CAAC;AAEF,eAAO,MAAM,UAAU,mNAQtB,CAAC;AAEF,eAAO,MAAM,YAAY,uZAexB,CAAC;AAEF,eAAO,MAAM,oBAAoB,2qBAiBhC,CAAC;AAEF,eAAO,MAAM,gBAAgB,wmDAwD5B,CAAC;AAGF,eAAO,MAAM,sBAAsB,ocAYlC,CAAC;AAIF,eAAO,MAAM,oBAAoB,iaAUhC,CAAC;AAEF;;GAEG;AAEH,eAAO,MAAM,aAAa,oeAQzB,CAAC;AAEF,eAAO,MAAM,cAAc,+rBAW1B,CAAC;AAEF,eAAO,MAAM,qBAAqB,seAOjC,CAAC;AAE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AO,MAAM,sBAAsB,+iBAQlC,CAAC;AAEF,eAAO,MAAM,kBAAkB,0vBAU9B,CAAC;AAEF,eAAO,MAAM,wBAAwB,oKAGpC,CAAC;AAEF,eAAO,MAAM,sBAAsB,gRAIlC,CAAC;AAEF;;GAEG;AAEH,eAAO,MAAM,iBAAiB,gqBAkB7B,CAAC;AAEF,eAAO,MAAM,mBAAmB,ovBAmB/B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,UAUtB,CAAC;AAEF,eAAO,MAAM,WAAW,UAUvB,CAAC;AAEF,eAAO,MAAM,SAAS,UAA2C,CAAC"}
package/dist/schema.js CHANGED
@@ -130,7 +130,7 @@ CREATE TABLE IF NOT EXISTS executions (
130
130
  config TEXT,
131
131
 
132
132
  -- Process information (legacy + new)
133
- agent_type TEXT CHECK(agent_type IN ('claude-code', 'codex')),
133
+ agent_type TEXT,
134
134
  session_id TEXT,
135
135
  workflow_execution_id TEXT,
136
136
 
@@ -190,16 +190,21 @@ CREATE TABLE IF NOT EXISTS prompt_templates (
190
190
  );
191
191
  `;
192
192
  // Execution logs table - stores detailed execution output
193
- // Logs are stored in JSONL format (newline-delimited JSON)
193
+ // Supports two formats:
194
+ // - raw_logs: Legacy JSONL format (newline-delimited JSON from stream-json output)
195
+ // - normalized_entry: New NDJSON format (NormalizedEntry objects from agent-execution-engine)
196
+ // At least one of raw_logs or normalized_entry must be non-null
194
197
  export const EXECUTION_LOGS_TABLE = `
195
198
  CREATE TABLE IF NOT EXISTS execution_logs (
196
199
  execution_id TEXT PRIMARY KEY,
197
- raw_logs TEXT NOT NULL DEFAULT '',
200
+ raw_logs TEXT,
201
+ normalized_entry TEXT,
198
202
  byte_size INTEGER NOT NULL DEFAULT 0,
199
203
  line_count INTEGER NOT NULL DEFAULT 0,
200
204
  created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
201
205
  updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
202
- FOREIGN KEY (execution_id) REFERENCES executions(id) ON DELETE CASCADE
206
+ FOREIGN KEY (execution_id) REFERENCES executions(id) ON DELETE CASCADE,
207
+ CHECK (raw_logs IS NOT NULL OR normalized_entry IS NOT NULL)
203
208
  );
204
209
  `;
205
210
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,CAAC;AAEpC;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;;;;;;;;;;;;;CAaxB,CAAC;AAEF;;GAEG;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;CAiB1B,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;CAmB3B,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;CAalC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG;;;;;;;;CAQzB,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;CAe3B,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;;;CAiBnC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwD/B,CAAC;AAEF,yBAAyB;AACzB,MAAM,CAAC,MAAM,sBAAsB,GAAG;;;;;;;;;;;;CAYrC,CAAC;AAEF,0DAA0D;AAC1D,2DAA2D;AAC3D,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;;;;;;;CAUnC,CAAC;AAEF;;GAEG;AAEH,MAAM,CAAC,MAAM,aAAa,GAAG;;;;;;;;CAQ5B,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;CAW7B,CAAC;AAEF,MAAM,CAAC,M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GAEG;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;CAkBhC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;CAmBlC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,WAAW;IACX,YAAY;IACZ,mBAAmB;IACnB,UAAU;IACV,YAAY;IACZ,oBAAoB;IACpB,gBAAgB;IAChB,sBAAsB;IACtB,oBAAoB;CACrB,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,aAAa;IACb,cAAc;IACd,qBAAqB;IACrB,YAAY;IACZ,cAAc;IACd,sBAAsB;IACtB,kBAAkB;IAClB,wBAAwB;IACxB,sBAAsB;CACvB,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,iBAAiB,EAAE,mBAAmB,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sudocode-ai/types",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "TypeScript type definitions for sudocode",
5
5
  "types": "src/index.d.ts",
6
6
  "type": "module",
@@ -9,6 +9,14 @@
9
9
  "types": "./src/index.d.ts",
10
10
  "default": "./src/index.d.ts"
11
11
  },
12
+ "./events": {
13
+ "types": "./src/events.d.ts",
14
+ "default": "./src/events.d.ts"
15
+ },
16
+ "./agents": {
17
+ "types": "./src/agents.d.ts",
18
+ "default": "./src/agents.d.ts"
19
+ },
12
20
  "./schema": {
13
21
  "types": "./dist/schema.d.ts",
14
22
  "default": "./dist/schema.js"
@@ -19,7 +27,9 @@
19
27
  }
20
28
  },
21
29
  "scripts": {
22
- "build": "tsc"
30
+ "build": "tsc",
31
+ "test": "vitest",
32
+ "test:run": "vitest --run"
23
33
  },
24
34
  "keywords": [
25
35
  "sudocode",
@@ -42,9 +52,14 @@
42
52
  },
43
53
  "files": [
44
54
  "src/index.d.ts",
55
+ "src/events.d.ts",
56
+ "src/agents.d.ts",
45
57
  "dist"
46
58
  ],
47
59
  "devDependencies": {
48
- "typescript": "^5.0.0"
60
+ "@types/better-sqlite3": "^7.6.12",
61
+ "better-sqlite3": "^11.7.0",
62
+ "typescript": "^5.0.0",
63
+ "vitest": "^3.2.4"
49
64
  }
50
65
  }
@@ -0,0 +1,252 @@
1
+ /**
2
+ * Agent configuration types for sudocode
3
+ *
4
+ * Defines agent types and their specific configuration interfaces.
5
+ * Each agent config extends BaseAgentConfig from agent-execution-engine.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * // Import from main package
10
+ * import type { AgentType, AgentConfig } from '@sudocode-ai/types';
11
+ *
12
+ * // Or import directly from agents
13
+ * import type { ClaudeCodeConfig } from '@sudocode-ai/types/agents';
14
+ *
15
+ * const agentType: AgentType = 'claude-code';
16
+ * const config: ClaudeCodeConfig = {
17
+ * workDir: '/path/to/project',
18
+ * claudePath: 'claude',
19
+ * print: true,
20
+ * outputFormat: 'stream-json',
21
+ * };
22
+ * ```
23
+ *
24
+ * @module @sudocode-ai/types/agents
25
+ */
26
+
27
+ /**
28
+ * Agent types supported for execution
29
+ */
30
+ export type AgentType = "claude-code" | "codex" | "copilot" | "cursor";
31
+
32
+ /**
33
+ * Execution modes supported by agents
34
+ * Aligns with ExecutionMode from agent-execution-engine
35
+ */
36
+ export type ExecutionMode = "structured" | "interactive" | "hybrid";
37
+
38
+ /**
39
+ * Base configuration options that all agents should support
40
+ * Aligns with BaseAgentConfig from agent-execution-engine
41
+ */
42
+ export interface BaseAgentConfig {
43
+ /** Path to the agent's CLI executable */
44
+ executablePath?: string;
45
+ /** Working directory for execution */
46
+ workDir: string;
47
+ /** Environment variables to pass to the process */
48
+ env?: Record<string, string>;
49
+ /** Maximum execution time in milliseconds */
50
+ timeout?: number;
51
+ /** Execution mode (if agent supports multiple modes) */
52
+ mode?: ExecutionMode;
53
+ }
54
+
55
+ /**
56
+ * Claude Code specific configuration
57
+ */
58
+ export interface ClaudeCodeConfig extends BaseAgentConfig {
59
+ /** Path to Claude Code CLI executable (default: 'claude') */
60
+ claudePath?: string;
61
+ /** Run in non-interactive print mode */
62
+ print?: boolean;
63
+ /** Output format (stream-json recommended for parsing) */
64
+ outputFormat?: "stream-json" | "json" | "text";
65
+ /** Enable verbose output (required for stream-json with print mode) */
66
+ verbose?: boolean;
67
+ /** Skip permission prompts */
68
+ dangerouslySkipPermissions?: boolean;
69
+ /** Enable bypassing permission checks as an option without enabling by default */
70
+ allowDangerouslySkipPermissions?: boolean;
71
+ /** Permission mode setting (acceptEdits, bypassPermissions, default, dontAsk, plan) */
72
+ permissionMode?: "acceptEdits" | "bypassPermissions" | "default" | "dontAsk" | "plan";
73
+
74
+ // === Model Configuration ===
75
+ /** Model for the session (alias like 'sonnet', 'opus' or full name like 'claude-sonnet-4-5-20250929') */
76
+ model?: string;
77
+ /** Fallback model when default is overloaded (only works with --print) */
78
+ fallbackModel?: string;
79
+
80
+ // === Tool Permissions ===
81
+ /** Comma or space-separated list of tool names to allow (e.g., "Bash(git:*) Edit") */
82
+ allowedTools?: string[];
83
+ /** Specify available tools from built-in set. Use "" to disable all, "default" for all, or tool names */
84
+ tools?: string[];
85
+ /** Comma or space-separated list of tool names to deny (e.g., "Bash(git:*) Edit") */
86
+ disallowedTools?: string[];
87
+
88
+ // === System Prompt ===
89
+ /** System prompt to use for the session */
90
+ systemPrompt?: string;
91
+ /** Append a system prompt to the default system prompt */
92
+ appendSystemPrompt?: string;
93
+
94
+ // === Directory & Context ===
95
+ /** Additional directories to allow tool access to */
96
+ addDir?: string[];
97
+
98
+ // === MCP Configuration ===
99
+ /** Load MCP servers from JSON files or strings (space-separated) */
100
+ mcpConfig?: string[];
101
+ /** Only use MCP servers from --mcp-config, ignoring all other MCP configurations */
102
+ strictMcpConfig?: boolean;
103
+
104
+ // === Session Management ===
105
+ /** Continue the most recent conversation */
106
+ continue?: boolean;
107
+ /** Resume a conversation - provide a session ID or leave empty for interactive selection */
108
+ resume?: string;
109
+ /** When resuming, create a new session ID instead of reusing the original */
110
+ forkSession?: boolean;
111
+ /** Use a specific session ID for the conversation (must be a valid UUID) */
112
+ sessionId?: string;
113
+
114
+ // === Output Configuration ===
115
+ /** JSON Schema for structured output validation */
116
+ jsonSchema?: string;
117
+ /** Include partial message chunks as they arrive (only with --print and --output-format=stream-json) */
118
+ includePartialMessages?: boolean;
119
+
120
+ // === Advanced ===
121
+ /** Path to a settings JSON file or a JSON string to load additional settings from */
122
+ settings?: string;
123
+ /** Comma-separated list of setting sources to load (user, project, local) */
124
+ settingSources?: string;
125
+ /** Enable debug mode with optional category filtering */
126
+ debug?: string | boolean;
127
+
128
+ // === Process Management ===
129
+ /** Maximum idle time before cleanup (pool only) */
130
+ idleTimeout?: number;
131
+ /** Retry configuration for failed spawns */
132
+ retry?: {
133
+ maxAttempts: number;
134
+ backoffMs: number;
135
+ };
136
+ /** Prompt to send to Claude Code */
137
+ prompt?: string;
138
+ }
139
+
140
+ /**
141
+ * OpenAI Codex specific configuration (CLI-based)
142
+ */
143
+ export interface CodexConfig extends BaseAgentConfig {
144
+ /** Path to Codex CLI executable */
145
+ codexPath?: string;
146
+ /** Use 'codex exec' for non-interactive execution */
147
+ exec?: boolean;
148
+ /** Emit newline-delimited JSON events */
149
+ json?: boolean;
150
+ /** Use experimental JSON output format */
151
+ experimentalJson?: boolean;
152
+ /** Write final assistant message to file */
153
+ outputLastMessage?: string;
154
+ /** Override configured model (e.g., 'gpt-5-codex', 'gpt-5') */
155
+ model?: string;
156
+ /** Sandbox policy */
157
+ sandbox?: "read-only" | "workspace-write" | "danger-full-access";
158
+ /** Approval policy */
159
+ askForApproval?: "untrusted" | "on-failure" | "on-request" | "never";
160
+ /** Shortcut combining workspace-write sandbox + on-failure approvals */
161
+ fullAuto?: boolean;
162
+ /** Allow execution outside Git repositories */
163
+ skipGitRepoCheck?: boolean;
164
+ /** Control ANSI color output */
165
+ color?: "always" | "never" | "auto";
166
+ /** Enable web browsing capability */
167
+ search?: boolean;
168
+ /** Attach image files to the prompt */
169
+ image?: string[];
170
+ /** Load configuration profile from config.toml */
171
+ profile?: string;
172
+ /** Additional directories to grant write access */
173
+ addDir?: string[];
174
+ /** Disable all safety checks (isolated environments only) */
175
+ yolo?: boolean;
176
+ /** Maximum idle time before cleanup */
177
+ idleTimeout?: number;
178
+ /** Retry configuration for failed spawns */
179
+ retry?: {
180
+ maxAttempts: number;
181
+ backoffMs: number;
182
+ };
183
+ /** Prompt to send to Codex */
184
+ prompt?: string;
185
+ }
186
+
187
+ /**
188
+ * GitHub Copilot CLI specific configuration
189
+ *
190
+ * @see https://github.com/github/copilot
191
+ */
192
+ export interface CopilotConfig extends BaseAgentConfig {
193
+ /** Path to Copilot CLI executable (default: 'copilot') */
194
+ copilotPath?: string;
195
+ /** Copilot CLI version to use (only with npx, default: 'latest') */
196
+ copilotVersion?: string;
197
+ /** Model to use (e.g., 'gpt-4o', 'gpt-5', 'claude-sonnet-4.5') */
198
+ model?: string;
199
+ /** Allow all tools without prompting */
200
+ allowAllTools?: boolean;
201
+ /** Comma-separated list of allowed tools */
202
+ allowTool?: string;
203
+ /** Comma-separated list of denied tools */
204
+ denyTool?: string;
205
+ /** Additional directories to include in context */
206
+ addDir?: string[];
207
+ /** MCP servers to disable for this execution */
208
+ disableMcpServer?: string[];
209
+ /** System prompt to prepend to user prompt */
210
+ systemPrompt?: string;
211
+ /** Prompt to send to Copilot */
212
+ prompt?: string;
213
+ /** Maximum idle time before cleanup */
214
+ idleTimeout?: number;
215
+ /** Retry configuration for failed spawns */
216
+ retry?: {
217
+ maxAttempts: number;
218
+ backoffMs: number;
219
+ };
220
+ }
221
+
222
+ /**
223
+ * Cursor specific configuration (cursor-agent CLI)
224
+ */
225
+ export interface CursorConfig extends BaseAgentConfig {
226
+ /** Path to cursor-agent CLI executable */
227
+ cursorPath?: string;
228
+ /** Auto-approve all tool executions (adds --force flag) */
229
+ force?: boolean;
230
+ /** Model to use for code generation */
231
+ model?: string;
232
+ /** Additional text to append to user prompts */
233
+ appendPrompt?: string;
234
+ /** Maximum idle time before cleanup */
235
+ idleTimeout?: number;
236
+ /** Retry configuration for failed spawns */
237
+ retry?: {
238
+ maxAttempts: number;
239
+ backoffMs: number;
240
+ };
241
+ /** Prompt to send to Cursor */
242
+ prompt?: string;
243
+ }
244
+
245
+ /**
246
+ * Discriminated union of all agent configurations
247
+ */
248
+ export type AgentConfig =
249
+ | ClaudeCodeConfig
250
+ | CodexConfig
251
+ | CopilotConfig
252
+ | CursorConfig;
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Event types for the watcher system
3
+ * These events are emitted by the CLI watcher and consumed by the server
4
+ */
5
+
6
+ import type { Spec, Issue } from "./index.js";
7
+
8
+ /**
9
+ * Event fired when an entity is synced between database and markdown
10
+ */
11
+ export interface EntitySyncEvent {
12
+ /** Type of entity that was synced */
13
+ entityType: "spec" | "issue";
14
+
15
+ /** ID of the entity (e.g., 'i-x7k9', 's-14sh') */
16
+ entityId: string;
17
+
18
+ /** Action that was performed */
19
+ action: "created" | "updated" | "deleted" | "no-change";
20
+
21
+ /** Absolute path to the markdown file */
22
+ filePath: string;
23
+
24
+ /** Absolute path to the .sudocode directory (for project identification) */
25
+ baseDir: string;
26
+
27
+ /** Source of the change that triggered sync */
28
+ source: "markdown" | "jsonl" | "database";
29
+
30
+ /** Timestamp when event occurred */
31
+ timestamp: Date;
32
+
33
+ /** Optional: Full entity data (avoids DB query in server) */
34
+ entity?: Spec | Issue;
35
+
36
+ /** Optional: Duration of sync operation in milliseconds */
37
+ duration?: number;
38
+
39
+ /** Optional: Whether a merge conflict was resolved */
40
+ conflictResolved?: boolean;
41
+
42
+ /** Version of event format */
43
+ version: 1;
44
+ }
45
+
46
+ /**
47
+ * Event fired when a file change is detected (before sync)
48
+ */
49
+ export interface FileChangeEvent {
50
+ /** Absolute path to the file */
51
+ filePath: string;
52
+
53
+ /** Absolute path to the .sudocode directory */
54
+ baseDir: string;
55
+
56
+ /** Type of file system event */
57
+ event: "add" | "change" | "unlink";
58
+
59
+ /** Detected entity type (if applicable) */
60
+ entityType?: "spec" | "issue";
61
+
62
+ /** Detected entity ID (if applicable) */
63
+ entityId?: string;
64
+
65
+ /** Timestamp */
66
+ timestamp: Date;
67
+
68
+ /** Version of event format */
69
+ version: 1;
70
+ }
package/src/index.d.ts CHANGED
@@ -206,9 +206,19 @@ export interface Config {
206
206
  }
207
207
 
208
208
  /**
209
- * Agent types supported for execution
209
+ * Agent types and configurations
210
+ * See agents.d.ts for detailed agent configuration types
210
211
  */
211
- export type AgentType = "claude-code" | "codex";
212
+ export type {
213
+ AgentType,
214
+ ExecutionMode,
215
+ BaseAgentConfig,
216
+ ClaudeCodeConfig,
217
+ CodexConfig,
218
+ CopilotConfig,
219
+ CursorConfig,
220
+ AgentConfig,
221
+ } from "./agents.js";
212
222
 
213
223
  /**
214
224
  * Execution status
@@ -274,3 +284,10 @@ export interface Execution {
274
284
  step_index: number | null;
275
285
  step_config: string | null;
276
286
  }
287
+
288
+ // Re-export execution artifact types
289
+ export type {
290
+ FileChangeStat,
291
+ ExecutionChangesResult,
292
+ ChangesSnapshot,
293
+ } from './artifacts.js';