@evomap/evolver-cli 2.0.0-beta.12 → 2.0.0-beta.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { algo, type signals } from '@evomap/evolver-core';
|
|
2
2
|
import type { NormalizedTurn } from '@evomap/evolver-runtime-adapters';
|
|
3
|
-
/** Short matchable signal tokens from
|
|
4
|
-
* signal yields ≥1 token: if it has no toolName and matches no known error class (e.g. `FAILED: …` or
|
|
3
|
+
/** Short matchable signal tokens from STRONG signals (error classes) and SUCCESS signals (verified capabilities).
|
|
4
|
+
* Every strong signal yields ≥1 token: if it has no toolName and matches no known error class (e.g. `FAILED: …` or
|
|
5
5
|
* `Error: connection refused`), it falls back to its kind (`structured_error`/`error_result`) so a real strong
|
|
6
6
|
* signal is never silently tokenless — keeping `signals_match.length === 0` an honest "no strong signal" gate.
|
|
7
|
+
* Success signals (#578) also produce tokens so a purely successful session can yield a matchable gene.
|
|
7
8
|
* Deduped, ≤8. */
|
|
8
9
|
export declare function signalTokens(sigs: readonly signals.ExtractedSignal[]): string[];
|
|
9
10
|
/** Draft strategy steps = the agent's own substantive (non-meta) turns — boundary-trimmed (never chopped
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// `evolver ingest --distill` and the live distillObserver reuse ONE copy (no forked distill logic). Zero behavior
|
|
3
3
|
// change vs the inline version: same tokens, same step drafting, same candidate shape. No I/O — the caller parses
|
|
4
4
|
// the session into turns + extracts signals; this turns them into a draft GeneCandidate (or null when too thin).
|
|
5
|
-
import { algo } from '@evomap/evolver-core';
|
|
5
|
+
import { algo, hub } from '@evomap/evolver-core';
|
|
6
6
|
// Map a strong signal's free-text to a SHORT, matchable token (so a gene's signals_match stays a few
|
|
7
7
|
// keywords, not a dumped error blob). Deterministic + testable; unknown errors fall back to the tool name only.
|
|
8
8
|
const SIGNAL_ERROR_CLASSES = [
|
|
@@ -14,10 +14,11 @@ const SIGNAL_ERROR_CLASSES = [
|
|
|
14
14
|
[/permission denied/i, 'permission-denied'],
|
|
15
15
|
[/timed?\s?out/i, 'timeout'],
|
|
16
16
|
];
|
|
17
|
-
/** Short matchable signal tokens from
|
|
18
|
-
* signal yields ≥1 token: if it has no toolName and matches no known error class (e.g. `FAILED: …` or
|
|
17
|
+
/** Short matchable signal tokens from STRONG signals (error classes) and SUCCESS signals (verified capabilities).
|
|
18
|
+
* Every strong signal yields ≥1 token: if it has no toolName and matches no known error class (e.g. `FAILED: …` or
|
|
19
19
|
* `Error: connection refused`), it falls back to its kind (`structured_error`/`error_result`) so a real strong
|
|
20
20
|
* signal is never silently tokenless — keeping `signals_match.length === 0` an honest "no strong signal" gate.
|
|
21
|
+
* Success signals (#578) also produce tokens so a purely successful session can yield a matchable gene.
|
|
21
22
|
* Deduped, ≤8. */
|
|
22
23
|
export function signalTokens(sigs) {
|
|
23
24
|
const set = new Set();
|
|
@@ -38,6 +39,22 @@ export function signalTokens(sigs) {
|
|
|
38
39
|
if (!matched)
|
|
39
40
|
set.add(s.kind);
|
|
40
41
|
}
|
|
42
|
+
// A later failure invalidates an earlier successful intermediate command. Conversely, fail-then-pass remains a
|
|
43
|
+
// valid repair history because the last deterministic outcome is the verified success.
|
|
44
|
+
const lastOutcome = sigs.findLast((s) => s.strength === 'strong' || s.strength === 'weak' || (s.strength === 'success' && !s.needsAnalysis));
|
|
45
|
+
const terminalSuccess = lastOutcome?.strength === 'success' && !lastOutcome.needsAnalysis;
|
|
46
|
+
// Only confirmed terminal success enters the deterministic path. Prose marked needsAnalysis is left to transcript
|
|
47
|
+
// LLM distillation instead of triggering a material cycle before analysis has happened.
|
|
48
|
+
for (const s of terminalSuccess ? sigs : []) {
|
|
49
|
+
if (s.strength !== 'success' || s.needsAnalysis)
|
|
50
|
+
continue;
|
|
51
|
+
if (s.toolName)
|
|
52
|
+
set.add(s.toolName);
|
|
53
|
+
if (s.kind === 'verified_success')
|
|
54
|
+
set.add('verified-success');
|
|
55
|
+
else
|
|
56
|
+
set.add(s.kind);
|
|
57
|
+
}
|
|
41
58
|
return [...set].slice(0, 8);
|
|
42
59
|
}
|
|
43
60
|
/** Trim free text to a clean step: collapse whitespace, and when longer than `cap` keep as much as fits, cutting
|
|
@@ -83,7 +100,7 @@ export function draftStrategy(turns) {
|
|
|
83
100
|
for (const t of turns) {
|
|
84
101
|
if (t.role !== 'assistant' || t.isMeta)
|
|
85
102
|
continue;
|
|
86
|
-
const raw = (t.text ?? '').replace(/\s+/g, ' ').trim();
|
|
103
|
+
const raw = hub.redactString(t.text ?? '').replace(/\s+/g, ' ').trim();
|
|
87
104
|
if (raw.length < 40)
|
|
88
105
|
continue; // too short to be a step
|
|
89
106
|
if (isNarrationOnly(raw))
|
|
@@ -96,6 +113,17 @@ export function draftStrategy(turns) {
|
|
|
96
113
|
}
|
|
97
114
|
return steps.slice(-6); // the latest substantive actions (closest to the resolution)
|
|
98
115
|
}
|
|
116
|
+
const GENERIC_SUCCESS_TOPICS = new Set([
|
|
117
|
+
'added', 'adjusted', 'assistant', 'change', 'changed', 'changes', 'command', 'commands', 'complete',
|
|
118
|
+
'completed', 'coverage', 'fixed', 'handling', 'implementation', 'passed', 'passing', 'regression', 'result',
|
|
119
|
+
'results', 'successful', 'successfully', 'tests', 'updated', 'validation', 'verified',
|
|
120
|
+
]);
|
|
121
|
+
function successTopicSignals(strategy) {
|
|
122
|
+
const text = strategy.join(' ');
|
|
123
|
+
return hub.extractTopicKeywords(text, undefined, 24, { minOccurrences: 1, preserveSourceOrder: true })
|
|
124
|
+
.filter((topic) => !GENERIC_SUCCESS_TOPICS.has(topic))
|
|
125
|
+
.slice(0, 4);
|
|
126
|
+
}
|
|
99
127
|
/**
|
|
100
128
|
* Assemble an UNPROVEN draft GeneCandidate from a parsed session, or null when too thin to distill (no strong
|
|
101
129
|
* signal OR no substantive step). The single source of the "what makes a draftable session" gate + candidate
|
|
@@ -105,10 +133,36 @@ export function draftStrategy(turns) {
|
|
|
105
133
|
export function draftGeneCandidate(turns, sigs, agent) {
|
|
106
134
|
const signals_match = signalTokens(sigs);
|
|
107
135
|
const strategy = draftStrategy(turns);
|
|
108
|
-
|
|
136
|
+
const hadVerifiedSuccess = sigs.some((s) => s.strength === 'success' && !s.needsAnalysis);
|
|
137
|
+
const hasTerminalVerifiedSuccess = signals_match.includes('verified-success');
|
|
138
|
+
// 当只有成功信号(没有错误信号)时,走 innovate 路径而非 repair (#578):
|
|
139
|
+
// 一次成功的问题解决过程不应被分类为 repair —— 它是一个可复用的成功能力。
|
|
140
|
+
const hasStrongError = sigs.some((s) => s.strength === 'strong');
|
|
141
|
+
if (signals_match.length === 0 || strategy.length === 0 || !hasStrongError) {
|
|
142
|
+
// Do not let the capability sniffer resurrect a success that a later unresolved outcome already superseded.
|
|
143
|
+
if (hadVerifiedSuccess && !hasTerminalVerifiedSuccess && !hasStrongError)
|
|
144
|
+
return null;
|
|
109
145
|
const hit = algo.sniffConversationCapabilities(turns)[0];
|
|
110
|
-
if (!hit)
|
|
146
|
+
if (!hit) {
|
|
147
|
+
// Sniffer 也未命中:如果有 success 信号和 strategy(仅当 hasStrongError 为 false 才走到这里且 signals_match 非空),
|
|
148
|
+
// 仍然产出 gene,但标记为 innovate —— 这是一个被验证的能力,而非错误修复。
|
|
149
|
+
if (signals_match.length > 0 && strategy.length > 0) {
|
|
150
|
+
const topics = successTopicSignals(strategy);
|
|
151
|
+
// Generic runner + success tokens are not a reusable capability identity. Let the optional transcript-LLM
|
|
152
|
+
// path handle prose that has no safe discriminating topic instead of storing one global shell-success gene.
|
|
153
|
+
if (topics.length === 0)
|
|
154
|
+
return null;
|
|
155
|
+
const successSignals = [...new Set([...signals_match, ...topics])].slice(0, 8);
|
|
156
|
+
return {
|
|
157
|
+
category: 'innovate',
|
|
158
|
+
signals_match: successSignals,
|
|
159
|
+
strategy,
|
|
160
|
+
summary: `Auto-drafted from ${agent} session (UNPROVEN — curate via review): ${topics.slice(0, 3).join(', ')}`,
|
|
161
|
+
generation_meta: { source: 'distilled' },
|
|
162
|
+
};
|
|
163
|
+
}
|
|
111
164
|
return null;
|
|
165
|
+
}
|
|
112
166
|
const fallbackStrategy = hit.evidence;
|
|
113
167
|
if (fallbackStrategy.length === 0)
|
|
114
168
|
return null;
|
|
@@ -149,6 +203,8 @@ const GENERIC_NOVELTY_SIGNALS = new Set([
|
|
|
149
203
|
'sh',
|
|
150
204
|
'cmd',
|
|
151
205
|
'command',
|
|
206
|
+
'verified-success',
|
|
207
|
+
'verified_success',
|
|
152
208
|
]);
|
|
153
209
|
function normalizeSignalSet(values) {
|
|
154
210
|
return new Set((values ?? []).map((value) => String(value).trim().toLowerCase()).filter(Boolean));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evomap/evolver-cli",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.13",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "evolver CLI (status/watch/cycles/rebuild-views/...)",
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@evomap/evolver-core": "2.0.0-beta.
|
|
24
|
-
"@evomap/evolver-adapter-public": "2.0.0-beta.
|
|
25
|
-
"@evomap/evolver-mcp": "2.0.0-beta.
|
|
26
|
-
"@evomap/evolver-proxy": "2.0.0-beta.
|
|
27
|
-
"@evomap/evolver-runtime-adapters": "2.0.0-beta.
|
|
28
|
-
"@evomap/evolver-webui": "2.0.0-beta.
|
|
23
|
+
"@evomap/evolver-core": "2.0.0-beta.13",
|
|
24
|
+
"@evomap/evolver-adapter-public": "2.0.0-beta.13",
|
|
25
|
+
"@evomap/evolver-mcp": "2.0.0-beta.13",
|
|
26
|
+
"@evomap/evolver-proxy": "2.0.0-beta.13",
|
|
27
|
+
"@evomap/evolver-runtime-adapters": "2.0.0-beta.13",
|
|
28
|
+
"@evomap/evolver-webui": "2.0.0-beta.13"
|
|
29
29
|
},
|
|
30
30
|
"repository": {
|
|
31
31
|
"type": "git",
|