@evomap/evolver-cli 2.0.0-beta.17 → 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.
Files changed (64) hide show
  1. package/dist/antiGeneRollout.js +7 -3
  2. package/dist/assetTrust.js +14 -1
  3. package/dist/atp.d.ts +8 -3
  4. package/dist/atp.js +82 -11
  5. package/dist/atpAutoBuyer.d.ts +120 -0
  6. package/dist/atpAutoBuyer.js +814 -0
  7. package/dist/atpAutoDeliver.js +2 -2
  8. package/dist/autoDistillLlm.js +2 -1
  9. package/dist/autoDistillTranscript.js +3 -2
  10. package/dist/autoexec.d.ts +90 -13
  11. package/dist/autoexec.js +731 -84
  12. package/dist/cli.js +13 -0
  13. package/dist/cliContracts.d.ts +5 -2
  14. package/dist/cliContracts.js +135 -8
  15. package/dist/commands.d.ts +1 -0
  16. package/dist/commands.js +1 -0
  17. package/dist/curriculumCapabilityGaps.d.ts +6 -0
  18. package/dist/curriculumCapabilityGaps.js +24 -0
  19. package/dist/cycleConsumer.d.ts +4 -0
  20. package/dist/cycleConsumer.js +175 -20
  21. package/dist/dashboard.js +47 -9
  22. package/dist/dispatch.js +6 -2
  23. package/dist/distillPrimitives.js +18 -6
  24. package/dist/doctor.js +63 -5
  25. package/dist/identityHome.js +2 -1
  26. package/dist/index.d.ts +67 -39
  27. package/dist/index.js +504 -185
  28. package/dist/learningTrace.d.ts +4 -0
  29. package/dist/learningTrace.js +30 -3
  30. package/dist/lifecycle.d.ts +54 -1
  31. package/dist/lifecycle.js +489 -37
  32. package/dist/materialSnapshot.d.ts +9 -1
  33. package/dist/materialSnapshot.js +23 -6
  34. package/dist/migrate/envTranslate.d.ts +26 -0
  35. package/dist/migrate/envTranslate.js +145 -0
  36. package/dist/migrate/oauthImport.d.ts +66 -0
  37. package/dist/migrate/oauthImport.js +667 -0
  38. package/dist/migrate/v1Import.d.ts +13 -1
  39. package/dist/migrate/v1Import.js +621 -122
  40. package/dist/promptRecallHook.d.ts +24 -0
  41. package/dist/promptRecallHook.js +425 -0
  42. package/dist/recallVerifyReport.d.ts +37 -0
  43. package/dist/recallVerifyReport.js +244 -0
  44. package/dist/requiredSandboxValidation.d.ts +5 -0
  45. package/dist/requiredSandboxValidation.js +4 -0
  46. package/dist/reuse.d.ts +1 -0
  47. package/dist/reuse.js +45 -37
  48. package/dist/runtimeCapabilities.js +13 -13
  49. package/dist/runtimeSessionSource.d.ts +3 -2
  50. package/dist/runtimeSessionSource.js +63 -11
  51. package/dist/sessionIngest.d.ts +37 -0
  52. package/dist/sessionIngest.js +156 -0
  53. package/dist/setupHooks.js +95 -1
  54. package/dist/skill2gep.d.ts +4 -7
  55. package/dist/skill2gep.js +4 -21
  56. package/dist/solo/mode.js +1 -0
  57. package/dist/sync.js +125 -23
  58. package/dist/thesis.d.ts +1 -1
  59. package/dist/thesis.js +18 -3
  60. package/dist/trajectoryExport.js +21 -3
  61. package/dist/v1Compat.d.ts +1 -0
  62. package/dist/v1Compat.js +9 -0
  63. package/dist/workflowRuntime.js +24 -18
  64. package/package.json +10 -7
@@ -13,6 +13,7 @@ interface SnapshotSource {
13
13
  agent: string;
14
14
  label: string;
15
15
  sessionId?: string;
16
+ resumeIdentityProvenance?: 'canonical_native_transcript';
16
17
  evidenceSummary: RuntimeSessionEvidenceSummary;
17
18
  turns: SnapshotTurn[];
18
19
  }
@@ -31,6 +32,7 @@ export interface RuntimeSessionEvidenceSummarySource {
31
32
  agent: string;
32
33
  label: string;
33
34
  sessionId?: string;
35
+ resumeIdentityProvenance?: 'canonical_native_transcript';
34
36
  evidenceSummary: RuntimeSessionEvidenceSummary;
35
37
  }
36
38
  export interface RuntimeSessionEvidenceAggregate {
@@ -50,5 +52,11 @@ export declare function runtimeSessionSourcesFromMaterialPayload(payload: unknow
50
52
  export declare function runtimeSessionEvidenceSummariesFromMaterialPayload(payload: unknown): RuntimeSessionEvidenceSummaryCollection | null;
51
53
  export declare function materialHasRuntimeSessionSnapshot(material: schema.Material): boolean;
52
54
  export declare function materialSourceAvailable(material: schema.Material): boolean;
53
- export declare function runtimeSessionSourcesForMaterial(material: schema.Material, readSource?: (path: string) => string): RuntimeSessionSource[];
55
+ export interface RuntimeSessionMaterialSources {
56
+ sources: RuntimeSessionSource[];
57
+ liveSources?: RuntimeSessionSource[];
58
+ sourceError?: unknown;
59
+ }
60
+ export declare function runtimeSessionSourcesForMaterialDetails(material: schema.Material, readSource?: (path: string) => string, nativeSessionHome?: string): RuntimeSessionMaterialSources;
61
+ export declare function runtimeSessionSourcesForMaterial(material: schema.Material, readSource?: (path: string) => string, nativeSessionHome?: string): RuntimeSessionSource[];
54
62
  export {};
@@ -208,6 +208,7 @@ export function buildRuntimeSessionMaterialSnapshot(sources, maxChars = DEFAULT_
208
208
  agent: snapshotIdentity(source.agent, SNAPSHOT_AGENT_MAX_CHARS) || 'unknown',
209
209
  label: snapshotIdentity(source.label, SNAPSHOT_IDENTITY_MAX_CHARS) || 'unknown',
210
210
  ...(safeSessionId ? { sessionId: safeSessionId } : {}),
211
+ ...(source.resumeIdentityProvenance ? { resumeIdentityProvenance: source.resumeIdentityProvenance } : {}),
211
212
  evidenceSummary,
212
213
  turns,
213
214
  });
@@ -270,10 +271,14 @@ function sourceFromSnapshot(value) {
270
271
  if (turns.length === 0)
271
272
  return null;
272
273
  const sessionId = typeof value['sessionId'] === 'string' && value['sessionId'].trim() ? value['sessionId'] : undefined;
274
+ const resumeIdentityProvenance = value['resumeIdentityProvenance'] === 'canonical_native_transcript'
275
+ ? value['resumeIdentityProvenance']
276
+ : undefined;
273
277
  return {
274
278
  agent,
275
279
  label,
276
280
  ...(sessionId ? { sessionId } : {}),
281
+ ...(resumeIdentityProvenance ? { resumeIdentityProvenance } : {}),
277
282
  turns,
278
283
  };
279
284
  }
@@ -328,10 +333,14 @@ export function runtimeSessionEvidenceSummariesFromMaterialPayload(payload) {
328
333
  const sessionId = typeof source['sessionId'] === 'string' && source['sessionId'].trim()
329
334
  ? source['sessionId']
330
335
  : undefined;
336
+ const resumeIdentityProvenance = source['resumeIdentityProvenance'] === 'canonical_native_transcript'
337
+ ? 'canonical_native_transcript'
338
+ : undefined;
331
339
  return [{
332
340
  agent: source['agent'],
333
341
  label: source['label'],
334
342
  ...(sessionId ? { sessionId } : {}),
343
+ ...(resumeIdentityProvenance ? { resumeIdentityProvenance } : {}),
335
344
  evidenceSummary: summary,
336
345
  }];
337
346
  });
@@ -350,21 +359,29 @@ export function materialHasRuntimeSessionSnapshot(material) {
350
359
  export function materialSourceAvailable(material) {
351
360
  return existsSync(material.sourcePath);
352
361
  }
353
- export function runtimeSessionSourcesForMaterial(material, readSource) {
362
+ export function runtimeSessionSourcesForMaterialDetails(material, readSource, nativeSessionHome) {
354
363
  let sourceError;
355
364
  try {
356
- const sources = parseRuntimeSessionSources(material.sourcePath, readSource);
357
- const sourcesWithTurns = sources.filter((source) => source.turns.length > 0);
365
+ const liveSources = parseRuntimeSessionSources(material.sourcePath, readSource, nativeSessionHome);
366
+ const sourcesWithTurns = liveSources.filter((source) => source.turns.length > 0);
358
367
  if (sourcesWithTurns.length > 0)
359
- return sourcesWithTurns;
368
+ return { sources: sourcesWithTurns, liveSources };
369
+ const snapshotSources = runtimeSessionSourcesFromMaterialPayload(material.payload);
370
+ return {
371
+ sources: snapshotSources,
372
+ liveSources,
373
+ };
360
374
  }
361
375
  catch (error) {
362
376
  sourceError = error;
363
377
  }
364
378
  const snapshotSources = runtimeSessionSourcesFromMaterialPayload(material.payload);
365
379
  if (snapshotSources.length > 0)
366
- return snapshotSources;
380
+ return { sources: snapshotSources, sourceError };
367
381
  if (sourceError)
368
382
  throw sourceError;
369
- return [];
383
+ return { sources: [] };
384
+ }
385
+ export function runtimeSessionSourcesForMaterial(material, readSource, nativeSessionHome) {
386
+ return runtimeSessionSourcesForMaterialDetails(material, readSource, nativeSessionHome).sources;
370
387
  }
@@ -0,0 +1,26 @@
1
+ import { bootstrap } from '@evomap/evolver-core';
2
+ export interface MigrateEnvOptions {
3
+ /** Path to a dotenv file to scan. When omitted, scans process env only. */
4
+ file?: string;
5
+ /** Also scan process.env (default true when file set). File values win, matching the runtime loader. */
6
+ includeProcessEnv?: boolean;
7
+ json?: boolean;
8
+ /** Optional path to write a suggested dotenv fragment (non-secret mapped keys only). */
9
+ writeSuggestions?: string;
10
+ }
11
+ export interface MigrateEnvResult {
12
+ report: bootstrap.V1EnvTranslationReport;
13
+ scannedKeys: string[];
14
+ source: 'process' | 'file' | 'file+process';
15
+ }
16
+ export declare function runMigrateEnvScan(opts: MigrateEnvOptions, processEnv?: Record<string, string | undefined>): MigrateEnvResult;
17
+ /** Build a dotenv fragment for mappable keys only (never writes secret values for keep/GITHUB). */
18
+ export declare function formatMappedDotenvFragment(report: bootstrap.V1EnvTranslationReport): string;
19
+ export declare function parseMigrateEnvArgs(argv: readonly string[]): MigrateEnvOptions | {
20
+ error: string;
21
+ };
22
+ export declare function runMigrateEnvCommand(argv: readonly string[], io?: {
23
+ stdout?: (line: string) => void;
24
+ stderr?: (line: string) => void;
25
+ env?: Record<string, string | undefined>;
26
+ }): Promise<number>;
@@ -0,0 +1,145 @@
1
+ // Offline V1→V2 env translation for `evolver migrate env` (Refs #698).
2
+ import { readFileSync, writeFileSync } from 'node:fs';
3
+ import { resolve } from 'node:path';
4
+ import { bootstrap } from '@evomap/evolver-core';
5
+ import { expandHomePath, parseEnvFile } from '@evomap/evolver-mcp';
6
+ function loadFileEnv(path) {
7
+ const resolved = resolve(expandHomePath(path));
8
+ return parseEnvFile(readFileSync(resolved, 'utf8'));
9
+ }
10
+ export function runMigrateEnvScan(opts, processEnv = process.env) {
11
+ let env = {};
12
+ let source = 'process';
13
+ if (opts.file) {
14
+ const fromFile = loadFileEnv(opts.file);
15
+ env = { ...fromFile };
16
+ source = 'file';
17
+ if (opts.includeProcessEnv !== false) {
18
+ env = { ...processEnv, ...fromFile };
19
+ source = 'file+process';
20
+ }
21
+ }
22
+ else {
23
+ env = { ...processEnv };
24
+ }
25
+ const report = bootstrap.translateV1Env(env);
26
+ return { report, scannedKeys: Object.keys(env).sort(), source };
27
+ }
28
+ /** Build a dotenv fragment for mappable keys only (never writes secret values for keep/GITHUB). */
29
+ export function formatMappedDotenvFragment(report) {
30
+ const lines = [
31
+ '# Generated by: evolver migrate env --write-suggestions',
32
+ '# Only MAP suggestions (V1 → V2 rename). Review before applying.',
33
+ '# Manual and removed V1 keys are comments; resolve manual items before deleting them.',
34
+ '',
35
+ ];
36
+ for (const s of report.suggestions) {
37
+ if (s.action === 'map' && s.v2Name && s.v2Value !== undefined) {
38
+ lines.push(`# was ${s.v1Name}`);
39
+ lines.push(`${s.v2Name}=${JSON.stringify(s.v2Value)}`);
40
+ lines.push('');
41
+ }
42
+ else if (s.action === 'manual') {
43
+ lines.push(`# REVIEW ${s.v1Name} — ${s.guidance}`);
44
+ lines.push('');
45
+ }
46
+ else if (s.action === 'remove') {
47
+ lines.push(`# REMOVE ${s.v1Name} — ${s.guidance}`);
48
+ lines.push('');
49
+ }
50
+ }
51
+ return lines.join('\n');
52
+ }
53
+ export function parseMigrateEnvArgs(argv) {
54
+ const opts = {};
55
+ for (let i = 0; i < argv.length; i += 1) {
56
+ const a = argv[i] ?? '';
57
+ if (a === '--json')
58
+ opts.json = true;
59
+ else if (a === '--file' || a === '--env-file') {
60
+ const v = argv[++i];
61
+ if (!v || v.startsWith('--'))
62
+ return { error: 'migrate env --file requires a path' };
63
+ opts.file = v;
64
+ }
65
+ else if (a.startsWith('--file='))
66
+ opts.file = a.slice('--file='.length);
67
+ else if (a.startsWith('--env-file='))
68
+ opts.file = a.slice('--env-file='.length);
69
+ else if (a === '--write-suggestions') {
70
+ const v = argv[++i];
71
+ if (!v || v.startsWith('--'))
72
+ return { error: 'migrate env --write-suggestions requires a path' };
73
+ opts.writeSuggestions = v;
74
+ }
75
+ else if (a.startsWith('--write-suggestions='))
76
+ opts.writeSuggestions = a.slice('--write-suggestions='.length);
77
+ else if (a === '--no-process-env')
78
+ opts.includeProcessEnv = false;
79
+ else if (a === '--help' || a === '-h')
80
+ return { error: 'help' };
81
+ else
82
+ return { error: `unknown argument: ${a}` };
83
+ }
84
+ return opts;
85
+ }
86
+ export async function runMigrateEnvCommand(argv, io = {}) {
87
+ const stdout = io.stdout ?? ((line) => { process.stdout.write(line); });
88
+ const stderr = io.stderr ?? ((line) => { process.stderr.write(line); });
89
+ const usage = [
90
+ 'Usage: evolver migrate env [--file <dotenv>] [--json] [--write-suggestions <path>] [--no-process-env]',
91
+ '',
92
+ 'Offline V1→V2 env translation for knobs removed or renamed after upgrade (Refs #698).',
93
+ 'Does not load secrets into resolvers; prints key names and actions only in text mode.',
94
+ '',
95
+ ].join('\n');
96
+ const parsed = parseMigrateEnvArgs(argv);
97
+ if ('error' in parsed) {
98
+ if (parsed.error === 'help') {
99
+ stdout(usage);
100
+ return 0;
101
+ }
102
+ stderr(`${parsed.error}\n${usage}`);
103
+ return 1;
104
+ }
105
+ try {
106
+ const result = runMigrateEnvScan(parsed, io.env ?? process.env);
107
+ if (parsed.writeSuggestions) {
108
+ const fragment = formatMappedDotenvFragment(result.report);
109
+ writeFileSync(resolve(expandHomePath(parsed.writeSuggestions)), fragment, {
110
+ encoding: 'utf8',
111
+ flag: 'wx',
112
+ mode: 0o600,
113
+ });
114
+ }
115
+ if (parsed.json) {
116
+ // JSON mode deliberately emits metadata only; raw source and mapped values stay in memory.
117
+ const safe = {
118
+ source: result.source,
119
+ detectedCount: result.report.detectedCount,
120
+ mappableCount: result.report.mappableCount,
121
+ manualCount: result.report.manualCount,
122
+ removableCount: result.report.removableCount,
123
+ githubTokenPresent: result.report.githubTokenPresent,
124
+ suggestions: result.report.suggestions.map((s) => ({
125
+ v1Name: s.v1Name,
126
+ action: s.action,
127
+ v2Name: s.v2Name,
128
+ guidance: s.guidance,
129
+ })),
130
+ };
131
+ stdout(`${JSON.stringify(safe, null, 2)}\n`);
132
+ }
133
+ else {
134
+ stdout(bootstrap.formatV1EnvTranslationReport(result.report));
135
+ if (parsed.writeSuggestions) {
136
+ stdout(`wrote suggestions: ${parsed.writeSuggestions}\n`);
137
+ }
138
+ }
139
+ return 0;
140
+ }
141
+ catch (error) {
142
+ stderr(`migrate env: ${error instanceof Error ? error.message : String(error)}\n`);
143
+ return 1;
144
+ }
145
+ }
@@ -0,0 +1,66 @@
1
+ import type { hub } from '@evomap/evolver-core';
2
+ import { type PublicAuthPathOptions } from '../login.js';
3
+ type OAuthMigrateStatus = 'migrated' | 'dry_run' | 'skipped_existing' | 'source_missing' | 'invalid_source' | 'refused';
4
+ export interface OAuthMigrateReport {
5
+ status: OAuthMigrateStatus;
6
+ fromPath: string;
7
+ toPath: string;
8
+ /** Field presence only — never raw secrets. */
9
+ sourceFields: {
10
+ hasAccessToken: boolean;
11
+ hasRefreshToken: boolean;
12
+ hasExpires: boolean;
13
+ hasDevice: boolean;
14
+ shape: 'v2-credential' | 'oauth2-snake' | 'nested' | 'unknown';
15
+ };
16
+ /** True when access token is past expiresAt (refresh may still work). */
17
+ accessExpired?: boolean;
18
+ message: string;
19
+ }
20
+ export interface OAuthMigrateOptions {
21
+ fromPath?: string;
22
+ toPath?: string;
23
+ force?: boolean;
24
+ dryRun?: boolean;
25
+ json?: boolean;
26
+ now?: () => number;
27
+ env?: NodeJS.ProcessEnv;
28
+ homeDir?: string;
29
+ /** Test seam for deterministic source replacement races. */
30
+ sourceReadTestHook?: (stage: 'before-open' | 'after-open' | 'after-read', path: string) => void;
31
+ /** Test seam for security metadata changes between snapshot and trust inspection. */
32
+ beforeSourceTrustTestHook?: (path: string) => void;
33
+ /** Test seam for a destination created immediately before no-clobber publish. */
34
+ beforeSaveTestHook?: (path: string) => void;
35
+ /** Test seam that avoids creating a real soft machine id. */
36
+ deviceFingerprint?: string;
37
+ }
38
+ /** Normalize expires fields: ms epoch preferred; accept seconds epoch or expires_in relative. */
39
+ export declare function normalizeExpiresAt(raw: Record<string, unknown>, nowMs: number): number | undefined;
40
+ export interface ParsedV1OAuth {
41
+ cred: hub.Credential & {
42
+ token: string;
43
+ };
44
+ shape: OAuthMigrateReport['sourceFields']['shape'];
45
+ hasAccessToken: boolean;
46
+ hasRefreshToken: boolean;
47
+ hasExpires: boolean;
48
+ hasDevice: boolean;
49
+ }
50
+ /**
51
+ * Parse a V1 (or already-V2) OAuth JSON object into a V2 hub.Credential.
52
+ * Accepts snake_case OAuth2, nested token objects, and V2 credential shape.
53
+ */
54
+ export declare function parseV1OAuthJson(raw: unknown, nowMs?: number): ParsedV1OAuth;
55
+ export declare function defaultV1OAuthPath(opts?: PublicAuthPathOptions): string;
56
+ /**
57
+ * Convert V1 ~/.evomap/oauth_token.json into V2 token.json via CredentialStore.
58
+ * Never prints secret values. Fail-closed on unsafe paths / missing tokens.
59
+ */
60
+ export declare function migrateV1OAuth(options?: OAuthMigrateOptions): OAuthMigrateReport;
61
+ export declare function runMigrateOAuthCommand(argv: readonly string[], io?: {
62
+ stdout?: (s: string) => void;
63
+ stderr?: (s: string) => void;
64
+ env?: NodeJS.ProcessEnv;
65
+ }): Promise<number>;
66
+ export {};