@evomap/evolver-cli 2.0.0-beta.1 → 2.0.0-beta.10

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.
Files changed (86) hide show
  1. package/dist/antiGeneBenchmark.js +12 -0
  2. package/dist/antiGeneEvidence.d.ts +15 -0
  3. package/dist/antiGeneEvidence.js +49 -0
  4. package/dist/antiGeneRollout.d.ts +3 -1
  5. package/dist/antiGeneRollout.js +16 -2
  6. package/dist/assetHealth.d.ts +6 -0
  7. package/dist/assetHealth.js +105 -0
  8. package/dist/assetSidecarRecovery.d.ts +14 -0
  9. package/dist/assetSidecarRecovery.js +171 -0
  10. package/dist/assetTrust.d.ts +24 -0
  11. package/dist/assetTrust.js +218 -0
  12. package/dist/atp.js +4 -2
  13. package/dist/autoDistillLlm.d.ts +6 -0
  14. package/dist/autoDistillLlm.js +44 -7
  15. package/dist/autoexec.d.ts +14 -12
  16. package/dist/autoexec.js +84 -34
  17. package/dist/autoexecConfig.d.ts +10 -0
  18. package/dist/autoexecConfig.js +68 -0
  19. package/dist/cli.js +12 -5
  20. package/dist/cliContracts.js +30 -3
  21. package/dist/cliLifecycle.d.ts +7 -0
  22. package/dist/cliLifecycle.js +9 -0
  23. package/dist/cycleConsumer.d.ts +61 -1
  24. package/dist/cycleConsumer.js +551 -16
  25. package/dist/dashboard.d.ts +33 -0
  26. package/dist/dashboard.js +352 -0
  27. package/dist/dispatch.d.ts +10 -1
  28. package/dist/dispatch.js +40 -2
  29. package/dist/distillAdmission.d.ts +13 -0
  30. package/dist/distillAdmission.js +35 -0
  31. package/dist/distillObserver.js +6 -8
  32. package/dist/distillPrimitives.d.ts +9 -7
  33. package/dist/distillPrimitives.js +65 -12
  34. package/dist/doctor.d.ts +2 -0
  35. package/dist/doctor.js +49 -3
  36. package/dist/index.d.ts +8 -2
  37. package/dist/index.js +350 -42
  38. package/dist/issueReport.d.ts +7 -0
  39. package/dist/issueReport.js +291 -0
  40. package/dist/lifecycle.d.ts +19 -1
  41. package/dist/lifecycle.js +226 -29
  42. package/dist/localMemoryGraph.d.ts +97 -0
  43. package/dist/localMemoryGraph.js +889 -0
  44. package/dist/login.d.ts +20 -4
  45. package/dist/login.js +58 -8
  46. package/dist/materialPackage.d.ts +52 -0
  47. package/dist/materialPackage.js +401 -0
  48. package/dist/materialSnapshot.d.ts +54 -0
  49. package/dist/materialSnapshot.js +370 -0
  50. package/dist/memoryEventMirror.d.ts +23 -0
  51. package/dist/memoryEventMirror.js +140 -0
  52. package/dist/migrate/fieldMap.js +25 -0
  53. package/dist/migrate/v1Import.d.ts +7 -1
  54. package/dist/migrate/v1Import.js +132 -11
  55. package/dist/nonGitWorkspaceNotice.d.ts +24 -0
  56. package/dist/nonGitWorkspaceNotice.js +122 -0
  57. package/dist/proxyToken.d.ts +10 -0
  58. package/dist/proxyToken.js +80 -0
  59. package/dist/recipe.d.ts +12 -2
  60. package/dist/recipe.js +381 -8
  61. package/dist/reuse.d.ts +5 -3
  62. package/dist/reuse.js +74 -6
  63. package/dist/reuseReport.js +16 -16
  64. package/dist/runtimeCapabilities.d.ts +18 -0
  65. package/dist/runtimeCapabilities.js +81 -0
  66. package/dist/runtimeSessionSource.d.ts +10 -0
  67. package/dist/runtimeSessionSource.js +32 -5
  68. package/dist/setupHooks.d.ts +11 -1
  69. package/dist/setupHooks.js +235 -16
  70. package/dist/skill2gep.d.ts +38 -9
  71. package/dist/skill2gep.js +147 -14
  72. package/dist/skillDistill.d.ts +1 -0
  73. package/dist/skillDistill.js +4 -4
  74. package/dist/skillFetch.d.ts +18 -0
  75. package/dist/skillFetch.js +391 -0
  76. package/dist/solo/mode.js +5 -0
  77. package/dist/sync.d.ts +38 -0
  78. package/dist/sync.js +1981 -0
  79. package/dist/trajectoryExport.js +23 -12
  80. package/dist/v1Compat.d.ts +24 -0
  81. package/dist/v1Compat.js +249 -0
  82. package/dist/workflow.d.ts +39 -0
  83. package/dist/workflow.js +386 -0
  84. package/dist/workflowRuntime.d.ts +66 -0
  85. package/dist/workflowRuntime.js +631 -0
  86. package/package.json +12 -6
@@ -1,3 +1,8 @@
1
+ // Distill primitives (#117 A1) — the PURE session→gene-draft logic, extracted from runIngest so the one-shot
2
+ // `evolver ingest --distill` and the live distillObserver reuse ONE copy (no forked distill logic). Zero behavior
3
+ // change vs the inline version: same tokens, same step drafting, same candidate shape. No I/O — the caller parses
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';
1
6
  // Map a strong signal's free-text to a SHORT, matchable token (so a gene's signals_match stays a few
2
7
  // keywords, not a dumped error blob). Deterministic + testable; unknown errors fall back to the tool name only.
3
8
  const SIGNAL_ERROR_CLASSES = [
@@ -100,28 +105,71 @@ export function draftStrategy(turns) {
100
105
  export function draftGeneCandidate(turns, sigs, agent) {
101
106
  const signals_match = signalTokens(sigs);
102
107
  const strategy = draftStrategy(turns);
103
- if (signals_match.length === 0 || strategy.length === 0)
104
- return null;
108
+ if (signals_match.length === 0 || strategy.length === 0) {
109
+ const hit = algo.sniffConversationCapabilities(turns)[0];
110
+ if (!hit)
111
+ return null;
112
+ const fallbackStrategy = hit.evidence;
113
+ if (fallbackStrategy.length === 0)
114
+ return null;
115
+ return {
116
+ category: 'innovate',
117
+ signals_match: hit.signals,
118
+ strategy: fallbackStrategy.slice(0, 6),
119
+ summary: `Auto-drafted verified capability from ${agent} session (UNPROVEN — curate via review): ${hit.summary}`,
120
+ preconditions: [
121
+ 'A live agent conversation explicitly described a reusable capability.',
122
+ 'The same conversation included validation or successful tool evidence.',
123
+ ],
124
+ validation: ['node --version'],
125
+ generation_meta: { source: 'distilled' },
126
+ };
127
+ }
105
128
  return {
106
129
  category: 'repair',
107
130
  signals_match,
108
131
  strategy,
109
132
  summary: `Auto-drafted from ${agent} session (UNPROVEN — curate via review): ${signals_match.slice(0, 3).join(', ')}`,
133
+ // A session-distilled gene has execution evidence (the session's turns) but no verified fail→pass-with-blast
134
+ // trajectory → `distilled` per V1 #302 classifyProvenance. Tagged so future governance/selection can grade it
135
+ // apart from evolved (solve→fail→mutate→pass) and manual (human-taught) genes.
136
+ generation_meta: { source: 'distilled' },
110
137
  };
111
138
  }
139
+ // Signals injected by the fallback itself, plus generic command runners, carry no domain identity. Including them
140
+ // in Jaccard makes unrelated capabilities (for example GitHub vs Playwright) look 60% identical even though their
141
+ // one discriminating signal differs. Keep them for exact-subset detection, but omit them from soft similarity.
142
+ const GENERIC_NOVELTY_SIGNALS = new Set([
143
+ 'reusable_capability',
144
+ 'verified_workflow',
145
+ 'shell_command',
146
+ 'bash',
147
+ 'powershell',
148
+ 'pwsh',
149
+ 'sh',
150
+ 'cmd',
151
+ 'command',
152
+ ]);
153
+ function normalizeSignalSet(values) {
154
+ return new Set((values ?? []).map((value) => String(value).trim().toLowerCase()).filter(Boolean));
155
+ }
156
+ function noveltySignalSet(signals) {
157
+ const discriminating = [...signals].filter((signal) => !GENERIC_NOVELTY_SIGNALS.has(signal));
158
+ return discriminating.length > 0 ? new Set(discriminating) : signals;
159
+ }
112
160
  /**
113
161
  * Value/novelty gate run BEFORE a draft is quarantined (#117 improvement 3). `intakeGene` already rejects
114
- * empty/structurally-invalid candidates and EXACT signal subsets (fullyOverlaps), but two kinds of noise still
115
- * reach the human review queue: drafts too thin to be worth reviewing (one weak signal, one vague step), and
116
- * near-duplicates that escape the subset check by carrying one extra signal. Unattended auto-distill turns that
117
- * trickle into a flood, and a review gate nobody reads is no gate. This adds a substance floor + a SOFT similarity
118
- * reject. Pure and deterministic; the caller decides what to do with a non-admit (skip, never an error).
162
+ * empty/structurally-invalid candidates and EXACT signal subsets (fullyOverlaps). Admission mirrors that subset
163
+ * check so a duplicate is a per-candidate skip instead of aborting a whole batch, then adds the two missing noise
164
+ * controls: a substance floor and a SOFT near-duplicate comparison. Unattended auto-distill turns that trickle
165
+ * into a flood, and a review gate nobody reads is no gate. Pure and deterministic; the caller decides what to do
166
+ * with a non-admit (skip, never an error).
119
167
  */
120
168
  export function assessDraftAdmission(candidate, existing = [], opts = {}) {
121
169
  const minSignals = opts.minSignals ?? 2;
122
170
  const minStrategy = opts.minStrategy ?? 1;
123
- const maxSimilarity = opts.maxSimilarity ?? 0.8;
124
- const sigs = [...new Set((candidate.signals_match ?? []).map((s) => String(s).toLowerCase()).filter(Boolean))];
171
+ const maxSimilarity = opts.maxSimilarity ?? 0.6;
172
+ const sigs = [...normalizeSignalSet(candidate.signals_match)];
125
173
  const strategy = (candidate.strategy ?? []).filter((s) => String(s).trim());
126
174
  if (sigs.length < minSignals)
127
175
  return { admit: false, reason: `too few signals (${sigs.length} < ${minSignals})` };
@@ -129,11 +177,16 @@ export function assessDraftAdmission(candidate, existing = [], opts = {}) {
129
177
  return { admit: false, reason: `strategy too thin (${strategy.length} < ${minStrategy} steps)` };
130
178
  const newSet = new Set(sigs);
131
179
  for (const eg of existing) {
132
- const egSet = new Set((eg.signals_match ?? []).map((s) => String(s).toLowerCase()).filter(Boolean));
180
+ const egSet = normalizeSignalSet(eg.signals_match);
133
181
  if (egSet.size === 0)
134
182
  continue;
135
- const inter = [...newSet].filter((s) => egSet.has(s)).length;
136
- const union = new Set([...newSet, ...egSet]).size;
183
+ if ([...newSet].every((signal) => egSet.has(signal))) {
184
+ return { admit: false, reason: `near-duplicate of ${eg.id ?? '?'} (candidate signal subset)` };
185
+ }
186
+ const comparableNew = noveltySignalSet(newSet);
187
+ const comparableExisting = noveltySignalSet(egSet);
188
+ const inter = [...comparableNew].filter((s) => comparableExisting.has(s)).length;
189
+ const union = new Set([...comparableNew, ...comparableExisting]).size;
137
190
  const jaccard = union ? inter / union : 0;
138
191
  if (jaccard >= maxSimilarity)
139
192
  return { admit: false, reason: `near-duplicate of ${eg.id ?? '?'} (similarity ${jaccard.toFixed(2)})` };
package/dist/doctor.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { type MemoryGraphOperatorStatus } from './localMemoryGraph.js';
1
2
  type DoctorStatus = 'pass' | 'warn' | 'fail';
2
3
  export interface DoctorCheck {
3
4
  name: string;
@@ -36,6 +37,7 @@ export interface DoctorDeps {
36
37
  statMode?: (p: string) => number | undefined;
37
38
  profile?: DoctorProfile;
38
39
  label?: string;
40
+ memoryGraphStatus?: (env: Record<string, string | undefined>) => MemoryGraphOperatorStatus;
39
41
  }
40
42
  export interface EnvCatalogResult {
41
43
  profile: DoctorProfile;
package/dist/doctor.js CHANGED
@@ -4,7 +4,9 @@
4
4
  // (heartbeat, proxy path) touch the proxy and are a SEPARATE, gated step — not here.
5
5
  import { readFileSync, existsSync, statSync } from 'node:fs';
6
6
  import { isAbsolute, join } from 'node:path';
7
+ import { events, issueReporter } from '@evomap/evolver-core';
7
8
  import { expandHomePath, parseEnvFile } from '@evomap/evolver-mcp';
9
+ import { formatMemoryGraphOperatorStatus, loadMemoryGraphOperatorStatus } from './localMemoryGraph.js';
8
10
  // Secrets that must live ONLY behind the EVOLVER_ENV_FILE pointer — never inlined into a runtime config (#217).
9
11
  const SECRET_KEYS = [
10
12
  'A2A_NODE_SECRET',
@@ -85,6 +87,13 @@ const ENV_CATALOG_DEFINITIONS = [
85
87
  purpose: 'Hub base URL for public/private adapter connections.',
86
88
  requiredFor: 'hub sync, PHub runtime, live smoke',
87
89
  },
90
+ {
91
+ name: 'EVOLVER_DEFAULT_HUB_URL',
92
+ group: 'hub-runtime',
93
+ purpose: 'Deployment-time default Hub URL override used when A2A_HUB_URL and EVOMAP_HUB_URL are unset.',
94
+ requiredFor: 'release/deployment default Hub selection',
95
+ defaultValue: 'https://evomap.ai',
96
+ },
88
97
  {
89
98
  name: 'EVOMAP_PRIVATE_ADAPTER_MODULE',
90
99
  group: 'hub-runtime',
@@ -425,6 +434,12 @@ const ENV_CATALOG_DEFINITIONS = [
425
434
  purpose: 'Public key used to verify self-update artifacts.',
426
435
  requiredFor: 'self-update verification',
427
436
  },
437
+ {
438
+ name: 'EVOLVER_SELF_UPDATE_SUPERVISOR',
439
+ group: 'self-update',
440
+ purpose: 'Attests that a generated durable service launcher owns relaunch.',
441
+ requiredFor: 'automatic self-update',
442
+ },
428
443
  {
429
444
  name: 'EVOLVER_SELF_UPDATE_TARGET_PATH',
430
445
  group: 'self-update',
@@ -561,6 +576,17 @@ export function runDoctorChecks(deps = {}) {
561
576
  if (deps.profile === 'private-runtime') {
562
577
  checks.push(...privateRuntimeChecks(env, envFileValues, envFileReadiness));
563
578
  }
579
+ try {
580
+ const status = (deps.memoryGraphStatus ?? loadMemoryGraphOperatorStatus)(effectiveEnv);
581
+ checks.push({
582
+ name: 'memory-graph',
583
+ status: status.recovery === 'degraded' ? 'warn' : 'pass',
584
+ detail: formatMemoryGraphOperatorStatus(status),
585
+ });
586
+ }
587
+ catch {
588
+ checks.push({ name: 'memory-graph', status: 'warn', detail: 'state=degraded corrupt=1 oversized_lines=0 oversized_files=0 archives=0' });
589
+ }
564
590
  return checks;
565
591
  }
566
592
  export function buildEnvCatalog(deps = {}) {
@@ -688,9 +714,9 @@ function privateRuntimeChecks(env, envFile, envFileReadiness) {
688
714
  else {
689
715
  checks.push({ name: 'phub-mode', status: 'fail', detail: `EVOMAP_HUB_MODE=${redact(mode)}; expected private for PHub runtime` });
690
716
  }
691
- const hubUrl = privateValue(env, envFile, 'EVOMAP_HUB_URL');
717
+ const hubUrl = privateHubUrlValue(env, envFile);
692
718
  if (!hubUrl) {
693
- checks.push({ name: 'phub-url', status: 'fail', detail: 'EVOMAP_HUB_URL is missing; point it at the PHub test-env URL' });
719
+ checks.push({ name: 'phub-url', status: 'fail', detail: 'Hub URL is missing; set EVOMAP_HUB_URL in EVOLVER_ENV_FILE, or use A2A_HUB_URL / EVOLVER_DEFAULT_HUB_URL for explicit compatibility' });
694
720
  }
695
721
  else if (isProductionLikeHubUrl(hubUrl)) {
696
722
  checks.push({ name: 'phub-url', status: 'warn', detail: `${redact(hubUrl)} does not look like a test-env URL; do not run live smoke against production PHub` });
@@ -771,7 +797,7 @@ function privateLiveSmokeCheck(env, envFile, essentials) {
771
797
  if (essentials.mode !== 'private')
772
798
  missing.push('EVOMAP_HUB_MODE=private');
773
799
  if (!essentials.hubUrl)
774
- missing.push('EVOMAP_HUB_URL');
800
+ missing.push('EVOMAP_HUB_URL|A2A_HUB_URL|EVOLVER_DEFAULT_HUB_URL');
775
801
  if (essentials.tokenCount === 0)
776
802
  missing.push(`one of ${PRIVATE_TOKEN_KEYS.join('|')}`);
777
803
  if (missing.length > 0) {
@@ -827,6 +853,11 @@ function privateValue(env, envFile, key) {
827
853
  const fromEnv = env[key]?.trim();
828
854
  return fromEnv || undefined;
829
855
  }
856
+ function privateHubUrlValue(env, envFile) {
857
+ return privateValue(env, envFile, 'EVOMAP_HUB_URL')
858
+ ?? privateValue(env, envFile, 'A2A_HUB_URL')
859
+ ?? privateValue(env, envFile, 'EVOLVER_DEFAULT_HUB_URL');
860
+ }
830
861
  function isLoopbackProxyUrl(raw) {
831
862
  try {
832
863
  const url = new URL(raw);
@@ -893,6 +924,21 @@ export async function runDoctor(argv, deps = {}) {
893
924
  }
894
925
  const checks = runDoctorChecks({ ...deps, profile: f.profile, ...(f.root !== undefined ? { configRoot: f.root } : {}) });
895
926
  const failed = checks.some((c) => c.status === 'fail');
927
+ if (failed) {
928
+ try {
929
+ const input = issueReporter.issueReportInputFromDoctor(checks.map(({ name, status }) => ({ name, status })));
930
+ if (input) {
931
+ issueReporter.createIssueDraft(input, {
932
+ rootDir: join(events.evomapHome(deps.env ?? process.env), 'evolution', 'issue-reporter'),
933
+ workspaceScope: process.cwd(),
934
+ env: deps.env ?? process.env,
935
+ });
936
+ }
937
+ }
938
+ catch {
939
+ // Local draft reporting must never change the doctor command surface.
940
+ }
941
+ }
896
942
  if (f.json) {
897
943
  process.stdout.write(`${JSON.stringify({ ok: !failed, profile: f.profile, checks })}\n`);
898
944
  }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { events, ops } from '@evomap/evolver-core';
2
2
  import { assetstore, material as materialNs } from '@evomap/evolver-core';
3
+ import { type NonGitWorkspaceNoticeOptions } from './nonGitWorkspaceNotice.js';
3
4
  /**
4
5
  * Composition seam for ingest's substrate dependencies. The CLI is the composition layer that wires the
5
6
  * MaterialStore (M1 raw-material substrate) + the watermark cursor (file-level re-ingest dedup) + the AE
@@ -16,12 +17,14 @@ export interface SessionIngestTickResult {
16
17
  sourceAgents: string[];
17
18
  signalKinds: string[];
18
19
  signalStrengths: string[];
20
+ invalidJsonRows?: number;
19
21
  }
20
22
  export declare const PACKAGE = "@evomap/evolver-cli";
21
23
  export interface RebuildOptions {
22
24
  eventsPath?: string;
23
25
  mvDir?: string;
24
26
  }
27
+ export declare function cliUsage(): string;
25
28
  export interface ResetLocalSecretOptions {
26
29
  env?: NodeJS.ProcessEnv;
27
30
  homeDir?: string;
@@ -41,7 +44,7 @@ export declare function runResetLocalSecret(argv: readonly string[], opts?: Rese
41
44
  export declare function rebuildViews(opts?: RebuildOptions): {
42
45
  rebuilt: string[];
43
46
  };
44
- /** migrate import-v1 <v1dir> [outDir]: v1→v2 只读迁移(异步, 由 cli.ts 调). */
47
+ /** migrate import-v1 <v1dir> [outDir] --workspace <path>: v1→v2 read-only migration. */
45
48
  export declare function runMigrate(argv: readonly string[]): Promise<number>;
46
49
  /** One-line summary of an asset for `asset-log` (pure, testable). */
47
50
  export declare function formatAssetLine(a: assetstore.AssetRecord): string;
@@ -111,7 +114,7 @@ export declare function promoteHint(v: assetstore.GeneLearningView): string;
111
114
  * gene); `--approve`/`--reject <id>` is the audited human act that lifts an auto-distilled draft out of (or
112
115
  * confirms it out of) quarantine. Approval is what lets a distilled gene's strategy be embedded into a real run
113
116
  * (the gate lives in makeTrustedGeneResolver, #45+review). The id may be a logical id or an asset_id.
114
- * Usage: evolver review [limit] | evolver review --approve <id> [reason…] | evolver review --reject <id> [reason…]
117
+ * Usage: evolver review [limit] | evolver review --approve <id> [--allow-weak-evidence] [reason…] | evolver review --reject <id> [reason…]
115
118
  */
116
119
  export declare function runReview(argv: readonly string[], store?: assetstore.AssetStoreProvider, review?: assetstore.ReviewLedger, deps?: IngestDeps): Promise<number>;
117
120
  /** Injection seam for `value` (#113): tests point these at temp paths / a fixed clock; defaults are the live home.
@@ -139,6 +142,7 @@ export interface RetentionDeps {
139
142
  rootEventsPath?: string;
140
143
  materialStorePath?: string;
141
144
  materialCursorPath?: string;
145
+ materialCursorPaths?: readonly string[];
142
146
  now?: () => number;
143
147
  }
144
148
  export declare function formatRetentionReport(report: events.RetentionReport): string;
@@ -172,6 +176,8 @@ export interface InjectDeps {
172
176
  readHookInput?: () => string | undefined;
173
177
  /** Test seam for the hook-time proxy daemon recovery path. Default is maybeAutoRestartProxyForSessionStart. */
174
178
  ensureProxyAutostart?: () => Promise<void>;
179
+ /** Test seam for the non-git workspace notice. Production uses cwd + ~/.evomap throttle state. */
180
+ nonGitNotice?: NonGitWorkspaceNoticeOptions;
175
181
  }
176
182
  /**
177
183
  * `evolver inject session-start`: the SessionStart hook entrypoint (the command every installer registers).