pi-para 0.5.5 → 0.6.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/CHANGELOG.md +22 -0
- package/package.json +8 -5
- package/scripts/build-assets.mjs +29 -0
- package/scripts/install.ps1 +27 -16
- package/scripts/install.sh +3 -2
- package/scripts/smoke-install.mjs +5 -3
- package/src/doctor.ts +5 -0
- package/dist/atomic-write.d.ts +0 -2
- package/dist/atomic-write.d.ts.map +0 -1
- package/dist/atomic-write.js +0 -18
- package/dist/atomic-write.js.map +0 -1
- package/dist/capture.d.ts +0 -34
- package/dist/capture.d.ts.map +0 -1
- package/dist/capture.js +0 -461
- package/dist/capture.js.map +0 -1
- package/dist/cli-legacy.d.ts +0 -4
- package/dist/cli-legacy.d.ts.map +0 -1
- package/dist/cli-legacy.js +0 -41
- package/dist/cli-legacy.js.map +0 -1
- package/dist/cli.d.ts +0 -8
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -511
- package/dist/cli.js.map +0 -1
- package/dist/commands.d.ts +0 -15
- package/dist/commands.d.ts.map +0 -1
- package/dist/commands.js +0 -719
- package/dist/commands.js.map +0 -1
- package/dist/config.d.ts +0 -104
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -242
- package/dist/config.js.map +0 -1
- package/dist/context.d.ts +0 -63
- package/dist/context.d.ts.map +0 -1
- package/dist/context.js +0 -311
- package/dist/context.js.map +0 -1
- package/dist/credentials.d.ts +0 -27
- package/dist/credentials.d.ts.map +0 -1
- package/dist/credentials.js +0 -85
- package/dist/credentials.js.map +0 -1
- package/dist/daemon.d.ts +0 -49
- package/dist/daemon.d.ts.map +0 -1
- package/dist/daemon.js +0 -226
- package/dist/daemon.js.map +0 -1
- package/dist/doctor.d.ts +0 -20
- package/dist/doctor.d.ts.map +0 -1
- package/dist/doctor.js +0 -171
- package/dist/doctor.js.map +0 -1
- package/dist/frontmatter.d.ts +0 -59
- package/dist/frontmatter.d.ts.map +0 -1
- package/dist/frontmatter.js +0 -170
- package/dist/frontmatter.js.map +0 -1
- package/dist/gepa/dataset.d.ts +0 -36
- package/dist/gepa/dataset.d.ts.map +0 -1
- package/dist/gepa/dataset.js +0 -148
- package/dist/gepa/dataset.js.map +0 -1
- package/dist/gepa/evaluator.d.ts +0 -51
- package/dist/gepa/evaluator.d.ts.map +0 -1
- package/dist/gepa/evaluator.js +0 -317
- package/dist/gepa/evaluator.js.map +0 -1
- package/dist/gepa/index.d.ts +0 -66
- package/dist/gepa/index.d.ts.map +0 -1
- package/dist/gepa/index.js +0 -240
- package/dist/gepa/index.js.map +0 -1
- package/dist/gepa/llm.d.ts +0 -35
- package/dist/gepa/llm.d.ts.map +0 -1
- package/dist/gepa/llm.js +0 -268
- package/dist/gepa/llm.js.map +0 -1
- package/dist/gepa/optimized/capture-prompt.txt +0 -65
- package/dist/gepa/optimizer.d.ts +0 -29
- package/dist/gepa/optimizer.d.ts.map +0 -1
- package/dist/gepa/optimizer.js +0 -249
- package/dist/gepa/optimizer.js.map +0 -1
- package/dist/gepa/targets.d.ts +0 -39
- package/dist/gepa/targets.d.ts.map +0 -1
- package/dist/gepa/targets.js +0 -326
- package/dist/gepa/targets.js.map +0 -1
- package/dist/gepa/types.d.ts +0 -168
- package/dist/gepa/types.d.ts.map +0 -1
- package/dist/gepa/types.js +0 -124
- package/dist/gepa/types.js.map +0 -1
- package/dist/index.d.ts +0 -21
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -359
- package/dist/index.js.map +0 -1
- package/dist/ingest.d.ts +0 -88
- package/dist/ingest.d.ts.map +0 -1
- package/dist/ingest.js +0 -105
- package/dist/ingest.js.map +0 -1
- package/dist/link-discovery.d.ts +0 -40
- package/dist/link-discovery.d.ts.map +0 -1
- package/dist/link-discovery.js +0 -122
- package/dist/link-discovery.js.map +0 -1
- package/dist/link-utils.d.ts +0 -30
- package/dist/link-utils.d.ts.map +0 -1
- package/dist/link-utils.js +0 -145
- package/dist/link-utils.js.map +0 -1
- package/dist/lint.d.ts +0 -39
- package/dist/lint.d.ts.map +0 -1
- package/dist/lint.js +0 -827
- package/dist/lint.js.map +0 -1
- package/dist/maintainer.d.ts +0 -24
- package/dist/maintainer.d.ts.map +0 -1
- package/dist/maintainer.js +0 -358
- package/dist/maintainer.js.map +0 -1
- package/dist/model-resolver.d.ts +0 -30
- package/dist/model-resolver.d.ts.map +0 -1
- package/dist/model-resolver.js +0 -71
- package/dist/model-resolver.js.map +0 -1
- package/dist/paths.d.ts +0 -20
- package/dist/paths.d.ts.map +0 -1
- package/dist/paths.js +0 -33
- package/dist/paths.js.map +0 -1
- package/dist/processor.d.ts +0 -14
- package/dist/processor.d.ts.map +0 -1
- package/dist/processor.js +0 -361
- package/dist/processor.js.map +0 -1
- package/dist/qmd-providers.d.ts +0 -12
- package/dist/qmd-providers.d.ts.map +0 -1
- package/dist/qmd-providers.js +0 -45
- package/dist/qmd-providers.js.map +0 -1
- package/dist/query.d.ts +0 -69
- package/dist/query.d.ts.map +0 -1
- package/dist/query.js +0 -120
- package/dist/query.js.map +0 -1
- package/dist/raw.d.ts +0 -57
- package/dist/raw.d.ts.map +0 -1
- package/dist/raw.js +0 -219
- package/dist/raw.js.map +0 -1
- package/dist/redact.d.ts +0 -21
- package/dist/redact.d.ts.map +0 -1
- package/dist/redact.js +0 -143
- package/dist/redact.js.map +0 -1
- package/dist/repair.d.ts +0 -11
- package/dist/repair.d.ts.map +0 -1
- package/dist/repair.js +0 -41
- package/dist/repair.js.map +0 -1
- package/dist/scheduler/controls.d.ts +0 -35
- package/dist/scheduler/controls.d.ts.map +0 -1
- package/dist/scheduler/controls.js +0 -98
- package/dist/scheduler/controls.js.map +0 -1
- package/dist/scheduler/index.d.ts +0 -48
- package/dist/scheduler/index.d.ts.map +0 -1
- package/dist/scheduler/index.js +0 -193
- package/dist/scheduler/index.js.map +0 -1
- package/dist/scheduler/leases.d.ts +0 -22
- package/dist/scheduler/leases.d.ts.map +0 -1
- package/dist/scheduler/leases.js +0 -74
- package/dist/scheduler/leases.js.map +0 -1
- package/dist/scheduler/session-capture.d.ts +0 -33
- package/dist/scheduler/session-capture.d.ts.map +0 -1
- package/dist/scheduler/session-capture.js +0 -108
- package/dist/scheduler/session-capture.js.map +0 -1
- package/dist/scheduler/state.d.ts +0 -56
- package/dist/scheduler/state.d.ts.map +0 -1
- package/dist/scheduler/state.js +0 -210
- package/dist/scheduler/state.js.map +0 -1
- package/dist/scope.d.ts +0 -54
- package/dist/scope.d.ts.map +0 -1
- package/dist/scope.js +0 -161
- package/dist/scope.js.map +0 -1
- package/dist/scripts/bulk-link-fix.d.ts +0 -9
- package/dist/scripts/bulk-link-fix.d.ts.map +0 -1
- package/dist/scripts/bulk-link-fix.js +0 -106
- package/dist/scripts/bulk-link-fix.js.map +0 -1
- package/dist/session-tools.d.ts +0 -33
- package/dist/session-tools.d.ts.map +0 -1
- package/dist/session-tools.js +0 -211
- package/dist/session-tools.js.map +0 -1
- package/dist/settings.d.ts +0 -19
- package/dist/settings.d.ts.map +0 -1
- package/dist/settings.js +0 -106
- package/dist/settings.js.map +0 -1
- package/dist/setup.d.ts +0 -29
- package/dist/setup.d.ts.map +0 -1
- package/dist/setup.js +0 -90
- package/dist/setup.js.map +0 -1
- package/dist/state.d.ts +0 -54
- package/dist/state.d.ts.map +0 -1
- package/dist/state.js +0 -176
- package/dist/state.js.map +0 -1
- package/dist/status.d.ts +0 -22
- package/dist/status.d.ts.map +0 -1
- package/dist/status.js +0 -93
- package/dist/status.js.map +0 -1
- package/dist/store.d.ts +0 -71
- package/dist/store.d.ts.map +0 -1
- package/dist/store.js +0 -282
- package/dist/store.js.map +0 -1
- package/dist/summarize.d.ts +0 -60
- package/dist/summarize.d.ts.map +0 -1
- package/dist/summarize.js +0 -266
- package/dist/summarize.js.map +0 -1
- package/dist/tag-registry.d.ts +0 -56
- package/dist/tag-registry.d.ts.map +0 -1
- package/dist/tag-registry.js +0 -146
- package/dist/tag-registry.js.map +0 -1
- package/dist/templates/prompts.d.ts +0 -63
- package/dist/templates/prompts.d.ts.map +0 -1
- package/dist/templates/prompts.js +0 -260
- package/dist/templates/prompts.js.map +0 -1
- package/dist/tools.d.ts +0 -26
- package/dist/tools.d.ts.map +0 -1
- package/dist/tools.js +0 -1198
- package/dist/tools.js.map +0 -1
- package/dist/watcher.d.ts +0 -25
- package/dist/watcher.d.ts.map +0 -1
- package/dist/watcher.js +0 -84
- package/dist/watcher.js.map +0 -1
- package/dist/webui/client/dist/index.html +0 -1885
- package/dist/webui/server.d.ts +0 -31
- package/dist/webui/server.d.ts.map +0 -1
- package/dist/webui/server.js +0 -566
- package/dist/webui/server.js.map +0 -1
- package/dist/wiki-tool-guidance.d.ts +0 -6
- package/dist/wiki-tool-guidance.d.ts.map +0 -1
- package/dist/wiki-tool-guidance.js +0 -70
- package/dist/wiki-tool-guidance.js.map +0 -1
- package/dist/wiki.d.ts +0 -108
- package/dist/wiki.d.ts.map +0 -1
- package/dist/wiki.js +0 -497
- package/dist/wiki.js.map +0 -1
- package/scripts/gepa/__pycache__/dataset.cpython-313.pyc +0 -0
- package/scripts/gepa/__pycache__/lm_providers.cpython-313.pyc +0 -0
- package/scripts/gepa/__pycache__/metric.cpython-313.pyc +0 -0
- package/scripts/gepa/__pycache__/program.cpython-313.pyc +0 -0
- package/scripts/gepa/__pycache__/wiki_reader.cpython-313.pyc +0 -0
- package/scripts/gepa/uv.lock +0 -2241
package/dist/gepa/evaluator.js
DELETED
|
@@ -1,317 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GEPA LLM-based evaluator — judges prompt/skill candidates on multiple dimensions.
|
|
3
|
-
*
|
|
4
|
-
* Every candidate is scored by an LLM judge across 5 equally-weighted dimensions:
|
|
5
|
-
* Structure (0.20), Clarity (0.20), Completeness (0.20),
|
|
6
|
-
* Error Prevention (0.20), Actionability (0.20)
|
|
7
|
-
*
|
|
8
|
-
* The evaluator builds a target-specific evaluation prompt that describes what
|
|
9
|
-
* "good" looks like for each target type (system prompts, capture prompts,
|
|
10
|
-
* maintenance prompts, skills), then parses the LLM's JSON response robustly.
|
|
11
|
-
*
|
|
12
|
-
* Constraint violations (missing required concepts) cap the score at 0.3.
|
|
13
|
-
*/
|
|
14
|
-
// -- Constants ---------------------------------------------------------------
|
|
15
|
-
/** Evaluation dimensions with equal weighting. */
|
|
16
|
-
const EVAL_DIMENSIONS = [
|
|
17
|
-
{ name: "structure", weight: 0.20 },
|
|
18
|
-
{ name: "clarity", weight: 0.20 },
|
|
19
|
-
{ name: "completeness", weight: 0.20 },
|
|
20
|
-
{ name: "error-prevention", weight: 0.20 },
|
|
21
|
-
{ name: "actionability", weight: 0.20 },
|
|
22
|
-
];
|
|
23
|
-
/** Maximum score when constraint violations are detected. */
|
|
24
|
-
const CONSTRAINT_VIOLATION_CAP = 0.3;
|
|
25
|
-
/** System prompt for the LLM judge. */
|
|
26
|
-
const JUDGE_SYSTEM_PROMPT = `You are an expert prompt engineer evaluating prompt templates and skill documents for an AI-powered PARA knowledge base system called pi-para.
|
|
27
|
-
|
|
28
|
-
Your evaluations must be precise, calibrated, and honest. Do not inflate scores.
|
|
29
|
-
|
|
30
|
-
Scoring scale:
|
|
31
|
-
- 0.0–0.2: Fundamentally broken or missing
|
|
32
|
-
- 0.2–0.4: Major issues, needs significant rework
|
|
33
|
-
- 0.4–0.6: Functional but has clear gaps or weaknesses
|
|
34
|
-
- 0.6–0.8: Good, minor improvements possible
|
|
35
|
-
- 0.8–1.0: Excellent, best-in-class for this type of content
|
|
36
|
-
|
|
37
|
-
Always respond with valid JSON only. No markdown formatting, no explanatory text outside the JSON.`;
|
|
38
|
-
// -- Target-type-specific quality criteria -----------------------------------
|
|
39
|
-
function getTargetTypeGuidance(target) {
|
|
40
|
-
const name = target.name.toLowerCase();
|
|
41
|
-
if (name.includes("system-prompt") || name.includes("capture-prompt-processor")) {
|
|
42
|
-
return `This is a SYSTEM PROMPT — it sets the persona and rules for an LLM agent.
|
|
43
|
-
|
|
44
|
-
Quality criteria for system prompts:
|
|
45
|
-
- MUST define a clear agent role/persona at the top
|
|
46
|
-
- MUST include explicit PARA category rules (resources/ as default, projects/ ONLY for goals with end dates)
|
|
47
|
-
- MUST include security rules (never store API keys/tokens/secrets in content)
|
|
48
|
-
- MUST include scope rules (kebab-case project names)
|
|
49
|
-
- SHOULD include content format guidance (wiki summary format)
|
|
50
|
-
- SHOULD include [[wikilink]] usage instructions
|
|
51
|
-
- Must be authoritative and unambiguous
|
|
52
|
-
- Must prevent common mistakes (wrong category, duplicate pages, secrets in content)`;
|
|
53
|
-
}
|
|
54
|
-
if (name.includes("capture")) {
|
|
55
|
-
return `This is a CAPTURE PROMPT — it instructs the LLM on extracting knowledge from coding sessions.
|
|
56
|
-
|
|
57
|
-
Quality criteria for capture prompts:
|
|
58
|
-
- MUST emphasize deduplication: search wiki_query BEFORE creating new pages
|
|
59
|
-
- MUST include session reference instructions (include session file path in Sources)
|
|
60
|
-
- MUST include skip-trivial logic (only skip pure greetings/chitchat)
|
|
61
|
-
- MUST define what constitutes capturable knowledge
|
|
62
|
-
- SHOULD specify capture bias: "when in doubt, capture it"
|
|
63
|
-
- SHOULD emphasize small operational facts are valuable`;
|
|
64
|
-
}
|
|
65
|
-
if (name.includes("maintenance")) {
|
|
66
|
-
return `This is a MAINTENANCE PROMPT — it instructs the LLM on keeping the wiki healthy.
|
|
67
|
-
|
|
68
|
-
Quality criteria:
|
|
69
|
-
- MUST take a conservative approach: "when unsure, leave it alone"
|
|
70
|
-
- MUST include duplicate detection and merge rules
|
|
71
|
-
- MUST include wikilink discovery
|
|
72
|
-
- MUST include category review rules
|
|
73
|
-
- SHOULD include project lifecycle review with safeguards`;
|
|
74
|
-
}
|
|
75
|
-
if (name.includes("ingest")) {
|
|
76
|
-
return `This is an INGEST PROMPT — it instructs the LLM on integrating new source material.
|
|
77
|
-
|
|
78
|
-
Quality criteria:
|
|
79
|
-
- MUST instruct to review existing pages before creating new ones
|
|
80
|
-
- MUST include PARA category assignment rules
|
|
81
|
-
- MUST include wiki summary format
|
|
82
|
-
- MUST instruct to flag contradictions`;
|
|
83
|
-
}
|
|
84
|
-
if (name.includes("query")) {
|
|
85
|
-
return `This is a QUERY PROMPT — it instructs the LLM on synthesizing answers from wiki search.
|
|
86
|
-
|
|
87
|
-
Quality criteria:
|
|
88
|
-
- MUST include citation instructions (use [[page-slug]] references)
|
|
89
|
-
- MUST include freshness verification rules
|
|
90
|
-
- MUST include self-healing instructions (fix incorrect wiki pages)`;
|
|
91
|
-
}
|
|
92
|
-
if (target.type === "skill") {
|
|
93
|
-
return `This is a SKILL DOCUMENT — behavioral guidelines or setup instructions.
|
|
94
|
-
|
|
95
|
-
Quality criteria:
|
|
96
|
-
- MUST have clear structure with numbered or headed sections
|
|
97
|
-
- MUST have actionable steps the agent can follow without ambiguity
|
|
98
|
-
- MUST include concrete examples where helpful
|
|
99
|
-
- SHOULD include "common mistakes" or anti-patterns to avoid`;
|
|
100
|
-
}
|
|
101
|
-
return `This is a prompt template for the pi-para PARA knowledge base system.
|
|
102
|
-
|
|
103
|
-
General quality criteria:
|
|
104
|
-
- Clear structure with logical sections
|
|
105
|
-
- Unambiguous instructions
|
|
106
|
-
- Appropriate level of detail
|
|
107
|
-
- Covers edge cases and error scenarios`;
|
|
108
|
-
}
|
|
109
|
-
// -- Evaluation prompt builder -----------------------------------------------
|
|
110
|
-
function buildEvaluationPrompt(candidate, target, context) {
|
|
111
|
-
const typeGuidance = getTargetTypeGuidance(target);
|
|
112
|
-
const constraintSection = target.constraints.length > 0
|
|
113
|
-
? `\n## Required Constraints\n\nThe following concepts MUST be present. If any are missing, the candidate has a constraint violation.\n\n${target.constraints.map((c, i) => `${i + 1}. ${c}`).join("\n")}\n`
|
|
114
|
-
: "";
|
|
115
|
-
const descriptionSection = target.description
|
|
116
|
-
? `\n**Purpose**: ${target.description}\n`
|
|
117
|
-
: "";
|
|
118
|
-
return `# Prompt Evaluation Task
|
|
119
|
-
|
|
120
|
-
You are evaluating a candidate ${target.type === "skill" ? "skill document" : "prompt template"} for the pi-para PARA knowledge base system.
|
|
121
|
-
|
|
122
|
-
## Target: "${target.name}"
|
|
123
|
-
**Type**: ${target.type}${descriptionSection}
|
|
124
|
-
|
|
125
|
-
## Target-Specific Quality Criteria
|
|
126
|
-
|
|
127
|
-
${typeGuidance}
|
|
128
|
-
${constraintSection}
|
|
129
|
-
## Current Wiki Context
|
|
130
|
-
|
|
131
|
-
${context || "No additional context available."}
|
|
132
|
-
|
|
133
|
-
## Candidate to Evaluate
|
|
134
|
-
|
|
135
|
-
<candidate>
|
|
136
|
-
${candidate}
|
|
137
|
-
</candidate>
|
|
138
|
-
|
|
139
|
-
## Evaluation Instructions
|
|
140
|
-
|
|
141
|
-
Score this candidate on exactly 5 dimensions, each from 0.0 to 1.0:
|
|
142
|
-
|
|
143
|
-
1. **structure** (0.20): Organization, clear sections, appropriate length, logical grouping
|
|
144
|
-
2. **clarity** (0.20): Unambiguous instructions, no contradictions, consistent interpretation
|
|
145
|
-
3. **completeness** (0.20): Covers all necessary aspects, no gaps, all constraints present
|
|
146
|
-
4. **error-prevention** (0.20): Guards against common mistakes, includes safety rails
|
|
147
|
-
5. **actionability** (0.20): Concrete rules to follow, clear decision criteria, not vague
|
|
148
|
-
|
|
149
|
-
Respond with ONLY this JSON structure (no markdown, no extra text):
|
|
150
|
-
{
|
|
151
|
-
"dimensions": {
|
|
152
|
-
"structure": { "score": 0.0, "feedback": "..." },
|
|
153
|
-
"clarity": { "score": 0.0, "feedback": "..." },
|
|
154
|
-
"completeness": { "score": 0.0, "feedback": "..." },
|
|
155
|
-
"error-prevention": { "score": 0.0, "feedback": "..." },
|
|
156
|
-
"actionability": { "score": 0.0, "feedback": "..." }
|
|
157
|
-
},
|
|
158
|
-
"constraintViolations": [],
|
|
159
|
-
"overallFeedback": "2-3 sentence summary"
|
|
160
|
-
}`;
|
|
161
|
-
}
|
|
162
|
-
// -- JSON parsing ------------------------------------------------------------
|
|
163
|
-
function extractJSON(raw) {
|
|
164
|
-
const trimmed = raw.trim();
|
|
165
|
-
try {
|
|
166
|
-
return JSON.parse(trimmed);
|
|
167
|
-
}
|
|
168
|
-
catch { /* continue */ }
|
|
169
|
-
const codeBlockMatch = trimmed.match(/```(?:json)?\s*\n?([\s\S]*?)```/);
|
|
170
|
-
if (codeBlockMatch) {
|
|
171
|
-
try {
|
|
172
|
-
return JSON.parse(codeBlockMatch[1].trim());
|
|
173
|
-
}
|
|
174
|
-
catch { /* continue */ }
|
|
175
|
-
}
|
|
176
|
-
const firstBrace = trimmed.indexOf("{");
|
|
177
|
-
const lastBrace = trimmed.lastIndexOf("}");
|
|
178
|
-
if (firstBrace !== -1 && lastBrace > firstBrace) {
|
|
179
|
-
try {
|
|
180
|
-
return JSON.parse(trimmed.slice(firstBrace, lastBrace + 1));
|
|
181
|
-
}
|
|
182
|
-
catch { /* continue */ }
|
|
183
|
-
}
|
|
184
|
-
return null;
|
|
185
|
-
}
|
|
186
|
-
function parseJudgeResponse(raw) {
|
|
187
|
-
const json = extractJSON(raw);
|
|
188
|
-
if (!json) {
|
|
189
|
-
return {
|
|
190
|
-
success: false,
|
|
191
|
-
dimensions: createZeroDimensions("Failed to parse LLM judge response as JSON"),
|
|
192
|
-
constraintViolations: [],
|
|
193
|
-
overallFeedback: `[gepa] Parse error: could not extract JSON from response.`,
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
const dims = json.dimensions;
|
|
197
|
-
const dimensions = [];
|
|
198
|
-
for (const dim of EVAL_DIMENSIONS) {
|
|
199
|
-
const dimData = dims?.[dim.name];
|
|
200
|
-
const score = typeof dimData?.score === "number"
|
|
201
|
-
? clamp(dimData.score, 0, 1)
|
|
202
|
-
: 0;
|
|
203
|
-
const feedback = typeof dimData?.feedback === "string"
|
|
204
|
-
? dimData.feedback
|
|
205
|
-
: "No feedback provided";
|
|
206
|
-
dimensions.push({
|
|
207
|
-
name: dim.name,
|
|
208
|
-
score,
|
|
209
|
-
feedback,
|
|
210
|
-
weight: dim.weight,
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
const violations = Array.isArray(json.constraintViolations)
|
|
214
|
-
? json.constraintViolations.filter((v) => typeof v === "string")
|
|
215
|
-
: [];
|
|
216
|
-
const overallFeedback = typeof json.overallFeedback === "string"
|
|
217
|
-
? json.overallFeedback
|
|
218
|
-
: "No overall feedback provided";
|
|
219
|
-
return { success: true, dimensions, constraintViolations: violations, overallFeedback };
|
|
220
|
-
}
|
|
221
|
-
// -- Constraint checking -----------------------------------------------------
|
|
222
|
-
function checkConstraintViolations(candidate, constraints) {
|
|
223
|
-
if (constraints.length === 0)
|
|
224
|
-
return [];
|
|
225
|
-
const lowerCandidate = candidate.toLowerCase();
|
|
226
|
-
const missing = [];
|
|
227
|
-
for (const constraint of constraints) {
|
|
228
|
-
const keyTerms = extractKeyTerms(constraint);
|
|
229
|
-
const hasAnyTerm = keyTerms.some((term) => lowerCandidate.includes(term.toLowerCase()));
|
|
230
|
-
if (!hasAnyTerm) {
|
|
231
|
-
missing.push(constraint);
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
return missing;
|
|
235
|
-
}
|
|
236
|
-
function extractKeyTerms(constraint) {
|
|
237
|
-
const fillerWords = new Set([
|
|
238
|
-
"must", "should", "include", "have", "contain", "mention",
|
|
239
|
-
"use", "provide", "specify", "ensure", "be", "the", "a", "an",
|
|
240
|
-
"and", "or", "for", "with", "about", "that", "this", "is", "are",
|
|
241
|
-
"in", "of", "to", "not", "no", "any", "all", "each",
|
|
242
|
-
]);
|
|
243
|
-
return constraint
|
|
244
|
-
.toLowerCase()
|
|
245
|
-
.replace(/[^a-z0-9\s-]/g, "")
|
|
246
|
-
.split(/\s+/)
|
|
247
|
-
.filter((w) => w.length > 2 && !fillerWords.has(w));
|
|
248
|
-
}
|
|
249
|
-
// -- Helpers -----------------------------------------------------------------
|
|
250
|
-
function clamp(value, min, max) {
|
|
251
|
-
return Math.max(min, Math.min(max, value));
|
|
252
|
-
}
|
|
253
|
-
function createZeroDimensions(feedback) {
|
|
254
|
-
return EVAL_DIMENSIONS.map((dim) => ({
|
|
255
|
-
name: dim.name,
|
|
256
|
-
score: 0,
|
|
257
|
-
feedback,
|
|
258
|
-
weight: dim.weight,
|
|
259
|
-
}));
|
|
260
|
-
}
|
|
261
|
-
function computeWeightedScore(dimensions) {
|
|
262
|
-
let totalWeight = 0;
|
|
263
|
-
let weightedSum = 0;
|
|
264
|
-
for (const dim of dimensions) {
|
|
265
|
-
weightedSum += dim.score * dim.weight;
|
|
266
|
-
totalWeight += dim.weight;
|
|
267
|
-
}
|
|
268
|
-
if (totalWeight === 0)
|
|
269
|
-
return 0;
|
|
270
|
-
return weightedSum / totalWeight;
|
|
271
|
-
}
|
|
272
|
-
// -- Main evaluation function ------------------------------------------------
|
|
273
|
-
/**
|
|
274
|
-
* Evaluate a candidate prompt/skill using an LLM judge.
|
|
275
|
-
*/
|
|
276
|
-
export async function evaluateCandidate(candidate, target, context, llm) {
|
|
277
|
-
const evalPrompt = buildEvaluationPrompt(candidate, target, context);
|
|
278
|
-
let rawResponse;
|
|
279
|
-
try {
|
|
280
|
-
rawResponse = await llm.complete(evalPrompt, JUDGE_SYSTEM_PROMPT);
|
|
281
|
-
}
|
|
282
|
-
catch (error) {
|
|
283
|
-
const msg = error instanceof Error ? error.message : String(error);
|
|
284
|
-
console.error(`[gepa] LLM judge call failed for target "${target.name}": ${msg}`);
|
|
285
|
-
return {
|
|
286
|
-
score: 0,
|
|
287
|
-
dimensions: createZeroDimensions(`LLM judge error: ${msg}`),
|
|
288
|
-
overallFeedback: `[gepa] Evaluation failed: ${msg}`,
|
|
289
|
-
};
|
|
290
|
-
}
|
|
291
|
-
const parsed = parseJudgeResponse(rawResponse);
|
|
292
|
-
if (!parsed.success) {
|
|
293
|
-
console.warn(`[gepa] Failed to parse judge response for "${target.name}", using zero scores`);
|
|
294
|
-
}
|
|
295
|
-
let { dimensions } = parsed;
|
|
296
|
-
let { overallFeedback } = parsed;
|
|
297
|
-
// Check for constraint violations
|
|
298
|
-
const hardViolations = checkConstraintViolations(candidate, target.constraints);
|
|
299
|
-
const allViolationsArr = [...hardViolations, ...parsed.constraintViolations];
|
|
300
|
-
const allViolations = Array.from(new Set(allViolationsArr));
|
|
301
|
-
if (allViolations.length > 0) {
|
|
302
|
-
const violationList = allViolations.join("; ");
|
|
303
|
-
console.log(`[gepa] Constraint violations for "${target.name}": ${violationList} — capping score at ${CONSTRAINT_VIOLATION_CAP}`);
|
|
304
|
-
dimensions = dimensions.map((dim) => ({
|
|
305
|
-
...dim,
|
|
306
|
-
score: Math.min(dim.score, CONSTRAINT_VIOLATION_CAP),
|
|
307
|
-
feedback: dim.score > CONSTRAINT_VIOLATION_CAP
|
|
308
|
-
? `${dim.feedback} [CAPPED: constraint violations]`
|
|
309
|
-
: dim.feedback,
|
|
310
|
-
}));
|
|
311
|
-
overallFeedback = `${overallFeedback}\n\n⚠️ CONSTRAINT VIOLATIONS (score capped at ${CONSTRAINT_VIOLATION_CAP}): ${violationList}`;
|
|
312
|
-
}
|
|
313
|
-
const score = computeWeightedScore(dimensions);
|
|
314
|
-
return { score, dimensions, overallFeedback };
|
|
315
|
-
}
|
|
316
|
-
export { buildEvaluationPrompt, extractJSON, parseJudgeResponse, checkConstraintViolations, computeWeightedScore, getTargetTypeGuidance, EVAL_DIMENSIONS, CONSTRAINT_VIOLATION_CAP, };
|
|
317
|
-
//# sourceMappingURL=evaluator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"evaluator.js","sourceRoot":"","sources":["../../src/gepa/evaluator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,+EAA+E;AAE/E,kDAAkD;AAClD,MAAM,eAAe,GAAG;IACtB,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE;IACnC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE;IACjC,EAAE,IAAI,EAAE,cA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BAAyB,EACzB,oBAAoB,EACpB,qBAAqB,EACrB,eAAe,EACf,wBAAwB,GACzB,CAAC"}
|
package/dist/gepa/index.d.ts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GEPA optimizer orchestrator — TypeScript side.
|
|
3
|
-
*
|
|
4
|
-
* 1. Extracts all prompt/tool/skill instruction texts from source
|
|
5
|
-
* 2. Writes targets.json for the Python DSPy GEPA script
|
|
6
|
-
* 3. Reads auth.json → passes API keys as env vars to uv subprocess
|
|
7
|
-
* 4. Calls `uv run scripts/gepa/optimize.py`
|
|
8
|
-
* 5. Reads results.json → saves optimized prompts to disk
|
|
9
|
-
*/
|
|
10
|
-
interface GEPATarget {
|
|
11
|
-
name: string;
|
|
12
|
-
type: "prompt" | "tool" | "skill";
|
|
13
|
-
content: string;
|
|
14
|
-
sourceFile: string;
|
|
15
|
-
}
|
|
16
|
-
interface GEPAResult {
|
|
17
|
-
target: string;
|
|
18
|
-
status: "success" | "error";
|
|
19
|
-
baseline_score?: number;
|
|
20
|
-
optimized_score?: number;
|
|
21
|
-
improvement_pct?: number;
|
|
22
|
-
optimized_instruction?: string;
|
|
23
|
-
original_instruction?: string;
|
|
24
|
-
model?: string;
|
|
25
|
-
auto?: string;
|
|
26
|
-
error?: string;
|
|
27
|
-
timestamp?: string;
|
|
28
|
-
}
|
|
29
|
-
interface GEPAOutput {
|
|
30
|
-
results: GEPAResult[];
|
|
31
|
-
model: string;
|
|
32
|
-
auto: string;
|
|
33
|
-
wiki_dir: string;
|
|
34
|
-
timestamp: string;
|
|
35
|
-
}
|
|
36
|
-
export interface GEPAOptions {
|
|
37
|
-
target?: string;
|
|
38
|
-
/** Student model — runs the proxy (fast, cheap). */
|
|
39
|
-
studentModel?: string;
|
|
40
|
-
/** Teacher/reflection model — proposes mutations (smart, creative). */
|
|
41
|
-
teacherModel?: string;
|
|
42
|
-
/** Judge model — scores outputs (fast, cheap). Default: same as student. */
|
|
43
|
-
judgeModel?: string;
|
|
44
|
-
/** Shorthand: sets studentModel (backward compat with --model flag) */
|
|
45
|
-
model?: string;
|
|
46
|
-
/** Shorthand: sets teacherModel (backward compat with --reflection-model flag) */
|
|
47
|
-
reflectionModel?: string;
|
|
48
|
-
auto?: "light" | "medium" | "heavy";
|
|
49
|
-
maxMetricCalls?: number;
|
|
50
|
-
threads?: number;
|
|
51
|
-
seed?: number;
|
|
52
|
-
}
|
|
53
|
-
export declare function extractTargets(packageRoot?: string): GEPATarget[];
|
|
54
|
-
export declare function runGEPA(options?: GEPAOptions): Promise<GEPAOutput>;
|
|
55
|
-
export declare function listOptimized(): {
|
|
56
|
-
name: string;
|
|
57
|
-
score: number;
|
|
58
|
-
timestamp: string;
|
|
59
|
-
model: string;
|
|
60
|
-
}[];
|
|
61
|
-
export declare function compareTarget(targetName: string): {
|
|
62
|
-
original: string;
|
|
63
|
-
optimized: string;
|
|
64
|
-
} | null;
|
|
65
|
-
export {};
|
|
66
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/gepa/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/gepa/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AASH,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,UAAU;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,KA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AM,CAAA;CAAE,GAAG,IAAI,CAOhG"}
|
package/dist/gepa/index.js
DELETED
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GEPA optimizer orchestrator — TypeScript side.
|
|
3
|
-
*
|
|
4
|
-
* 1. Extracts all prompt/tool/skill instruction texts from source
|
|
5
|
-
* 2. Writes targets.json for the Python DSPy GEPA script
|
|
6
|
-
* 3. Reads auth.json → passes API keys as env vars to uv subprocess
|
|
7
|
-
* 4. Calls `uv run scripts/gepa/optimize.py`
|
|
8
|
-
* 5. Reads results.json → saves optimized prompts to disk
|
|
9
|
-
*/
|
|
10
|
-
import { spawn } from "node:child_process";
|
|
11
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync, readdirSync } from "node:fs";
|
|
12
|
-
import { homedir } from "node:os";
|
|
13
|
-
import { dirname, join, resolve } from "node:path";
|
|
14
|
-
// -- Paths -------------------------------------------------------------------
|
|
15
|
-
const WIKI_DIR = join(homedir(), ".pi", "wiki");
|
|
16
|
-
const GEPA_DIR = join(WIKI_DIR, "gepa");
|
|
17
|
-
const INPUT_DIR = join(GEPA_DIR, "input");
|
|
18
|
-
const OUTPUT_DIR = join(GEPA_DIR, "output");
|
|
19
|
-
const OPTIMIZED_DIR = join(GEPA_DIR, "optimized");
|
|
20
|
-
const HISTORY_DIR = join(GEPA_DIR, "history");
|
|
21
|
-
// -- Package root ------------------------------------------------------------
|
|
22
|
-
function findPackageRoot() {
|
|
23
|
-
let dir = dirname(new URL(import.meta.url).pathname);
|
|
24
|
-
for (let i = 0; i < 5; i++) {
|
|
25
|
-
const pkgPath = join(dir, "package.json");
|
|
26
|
-
if (existsSync(pkgPath)) {
|
|
27
|
-
try {
|
|
28
|
-
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
|
|
29
|
-
if (pkg.name === "pi-para" || pkg.name === "@picassio/pi-para")
|
|
30
|
-
return dir;
|
|
31
|
-
}
|
|
32
|
-
catch { }
|
|
33
|
-
}
|
|
34
|
-
dir = dirname(dir);
|
|
35
|
-
}
|
|
36
|
-
return resolve(dirname(new URL(import.meta.url).pathname), "../..");
|
|
37
|
-
}
|
|
38
|
-
// -- Helpers: extract strings from TS source ---------------------------------
|
|
39
|
-
function extractTSConst(source, name) {
|
|
40
|
-
const m = source.match(new RegExp(`(?:export\\s+)?const\\s+${name}\\s*=\\s*\`([\\s\\S]*?)\`;`));
|
|
41
|
-
return m ? m[1].trim() : null;
|
|
42
|
-
}
|
|
43
|
-
function extractToolInstructions(source) {
|
|
44
|
-
const tools = {};
|
|
45
|
-
const blocks = [...source.matchAll(/registerTool\(\{[\s\S]*?name:\s*"(wiki_\w+)"[\s\S]*?(?=registerTool\(\{|$)/g)];
|
|
46
|
-
for (const block of blocks) {
|
|
47
|
-
const name = block[1].replace("wiki_", "wiki-");
|
|
48
|
-
const text = block[0];
|
|
49
|
-
const descStrs = [...(text.match(/description:\s*\n?\s*([\s\S]*?)(?:promptSnippet:|promptGuidelines:|parameters:)/)?.[1] ?? "").matchAll(/["'`]([^"'`]+)["'`]/g)];
|
|
50
|
-
const desc = descStrs.map(s => s[1]).join(" ");
|
|
51
|
-
const snippet = text.match(/promptSnippet:\s*["'`]([^"'`]+)["'`]/)?.[1] ?? "";
|
|
52
|
-
const guideMatch = text.match(/promptGuidelines:\s*\[([\s\S]*?)\]/);
|
|
53
|
-
const guides = guideMatch ? [...guideMatch[1].matchAll(/["'`]([^"'`]+)["'`]/g)].map(s => s[1]).join("\n") : "";
|
|
54
|
-
const combined = [`Tool: ${name}`, desc && `Description: ${desc.trim()}`, snippet && `Snippet: ${snippet}`, guides && `Guidelines:\n${guides}`].filter(Boolean).join("\n");
|
|
55
|
-
if (combined.length > 50)
|
|
56
|
-
tools[name] = combined;
|
|
57
|
-
}
|
|
58
|
-
return tools;
|
|
59
|
-
}
|
|
60
|
-
function toKebab(name) {
|
|
61
|
-
return name.replace(/_/g, "-").replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
62
|
-
}
|
|
63
|
-
// -- Target extraction -------------------------------------------------------
|
|
64
|
-
export function extractTargets(packageRoot) {
|
|
65
|
-
const root = packageRoot ?? findPackageRoot();
|
|
66
|
-
const targets = [];
|
|
67
|
-
// Prompt templates
|
|
68
|
-
const promptsFile = join(root, "src", "templates", "prompts.ts");
|
|
69
|
-
if (existsSync(promptsFile)) {
|
|
70
|
-
const src = readFileSync(promptsFile, "utf-8");
|
|
71
|
-
for (const n of ["WIKI_SYSTEM_PROMPT", "INGEST_PROMPT", "QUERY_PROMPT", "CAPTURE_SYSTEM_PROMPT", "CAPTURE_PROMPT", "EXPLICIT_CAPTURE_PROMPT", "SUMMARIZE_SYSTEM_PROMPT", "ITERATIVE_UPDATE_PROMPT", "OVERVIEW_PROMPT", "LINT_PROMPT"]) {
|
|
72
|
-
const c = extractTSConst(src, n);
|
|
73
|
-
if (c)
|
|
74
|
-
targets.push({ name: toKebab(n), type: "prompt", content: c, sourceFile: promptsFile });
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
// Maintainer + processor prompts
|
|
78
|
-
for (const [file, constName, targetName] of [
|
|
79
|
-
["src/maintainer.ts", "MAINTENANCE_SYSTEM_PROMPT", "maintenance-system-prompt"],
|
|
80
|
-
["src/processor.ts", "CAPTURE_SYSTEM_PROMPT", "processor-capture-prompt"],
|
|
81
|
-
]) {
|
|
82
|
-
const p = join(root, file);
|
|
83
|
-
if (existsSync(p)) {
|
|
84
|
-
const c = extractTSConst(readFileSync(p, "utf-8"), constName);
|
|
85
|
-
if (c)
|
|
86
|
-
targets.push({ name: targetName, type: "prompt", content: c, sourceFile: p });
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
// Tool instructions
|
|
90
|
-
const toolsFile = join(root, "src", "tools.ts");
|
|
91
|
-
if (existsSync(toolsFile)) {
|
|
92
|
-
for (const [n, c] of Object.entries(extractToolInstructions(readFileSync(toolsFile, "utf-8")))) {
|
|
93
|
-
targets.push({ name: `tool-${n}`, type: "tool", content: c, sourceFile: toolsFile });
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
// Skills
|
|
97
|
-
for (const s of ["para", "setup"]) {
|
|
98
|
-
const p = join(root, "skills", s, "SKILL.md");
|
|
99
|
-
if (existsSync(p)) {
|
|
100
|
-
const raw = readFileSync(p, "utf-8");
|
|
101
|
-
const body = raw.match(/^---\s*\n[\s\S]*?\n---\s*\n([\s\S]*)$/)?.[1]?.trim() ?? raw;
|
|
102
|
-
targets.push({ name: `skill-${s}`, type: "skill", content: body, sourceFile: p });
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
return targets;
|
|
106
|
-
}
|
|
107
|
-
// -- Auth env vars -----------------------------------------------------------
|
|
108
|
-
function getAuthEnvVars() {
|
|
109
|
-
const env = {};
|
|
110
|
-
try {
|
|
111
|
-
const auth = JSON.parse(readFileSync(join(homedir(), ".pi", "agent", "auth.json"), "utf-8"));
|
|
112
|
-
if (auth.anthropic?.access) {
|
|
113
|
-
env.ANTHROPIC_OAUTH_TOKEN = auth.anthropic.access;
|
|
114
|
-
env.ANTHROPIC_API_KEY = auth.anthropic.access;
|
|
115
|
-
}
|
|
116
|
-
else if (auth.anthropic?.key)
|
|
117
|
-
env.ANTHROPIC_API_KEY = auth.anthropic.key;
|
|
118
|
-
if (auth.minimax?.key)
|
|
119
|
-
env.MINIMAX_API_KEY = auth.minimax.key;
|
|
120
|
-
if (auth.openrouter?.key)
|
|
121
|
-
env.OPENROUTER_API_KEY = auth.openrouter.key;
|
|
122
|
-
else if (auth.openrouter?.openrouter_key)
|
|
123
|
-
env.OPENROUTER_API_KEY = auth.openrouter.openrouter_key;
|
|
124
|
-
}
|
|
125
|
-
catch {
|
|
126
|
-
try {
|
|
127
|
-
const raw = readFileSync(join(homedir(), ".config", "qmd", "index.yml"), "utf-8");
|
|
128
|
-
const m = raw.match(/chat:[\s\S]*?key:\s*(.+)/);
|
|
129
|
-
if (m) {
|
|
130
|
-
const k = m[1].trim();
|
|
131
|
-
if (raw.includes("minimaxi.com"))
|
|
132
|
-
env.MINIMAX_CN_API_KEY = k;
|
|
133
|
-
else
|
|
134
|
-
env.MINIMAX_API_KEY = k;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
catch { }
|
|
138
|
-
}
|
|
139
|
-
return env;
|
|
140
|
-
}
|
|
141
|
-
// -- Main orchestrator -------------------------------------------------------
|
|
142
|
-
export async function runGEPA(options = {}) {
|
|
143
|
-
const root = findPackageRoot();
|
|
144
|
-
const scriptsDir = join(root, "scripts", "gepa");
|
|
145
|
-
for (const d of [INPUT_DIR, OUTPUT_DIR, OPTIMIZED_DIR, HISTORY_DIR])
|
|
146
|
-
mkdirSync(d, { recursive: true });
|
|
147
|
-
// Load GEPA config from config.json (user-configurable defaults)
|
|
148
|
-
let gepaConfig = {};
|
|
149
|
-
try {
|
|
150
|
-
const cfg = JSON.parse(readFileSync(join(WIKI_DIR, "config.json"), "utf-8"));
|
|
151
|
-
gepaConfig = cfg.gepa ?? {};
|
|
152
|
-
}
|
|
153
|
-
catch { }
|
|
154
|
-
// Resolution: CLI flag → options → config.json → default
|
|
155
|
-
const studentModel = options.studentModel ?? options.model
|
|
156
|
-
?? gepaConfig.studentModel ?? "anthropic/claude-sonnet-4-20250514";
|
|
157
|
-
const teacherModel = options.teacherModel ?? options.reflectionModel
|
|
158
|
-
?? gepaConfig.teacherModel ?? "anthropic/claude-opus-4-6";
|
|
159
|
-
const judgeModel = options.judgeModel
|
|
160
|
-
?? gepaConfig.judgeModel ?? studentModel;
|
|
161
|
-
const auto = options.auto ?? gepaConfig.auto ?? "light";
|
|
162
|
-
const threads = options.threads ?? gepaConfig.threads ?? 2;
|
|
163
|
-
const seed = options.seed ?? gepaConfig.seed ?? 42;
|
|
164
|
-
const allTargets = extractTargets(root);
|
|
165
|
-
let targets = options.target ? allTargets.filter(t => t.name === options.target) : allTargets;
|
|
166
|
-
if (options.target && targets.length === 0)
|
|
167
|
-
throw new Error(`Target '${options.target}' not found. Available: ${allTargets.map(t => t.name).join(", ")}`);
|
|
168
|
-
console.log(`[gepa] Found ${targets.length} target(s) to optimize`);
|
|
169
|
-
console.log(`[gepa] Student: ${studentModel}, Teacher: ${teacherModel}, Judge: ${judgeModel}, Budget: ${auto}`);
|
|
170
|
-
const targetsFile = join(INPUT_DIR, "targets.json");
|
|
171
|
-
writeFileSync(targetsFile, JSON.stringify({ targets: targets.map(t => ({ name: t.name, type: t.type, content: t.content })) }, null, 2));
|
|
172
|
-
const outputFile = join(OUTPUT_DIR, "results.json");
|
|
173
|
-
const uvArgs = [
|
|
174
|
-
"run", "--project", scriptsDir, join(scriptsDir, "optimize.py"),
|
|
175
|
-
"--targets-file", targetsFile, "--wiki-dir", WIKI_DIR, "--output", outputFile,
|
|
176
|
-
"--model", studentModel,
|
|
177
|
-
"--reflection-model", teacherModel,
|
|
178
|
-
"--judge-model", judgeModel,
|
|
179
|
-
"--auto", auto,
|
|
180
|
-
"--threads", String(threads),
|
|
181
|
-
"--seed", String(seed),
|
|
182
|
-
...(options.maxMetricCalls ? ["--max-metric-calls", String(options.maxMetricCalls)] : []),
|
|
183
|
-
...(options.target ? ["--target", options.target] : []),
|
|
184
|
-
];
|
|
185
|
-
console.log(`[gepa] Running: uv ${uvArgs.slice(0, 6).join(" ")} ...`);
|
|
186
|
-
await new Promise((resolve, reject) => {
|
|
187
|
-
const proc = spawn("uv", uvArgs, { cwd: scriptsDir, env: { ...process.env, ...getAuthEnvVars() }, stdio: ["pipe", "inherit", "inherit"] });
|
|
188
|
-
proc.on("close", c => c === 0 ? resolve() : reject(new Error(`uv exited with code ${c}`)));
|
|
189
|
-
proc.on("error", e => reject(new Error(`Failed to spawn uv: ${e.message}`)));
|
|
190
|
-
});
|
|
191
|
-
if (!existsSync(outputFile))
|
|
192
|
-
throw new Error("Output file not created");
|
|
193
|
-
const output = JSON.parse(readFileSync(outputFile, "utf-8"));
|
|
194
|
-
for (const r of output.results) {
|
|
195
|
-
if (r.status === "success" && r.optimized_instruction) {
|
|
196
|
-
mkdirSync(OPTIMIZED_DIR, { recursive: true });
|
|
197
|
-
writeFileSync(join(OPTIMIZED_DIR, `${r.target}.txt`), r.optimized_instruction, "utf-8");
|
|
198
|
-
const hDir = join(HISTORY_DIR, r.target);
|
|
199
|
-
mkdirSync(hDir, { recursive: true });
|
|
200
|
-
writeFileSync(join(hDir, `${new Date().toISOString().replace(/[:.]/g, "-")}.json`), JSON.stringify(r, null, 2));
|
|
201
|
-
console.log(`[gepa] Saved optimized: ${r.target}`);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
return output;
|
|
205
|
-
}
|
|
206
|
-
// -- Query functions ---------------------------------------------------------
|
|
207
|
-
export function listOptimized() {
|
|
208
|
-
if (!existsSync(OPTIMIZED_DIR))
|
|
209
|
-
return [];
|
|
210
|
-
const results = [];
|
|
211
|
-
for (const f of readdirSync(OPTIMIZED_DIR).filter(f => f.endsWith(".txt"))) {
|
|
212
|
-
const name = f.replace(".txt", "");
|
|
213
|
-
let score = 0, timestamp = "", model = "";
|
|
214
|
-
try {
|
|
215
|
-
const entries = readdirSync(join(HISTORY_DIR, name)).filter(f => f.endsWith(".json")).sort().reverse();
|
|
216
|
-
if (entries[0]) {
|
|
217
|
-
const d = JSON.parse(readFileSync(join(HISTORY_DIR, name, entries[0]), "utf-8"));
|
|
218
|
-
score = d.optimized_score ?? 0;
|
|
219
|
-
timestamp = d.timestamp ?? "";
|
|
220
|
-
model = d.model ?? "";
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
catch { }
|
|
224
|
-
results.push({ name, score, timestamp, model });
|
|
225
|
-
}
|
|
226
|
-
return results;
|
|
227
|
-
}
|
|
228
|
-
export function compareTarget(targetName) {
|
|
229
|
-
const target = extractTargets().find(t => t.name === targetName);
|
|
230
|
-
if (!target)
|
|
231
|
-
return null;
|
|
232
|
-
try {
|
|
233
|
-
const opt = readFileSync(join(OPTIMIZED_DIR, `${targetName}.txt`), "utf-8");
|
|
234
|
-
return { original: target.content, optimized: opt };
|
|
235
|
-
}
|
|
236
|
-
catch {
|
|
237
|
-
return null;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
//# sourceMappingURL=index.js.map
|