@jamesaphoenix/tx-core 0.4.3 → 0.4.5
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/db.d.ts.map +1 -1
- package/dist/db.js +8 -2
- package/dist/db.js.map +1 -1
- package/dist/layer.d.ts +3 -3
- package/dist/services/auto-sync-service.d.ts +1 -1
- package/dist/services/cycle-scan-service.d.ts.map +1 -1
- package/dist/services/cycle-scan-service.js +6 -2
- package/dist/services/cycle-scan-service.js.map +1 -1
- package/dist/services/learning-service.d.ts +1 -1
- package/dist/services/orchestrator-service.d.ts +1 -1
- package/dist/services/orchestrator-service.d.ts.map +1 -1
- package/dist/services/orchestrator-service.js +14 -13
- package/dist/services/orchestrator-service.js.map +1 -1
- package/dist/services/retriever-service.d.ts +2 -2
- package/dist/services/sync-service.d.ts.map +1 -1
- package/dist/services/sync-service.js +9 -8
- package/dist/services/sync-service.js.map +1 -1
- package/dist/services/task-service.d.ts.map +1 -1
- package/dist/services/task-service.js +3 -2
- package/dist/services/task-service.js.map +1 -1
- package/dist/services/worker-process.d.ts +1 -1
- package/dist/services/worker-process.d.ts.map +1 -1
- package/dist/services/worker-process.js +9 -2
- package/dist/services/worker-process.js.map +1 -1
- package/dist/worker/run-worker.d.ts +1 -1
- package/package.json +1 -1
- package/dist/mappers/anchor.d.ts +0 -28
- package/dist/mappers/anchor.d.ts.map +0 -1
- package/dist/mappers/anchor.js +0 -105
- package/dist/mappers/anchor.js.map +0 -1
- package/dist/mappers/candidate.d.ts +0 -25
- package/dist/mappers/candidate.d.ts.map +0 -1
- package/dist/mappers/candidate.js +0 -83
- package/dist/mappers/candidate.js.map +0 -1
- package/dist/mappers/edge.d.ts +0 -19
- package/dist/mappers/edge.d.ts.map +0 -1
- package/dist/mappers/edge.js +0 -81
- package/dist/mappers/edge.js.map +0 -1
- package/dist/repo/anchor-repo.d.ts +0 -52
- package/dist/repo/anchor-repo.d.ts.map +0 -1
- package/dist/repo/anchor-repo.js +0 -245
- package/dist/repo/anchor-repo.js.map +0 -1
- package/dist/repo/candidate-repo.d.ts +0 -16
- package/dist/repo/candidate-repo.d.ts.map +0 -1
- package/dist/repo/candidate-repo.js +0 -164
- package/dist/repo/candidate-repo.js.map +0 -1
- package/dist/repo/compaction-repo.d.ts +0 -41
- package/dist/repo/compaction-repo.d.ts.map +0 -1
- package/dist/repo/compaction-repo.js +0 -84
- package/dist/repo/compaction-repo.js.map +0 -1
- package/dist/repo/edge-repo.d.ts +0 -26
- package/dist/repo/edge-repo.d.ts.map +0 -1
- package/dist/repo/edge-repo.js +0 -258
- package/dist/repo/edge-repo.js.map +0 -1
- package/dist/services/anchor-service.d.ts +0 -147
- package/dist/services/anchor-service.d.ts.map +0 -1
- package/dist/services/anchor-service.js +0 -540
- package/dist/services/anchor-service.js.map +0 -1
- package/dist/services/anchor-verification.d.ts +0 -102
- package/dist/services/anchor-verification.d.ts.map +0 -1
- package/dist/services/anchor-verification.js +0 -817
- package/dist/services/anchor-verification.js.map +0 -1
- package/dist/services/ast-grep-service.d.ts +0 -58
- package/dist/services/ast-grep-service.d.ts.map +0 -1
- package/dist/services/ast-grep-service.js +0 -427
- package/dist/services/ast-grep-service.js.map +0 -1
- package/dist/services/candidate-extractor-service.d.ts +0 -56
- package/dist/services/candidate-extractor-service.d.ts.map +0 -1
- package/dist/services/candidate-extractor-service.js +0 -365
- package/dist/services/candidate-extractor-service.js.map +0 -1
- package/dist/services/compaction-service.d.ts +0 -105
- package/dist/services/compaction-service.d.ts.map +0 -1
- package/dist/services/compaction-service.js +0 -369
- package/dist/services/compaction-service.js.map +0 -1
- package/dist/services/edge-service.d.ts +0 -78
- package/dist/services/edge-service.d.ts.map +0 -1
- package/dist/services/edge-service.js +0 -158
- package/dist/services/edge-service.js.map +0 -1
- package/dist/services/feedback-tracker.d.ts +0 -64
- package/dist/services/feedback-tracker.d.ts.map +0 -1
- package/dist/services/feedback-tracker.js +0 -110
- package/dist/services/feedback-tracker.js.map +0 -1
- package/dist/services/graph-expansion.d.ts +0 -158
- package/dist/services/graph-expansion.d.ts.map +0 -1
- package/dist/services/graph-expansion.js +0 -487
- package/dist/services/graph-expansion.js.map +0 -1
- package/dist/services/promotion-service.d.ts +0 -67
- package/dist/services/promotion-service.d.ts.map +0 -1
- package/dist/services/promotion-service.js +0 -151
- package/dist/services/promotion-service.js.map +0 -1
- package/dist/services/swarm-verification.d.ts +0 -104
- package/dist/services/swarm-verification.d.ts.map +0 -1
- package/dist/services/swarm-verification.js +0 -406
- package/dist/services/swarm-verification.js.map +0 -1
|
@@ -1,369 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CompactionService - Compacts completed tasks and exports learnings
|
|
3
|
-
*
|
|
4
|
-
* Implements PRD-006: Task Compaction & Learnings Export
|
|
5
|
-
* See DD-006: LLM Integration for implementation details
|
|
6
|
-
*/
|
|
7
|
-
import { Context, Effect, Layer, Config, Option } from "effect";
|
|
8
|
-
import { writeFileSync, existsSync, readFileSync } from "node:fs";
|
|
9
|
-
import { resolve, sep } from "node:path";
|
|
10
|
-
import { SqliteClient } from "../db.js";
|
|
11
|
-
import { DatabaseError, ExtractionUnavailableError, ValidationError } from "../errors.js";
|
|
12
|
-
import { CompactionRepository } from "../repo/compaction-repo.js";
|
|
13
|
-
import { rowToTask } from "../mappers/task.js";
|
|
14
|
-
/**
|
|
15
|
-
* Parse LLM JSON response, handling common formatting issues.
|
|
16
|
-
* Robust parser following DD-006 patterns.
|
|
17
|
-
*/
|
|
18
|
-
const parseLlmJson = (raw) => {
|
|
19
|
-
// Step 1: Try direct parse
|
|
20
|
-
try {
|
|
21
|
-
return JSON.parse(raw);
|
|
22
|
-
}
|
|
23
|
-
catch { /* continue */ }
|
|
24
|
-
// Step 2: Strip markdown code fences
|
|
25
|
-
const fenceMatch = raw.match(/```(?:json)?\s*\n?([\s\S]*?)```/);
|
|
26
|
-
if (fenceMatch && fenceMatch[1]) {
|
|
27
|
-
try {
|
|
28
|
-
return JSON.parse(fenceMatch[1].trim());
|
|
29
|
-
}
|
|
30
|
-
catch { /* continue */ }
|
|
31
|
-
}
|
|
32
|
-
// Step 3: Find first [ or { and parse from there
|
|
33
|
-
const jsonStart = raw.search(/[[{]/);
|
|
34
|
-
if (jsonStart >= 0) {
|
|
35
|
-
const candidate = raw.slice(jsonStart);
|
|
36
|
-
try {
|
|
37
|
-
return JSON.parse(candidate);
|
|
38
|
-
}
|
|
39
|
-
catch { /* continue */ }
|
|
40
|
-
// Step 4: Find matching bracket and extract
|
|
41
|
-
const openChar = candidate[0];
|
|
42
|
-
const closeChar = openChar === "[" ? "]" : "}";
|
|
43
|
-
const lastClose = candidate.lastIndexOf(closeChar);
|
|
44
|
-
if (lastClose > 0) {
|
|
45
|
-
try {
|
|
46
|
-
return JSON.parse(candidate.slice(0, lastClose + 1));
|
|
47
|
-
}
|
|
48
|
-
catch { /* continue */ }
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return null;
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* LLM prompt template for compaction.
|
|
55
|
-
*/
|
|
56
|
-
const COMPACTION_PROMPT = `Analyze these completed tasks and generate two outputs:
|
|
57
|
-
|
|
58
|
-
Completed Tasks:
|
|
59
|
-
{tasks}
|
|
60
|
-
|
|
61
|
-
Generate a JSON response with two fields:
|
|
62
|
-
|
|
63
|
-
1. "summary": A 2-4 paragraph summary capturing what was accomplished, grouped by related work. Keep under 500 words.
|
|
64
|
-
|
|
65
|
-
2. "learnings": Bullet points of actionable learnings that would help an AI agent working on similar tasks in the future. Focus on:
|
|
66
|
-
- Key technical decisions and why they were made
|
|
67
|
-
- Gotchas or pitfalls to avoid
|
|
68
|
-
- Patterns that worked well
|
|
69
|
-
- Things that should be done differently next time
|
|
70
|
-
|
|
71
|
-
Format learnings as markdown bullet points, suitable for appending to a CLAUDE.md file.
|
|
72
|
-
|
|
73
|
-
Example response format:
|
|
74
|
-
{
|
|
75
|
-
"summary": "## Task Summary\\n\\nCompleted authentication system implementation...",
|
|
76
|
-
"learnings": "- JWT tokens should use RS256 for production signing\\n- Token validation middleware must run before route handlers"
|
|
77
|
-
}`;
|
|
78
|
-
/**
|
|
79
|
-
* Validate that a target file path does not escape the project directory
|
|
80
|
-
* via path traversal (e.g. "../../etc/passwd" or absolute paths outside
|
|
81
|
-
* the project root). Returns the resolved absolute path on success.
|
|
82
|
-
*/
|
|
83
|
-
const validateProjectPath = (targetFile) => {
|
|
84
|
-
const projectRoot = process.cwd();
|
|
85
|
-
const resolved = resolve(projectRoot, targetFile);
|
|
86
|
-
if (!resolved.startsWith(projectRoot + sep)) {
|
|
87
|
-
return Effect.fail(new ValidationError({
|
|
88
|
-
reason: `Path traversal rejected: resolved path '${resolved}' escapes project directory '${projectRoot}'`
|
|
89
|
-
}));
|
|
90
|
-
}
|
|
91
|
-
return Effect.succeed(resolved);
|
|
92
|
-
};
|
|
93
|
-
/**
|
|
94
|
-
* CompactionService provides compaction operations for completed tasks.
|
|
95
|
-
*
|
|
96
|
-
* Design: Following DD-006 patterns for LLM integration with graceful degradation.
|
|
97
|
-
* When ANTHROPIC_API_KEY is not set, compact() fails gracefully while preview()
|
|
98
|
-
* and getSummaries() still work.
|
|
99
|
-
*/
|
|
100
|
-
export class CompactionService extends Context.Tag("CompactionService")() {
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Noop implementation - returns failures for LLM operations.
|
|
104
|
-
* Used for testing and when no API key is configured.
|
|
105
|
-
*/
|
|
106
|
-
export const CompactionServiceNoop = Layer.effect(CompactionService, Effect.gen(function* () {
|
|
107
|
-
const compactionRepo = yield* CompactionRepository;
|
|
108
|
-
const db = yield* SqliteClient;
|
|
109
|
-
const findCompactableTasks = (before) => Effect.try({
|
|
110
|
-
try: () => {
|
|
111
|
-
// Find tasks that are:
|
|
112
|
-
// 1. Status = 'done'
|
|
113
|
-
// 2. completed_at < before
|
|
114
|
-
// 3. All children are also done (subquery check)
|
|
115
|
-
const beforeStr = before.toISOString();
|
|
116
|
-
const rows = db.prepare(`
|
|
117
|
-
SELECT t.*
|
|
118
|
-
FROM tasks t
|
|
119
|
-
WHERE t.status = 'done'
|
|
120
|
-
AND t.completed_at IS NOT NULL
|
|
121
|
-
AND t.completed_at < ?
|
|
122
|
-
AND NOT EXISTS (
|
|
123
|
-
SELECT 1 FROM tasks child
|
|
124
|
-
WHERE child.parent_id = t.id
|
|
125
|
-
AND child.status != 'done'
|
|
126
|
-
)
|
|
127
|
-
ORDER BY t.completed_at ASC
|
|
128
|
-
`).all(beforeStr);
|
|
129
|
-
return rows.map(rowToTask);
|
|
130
|
-
},
|
|
131
|
-
catch: (cause) => new DatabaseError({ cause })
|
|
132
|
-
});
|
|
133
|
-
return {
|
|
134
|
-
compact: (_options) => Effect.fail(new ExtractionUnavailableError({
|
|
135
|
-
reason: "Task compaction requires ANTHROPIC_API_KEY. Set it as an environment variable to enable this feature."
|
|
136
|
-
})),
|
|
137
|
-
preview: (before) => findCompactableTasks(before),
|
|
138
|
-
getSummaries: () => compactionRepo.findAll(),
|
|
139
|
-
exportLearnings: (learnings, targetFile) => Effect.gen(function* () {
|
|
140
|
-
const filePath = yield* validateProjectPath(targetFile);
|
|
141
|
-
yield* Effect.try({
|
|
142
|
-
try: () => {
|
|
143
|
-
const date = new Date().toISOString().split("T")[0];
|
|
144
|
-
const content = `\n\n## Agent Learnings (${date})\n\n${learnings}\n`;
|
|
145
|
-
if (existsSync(filePath)) {
|
|
146
|
-
const existing = readFileSync(filePath, "utf-8");
|
|
147
|
-
writeFileSync(filePath, existing + content);
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
writeFileSync(filePath, `# Project Context\n${content}`);
|
|
151
|
-
}
|
|
152
|
-
},
|
|
153
|
-
catch: (cause) => new DatabaseError({ cause })
|
|
154
|
-
});
|
|
155
|
-
}),
|
|
156
|
-
isAvailable: () => Effect.succeed(false)
|
|
157
|
-
};
|
|
158
|
-
}));
|
|
159
|
-
/**
|
|
160
|
-
* Live implementation with Anthropic LLM support.
|
|
161
|
-
*/
|
|
162
|
-
export const CompactionServiceLive = Layer.effect(CompactionService, Effect.gen(function* () {
|
|
163
|
-
const compactionRepo = yield* CompactionRepository;
|
|
164
|
-
const db = yield* SqliteClient;
|
|
165
|
-
// Read API key from environment (optional)
|
|
166
|
-
const apiKeyOption = yield* Config.string("ANTHROPIC_API_KEY").pipe(Effect.option);
|
|
167
|
-
const hasApiKey = Option.isSome(apiKeyOption) && apiKeyOption.value.trim().length > 0;
|
|
168
|
-
const apiKey = hasApiKey ? apiKeyOption.value : null;
|
|
169
|
-
// Lazy-load Anthropic client
|
|
170
|
-
let client = null;
|
|
171
|
-
const ensureClient = Effect.gen(function* () {
|
|
172
|
-
if (!apiKey) {
|
|
173
|
-
return yield* Effect.fail(new ExtractionUnavailableError({
|
|
174
|
-
reason: "Task compaction requires ANTHROPIC_API_KEY. Set it as an environment variable to enable this feature."
|
|
175
|
-
}));
|
|
176
|
-
}
|
|
177
|
-
if (client)
|
|
178
|
-
return client;
|
|
179
|
-
// Dynamic import of Anthropic SDK (optional peer dependency)
|
|
180
|
-
const Anthropic = yield* Effect.tryPromise({
|
|
181
|
-
try: async () => {
|
|
182
|
-
// @ts-expect-error - @anthropic-ai/sdk is an optional peer dependency
|
|
183
|
-
const mod = await import("@anthropic-ai/sdk");
|
|
184
|
-
return mod.default;
|
|
185
|
-
},
|
|
186
|
-
catch: () => new ExtractionUnavailableError({
|
|
187
|
-
reason: "@anthropic-ai/sdk is not installed"
|
|
188
|
-
})
|
|
189
|
-
});
|
|
190
|
-
client = new Anthropic({ apiKey });
|
|
191
|
-
return client;
|
|
192
|
-
});
|
|
193
|
-
const findCompactableTasks = (before) => Effect.try({
|
|
194
|
-
try: () => {
|
|
195
|
-
// Find tasks that are:
|
|
196
|
-
// 1. Status = 'done'
|
|
197
|
-
// 2. completed_at < before
|
|
198
|
-
// 3. All children are also done (subquery check)
|
|
199
|
-
const beforeStr = before.toISOString();
|
|
200
|
-
const rows = db.prepare(`
|
|
201
|
-
SELECT t.*
|
|
202
|
-
FROM tasks t
|
|
203
|
-
WHERE t.status = 'done'
|
|
204
|
-
AND t.completed_at IS NOT NULL
|
|
205
|
-
AND t.completed_at < ?
|
|
206
|
-
AND NOT EXISTS (
|
|
207
|
-
SELECT 1 FROM tasks child
|
|
208
|
-
WHERE child.parent_id = t.id
|
|
209
|
-
AND child.status != 'done'
|
|
210
|
-
)
|
|
211
|
-
ORDER BY t.completed_at ASC
|
|
212
|
-
`).all(beforeStr);
|
|
213
|
-
return rows.map(rowToTask);
|
|
214
|
-
},
|
|
215
|
-
catch: (cause) => new DatabaseError({ cause })
|
|
216
|
-
});
|
|
217
|
-
const generateSummary = (tasks) => Effect.gen(function* () {
|
|
218
|
-
const anthropic = yield* ensureClient;
|
|
219
|
-
// Build task list for prompt
|
|
220
|
-
const taskList = tasks.map(t => `- ${t.id}: ${t.title} (completed: ${t.completedAt?.toISOString().split("T")[0] ?? "unknown"})\n ${t.description || "(no description)"}`).join("\n");
|
|
221
|
-
const prompt = COMPACTION_PROMPT.replace("{tasks}", taskList);
|
|
222
|
-
const response = yield* Effect.tryPromise({
|
|
223
|
-
try: () => anthropic.messages.create({
|
|
224
|
-
model: "claude-haiku-4-20250514",
|
|
225
|
-
max_tokens: 2048,
|
|
226
|
-
messages: [{
|
|
227
|
-
role: "user",
|
|
228
|
-
content: prompt
|
|
229
|
-
}]
|
|
230
|
-
}),
|
|
231
|
-
catch: (e) => new ExtractionUnavailableError({
|
|
232
|
-
reason: `Anthropic API call failed: ${String(e)}`
|
|
233
|
-
})
|
|
234
|
-
});
|
|
235
|
-
// Extract text from response
|
|
236
|
-
const textContent = response.content.find(c => c.type === "text");
|
|
237
|
-
if (!textContent || !textContent.text) {
|
|
238
|
-
return {
|
|
239
|
-
summary: "No summary generated",
|
|
240
|
-
learnings: "- No learnings extracted"
|
|
241
|
-
};
|
|
242
|
-
}
|
|
243
|
-
// Parse the JSON response
|
|
244
|
-
const parsed = parseLlmJson(textContent.text);
|
|
245
|
-
if (!parsed || !parsed.summary || !parsed.learnings) {
|
|
246
|
-
// Fallback: treat raw response as summary/learnings
|
|
247
|
-
return {
|
|
248
|
-
summary: textContent.text.slice(0, 1000),
|
|
249
|
-
learnings: "- No structured learnings extracted"
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
return parsed;
|
|
253
|
-
});
|
|
254
|
-
const exportLearningsToFile = (learnings, targetFile) => Effect.gen(function* () {
|
|
255
|
-
const filePath = yield* validateProjectPath(targetFile);
|
|
256
|
-
yield* Effect.try({
|
|
257
|
-
try: () => {
|
|
258
|
-
const date = new Date().toISOString().split("T")[0];
|
|
259
|
-
const content = `\n\n## Agent Learnings (${date})\n\n${learnings}\n`;
|
|
260
|
-
if (existsSync(filePath)) {
|
|
261
|
-
const existing = readFileSync(filePath, "utf-8");
|
|
262
|
-
writeFileSync(filePath, existing + content);
|
|
263
|
-
}
|
|
264
|
-
else {
|
|
265
|
-
writeFileSync(filePath, `# Project Context\n${content}`);
|
|
266
|
-
}
|
|
267
|
-
},
|
|
268
|
-
catch: (cause) => new DatabaseError({ cause })
|
|
269
|
-
});
|
|
270
|
-
});
|
|
271
|
-
return {
|
|
272
|
-
compact: (options) => Effect.gen(function* () {
|
|
273
|
-
const tasks = yield* findCompactableTasks(options.before);
|
|
274
|
-
// Default to 'both' per DOCTRINE RULE 2
|
|
275
|
-
const outputMode = options.outputMode ?? 'both';
|
|
276
|
-
if (tasks.length === 0) {
|
|
277
|
-
return {
|
|
278
|
-
compactedCount: 0,
|
|
279
|
-
summary: "No tasks to compact",
|
|
280
|
-
learnings: "",
|
|
281
|
-
taskIds: [],
|
|
282
|
-
learningsExportedTo: null,
|
|
283
|
-
outputMode
|
|
284
|
-
};
|
|
285
|
-
}
|
|
286
|
-
// Generate LLM summary (outside transaction - LLM calls are slow)
|
|
287
|
-
const { summary, learnings } = yield* generateSummary(tasks);
|
|
288
|
-
const taskIds = tasks.map(t => t.id);
|
|
289
|
-
const outputFile = options.outputFile ?? "CLAUDE.md";
|
|
290
|
-
const shouldExportToMarkdown = outputMode === 'markdown' || outputMode === 'both';
|
|
291
|
-
const shouldStoreInDatabase = outputMode === 'database' || outputMode === 'both';
|
|
292
|
-
if (options.dryRun) {
|
|
293
|
-
// Preview mode: return what would be compacted without making changes
|
|
294
|
-
return {
|
|
295
|
-
compactedCount: tasks.length,
|
|
296
|
-
summary,
|
|
297
|
-
learnings,
|
|
298
|
-
taskIds,
|
|
299
|
-
learningsExportedTo: shouldExportToMarkdown ? outputFile : null,
|
|
300
|
-
outputMode
|
|
301
|
-
};
|
|
302
|
-
}
|
|
303
|
-
// CRITICAL: Export learnings to file FIRST, before database transaction.
|
|
304
|
-
// This ordering prevents a false positive where the database records
|
|
305
|
-
// learnings_exported_to but the file export actually failed.
|
|
306
|
-
// If file export fails, we fail loudly here before any DB changes.
|
|
307
|
-
// See task tx-b2aa12e1 and regression test in compaction.test.ts.
|
|
308
|
-
if (shouldExportToMarkdown) {
|
|
309
|
-
yield* exportLearningsToFile(learnings, outputFile);
|
|
310
|
-
}
|
|
311
|
-
// Transaction: store log (optionally with learnings) + delete tasks atomically
|
|
312
|
-
yield* Effect.try({
|
|
313
|
-
try: () => {
|
|
314
|
-
db.exec("BEGIN IMMEDIATE");
|
|
315
|
-
try {
|
|
316
|
-
if (shouldStoreInDatabase) {
|
|
317
|
-
// Insert compaction log
|
|
318
|
-
// When outputMode is 'both', store learnings in DB as backup
|
|
319
|
-
// When outputMode is 'database', learnings are stored only in DB
|
|
320
|
-
const now = new Date().toISOString();
|
|
321
|
-
db.prepare(`INSERT INTO compaction_log (compacted_at, task_count, summary, task_ids, learnings_exported_to, learnings)
|
|
322
|
-
VALUES (?, ?, ?, ?, ?, ?)`).run(now, tasks.length, summary, JSON.stringify(taskIds), shouldExportToMarkdown ? outputFile : null, learnings);
|
|
323
|
-
}
|
|
324
|
-
// Delete compacted tasks
|
|
325
|
-
for (const task of tasks) {
|
|
326
|
-
// First delete any dependencies involving this task
|
|
327
|
-
db.prepare("DELETE FROM task_dependencies WHERE blocker_id = ? OR blocked_id = ?").run(task.id, task.id);
|
|
328
|
-
// Then delete the task
|
|
329
|
-
db.prepare("DELETE FROM tasks WHERE id = ?").run(task.id);
|
|
330
|
-
}
|
|
331
|
-
db.exec("COMMIT");
|
|
332
|
-
}
|
|
333
|
-
catch (e) {
|
|
334
|
-
db.exec("ROLLBACK");
|
|
335
|
-
throw e;
|
|
336
|
-
}
|
|
337
|
-
},
|
|
338
|
-
catch: (cause) => new DatabaseError({ cause })
|
|
339
|
-
});
|
|
340
|
-
return {
|
|
341
|
-
compactedCount: tasks.length,
|
|
342
|
-
summary,
|
|
343
|
-
learnings,
|
|
344
|
-
taskIds,
|
|
345
|
-
learningsExportedTo: shouldExportToMarkdown ? outputFile : null,
|
|
346
|
-
outputMode
|
|
347
|
-
};
|
|
348
|
-
}),
|
|
349
|
-
preview: (before) => findCompactableTasks(before),
|
|
350
|
-
getSummaries: () => compactionRepo.findAll(),
|
|
351
|
-
exportLearnings: exportLearningsToFile,
|
|
352
|
-
isAvailable: () => Effect.succeed(hasApiKey)
|
|
353
|
-
};
|
|
354
|
-
}));
|
|
355
|
-
/**
|
|
356
|
-
* Auto-detecting layer that selects the appropriate backend based on environment.
|
|
357
|
-
*
|
|
358
|
-
* Priority:
|
|
359
|
-
* 1. ANTHROPIC_API_KEY set -> Use Live implementation
|
|
360
|
-
* 2. Not set -> Use Noop (graceful degradation)
|
|
361
|
-
*/
|
|
362
|
-
export const CompactionServiceAuto = Layer.unwrapEffect(Effect.gen(function* () {
|
|
363
|
-
const anthropicKey = yield* Config.string("ANTHROPIC_API_KEY").pipe(Effect.option);
|
|
364
|
-
if (Option.isSome(anthropicKey) && anthropicKey.value.trim().length > 0) {
|
|
365
|
-
return CompactionServiceLive;
|
|
366
|
-
}
|
|
367
|
-
return CompactionServiceNoop;
|
|
368
|
-
}));
|
|
369
|
-
//# sourceMappingURL=compaction-service.js.map
|
|
@@ -1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AM,CAAC,mBAAmB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IAElF,IAAI,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxE,OAAO,qBAAqB,CAAA;IAC9B,CAAC;IAED,OAAO,qBAAqB,CAAA;AAC9B,CAAC,CAAC,CACH,CAAA"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { Context, Effect, Layer } from "effect";
|
|
2
|
-
import { EdgeRepository } from "../repo/edge-repo.js";
|
|
3
|
-
import { DatabaseError, EdgeNotFoundError, ValidationError } from "../errors.js";
|
|
4
|
-
import type { Edge, EdgeType, NodeType, CreateEdgeInput, UpdateEdgeInput, NeighborNode } from "@jamesaphoenix/tx-types";
|
|
5
|
-
/** Extended neighbor with depth information */
|
|
6
|
-
export interface NeighborWithDepth extends NeighborNode {
|
|
7
|
-
readonly depth: number;
|
|
8
|
-
}
|
|
9
|
-
/** Options for multi-hop neighbor finding */
|
|
10
|
-
export interface FindNeighborsOptions {
|
|
11
|
-
/** Maximum depth to traverse (default: 1) */
|
|
12
|
-
readonly depth?: number;
|
|
13
|
-
/** Direction of traversal */
|
|
14
|
-
readonly direction?: "outgoing" | "incoming" | "both";
|
|
15
|
-
/** Filter by edge types */
|
|
16
|
-
readonly edgeTypes?: readonly EdgeType[];
|
|
17
|
-
/** Include the path of edges that led to this neighbor */
|
|
18
|
-
readonly includePath?: boolean;
|
|
19
|
-
}
|
|
20
|
-
/** Neighbor with path information */
|
|
21
|
-
export interface NeighborWithPath extends NeighborWithDepth {
|
|
22
|
-
readonly path: readonly Edge[];
|
|
23
|
-
}
|
|
24
|
-
declare const EdgeService_base: Context.TagClass<EdgeService, "EdgeService", {
|
|
25
|
-
/**
|
|
26
|
-
* Create an edge between two nodes.
|
|
27
|
-
* Validates edge type, node types, and ensures weight is in [0, 1].
|
|
28
|
-
*/
|
|
29
|
-
readonly createEdge: (input: CreateEdgeInput) => Effect.Effect<Edge, ValidationError | DatabaseError>;
|
|
30
|
-
/**
|
|
31
|
-
* Find neighbors of a node with optional multi-hop traversal.
|
|
32
|
-
* Supports depth, direction, and edge type filtering.
|
|
33
|
-
*/
|
|
34
|
-
readonly findNeighbors: (nodeType: NodeType, nodeId: string, options?: FindNeighborsOptions) => Effect.Effect<readonly NeighborWithDepth[], DatabaseError>;
|
|
35
|
-
/**
|
|
36
|
-
* Find a path between two nodes.
|
|
37
|
-
* Returns the sequence of edges, or null if no path exists.
|
|
38
|
-
*/
|
|
39
|
-
readonly findPath: (fromType: NodeType, fromId: string, toType: NodeType, toId: string, maxDepth?: number) => Effect.Effect<readonly Edge[] | null, DatabaseError>;
|
|
40
|
-
/**
|
|
41
|
-
* Invalidate (soft delete) an edge.
|
|
42
|
-
*/
|
|
43
|
-
readonly invalidateEdge: (id: number) => Effect.Effect<boolean, EdgeNotFoundError | DatabaseError>;
|
|
44
|
-
/**
|
|
45
|
-
* Get an edge by ID.
|
|
46
|
-
*/
|
|
47
|
-
readonly get: (id: number) => Effect.Effect<Edge, EdgeNotFoundError | DatabaseError>;
|
|
48
|
-
/**
|
|
49
|
-
* Update an edge's weight or metadata.
|
|
50
|
-
*/
|
|
51
|
-
readonly update: (id: number, input: UpdateEdgeInput) => Effect.Effect<Edge, EdgeNotFoundError | ValidationError | DatabaseError>;
|
|
52
|
-
/**
|
|
53
|
-
* Find all edges of a specific type.
|
|
54
|
-
*/
|
|
55
|
-
readonly findByType: (edgeType: EdgeType) => Effect.Effect<readonly Edge[], ValidationError | DatabaseError>;
|
|
56
|
-
/**
|
|
57
|
-
* Find all edges from a source node.
|
|
58
|
-
*/
|
|
59
|
-
readonly findFromSource: (sourceType: NodeType, sourceId: string) => Effect.Effect<readonly Edge[], DatabaseError>;
|
|
60
|
-
/**
|
|
61
|
-
* Find all edges from multiple source nodes in a single batch query.
|
|
62
|
-
* Eliminates N+1 queries when fetching edges for multiple nodes.
|
|
63
|
-
*/
|
|
64
|
-
readonly findFromMultipleSources: (sourceType: NodeType, sourceIds: readonly string[]) => Effect.Effect<ReadonlyMap<string, readonly Edge[]>, DatabaseError>;
|
|
65
|
-
/**
|
|
66
|
-
* Find all edges to a target node.
|
|
67
|
-
*/
|
|
68
|
-
readonly findToTarget: (targetType: NodeType, targetId: string) => Effect.Effect<readonly Edge[], DatabaseError>;
|
|
69
|
-
/**
|
|
70
|
-
* Count edges by type.
|
|
71
|
-
*/
|
|
72
|
-
readonly countByType: () => Effect.Effect<Map<EdgeType, number>, DatabaseError>;
|
|
73
|
-
}>;
|
|
74
|
-
export declare class EdgeService extends EdgeService_base {
|
|
75
|
-
}
|
|
76
|
-
export declare const EdgeServiceLive: Layer.Layer<EdgeService, never, EdgeRepository>;
|
|
77
|
-
export {};
|
|
78
|
-
//# sourceMappingURL=edge-service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"edge-service.d.ts","sourceRoot":"","sources":["../../src/services/edge-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAChF,OAAO,KAAK,EACV,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,eAAe,EACf,eAAe,EACf,YAAY,EACb,MAAM,yBAAyB,CAAA;AAiBhC,+CAA+C;AAC/C,MAAM,WAAW,iBAAkB,SAAQ,YAAY;IACrD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB;AAED,6CAA6C;AAC7C,MAAM,WAAW,oBAAoB;IACnC,6CAA6C;IAC7C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB,6BAA6B;IAC7B,QAAQ,CA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yBACkB,CAAC,QAAQ,EAAE,QAAQ,KAAK,MAAM,CAAC,MAAM,CAAC,SAAS,IAAI,EAAE,EAAE,eAAe,GAAG,aAAa,CAAC;IAE5G;;OAEG;6BACsB,CAAC,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,SAAS,IAAI,EAAE,EAAE,aAAa,CAAC;IAElH;;;OAGG;sCAC+B,CAChC,UAAU,EAAE,QAAQ,EACpB,SAAS,EAAE,SAAS,MAAM,EAAE,KACzB,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,SAAS,IAAI,EAAE,CAAC,EAAE,aAAa,CAAC;IAEvE;;OAEG;2BACoB,CAAC,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,SAAS,IAAI,EAAE,EAAE,aAAa,CAAC;IAEhH;;OAEG;0BACmB,MAAM,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,aAAa,CAAC;;AAzEnF,qBAAa,WAAY,SAAQ,gBA2E9B;CAAG;AAuDN,eAAO,MAAM,eAAe,iDAiI3B,CAAA"}
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import { Context, Effect, Layer } from "effect";
|
|
2
|
-
import { EdgeRepository } from "../repo/edge-repo.js";
|
|
3
|
-
import { EdgeNotFoundError, ValidationError } from "../errors.js";
|
|
4
|
-
/** Valid edge types - imported at runtime for validation */
|
|
5
|
-
const VALID_EDGE_TYPES = [
|
|
6
|
-
"ANCHORED_TO",
|
|
7
|
-
"DERIVED_FROM",
|
|
8
|
-
"IMPORTS",
|
|
9
|
-
"CO_CHANGES_WITH",
|
|
10
|
-
"SIMILAR_TO",
|
|
11
|
-
"LINKS_TO",
|
|
12
|
-
"USED_IN_RUN",
|
|
13
|
-
"INVALIDATED_BY"
|
|
14
|
-
];
|
|
15
|
-
/** Valid node types - imported at runtime for validation */
|
|
16
|
-
const VALID_NODE_TYPES = ["learning", "file", "task", "run"];
|
|
17
|
-
export class EdgeService extends Context.Tag("EdgeService")() {
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Validate edge type.
|
|
21
|
-
*/
|
|
22
|
-
const validateEdgeType = (edgeType) => Effect.gen(function* () {
|
|
23
|
-
if (!VALID_EDGE_TYPES.includes(edgeType)) {
|
|
24
|
-
return yield* Effect.fail(new ValidationError({
|
|
25
|
-
reason: `Invalid edge type: ${edgeType}. Valid types: ${VALID_EDGE_TYPES.join(", ")}`
|
|
26
|
-
}));
|
|
27
|
-
}
|
|
28
|
-
return edgeType;
|
|
29
|
-
});
|
|
30
|
-
/**
|
|
31
|
-
* Validate node type.
|
|
32
|
-
*/
|
|
33
|
-
const validateNodeType = (nodeType, field) => Effect.gen(function* () {
|
|
34
|
-
if (!VALID_NODE_TYPES.includes(nodeType)) {
|
|
35
|
-
return yield* Effect.fail(new ValidationError({
|
|
36
|
-
reason: `Invalid ${field}: ${nodeType}. Valid types: ${VALID_NODE_TYPES.join(", ")}`
|
|
37
|
-
}));
|
|
38
|
-
}
|
|
39
|
-
return nodeType;
|
|
40
|
-
});
|
|
41
|
-
/**
|
|
42
|
-
* Validate weight is in [0, 1] range.
|
|
43
|
-
*/
|
|
44
|
-
const validateWeight = (weight) => Effect.gen(function* () {
|
|
45
|
-
const w = weight ?? 1.0;
|
|
46
|
-
if (!Number.isFinite(w) || w < 0 || w > 1) {
|
|
47
|
-
return yield* Effect.fail(new ValidationError({
|
|
48
|
-
reason: `Weight must be a finite number between 0 and 1, got: ${w}`
|
|
49
|
-
}));
|
|
50
|
-
}
|
|
51
|
-
return w;
|
|
52
|
-
});
|
|
53
|
-
/**
|
|
54
|
-
* Validate node ID is non-empty.
|
|
55
|
-
*/
|
|
56
|
-
const validateNodeId = (nodeId, field) => Effect.gen(function* () {
|
|
57
|
-
if (!nodeId || nodeId.trim().length === 0) {
|
|
58
|
-
return yield* Effect.fail(new ValidationError({
|
|
59
|
-
reason: `${field} is required and cannot be empty`
|
|
60
|
-
}));
|
|
61
|
-
}
|
|
62
|
-
return nodeId;
|
|
63
|
-
});
|
|
64
|
-
export const EdgeServiceLive = Layer.effect(EdgeService, Effect.gen(function* () {
|
|
65
|
-
const edgeRepo = yield* EdgeRepository;
|
|
66
|
-
return {
|
|
67
|
-
createEdge: (input) => Effect.gen(function* () {
|
|
68
|
-
// Validate all inputs
|
|
69
|
-
yield* validateEdgeType(input.edgeType);
|
|
70
|
-
yield* validateNodeType(input.sourceType, "sourceType");
|
|
71
|
-
yield* validateNodeType(input.targetType, "targetType");
|
|
72
|
-
yield* validateNodeId(input.sourceId, "sourceId");
|
|
73
|
-
yield* validateNodeId(input.targetId, "targetId");
|
|
74
|
-
yield* validateWeight(input.weight);
|
|
75
|
-
// Create the edge
|
|
76
|
-
return yield* edgeRepo.create(input);
|
|
77
|
-
}),
|
|
78
|
-
findNeighbors: (nodeType, nodeId, options = {}) => Effect.gen(function* () {
|
|
79
|
-
const depth = options.depth ?? 1;
|
|
80
|
-
const direction = options.direction ?? "both";
|
|
81
|
-
const edgeTypes = options.edgeTypes;
|
|
82
|
-
// For depth 1, use the repository directly
|
|
83
|
-
if (depth === 1) {
|
|
84
|
-
const neighbors = yield* edgeRepo.findNeighbors(nodeType, nodeId, { direction, edgeTypes });
|
|
85
|
-
return neighbors.map(n => ({ ...n, depth: 1 }));
|
|
86
|
-
}
|
|
87
|
-
// Multi-hop BFS traversal
|
|
88
|
-
const visited = new Set([`${nodeType}:${nodeId}`]);
|
|
89
|
-
const result = [];
|
|
90
|
-
let frontier = [{ nodeType, nodeId }];
|
|
91
|
-
for (let currentDepth = 1; currentDepth <= depth; currentDepth++) {
|
|
92
|
-
const nextFrontier = [];
|
|
93
|
-
for (const node of frontier) {
|
|
94
|
-
const neighbors = yield* edgeRepo.findNeighbors(node.nodeType, node.nodeId, { direction, edgeTypes });
|
|
95
|
-
for (const neighbor of neighbors) {
|
|
96
|
-
const key = `${neighbor.nodeType}:${neighbor.nodeId}`;
|
|
97
|
-
if (!visited.has(key)) {
|
|
98
|
-
visited.add(key);
|
|
99
|
-
result.push({ ...neighbor, depth: currentDepth });
|
|
100
|
-
nextFrontier.push({ nodeType: neighbor.nodeType, nodeId: neighbor.nodeId });
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
frontier = nextFrontier;
|
|
105
|
-
if (frontier.length === 0)
|
|
106
|
-
break;
|
|
107
|
-
}
|
|
108
|
-
return result;
|
|
109
|
-
}),
|
|
110
|
-
findPath: (fromType, fromId, toType, toId, maxDepth = 5) => edgeRepo.findPath(fromType, fromId, toType, toId, maxDepth),
|
|
111
|
-
invalidateEdge: (id) => edgeRepo.invalidate(id),
|
|
112
|
-
get: (id) => Effect.gen(function* () {
|
|
113
|
-
const edge = yield* edgeRepo.findById(id);
|
|
114
|
-
if (!edge) {
|
|
115
|
-
return yield* Effect.fail(new EdgeNotFoundError({ id }));
|
|
116
|
-
}
|
|
117
|
-
return edge;
|
|
118
|
-
}),
|
|
119
|
-
update: (id, input) => Effect.gen(function* () {
|
|
120
|
-
// Validate weight if provided
|
|
121
|
-
if (input.weight !== undefined) {
|
|
122
|
-
yield* validateWeight(input.weight);
|
|
123
|
-
}
|
|
124
|
-
// Get existing edge to verify it exists
|
|
125
|
-
const existing = yield* edgeRepo.findById(id);
|
|
126
|
-
if (!existing) {
|
|
127
|
-
return yield* Effect.fail(new EdgeNotFoundError({ id }));
|
|
128
|
-
}
|
|
129
|
-
// Update the edge
|
|
130
|
-
const updated = yield* edgeRepo.update(id, input);
|
|
131
|
-
if (!updated) {
|
|
132
|
-
return yield* Effect.fail(new EdgeNotFoundError({ id }));
|
|
133
|
-
}
|
|
134
|
-
return updated;
|
|
135
|
-
}),
|
|
136
|
-
findByType: (edgeType) => Effect.gen(function* () {
|
|
137
|
-
yield* validateEdgeType(edgeType);
|
|
138
|
-
return yield* edgeRepo.findByEdgeType(edgeType);
|
|
139
|
-
}),
|
|
140
|
-
findFromSource: (sourceType, sourceId) => edgeRepo.findBySource(sourceType, sourceId),
|
|
141
|
-
findFromMultipleSources: (sourceType, sourceIds) => edgeRepo.findByMultipleSources(sourceType, sourceIds),
|
|
142
|
-
findToTarget: (targetType, targetId) => edgeRepo.findByTarget(targetType, targetId),
|
|
143
|
-
countByType: () => Effect.gen(function* () {
|
|
144
|
-
const dbCounts = yield* edgeRepo.countByType();
|
|
145
|
-
const counts = new Map();
|
|
146
|
-
// Initialize all types with 0
|
|
147
|
-
for (const type of VALID_EDGE_TYPES) {
|
|
148
|
-
counts.set(type, 0);
|
|
149
|
-
}
|
|
150
|
-
// Merge in the actual counts from database
|
|
151
|
-
for (const [edgeType, count] of dbCounts) {
|
|
152
|
-
counts.set(edgeType, count);
|
|
153
|
-
}
|
|
154
|
-
return counts;
|
|
155
|
-
})
|
|
156
|
-
};
|
|
157
|
-
}));
|
|
158
|
-
//# sourceMappingURL=edge-service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"edge-service.js","sourceRoot":"","sources":["../../src/services/edge-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAiB,iBAAiB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAUhF,4DAA4D;AAC5D,MAAM,gBAAgB,GAAwB;IAC5C,aAAa;IACb,cAAc;IACd,SAAS;IACT,iBAAiB;IACjB,YAAY;IACZ,UAAU;IACV,aAAa;IACb,gBAAgB;CACjB,CAAA;AAED,4DAA4D;AAC5D,MAAM,gBAAgB,GAAwB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAA;AAwBjF,MAAM,OAAO,WAAY,SAAQ,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC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