@evomap/evolver-cli 2.0.0-beta.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.
Files changed (91) hide show
  1. package/dist/antiGeneBenchmark.d.ts +9 -0
  2. package/dist/antiGeneBenchmark.js +173 -0
  3. package/dist/antiGeneRollout.d.ts +14 -0
  4. package/dist/antiGeneRollout.js +276 -0
  5. package/dist/atp.d.ts +122 -0
  6. package/dist/atp.js +413 -0
  7. package/dist/atpAutoDeliver.d.ts +53 -0
  8. package/dist/atpAutoDeliver.js +197 -0
  9. package/dist/atpAutobuyPrompt.d.ts +48 -0
  10. package/dist/atpAutobuyPrompt.js +109 -0
  11. package/dist/autoDistillAntiGene.d.ts +63 -0
  12. package/dist/autoDistillAntiGene.js +396 -0
  13. package/dist/autoDistillLlm.d.ts +94 -0
  14. package/dist/autoDistillLlm.js +510 -0
  15. package/dist/autoDistillTranscript.d.ts +87 -0
  16. package/dist/autoDistillTranscript.js +364 -0
  17. package/dist/autoRecall.d.ts +25 -0
  18. package/dist/autoRecall.js +80 -0
  19. package/dist/autoexec.d.ts +237 -0
  20. package/dist/autoexec.js +1041 -0
  21. package/dist/cli.d.ts +2 -0
  22. package/dist/cli.js +7 -0
  23. package/dist/cliContracts.d.ts +72 -0
  24. package/dist/cliContracts.js +815 -0
  25. package/dist/commands.d.ts +9 -0
  26. package/dist/commands.js +10 -0
  27. package/dist/cursorRewrite.d.ts +42 -0
  28. package/dist/cursorRewrite.js +65 -0
  29. package/dist/cycleConsumer.d.ts +42 -0
  30. package/dist/cycleConsumer.js +519 -0
  31. package/dist/daemonLoop.d.ts +33 -0
  32. package/dist/daemonLoop.js +72 -0
  33. package/dist/dispatch.d.ts +10 -0
  34. package/dist/dispatch.js +75 -0
  35. package/dist/distillObserver.d.ts +33 -0
  36. package/dist/distillObserver.js +146 -0
  37. package/dist/distillPrimitives.d.ts +48 -0
  38. package/dist/distillPrimitives.js +142 -0
  39. package/dist/doctor.d.ts +54 -0
  40. package/dist/doctor.js +931 -0
  41. package/dist/geneValue.d.ts +37 -0
  42. package/dist/geneValue.js +97 -0
  43. package/dist/index.d.ts +193 -0
  44. package/dist/index.js +1135 -0
  45. package/dist/lifecycle.d.ts +75 -0
  46. package/dist/lifecycle.js +859 -0
  47. package/dist/login.d.ts +10 -0
  48. package/dist/login.js +38 -0
  49. package/dist/migrate/divergenceAudit.d.ts +29 -0
  50. package/dist/migrate/divergenceAudit.js +37 -0
  51. package/dist/migrate/fieldMap.d.ts +18 -0
  52. package/dist/migrate/fieldMap.js +68 -0
  53. package/dist/migrate/v1Import.d.ts +16 -0
  54. package/dist/migrate/v1Import.js +118 -0
  55. package/dist/phub.d.ts +18 -0
  56. package/dist/phub.js +284 -0
  57. package/dist/recall.d.ts +26 -0
  58. package/dist/recall.js +162 -0
  59. package/dist/recipe.d.ts +61 -0
  60. package/dist/recipe.js +564 -0
  61. package/dist/reflectionObserver.d.ts +8 -0
  62. package/dist/reflectionObserver.js +6 -0
  63. package/dist/reuse.d.ts +48 -0
  64. package/dist/reuse.js +300 -0
  65. package/dist/reuseReport.d.ts +20 -0
  66. package/dist/reuseReport.js +255 -0
  67. package/dist/reviewFilter.d.ts +4 -0
  68. package/dist/reviewFilter.js +6 -0
  69. package/dist/runtimeSessionSource.d.ts +9 -0
  70. package/dist/runtimeSessionSource.js +29 -0
  71. package/dist/setupHooks.d.ts +2 -0
  72. package/dist/setupHooks.js +410 -0
  73. package/dist/skill2gep.d.ts +144 -0
  74. package/dist/skill2gep.js +321 -0
  75. package/dist/skillDistill.d.ts +75 -0
  76. package/dist/skillDistill.js +342 -0
  77. package/dist/solo/breaker.d.ts +14 -0
  78. package/dist/solo/breaker.js +21 -0
  79. package/dist/solo/gitGuard.d.ts +17 -0
  80. package/dist/solo/gitGuard.js +62 -0
  81. package/dist/solo/mode.d.ts +12 -0
  82. package/dist/solo/mode.js +55 -0
  83. package/dist/thesis.d.ts +43 -0
  84. package/dist/thesis.js +179 -0
  85. package/dist/trajectoryExport.d.ts +1 -0
  86. package/dist/trajectoryExport.js +895 -0
  87. package/dist/valueDigest.d.ts +33 -0
  88. package/dist/valueDigest.js +94 -0
  89. package/dist/version.d.ts +2 -0
  90. package/dist/version.js +14 -0
  91. package/package.json +38 -0
@@ -0,0 +1,237 @@
1
+ import { events, assetstore, algo, exec, hooks, material as materialNs, verify, hub as hubNs } from '@evomap/evolver-core';
2
+ import { type Beat } from './daemonLoop.js';
3
+ import { connectPublicHub, ReuseCache } from '@evomap/evolver-adapter-public';
4
+ import type { FetchLike, OfflinePermitStore, OutcomeReport, OutcomeReceipt } from '@evomap/evolver-adapter-public';
5
+ import { type EvolverProxyClient } from '@evomap/evolver-mcp';
6
+ import { resolveDistillObserver } from './distillObserver.js';
7
+ import { type AutoDistillLlmResult, type LlmDistillRunner } from './autoDistillLlm.js';
8
+ import { type AutoDistillAntiGeneMode, type AutoDistillAntiGeneResult } from './autoDistillAntiGene.js';
9
+ import { type AutoDistillTranscriptMode, type TranscriptDistillTickResult } from './autoDistillTranscript.js';
10
+ import { type SessionIngestTickResult } from './index.js';
11
+ export interface AutoExecDirs {
12
+ base: string;
13
+ tasks: string;
14
+ done: string;
15
+ refused: string;
16
+ }
17
+ export interface AutoExecConfig {
18
+ allowedRoots: string[];
19
+ pollMs: number;
20
+ timeoutMs: number;
21
+ runner: 'claude' | 'codex' | 'cursor';
22
+ }
23
+ /** Create the queue layout under <home>/autoexec/{tasks,done,refused}. */
24
+ export declare function ensureAutoExecDirs(base: string): AutoExecDirs;
25
+ /** Read <base>/config.json; deny-by-default (empty allowedRoots) when absent. Default runner 'claude' (#66). */
26
+ export declare function readAutoExecConfig(base: string): AutoExecConfig;
27
+ export declare function summarizeSandboxedValidation(result: verify.SandboxedValidationResult): string | null;
28
+ /**
29
+ * One queue pass: drain every tasks/*.json through `runOne`, route the verdict to done/ (success or failure)
30
+ * or refused/ (deny-by-default), and move the task file out of the queue. Sequential; returns the verdicts.
31
+ */
32
+ export declare function autoExecPass(dirs: AutoExecDirs, runOne: (task: exec.AutoExecTask) => Promise<exec.AutoExecVerdict>): Promise<exec.AutoExecVerdict[]>;
33
+ /**
34
+ * Build the reuse-before-solve seam (#110) — THE real injection point. This is the public-repo composition
35
+ * layer that owns BOTH core's autoexec kernel and the adapter's hub capability, so it is where the adapter's
36
+ * `reuseBeforeSolve` is adapted into core's hub-agnostic `HubReuseSeam` (core never imports the adapter).
37
+ * Flow: free hub search → core's pure score/decide → paid fetch for AT MOST ONE winner → the winner enters the
38
+ * SAME selection pool as local genes (trust-first). The two-layer cache is owned HERE so it warms across passes
39
+ * (a repeat signal set → zero hub calls). Off by default: only wired when EVOLVER_REUSE_BEFORE_SOLVE === '1'
40
+ * AND a hub credential exists (no token → no seam → zero hub calls, exactly today's behavior).
41
+ */
42
+ export declare function makeHubReuseSeam(cap: hubNs.HubCapability, cache: ReuseCache, ingestor?: events.Ingestor, onAssetReused?: (assetId: string) => void): exec.HubReuseSeam;
43
+ /**
44
+ * Append a `value.inject` root_event for a SessionStart gene injection (#123). Attribution-only — the payload
45
+ * carries the injected gene ids (+ cycle/outcome when known) and NO savings number, exactly per the ledger's
46
+ * weakest-signal contract. Never throws: injection is the agent's critical path, so a failed emission is
47
+ * swallowed (the genes are still injected). Skips an empty gene set — there is nothing to attribute.
48
+ */
49
+ export declare function emitInject(ingestor: events.Ingestor, info: hooks.InjectInfo): Promise<void>;
50
+ /**
51
+ * Build the SessionStart inject emission seam (#123) — the public-repo composition point that connects core's
52
+ * sink-agnostic `onInject` callback to the real `value.inject` root_event sink. Core (composeSessionStartWithRecap)
53
+ * never imports the Ingestor; THIS is where the ingestor is wired in, mirroring makeHubReuseSeam for reuse. The
54
+ * returned callback is synchronous (the seam core calls is sync) and fire-and-forget: it stashes the
55
+ * error-swallowing emit promise so the caller can await durability without ever letting an ingest error surface.
56
+ * Returns undefined when there is no ingestor (no sink → no emission, exactly today's behavior).
57
+ */
58
+ export declare function makeInjectEmitter(ingestor?: events.Ingestor): {
59
+ onInject: (info: hooks.InjectInfo) => void;
60
+ flush: () => Promise<void>;
61
+ } | undefined;
62
+ /** A hub the link can report outcomes to. Structural (not the concrete class) so tests can fake it. */
63
+ export type OutcomeReportingHub = hubNs.HubCapability & {
64
+ recordOutcome(report: OutcomeReport): Promise<OutcomeReceipt>;
65
+ recordReuseResult?(report: hubNs.ReuseResultReport): Promise<hubNs.ReuseResultReceipt>;
66
+ };
67
+ /** The composed hub wiring: the reuse seam plus the matching outcome reporter that closes the loop. */
68
+ export interface HubLink {
69
+ seam: exec.HubReuseSeam;
70
+ /** Report a finished task's outcome (with the used-asset attribution claim) to the hub. Never throws. */
71
+ reportOutcome: (task: exec.AutoExecTask, verdict: exec.AutoExecVerdict) => Promise<void>;
72
+ }
73
+ export interface HubQuestionLink {
74
+ /** Submit optional proactive questions for a finished task. Never throws. */
75
+ submitForTask: (task: exec.AutoExecTask) => Promise<HubQuestionSubmitResult>;
76
+ }
77
+ type HubQuestionSubmitStatus = 'disabled' | 'skipped' | 'submitted' | 'not_accepted' | 'timeout' | 'failed';
78
+ interface HubQuestionSubmitResult {
79
+ status: HubQuestionSubmitStatus;
80
+ questionCount: number;
81
+ }
82
+ type DistillTickQuestionSource = ({
83
+ recorded: number;
84
+ } & Partial<Pick<SessionIngestTickResult, 'sourceAgents' | 'signalKinds' | 'signalStrengths'>>) | {
85
+ skipped: true;
86
+ };
87
+ export interface HubQuestionLinkOptions {
88
+ enabled?: boolean;
89
+ statePath?: string;
90
+ env?: Record<string, string | undefined>;
91
+ now?: () => number;
92
+ timeoutMs?: number;
93
+ }
94
+ type PublicHubConnectOptions = Parameters<typeof connectPublicHub>[0];
95
+ type PublicHubConnector = (opts: PublicHubConnectOptions) => {
96
+ hub: OutcomeReportingHub;
97
+ };
98
+ type PublicHubPermitConnector = (opts: PublicHubConnectOptions) => {
99
+ auth: hubNs.AuthProvider;
100
+ };
101
+ interface SolidifyPermitResolverOptions {
102
+ fetchFn?: FetchLike;
103
+ now?: () => number;
104
+ store?: OfflinePermitStore;
105
+ }
106
+ /**
107
+ * Map an autoexec verdict onto the hub outcome vocabulary (success | failed).
108
+ * refused/skipped ran no cycle — there is nothing to attribute, so no report.
109
+ */
110
+ export declare function verdictToOutcomeStatus(status: exec.AutoExecVerdict['status']): 'success' | 'failed' | null;
111
+ export declare function questionGeneratorStatePath(home?: string): string;
112
+ export declare function makeHubQuestionLink(cap: hubNs.HubCapability, options?: HubQuestionLinkOptions): HubQuestionLink;
113
+ export declare function shouldSubmitProactiveQuestionsForTask(task: exec.AutoExecTask): boolean;
114
+ export declare function urgentQuestionRuntimeWiringStatus(): typeof hubNs.URGENT_QUESTION_RUNTIME_WIRING_STATUS;
115
+ export declare function submitDistillTickExplorationQuestion(questions: HubQuestionLink | undefined, source: DistillTickQuestionSource | undefined): Promise<HubQuestionSubmitResult>;
116
+ export declare function scheduleAutoExecHubSideEffects(task: exec.AutoExecTask, verdict: exec.AutoExecVerdict, links: {
117
+ questions?: HubQuestionLink;
118
+ outcome?: HubLink;
119
+ }): void;
120
+ /**
121
+ * Compose the reuse seam and the outcome reporter. Reuse HITs still emit value-ledger observability, but the
122
+ * Hub outcome `used_asset_ids` claim comes only from the finished verdict's selected/executed asset. A fetched
123
+ * candidate can be withheld by trust/review gates or lose selection, so fetch-time attribution would overclaim.
124
+ * Reporting never throws and never blocks the verdict.
125
+ */
126
+ export declare function makeHubLink(cap: OutcomeReportingHub, ingestor?: events.Ingestor, reportEnabled?: boolean): HubLink;
127
+ /**
128
+ * Resolve the hub link (reuse seam + outcome reporter) from the environment, or undefined when reuse is
129
+ * not enabled/credentialed. Default OFF: requires EVOLVER_REUSE_BEFORE_SOLVE === '1' and an OAuth token at
130
+ * <evomapDir>/token.json. Any setup failure degrades to undefined (no link) so the daemon never blocks on
131
+ * hub config — reuse is an optimization. Outcome reporting rides the same gate (it is the read-back half
132
+ * of the same paid hub relationship); EVOLVER_OUTCOME_REPORT=0 turns just the reporting off.
133
+ */
134
+ export declare function resolveHubLink(env?: NodeJS.ProcessEnv, ingestor?: events.Ingestor, connectHub?: PublicHubConnector): HubLink | undefined;
135
+ export declare function resolveHubQuestionLink(env?: NodeJS.ProcessEnv, connectHub?: PublicHubConnector): HubQuestionLink | undefined;
136
+ export declare function offlinePermitDir(env?: NodeJS.ProcessEnv): string;
137
+ export declare function makeOfflineSolidifyPermitGate(permits: Pick<OfflinePermitStore, 'consumeOfflinePermit'>): algo.SolidifyPermitGate;
138
+ export declare function resolveSolidifyPermitGate(env?: NodeJS.ProcessEnv, connectHub?: PublicHubPermitConnector, opts?: SolidifyPermitResolverOptions): algo.SolidifyPermitGate | undefined;
139
+ export declare function makeProxyHubCapability(proxy: Pick<EvolverProxyClient, 'search' | 'fetchAsset' | 'recordReuseResult'>): OutcomeReportingHub;
140
+ /** Session-log dirs the auto-distill producer scans: EVOLVER_SESSION_DIRS (comma-sep) overrides; else the
141
+ * standard agent homes. The scanner skips non-existent dirs, so listing cross-platform homes is always safe. */
142
+ export declare function defaultSessionDirs(env?: NodeJS.ProcessEnv): string[];
143
+ /**
144
+ * Whether the cross-runtime reuse SIGNAL is folded into selection (#268/#274 soft re-order). **Default ON**: the
145
+ * re-rank is a SMALL, bounded, clamped nudge (±REUSE_WEIGHT) that the controlled A/B (reuseSignalAb.test.ts)
146
+ * proves flips only NEAR-TIES and can never override a gene's health/signal-match — so cross-AI reuse evidence
147
+ * shapes selection by default, not only when an operator opts in. `EVOLVER_REUSE_SIGNAL=0` is the kill switch.
148
+ */
149
+ export declare function reuseSignalEnabled(env?: NodeJS.ProcessEnv): boolean;
150
+ /**
151
+ * Whether the gene PROBATION loop is on (#306, phase 2). **Default OFF** — explicit opt-in (EVOLVER_GENE_PROBATION=1),
152
+ * because it lets unproven auto-distilled genes be TRIED with their strategy embedded so the cross-AI reuse loop
153
+ * self-closes (autoexec then also runs the evidence-based auto-promote tick). Unlike the bounded reuse soft re-order,
154
+ * this drives the autonomous agent with an unreviewed strategy — contained by the proven exec hard gates + worktree
155
+ * isolation (#309), but a real increase in what the loop attempts, so it stays opt-in until validated in production.
156
+ */
157
+ export declare function geneProbationEnabled(env?: NodeJS.ProcessEnv): boolean;
158
+ export interface DistillProducerOptions {
159
+ /** The daemon's bus Ingestor — REQUIRED, so the producer's `material.batch_ready` reaches the same ObserverBus
160
+ * the distillObserver is registered on. */
161
+ ingestor: events.Ingestor;
162
+ store?: assetstore.AssetStoreProvider;
163
+ review?: assetstore.ReviewLedger;
164
+ materialStore?: materialNs.MaterialStore;
165
+ watermarkStore?: materialNs.WatermarkStore;
166
+ consumer?: materialNs.ConsumerGroups;
167
+ sessionDirs?: readonly string[];
168
+ maxPerTick?: number;
169
+ }
170
+ export interface DistillProducerWiring {
171
+ enabled: boolean;
172
+ reason?: 'off';
173
+ observer: ReturnType<typeof resolveDistillObserver> | null;
174
+ /** One producer pass: scan the session dirs → record material on the bus Ingestor (emits material.batch_ready). */
175
+ tick: () => Promise<SessionIngestTickResult>;
176
+ sessionDirs: readonly string[];
177
+ }
178
+ /**
179
+ * Wire the auto-distill producer+consumer for the resident daemon (#106 slice2): returns the distillObserver to
180
+ * register on the bus + a `tick()` that scans the session dirs and records material onto the SAME bus Ingestor
181
+ * (→ `material.batch_ready` → the observer auto-drafts a quarantined gene). Off via `EVOLVER_AUTO_DISTILL=0`.
182
+ * All stores/paths are injectable for tests; production defaults to the live ~/.evomap substrate + agent homes.
183
+ */
184
+ export declare function resolveDistillProducer(env: NodeJS.ProcessEnv, opts: DistillProducerOptions): DistillProducerWiring;
185
+ type LlmDistillTickResult = AutoDistillLlmResult | {
186
+ skipped: true;
187
+ } | undefined;
188
+ type GuardedLlmDistill = () => Promise<LlmDistillTickResult>;
189
+ type AntiGeneDistillTickResult = AutoDistillAntiGeneResult | {
190
+ skipped: true;
191
+ } | undefined;
192
+ type GuardedAntiGeneDistill = () => Promise<AntiGeneDistillTickResult>;
193
+ export declare function shouldRunIdleDistill(intensity: Beat['intensity']): boolean;
194
+ export declare function runIdleLlmDistillForBeat(beat: Pick<Beat, 'intensity'>, guardedLlmDistill: GuardedLlmDistill | null, write?: (message: string) => void): Promise<void>;
195
+ export declare function runIdleAntiGeneDistillForBeat(beat: Pick<Beat, 'intensity'>, guardedAntiGeneDistill: GuardedAntiGeneDistill | null, write?: (message: string) => void): Promise<void>;
196
+ type GuardedTranscriptDistill = () => Promise<TranscriptDistillTickResult | {
197
+ skipped: true;
198
+ } | undefined>;
199
+ interface AutoDistillTranscriptWiring {
200
+ enabled: boolean;
201
+ mode: AutoDistillTranscriptMode;
202
+ tick: () => Promise<TranscriptDistillTickResult>;
203
+ }
204
+ interface AutoDistillAntiGeneWiring {
205
+ enabled: boolean;
206
+ mode: AutoDistillAntiGeneMode;
207
+ tick: () => Promise<AutoDistillAntiGeneResult>;
208
+ }
209
+ /**
210
+ * Wire the LLM-over-transcript producer for the resident daemon (#319 slice 2). Default OFF
211
+ * (EVOLVER_AUTO_DISTILL_TRANSCRIPT unset). When on, the tick scans the session dirs and LLM-distills prose-rich,
212
+ * weak/zero-signal sessions (per-session dedup/cooldown + per-tick cap inside runTranscriptDistillTick). Runs in
213
+ * the idle slot only (LLM cost), separate from the every-beat structural ingest.
214
+ */
215
+ export declare function resolveAutoDistillTranscript(env: NodeJS.ProcessEnv, opts: {
216
+ store: assetstore.AssetStoreProvider;
217
+ review?: assetstore.ReviewLedger;
218
+ ingestor?: events.Ingestor;
219
+ sessionDirs?: readonly string[];
220
+ }): AutoDistillTranscriptWiring;
221
+ export declare function resolveAutoDistillAntiGene(env: NodeJS.ProcessEnv, opts: {
222
+ store: assetstore.AssetStoreProvider;
223
+ review?: assetstore.ReviewLedger;
224
+ ingestor?: events.Ingestor;
225
+ statePath?: string;
226
+ cwd?: string;
227
+ now?: () => number;
228
+ runner?: LlmDistillRunner;
229
+ }): AutoDistillAntiGeneWiring;
230
+ export declare function runIdleTranscriptDistillForBeat(beat: Pick<Beat, 'intensity'>, guarded: GuardedTranscriptDistill | null, write?: (message: string) => void): Promise<void>;
231
+ /**
232
+ * `evolver autoexec [home]`: resident daemon. Builds the safe deps from EVOLVER_HOME, then single-flight-guards
233
+ * autoExecPass on an interval. Real agent execution only happens for repos the operator has allowlisted in
234
+ * <home>/autoexec/config.json (allowedRoots) — empty by default = nothing runs.
235
+ */
236
+ export declare function runAutoExec(argv: readonly string[]): Promise<number>;
237
+ export {};