@cdot65/prisma-airs-cli 1.4.2 → 2.3.0
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/README.md +8 -6
- package/dist/airs/management.d.ts +2 -0
- package/dist/airs/management.d.ts.map +1 -1
- package/dist/airs/management.js +14 -0
- package/dist/airs/management.js.map +1 -1
- package/dist/airs/redteam.d.ts +15 -1
- package/dist/airs/redteam.d.ts.map +1 -1
- package/dist/airs/redteam.js +105 -0
- package/dist/airs/redteam.js.map +1 -1
- package/dist/airs/runtime.js +3 -3
- package/dist/airs/runtime.js.map +1 -1
- package/dist/airs/types.d.ts +80 -0
- package/dist/airs/types.d.ts.map +1 -1
- package/dist/audit/runner.d.ts +1 -1
- package/dist/audit/runner.d.ts.map +1 -1
- package/dist/cli/commands/redteam.d.ts +4 -0
- package/dist/cli/commands/redteam.d.ts.map +1 -1
- package/dist/cli/commands/redteam.js +323 -1
- package/dist/cli/commands/redteam.js.map +1 -1
- package/dist/cli/commands/runtime.d.ts.map +1 -1
- package/dist/cli/commands/runtime.js +83 -50
- package/dist/cli/commands/runtime.js.map +1 -1
- package/dist/cli/commands/topics-apply.d.ts +16 -0
- package/dist/cli/commands/topics-apply.d.ts.map +1 -0
- package/dist/cli/commands/topics-apply.js +69 -0
- package/dist/cli/commands/topics-apply.js.map +1 -0
- package/dist/cli/commands/topics-create.d.ts +16 -0
- package/dist/cli/commands/topics-create.d.ts.map +1 -0
- package/dist/cli/commands/topics-create.js +71 -0
- package/dist/cli/commands/topics-create.js.map +1 -0
- package/dist/cli/commands/topics-eval.d.ts +7 -0
- package/dist/cli/commands/topics-eval.d.ts.map +1 -0
- package/dist/cli/commands/topics-eval.js +65 -0
- package/dist/cli/commands/topics-eval.js.map +1 -0
- package/dist/cli/commands/topics-revert.d.ts +9 -0
- package/dist/cli/commands/topics-revert.d.ts.map +1 -0
- package/dist/cli/commands/topics-revert.js +52 -0
- package/dist/cli/commands/topics-revert.js.map +1 -0
- package/dist/cli/commands/topics-sample.d.ts +4 -0
- package/dist/cli/commands/topics-sample.d.ts.map +1 -0
- package/dist/cli/commands/topics-sample.js +27 -0
- package/dist/cli/commands/topics-sample.js.map +1 -0
- package/dist/cli/renderer/audit.d.ts +3 -0
- package/dist/cli/renderer/audit.d.ts.map +1 -1
- package/dist/cli/renderer/audit.js +14 -0
- package/dist/cli/renderer/audit.js.map +1 -1
- package/dist/cli/renderer/eval.d.ts +30 -0
- package/dist/cli/renderer/eval.d.ts.map +1 -0
- package/dist/cli/renderer/eval.js +61 -0
- package/dist/cli/renderer/eval.js.map +1 -0
- package/dist/cli/renderer/index.d.ts +1 -1
- package/dist/cli/renderer/index.d.ts.map +1 -1
- package/dist/cli/renderer/index.js +1 -1
- package/dist/cli/renderer/index.js.map +1 -1
- package/dist/cli/renderer/redteam.d.ts +37 -0
- package/dist/cli/renderer/redteam.d.ts.map +1 -1
- package/dist/cli/renderer/redteam.js +64 -0
- package/dist/cli/renderer/redteam.js.map +1 -1
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +0 -6
- package/dist/config/loader.js.map +1 -1
- package/dist/config/schema.d.ts +0 -15
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +0 -6
- package/dist/config/schema.js.map +1 -1
- package/dist/core/constraints.d.ts +1 -0
- package/dist/core/constraints.d.ts.map +1 -1
- package/dist/core/constraints.js +7 -0
- package/dist/core/constraints.js.map +1 -1
- package/dist/core/prompt-loader.d.ts +14 -0
- package/dist/core/prompt-loader.d.ts.map +1 -0
- package/dist/core/prompt-loader.js +122 -0
- package/dist/core/prompt-loader.js.map +1 -0
- package/dist/core/types.d.ts +0 -74
- package/dist/core/types.d.ts.map +1 -1
- package/dist/index.d.ts +1 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -16
- package/dist/index.js.map +1 -1
- package/dist/llm/service.d.ts +6 -2
- package/dist/llm/service.d.ts.map +1 -1
- package/dist/llm/service.js +0 -5
- package/dist/llm/service.js.map +1 -1
- package/dist/llm/types.d.ts +18 -0
- package/dist/llm/types.d.ts.map +1 -0
- package/dist/{persistence → llm}/types.js.map +1 -1
- package/package.json +2 -2
- package/dist/cli/commands/generate.d.ts +0 -4
- package/dist/cli/commands/generate.d.ts.map +0 -1
- package/dist/cli/commands/generate.js +0 -228
- package/dist/cli/commands/generate.js.map +0 -1
- package/dist/cli/commands/list.d.ts +0 -4
- package/dist/cli/commands/list.d.ts.map +0 -1
- package/dist/cli/commands/list.js +0 -23
- package/dist/cli/commands/list.js.map +0 -1
- package/dist/cli/commands/report.d.ts +0 -4
- package/dist/cli/commands/report.d.ts.map +0 -1
- package/dist/cli/commands/report.js +0 -116
- package/dist/cli/commands/report.js.map +0 -1
- package/dist/cli/commands/resume.d.ts +0 -4
- package/dist/cli/commands/resume.d.ts.map +0 -1
- package/dist/cli/commands/resume.js +0 -135
- package/dist/cli/commands/resume.js.map +0 -1
- package/dist/cli/prompts.d.ts +0 -9
- package/dist/cli/prompts.d.ts.map +0 -1
- package/dist/cli/prompts.js +0 -90
- package/dist/cli/prompts.js.map +0 -1
- package/dist/cli/renderer/generate.d.ts +0 -29
- package/dist/cli/renderer/generate.d.ts.map +0 -1
- package/dist/cli/renderer/generate.js +0 -132
- package/dist/cli/renderer/generate.js.map +0 -1
- package/dist/core/loop.d.ts +0 -48
- package/dist/core/loop.d.ts.map +0 -1
- package/dist/core/loop.js +0 -430
- package/dist/core/loop.js.map +0 -1
- package/dist/memory/diff.d.ts +0 -4
- package/dist/memory/diff.d.ts.map +0 -1
- package/dist/memory/diff.js +0 -24
- package/dist/memory/diff.js.map +0 -1
- package/dist/memory/extractor.d.ts +0 -15
- package/dist/memory/extractor.d.ts.map +0 -1
- package/dist/memory/extractor.js +0 -133
- package/dist/memory/extractor.js.map +0 -1
- package/dist/memory/injector.d.ts +0 -22
- package/dist/memory/injector.d.ts.map +0 -1
- package/dist/memory/injector.js +0 -90
- package/dist/memory/injector.js.map +0 -1
- package/dist/memory/prompts/extract-learnings.d.ts +0 -3
- package/dist/memory/prompts/extract-learnings.d.ts.map +0 -1
- package/dist/memory/prompts/extract-learnings.js +0 -40
- package/dist/memory/prompts/extract-learnings.js.map +0 -1
- package/dist/memory/schemas.d.ts +0 -63
- package/dist/memory/schemas.d.ts.map +0 -1
- package/dist/memory/schemas.js +0 -13
- package/dist/memory/schemas.js.map +0 -1
- package/dist/memory/store.d.ts +0 -28
- package/dist/memory/store.d.ts.map +0 -1
- package/dist/memory/store.js +0 -103
- package/dist/memory/store.js.map +0 -1
- package/dist/memory/types.d.ts +0 -55
- package/dist/memory/types.d.ts.map +0 -1
- package/dist/memory/types.js +0 -6
- package/dist/memory/types.js.map +0 -1
- package/dist/persistence/store.d.ts +0 -21
- package/dist/persistence/store.d.ts.map +0 -1
- package/dist/persistence/store.js +0 -77
- package/dist/persistence/store.js.map +0 -1
- package/dist/persistence/types.d.ts +0 -23
- package/dist/persistence/types.d.ts.map +0 -1
- /package/dist/{persistence → llm}/types.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extractor.js","sourceRoot":"","sources":["../../src/memory/extractor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAiC,8BAA8B,EAAE,MAAM,cAAc,CAAC;AAC7F,OAAO,EAAoB,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAGjE,MAAM,OAAO,iBAAiB;IAElB;IACA;IAFV,YACU,KAAoB,EACpB,KAAkB;QADlB,UAAK,GAAL,KAAK,CAAe;QACpB,UAAK,GAAL,KAAK,CAAa;IACzB,CAAC;IAEJ,KAAK,CAAC,cAAc,CAAC,QAAkB;QACrC,IAAI,QAAQ,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE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IAC1B,CAAC;CACF"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { MemoryStore } from './store.js';
|
|
2
|
-
/**
|
|
3
|
-
* Builds a budget-aware memory section for LLM prompt injection.
|
|
4
|
-
* Retrieves relevant learnings from the store, sorts by corroboration count,
|
|
5
|
-
* and formats them within a character budget (verbose -> compact -> omit).
|
|
6
|
-
*/
|
|
7
|
-
export declare class MemoryInjector {
|
|
8
|
-
private store;
|
|
9
|
-
private maxChars;
|
|
10
|
-
/**
|
|
11
|
-
* @param store - Memory store for retrieving learnings.
|
|
12
|
-
* @param maxChars - Character budget for the memory section. Default 3000.
|
|
13
|
-
*/
|
|
14
|
-
constructor(store: MemoryStore, maxChars?: number);
|
|
15
|
-
/**
|
|
16
|
-
* Build a formatted memory section string for prompt injection.
|
|
17
|
-
* @param topicDescription - Topic to find relevant learnings for.
|
|
18
|
-
* @returns Formatted learnings string, or empty string if none found.
|
|
19
|
-
*/
|
|
20
|
-
buildMemorySection(topicDescription: string): Promise<string>;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=injector.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"injector.d.ts","sourceRoot":"","sources":["../../src/memory/injector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAG9C;;;;GAIG;AACH,qBAAa,cAAc;IAMvB,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,QAAQ;IANlB;;;OAGG;gBAEO,KAAK,EAAE,WAAW,EAClB,QAAQ,GAAE,MAAa;IAGjC;;;;OAIG;IACG,kBAAkB,CAAC,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CA6EpE"}
|
package/dist/memory/injector.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Builds a budget-aware memory section for LLM prompt injection.
|
|
3
|
-
* Retrieves relevant learnings from the store, sorts by corroboration count,
|
|
4
|
-
* and formats them within a character budget (verbose -> compact -> omit).
|
|
5
|
-
*/
|
|
6
|
-
export class MemoryInjector {
|
|
7
|
-
store;
|
|
8
|
-
maxChars;
|
|
9
|
-
/**
|
|
10
|
-
* @param store - Memory store for retrieving learnings.
|
|
11
|
-
* @param maxChars - Character budget for the memory section. Default 3000.
|
|
12
|
-
*/
|
|
13
|
-
constructor(store, maxChars = 3000) {
|
|
14
|
-
this.store = store;
|
|
15
|
-
this.maxChars = maxChars;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Build a formatted memory section string for prompt injection.
|
|
19
|
-
* @param topicDescription - Topic to find relevant learnings for.
|
|
20
|
-
* @returns Formatted learnings string, or empty string if none found.
|
|
21
|
-
*/
|
|
22
|
-
async buildMemorySection(topicDescription) {
|
|
23
|
-
const memories = await this.store.findRelevant(topicDescription);
|
|
24
|
-
if (memories.length === 0)
|
|
25
|
-
return '';
|
|
26
|
-
const allLearnings = [];
|
|
27
|
-
const allAntiPatterns = [];
|
|
28
|
-
for (const mem of memories) {
|
|
29
|
-
allLearnings.push(...mem.learnings);
|
|
30
|
-
allAntiPatterns.push(...mem.antiPatterns);
|
|
31
|
-
}
|
|
32
|
-
if (allLearnings.length === 0 && allAntiPatterns.length === 0)
|
|
33
|
-
return '';
|
|
34
|
-
// Sort by corroborations descending
|
|
35
|
-
allLearnings.sort((a, b) => b.corroborations - a.corroborations);
|
|
36
|
-
const header = [
|
|
37
|
-
'\n## Learnings from Previous Runs',
|
|
38
|
-
'These are empirically validated observations from prior guardrail generation runs:',
|
|
39
|
-
];
|
|
40
|
-
// Budget for content after header; each added line costs lineLen + 1 (newline separator)
|
|
41
|
-
let budget = this.maxChars - header.join('\n').length;
|
|
42
|
-
const lines = [...header];
|
|
43
|
-
let compactMode = false;
|
|
44
|
-
let omitted = 0;
|
|
45
|
-
for (const l of allLearnings) {
|
|
46
|
-
const tag = l.outcome === 'degraded' ? 'AVOID' : 'DO';
|
|
47
|
-
const seenCount = l.corroborations + 1;
|
|
48
|
-
if (!compactMode) {
|
|
49
|
-
const verbose = `- [${tag}] ${l.insight} (${l.changeType}, seen ${seenCount}x)`;
|
|
50
|
-
if (verbose.length + 1 <= budget) {
|
|
51
|
-
lines.push(verbose);
|
|
52
|
-
budget -= verbose.length + 1; // +1 for newline
|
|
53
|
-
continue;
|
|
54
|
-
}
|
|
55
|
-
// Switch to compact mode
|
|
56
|
-
compactMode = true;
|
|
57
|
-
}
|
|
58
|
-
const compact = `- [${tag}] ${l.insight}`;
|
|
59
|
-
if (compact.length + 1 <= budget) {
|
|
60
|
-
lines.push(compact);
|
|
61
|
-
budget -= compact.length + 1;
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
omitted++;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
if (omitted > 0) {
|
|
68
|
-
const notice = `(+${omitted} more learnings omitted)`;
|
|
69
|
-
if (notice.length + 1 <= budget) {
|
|
70
|
-
lines.push(notice);
|
|
71
|
-
budget -= notice.length + 1;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
const uniqueAntiPatterns = [...new Set(allAntiPatterns)];
|
|
75
|
-
if (uniqueAntiPatterns.length > 0) {
|
|
76
|
-
lines.push('');
|
|
77
|
-
lines.push('Known anti-patterns:');
|
|
78
|
-
budget -= 1 + 'Known anti-patterns:'.length + 1; // blank line + header
|
|
79
|
-
for (const ap of uniqueAntiPatterns) {
|
|
80
|
-
const line = `- ${ap}`;
|
|
81
|
-
if (line.length + 1 <= budget) {
|
|
82
|
-
lines.push(line);
|
|
83
|
-
budget -= line.length + 1;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return lines.join('\n');
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
//# sourceMappingURL=injector.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"injector.js","sourceRoot":"","sources":["../../src/memory/injector.ts"],"names":[],"mapp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AAkB,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC;QACzD,IAAI,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAClC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACf,KAAK,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;YACnC,MAAM,IAAI,CAAC,GAAG,sBAAsB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,sBAAsB;YAEvE,KAAK,MAAM,EAAE,IAAI,kBAAkB,EAAE,CAAC;gBACpC,MAAM,IAAI,GAAG,KAAK,EAAE,EAAE,CAAC;gBACvB,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,MAAM,EAAE,CAAC;oBAC9B,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;oBACjB,MAAM,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;gBAC5B,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extract-learnings.d.ts","sourceRoot":"","sources":["../../../src/memory/prompts/extract-learnings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,eAAO,MAAM,sBAAsB,8BAqCjC,CAAC"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { ChatPromptTemplate } from '@langchain/core/prompts';
|
|
2
|
-
export const extractLearningsPrompt = ChatPromptTemplate.fromMessages([
|
|
3
|
-
[
|
|
4
|
-
'system',
|
|
5
|
-
`You are analyzing the results of a Prisma AIRS custom topic guardrail generation run to extract reusable learnings.
|
|
6
|
-
|
|
7
|
-
Given the iteration history, identify:
|
|
8
|
-
1. **Learnings**: What worked, what didn't, and why. Each learning should have:
|
|
9
|
-
- insight: A concise observation (e.g., "Short direct descriptions outperform nuanced ones on AIRS")
|
|
10
|
-
- strategy: What was actually done (e.g., "Used a short description without exclusion clauses")
|
|
11
|
-
- outcome: "improved", "degraded", or "neutral"
|
|
12
|
-
- changeType: "description-only", "examples-only", "both", or "initial"
|
|
13
|
-
- tags: keywords like "brevity", "coded-language", "fp-reduction", "fn-reduction", "exclusion-clauses", "example-count", "zero-examples", "description-weight"
|
|
14
|
-
|
|
15
|
-
2. **Anti-patterns**: Strategies that consistently degraded performance (e.g., "Adding coded language patterns broadens AIRS matching unpredictably")
|
|
16
|
-
|
|
17
|
-
Pay special attention to the RELATIONSHIP BETWEEN EXAMPLE COUNT AND EFFICACY:
|
|
18
|
-
- Track whether reducing examples improved or degraded metrics
|
|
19
|
-
- Note when fewer examples (2) outperformed configurations with more examples (3-5)
|
|
20
|
-
- Identify if specific example counts (2, 3, 4, 5) correlate with better coverage for this topic type
|
|
21
|
-
- Tag learnings about example count with "example-count" and the relevant count (e.g., "few-examples", "many-examples")
|
|
22
|
-
|
|
23
|
-
Focus on actionable, generalizable insights. Avoid restating metrics — explain the *why* behind changes.`,
|
|
24
|
-
],
|
|
25
|
-
[
|
|
26
|
-
'human',
|
|
27
|
-
`Analyze this guardrail generation run:
|
|
28
|
-
|
|
29
|
-
Topic Description: {topicDescription}
|
|
30
|
-
Intent: {intent}
|
|
31
|
-
Total Iterations: {totalIterations}
|
|
32
|
-
Best Iteration: {bestIteration} (coverage: {bestCoverage})
|
|
33
|
-
|
|
34
|
-
Iteration History:
|
|
35
|
-
{iterationHistory}
|
|
36
|
-
|
|
37
|
-
Extract structured learnings from this run.`,
|
|
38
|
-
],
|
|
39
|
-
]);
|
|
40
|
-
//# sourceMappingURL=extract-learnings.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extract-learnings.js","sourceRoot":"","sources":["../../../src/memory/prompts/extract-learnings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,MAAM,CAAC,MAAM,sBAAsB,GAAG,kBAAkB,CAAC,YAAY,CAAC;IACpE;QACE,QAAQ;QACR;;;;;;;;;;;;;;;;;;yGAkBqG;KACtG;IACD;QACE,OAAO;QACP;;;;;;;;;;4CAUwC;KACzC;CACF,CAAC,CAAC"}
|
package/dist/memory/schemas.d.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare const ExtractedLearningSchema: z.ZodObject<{
|
|
3
|
-
insight: z.ZodString;
|
|
4
|
-
strategy: z.ZodString;
|
|
5
|
-
outcome: z.ZodEnum<["improved", "degraded", "neutral"]>;
|
|
6
|
-
changeType: z.ZodOptional<z.ZodEnum<["description-only", "examples-only", "both", "initial"]>>;
|
|
7
|
-
tags: z.ZodArray<z.ZodString, "many">;
|
|
8
|
-
}, "strip", z.ZodTypeAny, {
|
|
9
|
-
insight: string;
|
|
10
|
-
strategy: string;
|
|
11
|
-
outcome: "improved" | "degraded" | "neutral";
|
|
12
|
-
tags: string[];
|
|
13
|
-
changeType?: "description-only" | "examples-only" | "both" | "initial" | undefined;
|
|
14
|
-
}, {
|
|
15
|
-
insight: string;
|
|
16
|
-
strategy: string;
|
|
17
|
-
outcome: "improved" | "degraded" | "neutral";
|
|
18
|
-
tags: string[];
|
|
19
|
-
changeType?: "description-only" | "examples-only" | "both" | "initial" | undefined;
|
|
20
|
-
}>;
|
|
21
|
-
export declare const LearningExtractionOutputSchema: z.ZodObject<{
|
|
22
|
-
learnings: z.ZodArray<z.ZodObject<{
|
|
23
|
-
insight: z.ZodString;
|
|
24
|
-
strategy: z.ZodString;
|
|
25
|
-
outcome: z.ZodEnum<["improved", "degraded", "neutral"]>;
|
|
26
|
-
changeType: z.ZodOptional<z.ZodEnum<["description-only", "examples-only", "both", "initial"]>>;
|
|
27
|
-
tags: z.ZodArray<z.ZodString, "many">;
|
|
28
|
-
}, "strip", z.ZodTypeAny, {
|
|
29
|
-
insight: string;
|
|
30
|
-
strategy: string;
|
|
31
|
-
outcome: "improved" | "degraded" | "neutral";
|
|
32
|
-
tags: string[];
|
|
33
|
-
changeType?: "description-only" | "examples-only" | "both" | "initial" | undefined;
|
|
34
|
-
}, {
|
|
35
|
-
insight: string;
|
|
36
|
-
strategy: string;
|
|
37
|
-
outcome: "improved" | "degraded" | "neutral";
|
|
38
|
-
tags: string[];
|
|
39
|
-
changeType?: "description-only" | "examples-only" | "both" | "initial" | undefined;
|
|
40
|
-
}>, "many">;
|
|
41
|
-
antiPatterns: z.ZodArray<z.ZodString, "many">;
|
|
42
|
-
}, "strip", z.ZodTypeAny, {
|
|
43
|
-
learnings: {
|
|
44
|
-
insight: string;
|
|
45
|
-
strategy: string;
|
|
46
|
-
outcome: "improved" | "degraded" | "neutral";
|
|
47
|
-
tags: string[];
|
|
48
|
-
changeType?: "description-only" | "examples-only" | "both" | "initial" | undefined;
|
|
49
|
-
}[];
|
|
50
|
-
antiPatterns: string[];
|
|
51
|
-
}, {
|
|
52
|
-
learnings: {
|
|
53
|
-
insight: string;
|
|
54
|
-
strategy: string;
|
|
55
|
-
outcome: "improved" | "degraded" | "neutral";
|
|
56
|
-
tags: string[];
|
|
57
|
-
changeType?: "description-only" | "examples-only" | "both" | "initial" | undefined;
|
|
58
|
-
}[];
|
|
59
|
-
antiPatterns: string[];
|
|
60
|
-
}>;
|
|
61
|
-
export type ExtractedLearning = z.infer<typeof ExtractedLearningSchema>;
|
|
62
|
-
export type LearningExtractionOutput = z.infer<typeof LearningExtractionOutputSchema>;
|
|
63
|
-
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/memory/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;EAMlC,CAAC;AAEH,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGzC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC"}
|
package/dist/memory/schemas.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export const ExtractedLearningSchema = z.object({
|
|
3
|
-
insight: z.string().min(1),
|
|
4
|
-
strategy: z.string().min(1),
|
|
5
|
-
outcome: z.enum(['improved', 'degraded', 'neutral']),
|
|
6
|
-
changeType: z.enum(['description-only', 'examples-only', 'both', 'initial']).optional(),
|
|
7
|
-
tags: z.array(z.string()),
|
|
8
|
-
});
|
|
9
|
-
export const LearningExtractionOutputSchema = z.object({
|
|
10
|
-
learnings: z.array(ExtractedLearningSchema),
|
|
11
|
-
antiPatterns: z.array(z.string()),
|
|
12
|
-
});
|
|
13
|
-
//# sourceMappingURL=schemas.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../src/memory/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3B,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;IACpD,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,kBAAkB,EAAE,eAAe,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,QAAQ,EAAE;IACvF,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CAC1B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC,MAAM,CAAC;IACrD,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,uBAAuB,CAAC;IAC3C,YAAY,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CAClC,CAAC,CAAC"}
|
package/dist/memory/store.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { TopicMemory } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Normalize a topic description into a stable category key.
|
|
4
|
-
* Removes stop words, lowercases, deduplicates, and sorts alphabetically.
|
|
5
|
-
* @param description - Free-text topic description.
|
|
6
|
-
* @returns Hyphen-joined keyword string used as the memory file name.
|
|
7
|
-
*/
|
|
8
|
-
export declare function normalizeCategory(description: string): string;
|
|
9
|
-
/**
|
|
10
|
-
* File-based persistence for cross-run learnings.
|
|
11
|
-
* Stores one JSON file per category at `{dir}/{category}.json`.
|
|
12
|
-
* Supports keyword-overlap-based retrieval for cross-topic transfer.
|
|
13
|
-
*/
|
|
14
|
-
export declare class MemoryStore {
|
|
15
|
-
private dir;
|
|
16
|
-
constructor(dir: string);
|
|
17
|
-
private filePath;
|
|
18
|
-
/** Persist a topic memory to disk, creating the directory if needed. */
|
|
19
|
-
save(memory: TopicMemory): Promise<void>;
|
|
20
|
-
/** Load a topic memory by category, or null if not found. */
|
|
21
|
-
load(category: string): Promise<TopicMemory | null>;
|
|
22
|
-
/** Find all topic memories with >= 50% keyword overlap to the given description. */
|
|
23
|
-
findRelevant(topicDescription: string): Promise<TopicMemory[]>;
|
|
24
|
-
/** List all stored category names. */
|
|
25
|
-
listCategories(): Promise<string[]>;
|
|
26
|
-
private categoriesOverlap;
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=store.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/memory/store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAuB9C;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAS7D;AAED;;;;GAIG;AACH,qBAAa,WAAW;IACV,OAAO,CAAC,GAAG;gBAAH,GAAG,EAAE,MAAM;IAE/B,OAAO,CAAC,QAAQ;IAIhB,wEAAwE;IAClE,IAAI,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAK9C,6DAA6D;IACvD,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IASzD,oFAAoF;IAC9E,YAAY,CAAC,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAepE,sCAAsC;IAChC,cAAc,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IASzC,OAAO,CAAC,iBAAiB;CAW1B"}
|
package/dist/memory/store.js
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { mkdir, readdir, readFile, writeFile } from 'node:fs/promises';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
const STOP_WORDS = new Set([
|
|
4
|
-
'a',
|
|
5
|
-
'an',
|
|
6
|
-
'the',
|
|
7
|
-
'and',
|
|
8
|
-
'or',
|
|
9
|
-
'of',
|
|
10
|
-
'about',
|
|
11
|
-
'for',
|
|
12
|
-
'in',
|
|
13
|
-
'on',
|
|
14
|
-
'to',
|
|
15
|
-
'with',
|
|
16
|
-
'that',
|
|
17
|
-
'this',
|
|
18
|
-
'is',
|
|
19
|
-
'are',
|
|
20
|
-
'was',
|
|
21
|
-
'were',
|
|
22
|
-
]);
|
|
23
|
-
/**
|
|
24
|
-
* Normalize a topic description into a stable category key.
|
|
25
|
-
* Removes stop words, lowercases, deduplicates, and sorts alphabetically.
|
|
26
|
-
* @param description - Free-text topic description.
|
|
27
|
-
* @returns Hyphen-joined keyword string used as the memory file name.
|
|
28
|
-
*/
|
|
29
|
-
export function normalizeCategory(description) {
|
|
30
|
-
const words = description
|
|
31
|
-
.toLowerCase()
|
|
32
|
-
.replace(/[^a-z0-9\s]/g, '')
|
|
33
|
-
.split(/\s+/)
|
|
34
|
-
.filter((w) => w.length > 0 && !STOP_WORDS.has(w));
|
|
35
|
-
const unique = [...new Set(words)].sort();
|
|
36
|
-
return unique.length > 0 ? unique.join('-') : 'uncategorized';
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* File-based persistence for cross-run learnings.
|
|
40
|
-
* Stores one JSON file per category at `{dir}/{category}.json`.
|
|
41
|
-
* Supports keyword-overlap-based retrieval for cross-topic transfer.
|
|
42
|
-
*/
|
|
43
|
-
export class MemoryStore {
|
|
44
|
-
dir;
|
|
45
|
-
constructor(dir) {
|
|
46
|
-
this.dir = dir;
|
|
47
|
-
}
|
|
48
|
-
filePath(category) {
|
|
49
|
-
return join(this.dir, `${category}.json`);
|
|
50
|
-
}
|
|
51
|
-
/** Persist a topic memory to disk, creating the directory if needed. */
|
|
52
|
-
async save(memory) {
|
|
53
|
-
await mkdir(this.dir, { recursive: true });
|
|
54
|
-
await writeFile(this.filePath(memory.category), JSON.stringify(memory, null, 2), 'utf-8');
|
|
55
|
-
}
|
|
56
|
-
/** Load a topic memory by category, or null if not found. */
|
|
57
|
-
async load(category) {
|
|
58
|
-
try {
|
|
59
|
-
const data = await readFile(this.filePath(category), 'utf-8');
|
|
60
|
-
return JSON.parse(data);
|
|
61
|
-
}
|
|
62
|
-
catch {
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
/** Find all topic memories with >= 50% keyword overlap to the given description. */
|
|
67
|
-
async findRelevant(topicDescription) {
|
|
68
|
-
const targetCategory = normalizeCategory(topicDescription);
|
|
69
|
-
const categories = await this.listCategories();
|
|
70
|
-
const results = [];
|
|
71
|
-
for (const cat of categories) {
|
|
72
|
-
if (this.categoriesOverlap(targetCategory, cat)) {
|
|
73
|
-
const memory = await this.load(cat);
|
|
74
|
-
if (memory)
|
|
75
|
-
results.push(memory);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return results;
|
|
79
|
-
}
|
|
80
|
-
/** List all stored category names. */
|
|
81
|
-
async listCategories() {
|
|
82
|
-
try {
|
|
83
|
-
const files = await readdir(this.dir);
|
|
84
|
-
return files.filter((f) => f.endsWith('.json')).map((f) => f.replace(/\.json$/, ''));
|
|
85
|
-
}
|
|
86
|
-
catch {
|
|
87
|
-
return [];
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
categoriesOverlap(a, b) {
|
|
91
|
-
const wordsA = new Set(a.split('-'));
|
|
92
|
-
const wordsB = new Set(b.split('-'));
|
|
93
|
-
let overlap = 0;
|
|
94
|
-
for (const w of wordsA) {
|
|
95
|
-
if (wordsB.has(w))
|
|
96
|
-
overlap++;
|
|
97
|
-
}
|
|
98
|
-
// Require at least 50% keyword overlap relative to smaller set
|
|
99
|
-
const minSize = Math.min(wordsA.size, wordsB.size);
|
|
100
|
-
return minSize > 0 && overlap / minSize >= 0.5;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
//# sourceMappingURL=store.js.map
|
package/dist/memory/store.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/memory/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC;IACzB,GAAG;IACH,IAAI;IACJ,KAAK;IACL,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ACvF,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;IAEO,iBAAiB,CAAC,CAAS,EAAE,CAAS;QAC5C,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;QACrC,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;QACrC,IAAI,OAAO,GAAG,CAAC,CAAC;QAChB,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;YACvB,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;gBAAE,OAAO,EAAE,CAAC;QAC/B,CAAC;QACD,+DAA+D;QAC/D,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;QACnD,OAAO,OAAO,GAAG,CAAC,IAAI,OAAO,GAAG,OAAO,IAAI,GAAG,CAAC;IACjD,CAAC;CACF"}
|
package/dist/memory/types.d.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Memory system types — cross-run learning persistence that lets
|
|
3
|
-
* future runs benefit from past refinement insights.
|
|
4
|
-
*/
|
|
5
|
-
import type { CustomTopic, EfficacyMetrics } from '../core/types.js';
|
|
6
|
-
export interface IterationDiff {
|
|
7
|
-
fromIteration: number;
|
|
8
|
-
toIteration: number;
|
|
9
|
-
descriptionChanged: boolean;
|
|
10
|
-
examplesChanged: boolean;
|
|
11
|
-
examplesAdded: string[];
|
|
12
|
-
examplesRemoved: string[];
|
|
13
|
-
descriptionBefore: string;
|
|
14
|
-
descriptionAfter: string;
|
|
15
|
-
metricDelta: {
|
|
16
|
-
coverage: number;
|
|
17
|
-
tpr: number;
|
|
18
|
-
tnr: number;
|
|
19
|
-
accuracy: number;
|
|
20
|
-
f1: number;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
export interface Learning {
|
|
24
|
-
id: string;
|
|
25
|
-
runId: string;
|
|
26
|
-
extractedAt: string;
|
|
27
|
-
topicCategory: string;
|
|
28
|
-
topicDescription: string;
|
|
29
|
-
insight: string;
|
|
30
|
-
strategy: string;
|
|
31
|
-
outcome: 'improved' | 'degraded' | 'neutral';
|
|
32
|
-
changeType?: 'description-only' | 'examples-only' | 'both' | 'initial';
|
|
33
|
-
metrics: {
|
|
34
|
-
coverage: number;
|
|
35
|
-
tpr: number;
|
|
36
|
-
tnr: number;
|
|
37
|
-
accuracy: number;
|
|
38
|
-
f1: number;
|
|
39
|
-
};
|
|
40
|
-
corroborations: number;
|
|
41
|
-
tags: string[];
|
|
42
|
-
}
|
|
43
|
-
export interface TopicMemory {
|
|
44
|
-
category: string;
|
|
45
|
-
updatedAt: string;
|
|
46
|
-
learnings: Learning[];
|
|
47
|
-
bestKnown: {
|
|
48
|
-
runId: string;
|
|
49
|
-
iteration: number;
|
|
50
|
-
topic: CustomTopic;
|
|
51
|
-
metrics: EfficacyMetrics;
|
|
52
|
-
} | null;
|
|
53
|
-
antiPatterns: string[];
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/memory/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAKrE,MAAM,WAAW,aAAa;IAC5B,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,eAAe,EAAE,OAAO,CAAC;IACzB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,M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"file":"types.js","sourceRoot":"","sources":["../../src/memory/types.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { RunState } from '../core/types.js';
|
|
2
|
-
import type { RunStateSummary, RunStore } from './types.js';
|
|
3
|
-
/**
|
|
4
|
-
* JSON file-based run state persistence.
|
|
5
|
-
* Stores one file per run at `{dir}/{runId}.json` with atomic writes.
|
|
6
|
-
*/
|
|
7
|
-
export declare class JsonFileStore implements RunStore {
|
|
8
|
-
private readonly dir;
|
|
9
|
-
/** @param dir - Directory for run state JSON files. */
|
|
10
|
-
constructor(dir: string);
|
|
11
|
-
/** Save a run state to disk, creating the directory if needed. */
|
|
12
|
-
save(run: RunState): Promise<void>;
|
|
13
|
-
/** Load a run state by ID, or null if not found. */
|
|
14
|
-
load(id: string): Promise<RunState | null>;
|
|
15
|
-
/** List summaries of all persisted runs. */
|
|
16
|
-
list(): Promise<RunStateSummary[]>;
|
|
17
|
-
/** Delete a run state by ID. No-op if it doesn't exist. */
|
|
18
|
-
delete(id: string): Promise<void>;
|
|
19
|
-
private filePath;
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=store.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/persistence/store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE5D;;;GAGG;AACH,qBAAa,aAAc,YAAW,QAAQ;IAEhC,OAAO,CAAC,QAAQ,CAAC,GAAG;IADhC,uDAAuD;gBAC1B,GAAG,EAAE,MAAM;IAExC,kEAAkE;IAC5D,IAAI,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IASxC,oDAAoD;IAC9C,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAShD,4CAA4C;IACtC,IAAI,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;IA8BxC,2DAA2D;IACrD,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQvC,OAAO,CAAC,QAAQ;CAGjB"}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { mkdir, readdir, readFile, unlink, writeFile } from 'node:fs/promises';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
/**
|
|
4
|
-
* JSON file-based run state persistence.
|
|
5
|
-
* Stores one file per run at `{dir}/{runId}.json` with atomic writes.
|
|
6
|
-
*/
|
|
7
|
-
export class JsonFileStore {
|
|
8
|
-
dir;
|
|
9
|
-
/** @param dir - Directory for run state JSON files. */
|
|
10
|
-
constructor(dir) {
|
|
11
|
-
this.dir = dir;
|
|
12
|
-
}
|
|
13
|
-
/** Save a run state to disk, creating the directory if needed. */
|
|
14
|
-
async save(run) {
|
|
15
|
-
await mkdir(this.dir, { recursive: true });
|
|
16
|
-
const filePath = this.filePath(run.id);
|
|
17
|
-
const tmp = `${filePath}.tmp`;
|
|
18
|
-
await writeFile(tmp, JSON.stringify(run, null, 2), 'utf-8');
|
|
19
|
-
await writeFile(filePath, JSON.stringify(run, null, 2), 'utf-8');
|
|
20
|
-
await unlink(tmp).catch(() => { });
|
|
21
|
-
}
|
|
22
|
-
/** Load a run state by ID, or null if not found. */
|
|
23
|
-
async load(id) {
|
|
24
|
-
try {
|
|
25
|
-
const data = await readFile(this.filePath(id), 'utf-8');
|
|
26
|
-
return JSON.parse(data);
|
|
27
|
-
}
|
|
28
|
-
catch {
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
/** List summaries of all persisted runs. */
|
|
33
|
-
async list() {
|
|
34
|
-
let files;
|
|
35
|
-
try {
|
|
36
|
-
files = await readdir(this.dir);
|
|
37
|
-
}
|
|
38
|
-
catch {
|
|
39
|
-
return [];
|
|
40
|
-
}
|
|
41
|
-
const summaries = [];
|
|
42
|
-
for (const file of files) {
|
|
43
|
-
if (!file.endsWith('.json'))
|
|
44
|
-
continue;
|
|
45
|
-
try {
|
|
46
|
-
const data = await readFile(join(this.dir, file), 'utf-8');
|
|
47
|
-
const run = JSON.parse(data);
|
|
48
|
-
summaries.push({
|
|
49
|
-
id: run.id,
|
|
50
|
-
createdAt: run.createdAt,
|
|
51
|
-
updatedAt: run.updatedAt,
|
|
52
|
-
status: run.status,
|
|
53
|
-
currentIteration: run.currentIteration,
|
|
54
|
-
bestCoverage: run.bestCoverage,
|
|
55
|
-
topicDescription: run.userInput.topicDescription,
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
catch {
|
|
59
|
-
// skip corrupted files
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return summaries;
|
|
63
|
-
}
|
|
64
|
-
/** Delete a run state by ID. No-op if it doesn't exist. */
|
|
65
|
-
async delete(id) {
|
|
66
|
-
try {
|
|
67
|
-
await unlink(this.filePath(id));
|
|
68
|
-
}
|
|
69
|
-
catch {
|
|
70
|
-
// ignore if doesn't exist
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
filePath(id) {
|
|
74
|
-
return join(this.dir, `${id}.json`);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
//# sourceMappingURL=store.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/persistence/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC;;;GAGG;AACH,MAAM,OAAO,aAAa;IAEK;IAD7B,uDAAuD;IACvD,YAA6B,GAAW;QAAX,QAAG,GAAH,GAAG,CA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zB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;gBAAE,SAAS;YACtC,IAAI,CAAC;gBACH,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;gBAC3D,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAa,CAAC;gBACzC,SAAS,CAAC,IAAI,CAAC;oBACb,EAAE,EAAE,GAAG,CAAC,EAAE;oBACV,SAAS,EAAE,GAAG,CAAC,SAAS;oBACxB,SAAS,EAAE,GAAG,CAAC,SAAS;oBACxB,MAAM,EAAE,GAAG,CAAC,MAAM;oBAClB,gBAAgB,EAAE,GAAG,CAAC,gBAAgB;oBACtC,YAAY,EAAE,GAAG,CAAC,YAAY;oBAC9B,gBAAgB,EAAE,GAAG,CAAC,SAAS,CAAC,gBAAgB;iBACjD,CAAC,CAAC;YACL,CAAC;YAAC,MAAM,CAAC;gBACP,uBAAuB;YACzB,CAAC;QACH,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,2DAA2D;IAC3D,KAAK,CAAC,MAAM,CAAC,EAAU;QACrB,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;QAClC,CAAC;QAAC,MAAM,CAAC;YACP,0BAA0B;QAC5B,CAAC;IACH,CAAC;IAEO,QAAQ,CAAC,EAAU;QACzB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;CACF"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { RunState } from '../core/types.js';
|
|
2
|
-
/** Contract for run state persistence backends. */
|
|
3
|
-
export interface RunStore {
|
|
4
|
-
/** Save or overwrite a run state. */
|
|
5
|
-
save(run: RunState): Promise<void>;
|
|
6
|
-
/** Load a run state by ID, or null if not found. */
|
|
7
|
-
load(id: string): Promise<RunState | null>;
|
|
8
|
-
/** List summaries of all persisted runs. */
|
|
9
|
-
list(): Promise<RunStateSummary[]>;
|
|
10
|
-
/** Delete a run state by ID. */
|
|
11
|
-
delete(id: string): Promise<void>;
|
|
12
|
-
}
|
|
13
|
-
/** Lightweight summary of a persisted run for listing. */
|
|
14
|
-
export interface RunStateSummary {
|
|
15
|
-
id: string;
|
|
16
|
-
createdAt: string;
|
|
17
|
-
updatedAt: string;
|
|
18
|
-
status: RunState['status'];
|
|
19
|
-
currentIteration: number;
|
|
20
|
-
bestCoverage: number;
|
|
21
|
-
topicDescription: string;
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/persistence/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEjD,mDAAmD;AACnD,MAAM,WAAW,QAAQ;IACvB,qCAAqC;IACrC,IAAI,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,oDAAoD;IACpD,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;IAC3C,4CAA4C;IAC5C,IAAI,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;IACnC,gCAAgC;IAChC,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnC;AAED,0DAA0D;AAC1D,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC3B,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;CAC1B"}
|
|
File without changes
|