@evomap/evolver-cli 2.0.0-beta.9 → 2.0.1

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 (87) hide show
  1. package/dist/antiGeneBenchmark.js +2 -0
  2. package/dist/antiGeneRollout.js +9 -3
  3. package/dist/assetHealth.js +2 -0
  4. package/dist/assetTrust.js +14 -1
  5. package/dist/atp.d.ts +10 -5
  6. package/dist/atp.js +119 -26
  7. package/dist/atpAutoBuyer.d.ts +120 -0
  8. package/dist/atpAutoBuyer.js +814 -0
  9. package/dist/atpAutoDeliver.js +2 -2
  10. package/dist/autoDistillLlm.js +2 -1
  11. package/dist/autoDistillTranscript.js +3 -2
  12. package/dist/autoexec.d.ts +101 -13
  13. package/dist/autoexec.js +794 -91
  14. package/dist/cli.js +13 -0
  15. package/dist/cliContracts.d.ts +23 -2
  16. package/dist/cliContracts.js +504 -54
  17. package/dist/commands.d.ts +1 -0
  18. package/dist/commands.js +1 -0
  19. package/dist/curriculumCapabilityGaps.d.ts +6 -0
  20. package/dist/curriculumCapabilityGaps.js +24 -0
  21. package/dist/cycleConsumer.d.ts +13 -0
  22. package/dist/cycleConsumer.js +186 -20
  23. package/dist/dashboard.js +47 -9
  24. package/dist/dispatch.js +8 -2
  25. package/dist/distillPrimitives.d.ts +3 -2
  26. package/dist/distillPrimitives.js +80 -12
  27. package/dist/doctor.js +120 -11
  28. package/dist/identityHome.d.ts +9 -0
  29. package/dist/identityHome.js +47 -0
  30. package/dist/index.d.ts +70 -40
  31. package/dist/index.js +581 -193
  32. package/dist/learningTrace.d.ts +15 -0
  33. package/dist/learningTrace.js +73 -0
  34. package/dist/lifecycle.d.ts +67 -1
  35. package/dist/lifecycle.js +738 -44
  36. package/dist/localMemoryGraph.d.ts +90 -3
  37. package/dist/localMemoryGraph.js +2031 -231
  38. package/dist/login.d.ts +1 -1
  39. package/dist/login.js +3 -3
  40. package/dist/materialSnapshot.d.ts +9 -1
  41. package/dist/materialSnapshot.js +23 -6
  42. package/dist/memoryGraphOps.d.ts +8 -0
  43. package/dist/memoryGraphOps.js +140 -0
  44. package/dist/migrate/assetFormatMap.d.ts +61 -0
  45. package/dist/migrate/assetFormatMap.js +53 -0
  46. package/dist/migrate/envTranslate.d.ts +26 -0
  47. package/dist/migrate/envTranslate.js +147 -0
  48. package/dist/migrate/fieldMap.d.ts +4 -2
  49. package/dist/migrate/fieldMap.js +9 -5
  50. package/dist/migrate/oauthImport.d.ts +66 -0
  51. package/dist/migrate/oauthImport.js +667 -0
  52. package/dist/migrate/v1Import.d.ts +92 -1
  53. package/dist/migrate/v1Import.js +1481 -141
  54. package/dist/promptRecallHook.d.ts +24 -0
  55. package/dist/promptRecallHook.js +425 -0
  56. package/dist/recallVerifyReport.d.ts +37 -0
  57. package/dist/recallVerifyReport.js +244 -0
  58. package/dist/recipe.d.ts +7 -1
  59. package/dist/recipe.js +426 -56
  60. package/dist/requiredSandboxValidation.d.ts +5 -0
  61. package/dist/requiredSandboxValidation.js +4 -0
  62. package/dist/reuse.d.ts +9 -0
  63. package/dist/reuse.js +151 -56
  64. package/dist/runtimeCapabilities.js +15 -15
  65. package/dist/runtimeSessionSource.d.ts +3 -2
  66. package/dist/runtimeSessionSource.js +63 -11
  67. package/dist/selectionPolicyConfig.d.ts +8 -0
  68. package/dist/selectionPolicyConfig.js +18 -0
  69. package/dist/semanticIdfConfig.d.ts +2 -0
  70. package/dist/semanticIdfConfig.js +4 -0
  71. package/dist/sessionIngest.d.ts +37 -0
  72. package/dist/sessionIngest.js +156 -0
  73. package/dist/setupHooks.js +95 -1
  74. package/dist/skill2gep.d.ts +13 -9
  75. package/dist/skill2gep.js +42 -30
  76. package/dist/skillDistill.d.ts +8 -4
  77. package/dist/skillDistill.js +38 -9
  78. package/dist/solo/mode.js +1 -0
  79. package/dist/sync.d.ts +12 -0
  80. package/dist/sync.js +1246 -151
  81. package/dist/thesis.d.ts +1 -1
  82. package/dist/thesis.js +20 -3
  83. package/dist/trajectoryExport.js +21 -3
  84. package/dist/v1Compat.d.ts +1 -0
  85. package/dist/v1Compat.js +9 -0
  86. package/dist/workflowRuntime.js +24 -18
  87. package/package.json +11 -8
@@ -172,8 +172,8 @@ export function buildAtpAutoDeliverProofPayload(task, nowDate = () => new Date()
172
172
  return {
173
173
  result: 'completed',
174
174
  asset_id: assetId,
175
- completed_at: taskString(task, 'claimed_at') ?? nowDate().toISOString(),
176
- pass_rate: 1.0,
175
+ completed_at: taskString(task, 'completed_at') ?? taskString(task, 'completedAt') ?? nowDate().toISOString(),
176
+ // pass_rate is deliberately absent: auto-delivery has an asset reference, not measured validation evidence.
177
177
  signals: Array.isArray(task['signals']) ? task['signals'].filter((s) => typeof s === 'string').slice(0, 10) : [],
178
178
  submitter: 'evolver_auto_deliver',
179
179
  };
@@ -3,6 +3,7 @@ import { closeSync, existsSync, mkdirSync, openSync, readFileSync, readSync, rea
3
3
  import { tmpdir } from 'node:os';
4
4
  import { dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
5
5
  import { algo, assetstore, events, exec, hub, verify } from '@evomap/evolver-core';
6
+ import { runRequiredSandboxedValidation } from './requiredSandboxValidation.js';
6
7
  const DEFAULT_MIN_CAPSULES = 10;
7
8
  const DEFAULT_MAX_CAPSULES = 24;
8
9
  const DEFAULT_MIN_SUCCESS_SCORE = 0.7;
@@ -519,7 +520,7 @@ export async function autoDistillLlm(options) {
519
520
  patchState(statePath, input.dataHash, { failed_attempts_inc: true }, hashCap);
520
521
  return { ok: false, mode, reason: 'validation_failed', dataHash: input.dataHash };
521
522
  }
522
- const validation = await verify.runSandboxedValidation(intake.gene.validation, cwd, {
523
+ const validation = await runRequiredSandboxedValidation(intake.gene.validation, cwd, {
523
524
  timeoutMs: options.validationTimeoutMs ?? envInt(env, 'EVOLVE_DISTILL_VALIDATION_TIMEOUT_MS', DEFAULT_VALIDATION_TIMEOUT_MS),
524
525
  });
525
526
  if (!validation.passed) {
@@ -12,9 +12,10 @@
12
12
  import { createHash } from 'node:crypto';
13
13
  import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
14
14
  import { basename, dirname, join } from 'node:path';
15
- import { algo, assetstore, events, hub, verify, signals } from '@evomap/evolver-core';
15
+ import { algo, assetstore, events, hub, signals } from '@evomap/evolver-core';
16
16
  import { adapterForPath } from '@evomap/evolver-runtime-adapters';
17
17
  import { asGeneCandidate, parseDistillOutput, normalizeValidation, jaccardDuplicate, resolveDistillRunner, p3Decide, } from './autoDistillLlm.js';
18
+ import { runRequiredSandboxedValidation } from './requiredSandboxValidation.js';
18
19
  const DEFAULT_MIN_TURNS = 2;
19
20
  const DEFAULT_MIN_CHARS = 200;
20
21
  const DEFAULT_TIMEOUT_MS = 180_000;
@@ -169,7 +170,7 @@ export async function autoDistillTranscript(options) {
169
170
  const intake = algo.intakeGene(normalized, existing);
170
171
  if (!intake.ok || !intake.gene)
171
172
  return { ok: false, mode, reason: 'validation_failed', candidate: normalized };
172
- const validation = await verify.runSandboxedValidation(intake.gene.validation, cwd, {
173
+ const validation = await runRequiredSandboxedValidation(intake.gene.validation, cwd, {
173
174
  timeoutMs: options.validationTimeoutMs ?? envInt(env, 'EVOLVE_DISTILL_VALIDATION_TIMEOUT_MS', DEFAULT_VALIDATION_TIMEOUT_MS),
174
175
  });
175
176
  if (!validation.passed)
@@ -8,22 +8,41 @@ import { resolveDistillObserver } from './distillObserver.js';
8
8
  import { type AutoDistillLlmResult, type LlmDistillRunner } from './autoDistillLlm.js';
9
9
  import { type AutoDistillAntiGeneMode, type AutoDistillAntiGeneResult } from './autoDistillAntiGene.js';
10
10
  import { type AutoDistillTranscriptMode, type TranscriptDistillTickResult } from './autoDistillTranscript.js';
11
- import { type SessionIngestTickResult } from './index.js';
11
+ import { type SessionIngestTickResult } from './sessionIngest.js';
12
+ import { AtpAutoBuyer, type AtpAutoBuyerClient, type AtpAutoBuyerRequest } from './atpAutoBuyer.js';
13
+ import { type ConfiguredSelectionGuard } from './selectionPolicyConfig.js';
12
14
  export { readAutoExecConfig, type AutoExecConfig } from './autoexecConfig.js';
15
+ export { semanticIdfEnabled } from './semanticIdfConfig.js';
16
+ export { selectionFloorFromEnv, selectionGuardFromEnv, selectionPolicyFromEnv, type ConfiguredSelectionGuard, } from './selectionPolicyConfig.js';
17
+ export declare function withAutoExecSelectionPolicy<T extends object>(deps: T, env?: NodeJS.ProcessEnv): T & {
18
+ selectionPolicy?: exec.AutoExecDeps['selectionPolicy'];
19
+ };
20
+ export declare function withAutoExecSelectionConfig<T extends object>(deps: T, env?: NodeJS.ProcessEnv): T & {
21
+ selectionPolicy?: exec.AutoExecDeps['selectionPolicy'];
22
+ selectionGuard: ConfiguredSelectionGuard;
23
+ selectionFloor?: number;
24
+ };
13
25
  export interface AutoExecDirs {
14
26
  base: string;
15
27
  tasks: string;
28
+ inflight: string;
16
29
  done: string;
17
30
  refused: string;
18
31
  }
19
- /** Create the queue layout under <home>/autoexec/{tasks,done,refused}. */
32
+ /** Create the queue layout under <home>/autoexec/{tasks,inflight,done,refused}. */
20
33
  export declare function ensureAutoExecDirs(base: string): AutoExecDirs;
21
34
  export declare function summarizeSandboxedValidation(result: verify.SandboxedValidationResult): string | null;
22
35
  /**
23
- * One queue pass: drain every tasks/*.json through `runOne`, route the verdict to done/ (success or failure)
24
- * or refused/ (deny-by-default), and move the task file out of the queue. Sequential; returns the verdicts.
36
+ * One queue pass: atomically claim regular tasks/*.json into inflight/, then route each verdict to done/
37
+ * (success or failure) or refused/ (deny-by-default). A claim is atomically marked started before runOne;
38
+ * after a crash, started and legacy claims are ambiguous and fail closed instead of repeating side effects.
39
+ * Unreadable or incomplete claimed tasks stay pending because the drop-directory has no atomic publish marker.
25
40
  */
26
- export declare function autoExecPass(dirs: AutoExecDirs, runOne: (task: exec.AutoExecTask) => Promise<exec.AutoExecVerdict>): Promise<exec.AutoExecVerdict[]>;
41
+ export declare function autoExecPass(dirs: AutoExecDirs, runOne: (task: exec.AutoExecTask) => Promise<exec.AutoExecVerdict>, options?: {
42
+ executePendingTasks?: boolean;
43
+ }): Promise<exec.AutoExecVerdict[]>;
44
+ /** Keep unsupported built-in runners away from the execution queue without stopping the resident daemon. */
45
+ export declare function runnerBoundAutoExecPass(runner: exec.RunnerName, dirs: AutoExecDirs, runOne: (task: exec.AutoExecTask) => Promise<exec.AutoExecVerdict>): () => Promise<exec.AutoExecVerdict[]>;
27
46
  /**
28
47
  * Build the reuse-before-solve seam (#110) — THE real injection point. This is the public-repo composition
29
48
  * layer that owns BOTH core's autoexec kernel and the adapter's hub capability, so it is where the adapter's
@@ -33,7 +52,48 @@ export declare function autoExecPass(dirs: AutoExecDirs, runOne: (task: exec.Aut
33
52
  * (a repeat signal set → zero hub calls). Off by default: only wired when EVOLVER_REUSE_BEFORE_SOLVE === '1'
34
53
  * AND a hub credential exists (no token → no seam → zero hub calls, exactly today's behavior).
35
54
  */
36
- export declare function makeHubReuseSeam(cap: hubNs.HubCapability, cache: ReuseCache, ingestor?: events.Ingestor, onAssetReused?: (assetId: string) => void): exec.HubReuseSeam;
55
+ export type VerifiedHubSearchMissReason = 'no_results' | 'below_threshold';
56
+ export interface VerifiedHubSearchMiss {
57
+ reason: VerifiedHubSearchMissReason;
58
+ signals: readonly string[];
59
+ cycleId?: string;
60
+ }
61
+ export type VerifiedHubSearchMissHandler = (miss: VerifiedHubSearchMiss) => void;
62
+ /** Minimal audit seam so autoexec tests never have to touch the operator's real asset-call log. */
63
+ export interface AssetCallLogger {
64
+ append(entry: hubNs.AssetCallEntry): void;
65
+ assetCostIndex?(): Record<string, number>;
66
+ }
67
+ interface HubSearchHitAudit {
68
+ runId: string | null;
69
+ assetId?: string;
70
+ assetType?: string;
71
+ sourceNodeId?: string;
72
+ chainId?: string;
73
+ score?: number;
74
+ mode: 'direct' | 'reference';
75
+ signals: readonly string[];
76
+ tokensSaved: number;
77
+ tokensSavedBasis: hubNs.TokensSavedBasis;
78
+ }
79
+ interface HubReuseAuditOptions {
80
+ assetLog?: AssetCallLogger;
81
+ onSearchHit?: (hit: HubSearchHitAudit) => void;
82
+ env?: NodeJS.ProcessEnv;
83
+ }
84
+ /** Build the deliberately small, public-safe ATP request allowed to leave autoexec after a verified Hub miss. */
85
+ export declare function atpCapabilityGapRequest(signals: readonly string[]): AtpAutoBuyerRequest;
86
+ /** Schedule economic work outside the reuse/task critical path and contain all asynchronous failures. */
87
+ export declare function scheduleAtpAutoBuyForVerifiedMiss(miss: VerifiedHubSearchMiss, buyer: Pick<AtpAutoBuyer, 'consider'>): void;
88
+ /** Resolve an autonomous buyer only after an explicit env/ack consent check; the buyer checks consent again. */
89
+ export declare function resolveAtpAutoBuyer(env?: NodeJS.ProcessEnv, createClient?: (resolvedEnv: NodeJS.ProcessEnv) => AtpAutoBuyerClient): AtpAutoBuyer | undefined;
90
+ export declare function makeHubReuseSeam(cap: hubNs.HubCapability, cache: ReuseCache, ingestor?: events.Ingestor, onAssetReused?: (assetId: string) => void, onVerifiedSearchMiss?: VerifiedHubSearchMissHandler, audit?: HubReuseAuditOptions): exec.HubReuseSeam;
91
+ /**
92
+ * Free search-only seam used by ATP auto-buy when reuse injection is disabled. It proves a capability miss with
93
+ * the same dual-leg search and score threshold as reuse, but never performs the paid fetch or contributes a Hub
94
+ * candidate.
95
+ */
96
+ export declare function makeHubSearchMissProbe(cap: hubNs.HubCapability, cache: ReuseCache, onVerifiedSearchMiss: VerifiedHubSearchMissHandler, enabled: () => boolean, env?: NodeJS.ProcessEnv, assetLog?: AssetCallLogger): exec.HubReuseSeam;
37
97
  /**
38
98
  * Append a `value.inject` root_event for a SessionStart gene injection (#123). Attribution-only — the payload
39
99
  * carries the injected gene ids (+ cycle/outcome when known) and NO savings number, exactly per the ledger's
@@ -113,6 +173,36 @@ export interface AutoexecLockReleaseDeps {
113
173
  stderr?: (text: string) => void;
114
174
  }
115
175
  export declare function releaseAutoexecLock(lockPath: string, deps?: AutoexecLockReleaseDeps): boolean;
176
+ type AutoexecStreamErrorListener = (error: NodeJS.ErrnoException) => void;
177
+ export interface AutoexecErrorStream {
178
+ on(event: 'error', listener: AutoexecStreamErrorListener): unknown;
179
+ off?(event: 'error', listener: AutoexecStreamErrorListener): unknown;
180
+ removeListener?(event: 'error', listener: AutoexecStreamErrorListener): unknown;
181
+ }
182
+ export interface AutoexecBrokenPipeGuardDeps {
183
+ stdout?: AutoexecErrorStream;
184
+ stderr?: AutoexecErrorStream;
185
+ }
186
+ /** Keep a detached daemon alive when its output consumer closes, without hiding other stream failures. */
187
+ export declare function installAutoexecBrokenPipeGuards(deps?: AutoexecBrokenPipeGuardDeps): () => void;
188
+ export type AutoexecProcessSignal = 'SIGINT' | 'SIGTERM' | 'SIGHUP';
189
+ type AutoexecSignalListener = () => void;
190
+ export interface AutoexecSignalSource {
191
+ on(event: AutoexecProcessSignal, listener: AutoexecSignalListener): unknown;
192
+ off?(event: AutoexecProcessSignal, listener: AutoexecSignalListener): unknown;
193
+ removeListener?(event: AutoexecProcessSignal, listener: AutoexecSignalListener): unknown;
194
+ }
195
+ export interface AutoexecShutdownDeps {
196
+ stop: () => Promise<void>;
197
+ cleanup: () => void;
198
+ signals?: AutoexecSignalSource;
199
+ write?: (message: string) => void;
200
+ }
201
+ /**
202
+ * Own autoexec's process-signal lifetime. V2 intentionally has no hot-reload seam: SIGHUP is informational and
203
+ * keeps the current generation alive; SIGINT/SIGTERM drain the resident loop before cleanup and exit.
204
+ */
205
+ export declare function waitForAutoexecShutdown(deps: AutoexecShutdownDeps): Promise<number>;
116
206
  export declare function urgentQuestionRuntimeWiringStatus(): typeof hubNs.URGENT_QUESTION_RUNTIME_WIRING_STATUS;
117
207
  export declare function submitDistillTickExplorationQuestion(questions: HubQuestionLink | undefined, source: DistillTickQuestionSource | undefined): Promise<HubQuestionSubmitResult>;
118
208
  export declare function scheduleAutoExecHubSideEffects(task: exec.AutoExecTask, verdict: exec.AutoExecVerdict, links: {
@@ -125,15 +215,13 @@ export declare function scheduleAutoExecHubSideEffects(task: exec.AutoExecTask,
125
215
  * candidate can be withheld by trust/review gates or lose selection, so fetch-time attribution would overclaim.
126
216
  * Reporting never throws and never blocks the verdict.
127
217
  */
128
- export declare function makeHubLink(cap: OutcomeReportingHub, ingestor?: events.Ingestor, reportEnabled?: boolean): HubLink;
218
+ export declare function makeHubLink(cap: OutcomeReportingHub, ingestor?: events.Ingestor, reportEnabled?: boolean, onVerifiedSearchMiss?: VerifiedHubSearchMissHandler, assetLog?: AssetCallLogger, env?: NodeJS.ProcessEnv): HubLink;
129
219
  /**
130
- * Resolve the hub link (reuse seam + outcome reporter) from the environment, or undefined when reuse is
131
- * not enabled/credentialed. Default OFF: requires EVOLVER_REUSE_BEFORE_SOLVE === '1' and an OAuth token at
132
- * <evomapDir>/token.json. Any setup failure degrades to undefined (no link) so the daemon never blocks on
133
- * hub config — reuse is an optimization. Outcome reporting rides the same gate (it is the read-back half
134
- * of the same paid hub relationship); EVOLVER_OUTCOME_REPORT=0 turns just the reporting off.
220
+ * Resolve public/private reuse wiring. Reuse remains default-off. When a public ATP miss handler is supplied,
221
+ * a consent-gated free search-only seam may still be composed so auto-buy can prove a miss independently of
222
+ * reuse injection; that seam never fetches or injects Hub assets.
135
223
  */
136
- export declare function resolveHubLink(env?: NodeJS.ProcessEnv, ingestor?: events.Ingestor, connectHub?: PublicHubConnector): HubLink | undefined;
224
+ export declare function resolveHubLink(env?: NodeJS.ProcessEnv, ingestor?: events.Ingestor, connectHub?: PublicHubConnector, onVerifiedSearchMiss?: VerifiedHubSearchMissHandler, assetLog?: AssetCallLogger): HubLink | undefined;
137
225
  export declare function resolveHubQuestionLink(env?: NodeJS.ProcessEnv, connectHub?: PublicHubConnector): HubQuestionLink | undefined;
138
226
  export declare function resolveMemoryEventMirror(env?: NodeJS.ProcessEnv, connectHub?: PublicHubConnector): MemoryEventMirrorWiring;
139
227
  export declare function offlinePermitDir(env?: NodeJS.ProcessEnv): string;