sqlew 3.6.2 → 3.6.3
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/CHANGELOG.md +441 -403
- package/assets/config.example.toml +28 -0
- package/dist/tests/migrations/test-all-versions.js +210 -210
- package/dist/tools/tasks.js +2 -2
- package/dist/tools/tasks.js.map +1 -1
- package/dist/utils/task-stale-detection.d.ts.map +1 -1
- package/dist/utils/task-stale-detection.js +79 -4
- package/dist/utils/task-stale-detection.js.map +1 -1
- package/docs/MIGRATION_CHAIN.md +293 -293
- package/package.json +85 -85
|
@@ -81,6 +81,34 @@ stale_hours_waiting_review = 24
|
|
|
81
81
|
# Default: true
|
|
82
82
|
auto_stale_enabled = true
|
|
83
83
|
|
|
84
|
+
# ============================================================================
|
|
85
|
+
# VCS-Aware Auto-Complete Settings (v3.5.2)
|
|
86
|
+
# ============================================================================
|
|
87
|
+
[vcs]
|
|
88
|
+
# Auto-complete tasks when files are staged (git add)
|
|
89
|
+
# When true: waiting_review → done when files are staged
|
|
90
|
+
# When false: Manual task completion required
|
|
91
|
+
# Default: true
|
|
92
|
+
git_auto_complete_on_stage = true
|
|
93
|
+
|
|
94
|
+
# Auto-archive tasks when files are committed (git commit)
|
|
95
|
+
# When true: done → archived when files are committed
|
|
96
|
+
# When false: Manual task archiving required
|
|
97
|
+
# Default: true
|
|
98
|
+
git_auto_archive_on_commit = true
|
|
99
|
+
|
|
100
|
+
# Require ALL watched files to be staged for auto-completion
|
|
101
|
+
# When true: All files must be staged to trigger waiting_review → done
|
|
102
|
+
# When false: At least one file staged is sufficient
|
|
103
|
+
# Default: true
|
|
104
|
+
require_all_files_staged = true
|
|
105
|
+
|
|
106
|
+
# Require ALL watched files to be committed for auto-archiving
|
|
107
|
+
# When true: All files must be committed to trigger done → archived
|
|
108
|
+
# When false: At least one file committed is sufficient
|
|
109
|
+
# Default: true
|
|
110
|
+
require_all_files_committed_for_archive = true
|
|
111
|
+
|
|
84
112
|
# ============================================================================
|
|
85
113
|
# Example Configurations
|
|
86
114
|
# ============================================================================
|
|
@@ -136,251 +136,251 @@ function createDatabaseForVersion(version) {
|
|
|
136
136
|
// We'll use a simplified approach: create tables that match version detection
|
|
137
137
|
if (version === '1.0.0') {
|
|
138
138
|
// v1.0.0: Unprefixed tables
|
|
139
|
-
db.exec(`
|
|
140
|
-
CREATE TABLE agents (
|
|
141
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
142
|
-
name TEXT NOT NULL UNIQUE,
|
|
143
|
-
created_ts INTEGER NOT NULL DEFAULT (strftime('%s', 'now'))
|
|
144
|
-
);
|
|
145
|
-
|
|
146
|
-
CREATE TABLE decisions (
|
|
147
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
148
|
-
agent_id INTEGER NOT NULL,
|
|
149
|
-
key TEXT NOT NULL,
|
|
150
|
-
value TEXT NOT NULL,
|
|
151
|
-
ts INTEGER NOT NULL DEFAULT (strftime('%s', 'now')),
|
|
152
|
-
FOREIGN KEY (agent_id) REFERENCES agents(id)
|
|
153
|
-
);
|
|
139
|
+
db.exec(`
|
|
140
|
+
CREATE TABLE agents (
|
|
141
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
142
|
+
name TEXT NOT NULL UNIQUE,
|
|
143
|
+
created_ts INTEGER NOT NULL DEFAULT (strftime('%s', 'now'))
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
CREATE TABLE decisions (
|
|
147
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
148
|
+
agent_id INTEGER NOT NULL,
|
|
149
|
+
key TEXT NOT NULL,
|
|
150
|
+
value TEXT NOT NULL,
|
|
151
|
+
ts INTEGER NOT NULL DEFAULT (strftime('%s', 'now')),
|
|
152
|
+
FOREIGN KEY (agent_id) REFERENCES agents(id)
|
|
153
|
+
);
|
|
154
154
|
`);
|
|
155
155
|
log(` ✓ Created v1.0.0 schema (unprefixed tables)`, GREEN);
|
|
156
156
|
}
|
|
157
157
|
else if (version.startsWith('1.1.') || version === '2.0.0') {
|
|
158
158
|
// v1.1.x and v2.0.0: Prefixed tables, no activity log
|
|
159
|
-
db.exec(`
|
|
160
|
-
CREATE TABLE m_agents (
|
|
161
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
162
|
-
name TEXT NOT NULL UNIQUE,
|
|
163
|
-
created_ts INTEGER NOT NULL DEFAULT (strftime('%s', 'now'))
|
|
164
|
-
);
|
|
165
|
-
|
|
166
|
-
CREATE TABLE t_decisions (
|
|
167
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
168
|
-
agent_id INTEGER NOT NULL,
|
|
169
|
-
context_key TEXT NOT NULL,
|
|
170
|
-
value TEXT NOT NULL,
|
|
171
|
-
ts INTEGER NOT NULL DEFAULT (strftime('%s', 'now')),
|
|
172
|
-
FOREIGN KEY (agent_id) REFERENCES m_agents(id)
|
|
173
|
-
);
|
|
159
|
+
db.exec(`
|
|
160
|
+
CREATE TABLE m_agents (
|
|
161
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
162
|
+
name TEXT NOT NULL UNIQUE,
|
|
163
|
+
created_ts INTEGER NOT NULL DEFAULT (strftime('%s', 'now'))
|
|
164
|
+
);
|
|
165
|
+
|
|
166
|
+
CREATE TABLE t_decisions (
|
|
167
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
168
|
+
agent_id INTEGER NOT NULL,
|
|
169
|
+
context_key TEXT NOT NULL,
|
|
170
|
+
value TEXT NOT NULL,
|
|
171
|
+
ts INTEGER NOT NULL DEFAULT (strftime('%s', 'now')),
|
|
172
|
+
FOREIGN KEY (agent_id) REFERENCES m_agents(id)
|
|
173
|
+
);
|
|
174
174
|
`);
|
|
175
175
|
log(` ✓ Created v${version} schema (prefixed tables)`, GREEN);
|
|
176
176
|
}
|
|
177
177
|
else if (version.startsWith('2.1.')) {
|
|
178
178
|
// v2.1.x: Has activity log, no task tables
|
|
179
|
-
db.exec(`
|
|
180
|
-
CREATE TABLE m_agents (
|
|
181
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
182
|
-
name TEXT NOT NULL UNIQUE,
|
|
183
|
-
created_ts INTEGER NOT NULL DEFAULT (strftime('%s', 'now'))
|
|
184
|
-
);
|
|
185
|
-
|
|
186
|
-
CREATE TABLE t_decisions (
|
|
187
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
188
|
-
agent_id INTEGER NOT NULL,
|
|
189
|
-
context_key TEXT NOT NULL,
|
|
190
|
-
value TEXT NOT NULL,
|
|
191
|
-
ts INTEGER NOT NULL DEFAULT (strftime('%s', 'now')),
|
|
192
|
-
FOREIGN KEY (agent_id) REFERENCES m_agents(id)
|
|
193
|
-
);
|
|
194
|
-
|
|
195
|
-
CREATE TABLE t_activity_log (
|
|
196
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
197
|
-
ts INTEGER NOT NULL DEFAULT (strftime('%s', 'now')),
|
|
198
|
-
action_type TEXT NOT NULL,
|
|
199
|
-
details TEXT
|
|
200
|
-
);
|
|
179
|
+
db.exec(`
|
|
180
|
+
CREATE TABLE m_agents (
|
|
181
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
182
|
+
name TEXT NOT NULL UNIQUE,
|
|
183
|
+
created_ts INTEGER NOT NULL DEFAULT (strftime('%s', 'now'))
|
|
184
|
+
);
|
|
185
|
+
|
|
186
|
+
CREATE TABLE t_decisions (
|
|
187
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
188
|
+
agent_id INTEGER NOT NULL,
|
|
189
|
+
context_key TEXT NOT NULL,
|
|
190
|
+
value TEXT NOT NULL,
|
|
191
|
+
ts INTEGER NOT NULL DEFAULT (strftime('%s', 'now')),
|
|
192
|
+
FOREIGN KEY (agent_id) REFERENCES m_agents(id)
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
CREATE TABLE t_activity_log (
|
|
196
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
197
|
+
ts INTEGER NOT NULL DEFAULT (strftime('%s', 'now')),
|
|
198
|
+
action_type TEXT NOT NULL,
|
|
199
|
+
details TEXT
|
|
200
|
+
);
|
|
201
201
|
`);
|
|
202
202
|
log(` ✓ Created v${version} schema (with activity log)`, GREEN);
|
|
203
203
|
}
|
|
204
204
|
else if (version === '3.0.2' || version.startsWith('3.1.')) {
|
|
205
205
|
// v3.0.x - v3.1.x: Has task tables, no dependencies
|
|
206
|
-
db.exec(`
|
|
207
|
-
CREATE TABLE m_agents (
|
|
208
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
209
|
-
name TEXT NOT NULL UNIQUE,
|
|
210
|
-
created_ts INTEGER NOT NULL DEFAULT (strftime('%s', 'now'))
|
|
211
|
-
);
|
|
212
|
-
|
|
213
|
-
CREATE TABLE m_task_statuses (
|
|
214
|
-
id INTEGER PRIMARY KEY,
|
|
215
|
-
name TEXT NOT NULL UNIQUE
|
|
216
|
-
);
|
|
217
|
-
|
|
218
|
-
INSERT INTO m_task_statuses (id, name) VALUES
|
|
219
|
-
(1, 'pending'),
|
|
220
|
-
(2, 'in_progress'),
|
|
221
|
-
(3, 'completed'),
|
|
222
|
-
(4, 'archived');
|
|
223
|
-
|
|
224
|
-
CREATE TABLE t_tasks (
|
|
225
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
226
|
-
title TEXT NOT NULL,
|
|
227
|
-
status_id INTEGER NOT NULL,
|
|
228
|
-
created_by_agent_id INTEGER NOT NULL,
|
|
229
|
-
created_ts INTEGER NOT NULL DEFAULT (strftime('%s', 'now')),
|
|
230
|
-
FOREIGN KEY (status_id) REFERENCES m_task_statuses(id),
|
|
231
|
-
FOREIGN KEY (created_by_agent_id) REFERENCES m_agents(id)
|
|
232
|
-
);
|
|
233
|
-
|
|
234
|
-
CREATE TABLE t_activity_log (
|
|
235
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
236
|
-
ts INTEGER NOT NULL DEFAULT (strftime('%s', 'now')),
|
|
237
|
-
action_type TEXT NOT NULL,
|
|
238
|
-
details TEXT
|
|
239
|
-
);
|
|
206
|
+
db.exec(`
|
|
207
|
+
CREATE TABLE m_agents (
|
|
208
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
209
|
+
name TEXT NOT NULL UNIQUE,
|
|
210
|
+
created_ts INTEGER NOT NULL DEFAULT (strftime('%s', 'now'))
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
CREATE TABLE m_task_statuses (
|
|
214
|
+
id INTEGER PRIMARY KEY,
|
|
215
|
+
name TEXT NOT NULL UNIQUE
|
|
216
|
+
);
|
|
217
|
+
|
|
218
|
+
INSERT INTO m_task_statuses (id, name) VALUES
|
|
219
|
+
(1, 'pending'),
|
|
220
|
+
(2, 'in_progress'),
|
|
221
|
+
(3, 'completed'),
|
|
222
|
+
(4, 'archived');
|
|
223
|
+
|
|
224
|
+
CREATE TABLE t_tasks (
|
|
225
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
226
|
+
title TEXT NOT NULL,
|
|
227
|
+
status_id INTEGER NOT NULL,
|
|
228
|
+
created_by_agent_id INTEGER NOT NULL,
|
|
229
|
+
created_ts INTEGER NOT NULL DEFAULT (strftime('%s', 'now')),
|
|
230
|
+
FOREIGN KEY (status_id) REFERENCES m_task_statuses(id),
|
|
231
|
+
FOREIGN KEY (created_by_agent_id) REFERENCES m_agents(id)
|
|
232
|
+
);
|
|
233
|
+
|
|
234
|
+
CREATE TABLE t_activity_log (
|
|
235
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
236
|
+
ts INTEGER NOT NULL DEFAULT (strftime('%s', 'now')),
|
|
237
|
+
action_type TEXT NOT NULL,
|
|
238
|
+
details TEXT
|
|
239
|
+
);
|
|
240
240
|
`);
|
|
241
241
|
log(` ✓ Created v${version} schema (with tasks, no dependencies)`, GREEN);
|
|
242
242
|
}
|
|
243
243
|
else if (version.startsWith('3.2.') && version !== '3.2.2') {
|
|
244
244
|
// v3.2.0 - v3.2.1: Has task dependencies, no decision context
|
|
245
|
-
db.exec(`
|
|
246
|
-
CREATE TABLE m_agents (
|
|
247
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
248
|
-
name TEXT NOT NULL UNIQUE,
|
|
249
|
-
created_ts INTEGER NOT NULL DEFAULT (strftime('%s', 'now'))
|
|
250
|
-
);
|
|
251
|
-
|
|
252
|
-
CREATE TABLE m_task_statuses (
|
|
253
|
-
id INTEGER PRIMARY KEY,
|
|
254
|
-
name TEXT NOT NULL UNIQUE
|
|
255
|
-
);
|
|
256
|
-
|
|
257
|
-
INSERT INTO m_task_statuses (id, name) VALUES
|
|
258
|
-
(1, 'pending'),
|
|
259
|
-
(2, 'in_progress'),
|
|
260
|
-
(3, 'completed'),
|
|
261
|
-
(4, 'archived');
|
|
262
|
-
|
|
263
|
-
CREATE TABLE t_tasks (
|
|
264
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
265
|
-
title TEXT NOT NULL,
|
|
266
|
-
status_id INTEGER NOT NULL,
|
|
267
|
-
created_by_agent_id INTEGER NOT NULL,
|
|
268
|
-
created_ts INTEGER NOT NULL DEFAULT (strftime('%s', 'now')),
|
|
269
|
-
FOREIGN KEY (status_id) REFERENCES m_task_statuses(id),
|
|
270
|
-
FOREIGN KEY (created_by_agent_id) REFERENCES m_agents(id)
|
|
271
|
-
);
|
|
272
|
-
|
|
273
|
-
CREATE TABLE t_task_dependencies (
|
|
274
|
-
blocker_task_id INTEGER NOT NULL,
|
|
275
|
-
blocked_task_id INTEGER NOT NULL,
|
|
276
|
-
PRIMARY KEY (blocker_task_id, blocked_task_id),
|
|
277
|
-
FOREIGN KEY (blocker_task_id) REFERENCES t_tasks(id),
|
|
278
|
-
FOREIGN KEY (blocked_task_id) REFERENCES t_tasks(id)
|
|
279
|
-
);
|
|
245
|
+
db.exec(`
|
|
246
|
+
CREATE TABLE m_agents (
|
|
247
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
248
|
+
name TEXT NOT NULL UNIQUE,
|
|
249
|
+
created_ts INTEGER NOT NULL DEFAULT (strftime('%s', 'now'))
|
|
250
|
+
);
|
|
251
|
+
|
|
252
|
+
CREATE TABLE m_task_statuses (
|
|
253
|
+
id INTEGER PRIMARY KEY,
|
|
254
|
+
name TEXT NOT NULL UNIQUE
|
|
255
|
+
);
|
|
256
|
+
|
|
257
|
+
INSERT INTO m_task_statuses (id, name) VALUES
|
|
258
|
+
(1, 'pending'),
|
|
259
|
+
(2, 'in_progress'),
|
|
260
|
+
(3, 'completed'),
|
|
261
|
+
(4, 'archived');
|
|
262
|
+
|
|
263
|
+
CREATE TABLE t_tasks (
|
|
264
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
265
|
+
title TEXT NOT NULL,
|
|
266
|
+
status_id INTEGER NOT NULL,
|
|
267
|
+
created_by_agent_id INTEGER NOT NULL,
|
|
268
|
+
created_ts INTEGER NOT NULL DEFAULT (strftime('%s', 'now')),
|
|
269
|
+
FOREIGN KEY (status_id) REFERENCES m_task_statuses(id),
|
|
270
|
+
FOREIGN KEY (created_by_agent_id) REFERENCES m_agents(id)
|
|
271
|
+
);
|
|
272
|
+
|
|
273
|
+
CREATE TABLE t_task_dependencies (
|
|
274
|
+
blocker_task_id INTEGER NOT NULL,
|
|
275
|
+
blocked_task_id INTEGER NOT NULL,
|
|
276
|
+
PRIMARY KEY (blocker_task_id, blocked_task_id),
|
|
277
|
+
FOREIGN KEY (blocker_task_id) REFERENCES t_tasks(id),
|
|
278
|
+
FOREIGN KEY (blocked_task_id) REFERENCES t_tasks(id)
|
|
279
|
+
);
|
|
280
280
|
`);
|
|
281
281
|
log(` ✓ Created v${version} schema (with task dependencies)`, GREEN);
|
|
282
282
|
}
|
|
283
283
|
else if (version === '3.2.2' || version.startsWith('3.2.') || version.startsWith('3.4.')) {
|
|
284
284
|
// v3.2.2+: Has decision context, no pruned files
|
|
285
|
-
db.exec(`
|
|
286
|
-
CREATE TABLE m_agents (
|
|
287
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
288
|
-
name TEXT NOT NULL UNIQUE,
|
|
289
|
-
created_ts INTEGER NOT NULL DEFAULT (strftime('%s', 'now'))
|
|
290
|
-
);
|
|
291
|
-
|
|
292
|
-
CREATE TABLE m_task_statuses (
|
|
293
|
-
id INTEGER PRIMARY KEY,
|
|
294
|
-
name TEXT NOT NULL UNIQUE
|
|
295
|
-
);
|
|
296
|
-
|
|
297
|
-
INSERT INTO m_task_statuses (id, name) VALUES
|
|
298
|
-
(1, 'pending'),
|
|
299
|
-
(2, 'in_progress'),
|
|
300
|
-
(3, 'completed'),
|
|
301
|
-
(4, 'archived');
|
|
302
|
-
|
|
303
|
-
CREATE TABLE t_tasks (
|
|
304
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
305
|
-
title TEXT NOT NULL,
|
|
306
|
-
status_id INTEGER NOT NULL,
|
|
307
|
-
created_by_agent_id INTEGER NOT NULL,
|
|
308
|
-
created_ts INTEGER NOT NULL DEFAULT (strftime('%s', 'now')),
|
|
309
|
-
FOREIGN KEY (status_id) REFERENCES m_task_statuses(id),
|
|
310
|
-
FOREIGN KEY (created_by_agent_id) REFERENCES m_agents(id)
|
|
311
|
-
);
|
|
312
|
-
|
|
313
|
-
CREATE TABLE t_task_dependencies (
|
|
314
|
-
blocker_task_id INTEGER NOT NULL,
|
|
315
|
-
blocked_task_id INTEGER NOT NULL,
|
|
316
|
-
PRIMARY KEY (blocker_task_id, blocked_task_id),
|
|
317
|
-
FOREIGN KEY (blocker_task_id) REFERENCES t_tasks(id),
|
|
318
|
-
FOREIGN KEY (blocked_task_id) REFERENCES t_tasks(id)
|
|
319
|
-
);
|
|
320
|
-
|
|
321
|
-
CREATE TABLE t_decision_context (
|
|
322
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
323
|
-
decision_id INTEGER NOT NULL,
|
|
324
|
-
rationale TEXT,
|
|
325
|
-
alternatives TEXT,
|
|
326
|
-
tradeoffs TEXT
|
|
327
|
-
);
|
|
285
|
+
db.exec(`
|
|
286
|
+
CREATE TABLE m_agents (
|
|
287
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
288
|
+
name TEXT NOT NULL UNIQUE,
|
|
289
|
+
created_ts INTEGER NOT NULL DEFAULT (strftime('%s', 'now'))
|
|
290
|
+
);
|
|
291
|
+
|
|
292
|
+
CREATE TABLE m_task_statuses (
|
|
293
|
+
id INTEGER PRIMARY KEY,
|
|
294
|
+
name TEXT NOT NULL UNIQUE
|
|
295
|
+
);
|
|
296
|
+
|
|
297
|
+
INSERT INTO m_task_statuses (id, name) VALUES
|
|
298
|
+
(1, 'pending'),
|
|
299
|
+
(2, 'in_progress'),
|
|
300
|
+
(3, 'completed'),
|
|
301
|
+
(4, 'archived');
|
|
302
|
+
|
|
303
|
+
CREATE TABLE t_tasks (
|
|
304
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
305
|
+
title TEXT NOT NULL,
|
|
306
|
+
status_id INTEGER NOT NULL,
|
|
307
|
+
created_by_agent_id INTEGER NOT NULL,
|
|
308
|
+
created_ts INTEGER NOT NULL DEFAULT (strftime('%s', 'now')),
|
|
309
|
+
FOREIGN KEY (status_id) REFERENCES m_task_statuses(id),
|
|
310
|
+
FOREIGN KEY (created_by_agent_id) REFERENCES m_agents(id)
|
|
311
|
+
);
|
|
312
|
+
|
|
313
|
+
CREATE TABLE t_task_dependencies (
|
|
314
|
+
blocker_task_id INTEGER NOT NULL,
|
|
315
|
+
blocked_task_id INTEGER NOT NULL,
|
|
316
|
+
PRIMARY KEY (blocker_task_id, blocked_task_id),
|
|
317
|
+
FOREIGN KEY (blocker_task_id) REFERENCES t_tasks(id),
|
|
318
|
+
FOREIGN KEY (blocked_task_id) REFERENCES t_tasks(id)
|
|
319
|
+
);
|
|
320
|
+
|
|
321
|
+
CREATE TABLE t_decision_context (
|
|
322
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
323
|
+
decision_id INTEGER NOT NULL,
|
|
324
|
+
rationale TEXT,
|
|
325
|
+
alternatives TEXT,
|
|
326
|
+
tradeoffs TEXT
|
|
327
|
+
);
|
|
328
328
|
`);
|
|
329
329
|
log(` ✓ Created v${version} schema (with decision context)`, GREEN);
|
|
330
330
|
}
|
|
331
331
|
else if (version.startsWith('3.5.')) {
|
|
332
332
|
// v3.5.x: Has pruned files, no help system
|
|
333
|
-
db.exec(`
|
|
334
|
-
CREATE TABLE m_agents (
|
|
335
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
336
|
-
name TEXT NOT NULL UNIQUE,
|
|
337
|
-
created_ts INTEGER NOT NULL DEFAULT (strftime('%s', 'now'))
|
|
338
|
-
);
|
|
339
|
-
|
|
340
|
-
CREATE TABLE m_task_statuses (
|
|
341
|
-
id INTEGER PRIMARY KEY,
|
|
342
|
-
name TEXT NOT NULL UNIQUE
|
|
343
|
-
);
|
|
344
|
-
|
|
345
|
-
INSERT INTO m_task_statuses (id, name) VALUES
|
|
346
|
-
(1, 'pending'),
|
|
347
|
-
(2, 'in_progress'),
|
|
348
|
-
(3, 'completed'),
|
|
349
|
-
(4, 'archived');
|
|
350
|
-
|
|
351
|
-
CREATE TABLE t_tasks (
|
|
352
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
353
|
-
title TEXT NOT NULL,
|
|
354
|
-
status_id INTEGER NOT NULL,
|
|
355
|
-
created_by_agent_id INTEGER NOT NULL,
|
|
356
|
-
created_ts INTEGER NOT NULL DEFAULT (strftime('%s', 'now')),
|
|
357
|
-
FOREIGN KEY (status_id) REFERENCES m_task_statuses(id),
|
|
358
|
-
FOREIGN KEY (created_by_agent_id) REFERENCES m_agents(id)
|
|
359
|
-
);
|
|
360
|
-
|
|
361
|
-
CREATE TABLE t_task_pruned_files (
|
|
362
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
363
|
-
task_id INTEGER NOT NULL,
|
|
364
|
-
file_path TEXT NOT NULL,
|
|
365
|
-
FOREIGN KEY (task_id) REFERENCES t_tasks(id)
|
|
366
|
-
);
|
|
333
|
+
db.exec(`
|
|
334
|
+
CREATE TABLE m_agents (
|
|
335
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
336
|
+
name TEXT NOT NULL UNIQUE,
|
|
337
|
+
created_ts INTEGER NOT NULL DEFAULT (strftime('%s', 'now'))
|
|
338
|
+
);
|
|
339
|
+
|
|
340
|
+
CREATE TABLE m_task_statuses (
|
|
341
|
+
id INTEGER PRIMARY KEY,
|
|
342
|
+
name TEXT NOT NULL UNIQUE
|
|
343
|
+
);
|
|
344
|
+
|
|
345
|
+
INSERT INTO m_task_statuses (id, name) VALUES
|
|
346
|
+
(1, 'pending'),
|
|
347
|
+
(2, 'in_progress'),
|
|
348
|
+
(3, 'completed'),
|
|
349
|
+
(4, 'archived');
|
|
350
|
+
|
|
351
|
+
CREATE TABLE t_tasks (
|
|
352
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
353
|
+
title TEXT NOT NULL,
|
|
354
|
+
status_id INTEGER NOT NULL,
|
|
355
|
+
created_by_agent_id INTEGER NOT NULL,
|
|
356
|
+
created_ts INTEGER NOT NULL DEFAULT (strftime('%s', 'now')),
|
|
357
|
+
FOREIGN KEY (status_id) REFERENCES m_task_statuses(id),
|
|
358
|
+
FOREIGN KEY (created_by_agent_id) REFERENCES m_agents(id)
|
|
359
|
+
);
|
|
360
|
+
|
|
361
|
+
CREATE TABLE t_task_pruned_files (
|
|
362
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
363
|
+
task_id INTEGER NOT NULL,
|
|
364
|
+
file_path TEXT NOT NULL,
|
|
365
|
+
FOREIGN KEY (task_id) REFERENCES t_tasks(id)
|
|
366
|
+
);
|
|
367
367
|
`);
|
|
368
368
|
log(` ✓ Created v${version} schema (with pruned files)`, GREEN);
|
|
369
369
|
}
|
|
370
370
|
else if (version === '3.6.0') {
|
|
371
371
|
// v3.6.0: Has help system
|
|
372
|
-
db.exec(`
|
|
373
|
-
CREATE TABLE m_agents (
|
|
374
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
375
|
-
name TEXT NOT NULL UNIQUE,
|
|
376
|
-
created_ts INTEGER NOT NULL DEFAULT (strftime('%s', 'now'))
|
|
377
|
-
);
|
|
378
|
-
|
|
379
|
-
CREATE TABLE m_help_tools (
|
|
380
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
381
|
-
tool_name TEXT NOT NULL UNIQUE,
|
|
382
|
-
short_description TEXT
|
|
383
|
-
);
|
|
372
|
+
db.exec(`
|
|
373
|
+
CREATE TABLE m_agents (
|
|
374
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
375
|
+
name TEXT NOT NULL UNIQUE,
|
|
376
|
+
created_ts INTEGER NOT NULL DEFAULT (strftime('%s', 'now'))
|
|
377
|
+
);
|
|
378
|
+
|
|
379
|
+
CREATE TABLE m_help_tools (
|
|
380
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
381
|
+
tool_name TEXT NOT NULL UNIQUE,
|
|
382
|
+
short_description TEXT
|
|
383
|
+
);
|
|
384
384
|
`);
|
|
385
385
|
log(` ✓ Created v${version} schema (with help system)`, GREEN);
|
|
386
386
|
}
|
package/dist/tools/tasks.js
CHANGED
|
@@ -724,7 +724,7 @@ export async function moveTask(params, adapter) {
|
|
|
724
724
|
// Note: Using system agent (id=1) for status changes
|
|
725
725
|
// In a real implementation, you'd pass the actual agent_id who made the change
|
|
726
726
|
const systemAgentId = 1;
|
|
727
|
-
await logTaskStatusChange(
|
|
727
|
+
await logTaskStatusChange(trx, {
|
|
728
728
|
task_id: params.task_id,
|
|
729
729
|
old_status: currentStatusId,
|
|
730
730
|
new_status: newStatusId,
|
|
@@ -780,7 +780,7 @@ export async function linkTask(params, adapter) {
|
|
|
780
780
|
const decisionKey = String(params.target_id);
|
|
781
781
|
const keyId = await getOrCreateContextKey(actualAdapter, decisionKey, trx);
|
|
782
782
|
const linkRelation = params.link_relation || 'implements';
|
|
783
|
-
await
|
|
783
|
+
await trx('t_task_decision_links').insert({
|
|
784
784
|
task_id: params.task_id,
|
|
785
785
|
decision_key_id: keyId,
|
|
786
786
|
link_type: linkRelation
|