@evomap/evolver-cli 2.0.0-beta.18 → 2.0.0-beta.19
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/antiGeneRollout.js +7 -3
- package/dist/assetTrust.js +14 -1
- package/dist/atp.d.ts +8 -3
- package/dist/atp.js +82 -11
- package/dist/atpAutoBuyer.d.ts +120 -0
- package/dist/atpAutoBuyer.js +814 -0
- package/dist/atpAutoDeliver.js +2 -2
- package/dist/autoDistillLlm.js +2 -1
- package/dist/autoDistillTranscript.js +3 -2
- package/dist/autoexec.d.ts +90 -13
- package/dist/autoexec.js +731 -84
- package/dist/cli.js +13 -0
- package/dist/cliContracts.d.ts +5 -2
- package/dist/cliContracts.js +135 -8
- package/dist/commands.d.ts +1 -0
- package/dist/commands.js +1 -0
- package/dist/curriculumCapabilityGaps.d.ts +6 -0
- package/dist/curriculumCapabilityGaps.js +24 -0
- package/dist/cycleConsumer.d.ts +4 -0
- package/dist/cycleConsumer.js +175 -20
- package/dist/dashboard.js +47 -9
- package/dist/dispatch.js +6 -2
- package/dist/distillPrimitives.js +18 -6
- package/dist/doctor.js +63 -5
- package/dist/identityHome.js +2 -1
- package/dist/index.d.ts +67 -39
- package/dist/index.js +504 -185
- package/dist/learningTrace.js +8 -2
- package/dist/lifecycle.d.ts +54 -1
- package/dist/lifecycle.js +489 -37
- package/dist/materialSnapshot.d.ts +9 -1
- package/dist/materialSnapshot.js +23 -6
- package/dist/migrate/envTranslate.d.ts +26 -0
- package/dist/migrate/envTranslate.js +145 -0
- package/dist/migrate/oauthImport.d.ts +66 -0
- package/dist/migrate/oauthImport.js +667 -0
- package/dist/migrate/v1Import.d.ts +13 -1
- package/dist/migrate/v1Import.js +621 -122
- package/dist/promptRecallHook.d.ts +24 -0
- package/dist/promptRecallHook.js +425 -0
- package/dist/recallVerifyReport.d.ts +37 -0
- package/dist/recallVerifyReport.js +244 -0
- package/dist/requiredSandboxValidation.d.ts +5 -0
- package/dist/requiredSandboxValidation.js +4 -0
- package/dist/reuse.d.ts +1 -0
- package/dist/reuse.js +45 -37
- package/dist/runtimeCapabilities.js +13 -13
- package/dist/runtimeSessionSource.d.ts +3 -2
- package/dist/runtimeSessionSource.js +63 -11
- package/dist/sessionIngest.d.ts +37 -0
- package/dist/sessionIngest.js +156 -0
- package/dist/setupHooks.js +95 -1
- package/dist/skill2gep.d.ts +4 -7
- package/dist/skill2gep.js +4 -21
- package/dist/solo/mode.js +1 -0
- package/dist/sync.js +125 -23
- package/dist/thesis.d.ts +1 -1
- package/dist/thesis.js +18 -3
- package/dist/trajectoryExport.js +21 -3
- package/dist/v1Compat.d.ts +1 -0
- package/dist/v1Compat.js +9 -0
- package/dist/workflowRuntime.js +24 -18
- package/package.json +10 -7
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { readdirSync } from 'node:fs';
|
|
2
|
+
import { join, resolve } from 'node:path';
|
|
3
|
+
import { events, material as materialNs, signals } from '@evomap/evolver-core';
|
|
4
|
+
import { isCursorStateVscdbPath } from '@evomap/evolver-runtime-adapters';
|
|
5
|
+
import { emitSessionRecall } from './autoRecall.js';
|
|
6
|
+
import { buildRuntimeSessionMaterialSnapshot } from './materialSnapshot.js';
|
|
7
|
+
import { isRuntimeSessionSourcePath, parseRuntimeSessionSourcesWithDiagnostics, } from './runtimeSessionSource.js';
|
|
8
|
+
/** Material consumer group shared by ingestion and the downstream cycle consumer. */
|
|
9
|
+
export const INGEST_CONSUMER_GROUP = 'cycle';
|
|
10
|
+
export function resolveIngestDeps(deps) {
|
|
11
|
+
return {
|
|
12
|
+
materialStore: deps.materialStore ?? new materialNs.MaterialStore({ path: events.materialStorePath() }),
|
|
13
|
+
watermarkStore: deps.watermarkStore ?? new materialNs.WatermarkStore(events.materialWatermarkPath()),
|
|
14
|
+
ingestor: deps.ingestor ?? new events.Ingestor({ path: events.rootEventsPath() }),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
const MATERIAL_SOURCE_AGENTS = new Set([
|
|
18
|
+
'claude-code',
|
|
19
|
+
'codex',
|
|
20
|
+
'cursor',
|
|
21
|
+
'gemini',
|
|
22
|
+
'antigravity',
|
|
23
|
+
'kimi',
|
|
24
|
+
'kiro',
|
|
25
|
+
'opencode',
|
|
26
|
+
'generic-chat',
|
|
27
|
+
]);
|
|
28
|
+
export function toMaterialSourceAgent(agent) {
|
|
29
|
+
return MATERIAL_SOURCE_AGENTS.has(agent) ? agent : undefined;
|
|
30
|
+
}
|
|
31
|
+
function materialExistsFor(store, sourcePath, watermark) {
|
|
32
|
+
if (watermark.contentHash === undefined)
|
|
33
|
+
return false;
|
|
34
|
+
for (const material of store.iterate()) {
|
|
35
|
+
if (material.sourcePath === sourcePath
|
|
36
|
+
&& material.watermark.size === watermark.size
|
|
37
|
+
&& material.watermark.contentHash === watermark.contentHash)
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
export async function recordSessionMaterial(sourceAgent, absPath, signalCount, deps, recordCount = 1, payload, diagnostics) {
|
|
43
|
+
const previous = deps.watermarkStore.get(absPath);
|
|
44
|
+
const scan = materialNs.scanFile(absPath, previous);
|
|
45
|
+
if (previous && !scan.changed)
|
|
46
|
+
return { recorded: false, emitted: false };
|
|
47
|
+
const material = materialNs.buildMaterial({
|
|
48
|
+
sourceAgent,
|
|
49
|
+
sourceKind: 'runtime_session',
|
|
50
|
+
sourcePath: absPath,
|
|
51
|
+
kind: 'session_log',
|
|
52
|
+
watermark: scan.watermark,
|
|
53
|
+
consumerGroup: INGEST_CONSUMER_GROUP,
|
|
54
|
+
...(payload ? { payload } : {}),
|
|
55
|
+
});
|
|
56
|
+
const isNew = !materialExistsFor(deps.materialStore, absPath, scan.watermark);
|
|
57
|
+
if (isNew)
|
|
58
|
+
await deps.materialStore.put(material);
|
|
59
|
+
const parseDiagnostics = diagnostics && diagnostics.invalidJson > 0
|
|
60
|
+
? { rowsScanned: diagnostics.rowsScanned, rowsRead: diagnostics.rowsRead, invalidJson: diagnostics.invalidJson }
|
|
61
|
+
: undefined;
|
|
62
|
+
await deps.ingestor.ingest({
|
|
63
|
+
type: 'material.batch_ready',
|
|
64
|
+
payload: { source: absPath, recordCount, signalCount, ...(parseDiagnostics ? { parseDiagnostics } : {}) },
|
|
65
|
+
human: {
|
|
66
|
+
title: `material 已落地: ${sourceAgent} session`,
|
|
67
|
+
...(parseDiagnostics ? { detail: `skipped ${parseDiagnostics.invalidJson} invalid JSONL row(s)` } : {}),
|
|
68
|
+
severity: 'info',
|
|
69
|
+
},
|
|
70
|
+
actor: { kind: 'machine' },
|
|
71
|
+
});
|
|
72
|
+
deps.watermarkStore.set(absPath, scan.watermark);
|
|
73
|
+
return { recorded: isNew, emitted: true, materialId: material.materialId };
|
|
74
|
+
}
|
|
75
|
+
/** Recursively enumerate recognized runtime-session sources, skipping inaccessible directories. */
|
|
76
|
+
export function scanSessionDirs(dirs) {
|
|
77
|
+
const out = [];
|
|
78
|
+
for (const dir of dirs) {
|
|
79
|
+
let entries;
|
|
80
|
+
try {
|
|
81
|
+
entries = readdirSync(resolve(dir), { recursive: true });
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
for (const entry of entries) {
|
|
87
|
+
const file = join(resolve(dir), entry);
|
|
88
|
+
if (isRuntimeSessionSourcePath(file))
|
|
89
|
+
out.push(file);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return out;
|
|
93
|
+
}
|
|
94
|
+
function sortedStrings(values) {
|
|
95
|
+
return [...new Set([...values].map(String).filter(Boolean))].sort();
|
|
96
|
+
}
|
|
97
|
+
/** Record all new or changed runtime sessions as material for the auto-distill loop. */
|
|
98
|
+
export async function runSessionIngestTick(dirs, deps = {}) {
|
|
99
|
+
const resolvedDeps = resolveIngestDeps(deps);
|
|
100
|
+
let recorded = 0;
|
|
101
|
+
const sourceAgents = new Set();
|
|
102
|
+
const signalKinds = new Set();
|
|
103
|
+
const signalStrengths = new Set();
|
|
104
|
+
let invalidJsonRows = 0;
|
|
105
|
+
let parseFailures = 0;
|
|
106
|
+
const autoRecallOn = process.env['EVOLVER_AUTO_RECALL'] === '1';
|
|
107
|
+
for (const file of scanSessionDirs(dirs)) {
|
|
108
|
+
let parsed;
|
|
109
|
+
try {
|
|
110
|
+
parsed = parseRuntimeSessionSourcesWithDiagnostics(file, undefined, deps.nativeSessionHome);
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
if (isCursorStateVscdbPath(file))
|
|
114
|
+
parseFailures += 1;
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
try {
|
|
118
|
+
const parsedSources = parsed.sources;
|
|
119
|
+
const agent = parsedSources[0] ? toMaterialSourceAgent(parsedSources[0].agent) : undefined;
|
|
120
|
+
if (parsedSources.length === 0 || !agent)
|
|
121
|
+
continue;
|
|
122
|
+
const signalsBySource = parsedSources.map((source) => signals.extractSignals(source.turns));
|
|
123
|
+
const snapshot = buildRuntimeSessionMaterialSnapshot(parsedSources);
|
|
124
|
+
const result = await recordSessionMaterial(agent, file, signalsBySource.reduce((sum, sourceSignals) => sum + sourceSignals.length, 0), resolvedDeps, parsedSources.length, snapshot, parsed.diagnostics);
|
|
125
|
+
if (result.emitted)
|
|
126
|
+
invalidJsonRows += parsed.diagnostics.invalidJson;
|
|
127
|
+
if (result.recorded) {
|
|
128
|
+
recorded += 1;
|
|
129
|
+
sourceAgents.add(agent);
|
|
130
|
+
for (const sourceSignals of signalsBySource) {
|
|
131
|
+
for (const signal of sourceSignals) {
|
|
132
|
+
signalKinds.add(signal.kind);
|
|
133
|
+
signalStrengths.add(signal.strength);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (autoRecallOn && parsedSources.length === 1 && !parsedSources[0].sessionId) {
|
|
138
|
+
const turns = parsedSources[0].turns
|
|
139
|
+
.filter((turn) => !turn.isMeta)
|
|
140
|
+
.map((turn) => ({ role: turn.role, text: turn.text }));
|
|
141
|
+
await emitSessionRecall(file, turns, { ingestor: resolvedDeps.ingestor });
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
// Individual session files are best-effort and must not stop the daemon scan.
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return {
|
|
149
|
+
recorded,
|
|
150
|
+
sourceAgents: sortedStrings(sourceAgents),
|
|
151
|
+
signalKinds: sortedStrings(signalKinds),
|
|
152
|
+
signalStrengths: sortedStrings(signalStrengths),
|
|
153
|
+
...(invalidJsonRows > 0 ? { invalidJsonRows } : {}),
|
|
154
|
+
...(parseFailures > 0 ? { parseFailures } : {}),
|
|
155
|
+
};
|
|
156
|
+
}
|
package/dist/setupHooks.js
CHANGED
|
@@ -36,7 +36,7 @@ function parseFlags(argv) {
|
|
|
36
36
|
}
|
|
37
37
|
return out;
|
|
38
38
|
}
|
|
39
|
-
const USAGE = `usage: evolver setup-hooks [--runtime=${SETUP_RUNTIMES.join('|')}] [--scope=user|project|global] [--root=<dir>] [--env-file=<path>] [--profile-descriptor=<json>] [--service=${SERVICE_TARGETS.join('|')}] [--uninstall] [--dry-run] [--force] [--json] [--hook-command="evolver inject session-start"] [--server-command=<cmd>] [--server-args=a,b] [--service-command=<cmd>] [--service-args=a,b]\n`;
|
|
39
|
+
const USAGE = `usage: evolver setup-hooks [--runtime=${SETUP_RUNTIMES.join('|')}] [--scope=user|project|global] [--root=<dir>] [--env-file=<path>] [--profile-descriptor=<json>] [--service=${SERVICE_TARGETS.join('|')}] [--verify] [--uninstall] [--dry-run] [--force] [--json] [--hook-command="evolver inject session-start"] [--server-command=<cmd>] [--server-args=a,b] [--service-command=<cmd>] [--service-args=a,b]\n --verify is read-only for opencode and kiro\n`;
|
|
40
40
|
export function commandNamesForPath(command, platform, pathExt) {
|
|
41
41
|
if (platform !== 'win32' || /\.[^\\/]+$/.test(command))
|
|
42
42
|
return [command];
|
|
@@ -402,7 +402,27 @@ function appendAdapterNotes(text, hints) {
|
|
|
402
402
|
? `${text}\n\nAdapter notes:\n${hints.map((hint) => ` - ${hint}`).join('\n')}`
|
|
403
403
|
: text;
|
|
404
404
|
}
|
|
405
|
+
const SETUP_VALUE_FLAGS = new Set([
|
|
406
|
+
'runtime', 'platform', 'scope', 'root', 'env-file', 'profile-descriptor', 'service',
|
|
407
|
+
'hook-command', 'server-command', 'server-args', 'service-command', 'service-args',
|
|
408
|
+
]);
|
|
409
|
+
function setupHelpRequested(argv) {
|
|
410
|
+
if (argv.includes('--help'))
|
|
411
|
+
return true;
|
|
412
|
+
return argv.some((arg, index) => {
|
|
413
|
+
if (arg !== '-h')
|
|
414
|
+
return false;
|
|
415
|
+
const previous = argv[index - 1];
|
|
416
|
+
if (!previous?.startsWith('--') || previous.includes('='))
|
|
417
|
+
return true;
|
|
418
|
+
return !SETUP_VALUE_FLAGS.has(previous.slice(2));
|
|
419
|
+
});
|
|
420
|
+
}
|
|
405
421
|
export async function runSetupHooks(argv, store, review, deps = {}) {
|
|
422
|
+
if (setupHelpRequested(argv)) {
|
|
423
|
+
process.stdout.write(USAGE);
|
|
424
|
+
return 0;
|
|
425
|
+
}
|
|
406
426
|
const f = parseFlags(argv);
|
|
407
427
|
const runtimeRaw = typeof f['runtime'] === 'string'
|
|
408
428
|
? f['runtime']
|
|
@@ -434,6 +454,80 @@ export async function runSetupHooks(argv, store, review, deps = {}) {
|
|
|
434
454
|
const configRoot = typeof f['root'] === 'string' ? f['root'] : process.cwd();
|
|
435
455
|
// claude-code: user scope targets ~/.claude.json regardless of --root; project scope uses configRoot.
|
|
436
456
|
const scope = scopeResult.scope;
|
|
457
|
+
// V1 exposed setup-hooks --verify as a read-only operation. Silently ignoring it is unsafe: the command then
|
|
458
|
+
// falls through to installInjection and can rewrite runtime configuration while the operator asked only to
|
|
459
|
+
// inspect it. V2's JSON MCP installers already have a transaction-free dry-run preflight, so use that as the
|
|
460
|
+
// verifier for OpenCode and Kiro. Legacy installers do not have a proven read-only preflight and must refuse.
|
|
461
|
+
if (f['verify'] !== undefined) {
|
|
462
|
+
const verificationArgsValid = f['verify'] === true
|
|
463
|
+
&& f['uninstall'] === undefined
|
|
464
|
+
&& f['dry-run'] === undefined
|
|
465
|
+
&& f['force'] === undefined;
|
|
466
|
+
if (!verificationArgsValid) {
|
|
467
|
+
const error = '--verify is read-only and cannot take a value or be combined with --uninstall, --dry-run, or --force';
|
|
468
|
+
if (json)
|
|
469
|
+
emit({ runtime, action: 'verify', ok: false, verified: false, files: [], error });
|
|
470
|
+
else
|
|
471
|
+
process.stderr.write(`${error}\n${USAGE}`);
|
|
472
|
+
return 2;
|
|
473
|
+
}
|
|
474
|
+
if (runtime !== 'opencode' && runtime !== 'kiro') {
|
|
475
|
+
const error = `--verify is not available for ${runtime}; no config was written`;
|
|
476
|
+
if (json)
|
|
477
|
+
emit({ runtime, action: 'verify', ok: false, verified: false, files: [], error });
|
|
478
|
+
else
|
|
479
|
+
process.stderr.write(`${error}\n`);
|
|
480
|
+
return 2;
|
|
481
|
+
}
|
|
482
|
+
const verifyDescriptor = profileDescriptorFromFlag(f);
|
|
483
|
+
if (!verifyDescriptor.ok) {
|
|
484
|
+
if (json)
|
|
485
|
+
emit({ runtime, action: 'verify', ok: false, verified: false, files: [], error: verifyDescriptor.error });
|
|
486
|
+
else
|
|
487
|
+
process.stderr.write(`${verifyDescriptor.error}\n`);
|
|
488
|
+
return 1;
|
|
489
|
+
}
|
|
490
|
+
let verification;
|
|
491
|
+
try {
|
|
492
|
+
const server = buildServer(f, verifyDescriptor.descriptor);
|
|
493
|
+
verification = installInjection(planInjection(runtime, server), {
|
|
494
|
+
configRoot,
|
|
495
|
+
server,
|
|
496
|
+
scope,
|
|
497
|
+
dryRun: true,
|
|
498
|
+
homeDir: homedir(),
|
|
499
|
+
kiroHome: process.env['KIRO_HOME'],
|
|
500
|
+
xdgConfigHome: process.env['XDG_CONFIG_HOME'],
|
|
501
|
+
opencodeConfig: process.env['OPENCODE_CONFIG'],
|
|
502
|
+
opencodeConfigDir: process.env['OPENCODE_CONFIG_DIR'],
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
catch (error) {
|
|
506
|
+
const message = safeSetupOperationError(error);
|
|
507
|
+
if (json)
|
|
508
|
+
emit({ runtime, action: 'verify', ok: false, verified: false, files: [], error: message });
|
|
509
|
+
else
|
|
510
|
+
process.stderr.write(`${message}\n`);
|
|
511
|
+
return 1;
|
|
512
|
+
}
|
|
513
|
+
if (!verification.ok) {
|
|
514
|
+
const message = safeSetupResultError(verification.error);
|
|
515
|
+
if (json)
|
|
516
|
+
emit({ runtime, action: 'verify', ok: false, verified: false, files: [], error: message });
|
|
517
|
+
else
|
|
518
|
+
process.stderr.write(`${message}\n`);
|
|
519
|
+
return 1;
|
|
520
|
+
}
|
|
521
|
+
const files = displayResultPaths(verification.files, configRoot, scope) ?? [];
|
|
522
|
+
const verified = verification.alreadyInstalled === true && verification.verified === true;
|
|
523
|
+
if (json)
|
|
524
|
+
emit({ runtime, action: 'verify', ok: verified, verified, files });
|
|
525
|
+
else
|
|
526
|
+
process.stdout.write(verified
|
|
527
|
+
? `verified evolver setup for ${runtime}: ${files.join(', ')}\n`
|
|
528
|
+
: `evolver setup for ${runtime} is missing or does not match the requested configuration\n`);
|
|
529
|
+
return verified ? 0 : 1;
|
|
530
|
+
}
|
|
437
531
|
if (f['dry-run'] === true && runtime !== 'opencode' && runtime !== 'kiro') {
|
|
438
532
|
const error = `--dry-run is currently supported for opencode and kiro setup only; no config was written.`;
|
|
439
533
|
if (json)
|
package/dist/skill2gep.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { type algo, type wire } from '@evomap/evolver-core';
|
|
1
|
+
import { type algo, type wire, verify } from '@evomap/evolver-core';
|
|
2
|
+
declare const isValidationCommandAllowed: typeof verify.isValidationCommandAllowed;
|
|
3
|
+
export { isValidationCommandAllowed };
|
|
2
4
|
type GenerationSource = wire.GenerationSource;
|
|
3
5
|
/** Max strategy steps kept from a skill (v1 parity: MAX_STRATEGY_STEPS). */
|
|
4
6
|
export declare const MAX_STRATEGY_STEPS = 28;
|
|
@@ -24,10 +26,6 @@ export interface ParseSkillMdOptions {
|
|
|
24
26
|
* tokenizer keeps ASCII `[a-z0-9_]` only, so a CJK skill's signals come from its (English) frontmatter description.
|
|
25
27
|
*/
|
|
26
28
|
export declare function parseSkillMd(skillMd: string, opts?: ParseSkillMdOptions): ParsedSkill;
|
|
27
|
-
/** Whether a validation command is safe to run as a Gene.validation entry (faithful port of v1
|
|
28
|
-
* policyCheck.isValidationCommandAllowed): a `node …` command with no command substitution, no shell
|
|
29
|
-
* metacharacters (outside quoted strings), and no node eval flags (-e/--eval/--print/-p). */
|
|
30
|
-
export declare function isValidationCommandAllowed(cmd: string): boolean;
|
|
31
29
|
/** Infer a gene category from signals + description (v1 inferCategory): priority repair > innovate > optimize,
|
|
32
30
|
* substring match (catches inflections + underscore signal tokens like `log_error`). */
|
|
33
31
|
export declare function inferCategory(signals: readonly string[], description: string): string;
|
|
@@ -176,5 +174,4 @@ export interface ReverseDistillResult {
|
|
|
176
174
|
export declare function reverseDistill(parsed: ParsedSkill, execution?: SkillExecution, opts?: SynthesizeOptions & {
|
|
177
175
|
scenario?: string;
|
|
178
176
|
evidenceMode?: SkillEvidenceMode;
|
|
179
|
-
}): ReverseDistillResult;
|
|
180
|
-
export {};
|
|
177
|
+
}): ReverseDistillResult;
|
package/dist/skill2gep.js
CHANGED
|
@@ -4,15 +4,16 @@
|
|
|
4
4
|
// faithful to v1 (golden-tested). B2 adds `synthesizeGene` + the Capsule contracts (trace-only / empty→Gene-only /
|
|
5
5
|
// validation-coverage); the human-review + real-trace red lines live there.
|
|
6
6
|
import { createHash } from 'node:crypto';
|
|
7
|
-
import { bootstrap } from '@evomap/evolver-core';
|
|
7
|
+
import { bootstrap, verify } from '@evomap/evolver-core';
|
|
8
|
+
const { isValidationCommandAllowed } = verify;
|
|
9
|
+
// Re-export for backward compatibility (used by tests)
|
|
10
|
+
export { isValidationCommandAllowed };
|
|
8
11
|
/** Max strategy steps kept from a skill (v1 parity: MAX_STRATEGY_STEPS). */
|
|
9
12
|
export const MAX_STRATEGY_STEPS = 28;
|
|
10
13
|
/** Gene id prefix for skill-distilled genes (v1 SKILL2GEP_ID_PREFIX). */
|
|
11
14
|
const SKILL2GEP_ID_PREFIX = 'gene_s2g_';
|
|
12
15
|
/** Default max-files constraint for a distilled gene (v1 skillDistiller.DISTILLED_MAX_FILES). */
|
|
13
16
|
const SKILL_MAX_FILES = 12;
|
|
14
|
-
/** Validation-command allowlist prefixes (v1 policyCheck): only `node …` is a runnable Gene.validation entry. */
|
|
15
|
-
const VALIDATION_ALLOWED_PREFIXES = ['node '];
|
|
16
17
|
function sectionHeadingMatches(heading, keyword) {
|
|
17
18
|
if (/^[a-z0-9 ]+$/i.test(keyword)) {
|
|
18
19
|
const forms = keyword === 'verify'
|
|
@@ -155,24 +156,6 @@ export function parseSkillMd(skillMd, opts = {}) {
|
|
|
155
156
|
preconditions: preconditions.slice(0, 4),
|
|
156
157
|
};
|
|
157
158
|
}
|
|
158
|
-
/** Whether a validation command is safe to run as a Gene.validation entry (faithful port of v1
|
|
159
|
-
* policyCheck.isValidationCommandAllowed): a `node …` command with no command substitution, no shell
|
|
160
|
-
* metacharacters (outside quoted strings), and no node eval flags (-e/--eval/--print/-p). */
|
|
161
|
-
export function isValidationCommandAllowed(cmd) {
|
|
162
|
-
const c = String(cmd || '').trim();
|
|
163
|
-
if (!c)
|
|
164
|
-
return false;
|
|
165
|
-
if (!VALIDATION_ALLOWED_PREFIXES.some((p) => c.startsWith(p)))
|
|
166
|
-
return false;
|
|
167
|
-
if (/`|\$\(/.test(c))
|
|
168
|
-
return false; // no command substitution
|
|
169
|
-
const stripped = c.replace(/"[^"]*"/g, '').replace(/'[^']*'/g, ''); // ignore metachars inside quotes
|
|
170
|
-
if (/[;&|><]/.test(stripped))
|
|
171
|
-
return false; // no chaining / redirection
|
|
172
|
-
if (/^node\s+(-e|--eval|--print|-p)\b/.test(c))
|
|
173
|
-
return false; // no inline eval
|
|
174
|
-
return true;
|
|
175
|
-
}
|
|
176
159
|
/** Stable slug for a skill-distilled gene id (v1 slugify). */
|
|
177
160
|
function slugify(s) {
|
|
178
161
|
return String(s || '').toLowerCase().replace(/[^a-z0-9]+/g, '_').replace(/^_+|_+$/g, '').slice(0, 60);
|
package/dist/solo/mode.js
CHANGED
|
@@ -34,6 +34,7 @@ export function applySoloLockdown(env = process.env) {
|
|
|
34
34
|
EVOLVER_ATP: 'off',
|
|
35
35
|
EVOLVER_ATP_AUTOBUY: 'off',
|
|
36
36
|
EVOLVER_ATP_AUTODELIVER: 'off',
|
|
37
|
+
EVOLVER_LEARNING_TRACE_UPLOAD: '0',
|
|
37
38
|
// Empty hub creds so any lower-level connector short-circuits.
|
|
38
39
|
A2A_HUB_URL: '',
|
|
39
40
|
EVOMAP_HUB_URL: '',
|