@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
@@ -0,0 +1,15 @@
1
+ import { trace } from '@evomap/evolver-core';
2
+ export interface LearningTraceWiring {
3
+ enabled: boolean;
4
+ upload: 'on' | 'off' | 'no_credentials';
5
+ config: {
6
+ packetSink: trace.LearningPacketSink;
7
+ traceSink?: trace.TraceSink;
8
+ sourceRepo?: string;
9
+ proxyTraces?: {
10
+ dir: string;
11
+ readOptions?: trace.TraceReadOptions;
12
+ };
13
+ } | null;
14
+ }
15
+ export declare function resolveLearningTrace(env?: NodeJS.ProcessEnv): LearningTraceWiring;
@@ -0,0 +1,73 @@
1
+ // Learning-trace wiring for the autoexec daemon (Learning Ops slices 2+3). Local file sinks are the
2
+ // always-on durability layer — per-run LearningPacket drafts land under ~/.evomap/evolution/learning-trace/
3
+ // (kill switch: EVOLVER_LEARNING_TRACE=0). Hub upload (slice 3) is opt-in via EVOLVER_LEARNING_TRACE_UPLOAD=1
4
+ // and rides the same OAuth credential as the other hub links; when enabled + credentialed, packets are teed
5
+ // file-first then uploaded best-effort, so a hub outage never loses the local record or affects a verdict.
6
+ import { events, trace } from '@evomap/evolver-core';
7
+ import { join } from 'node:path';
8
+ import { homedir } from 'node:os';
9
+ import { existsSync, readFileSync } from 'node:fs';
10
+ import { HubLearningPacketSink, TeeLearningPacketSink, connectPublicHub, resolveHubUrl, globalFetchLike, } from '@evomap/evolver-adapter-public';
11
+ import { resolveAtpSenderId } from './atp.js';
12
+ import { resolveIdentityHome } from './identityHome.js';
13
+ /** Same default node-secret resolution as trajectory export: env first, then ~/.evomap/node_secret. Best-effort —
14
+ * without a secret the fold still reads plaintext/metadata-only rows; encrypted envelopes are just skipped. */
15
+ function defaultNodeSecret(env) {
16
+ const envSecret = env['EVOMAP_NODE_SECRET'] ?? env['A2A_NODE_SECRET'];
17
+ if (typeof envSecret === 'string' && envSecret.length > 0)
18
+ return envSecret;
19
+ try {
20
+ const file = join(events.evomapHome(env), 'node_secret');
21
+ if (existsSync(file))
22
+ return readFileSync(file, 'utf8').trim() || undefined;
23
+ }
24
+ catch { /* secretless fold still covers unencrypted rows */ }
25
+ return undefined;
26
+ }
27
+ function resolveHubUpload(env) {
28
+ if (env['EVOLVER_LEARNING_TRACE_UPLOAD'] !== '1')
29
+ return { sink: null, state: 'off' };
30
+ const configuredHubMode = env['EVOMAP_HUB_MODE'];
31
+ const publicUploadAllowed = configuredHubMode === undefined
32
+ || configuredHubMode.trim().toLowerCase() === 'public';
33
+ if (!publicUploadAllowed)
34
+ return { sink: null, state: 'off' };
35
+ const dir = resolveIdentityHome(env) ?? join(homedir(), '.evomap');
36
+ if (!existsSync(join(dir, 'token.json')))
37
+ return { sink: null, state: 'no_credentials' };
38
+ try {
39
+ const hubUrl = resolveHubUrl(env);
40
+ const senderId = resolveAtpSenderId(env);
41
+ const { auth } = connectPublicHub({ hubUrl, authMode: 'oauth', evomapDir: dir, senderId: () => senderId });
42
+ return {
43
+ sink: new HubLearningPacketSink({ baseUrl: hubUrl, auth, fetchFn: globalFetchLike, nodeId: () => senderId }),
44
+ state: 'on',
45
+ };
46
+ }
47
+ catch {
48
+ return { sink: null, state: 'no_credentials' };
49
+ }
50
+ }
51
+ export function resolveLearningTrace(env = process.env) {
52
+ if (env['EVOLVER_LEARNING_TRACE'] === '0')
53
+ return { enabled: false, upload: 'off', config: null };
54
+ const dir = events.learningTraceDir(env);
55
+ const fileSink = new trace.FileLearningPacketSink(dir);
56
+ const upload = resolveHubUpload(env);
57
+ // Proxy llm_turn fold (slice 5): point the per-run fold at the proxy's trace day-files. Rides the same
58
+ // master switch — if the proxy isn't running the dir is simply empty and the fold is a no-op.
59
+ const nodeSecret = defaultNodeSecret(env);
60
+ return {
61
+ enabled: true,
62
+ upload: upload.state,
63
+ config: {
64
+ packetSink: upload.sink ? new TeeLearningPacketSink(fileSink, upload.sink) : fileSink,
65
+ traceSink: new trace.FileTraceSink(join(dir, 'trace-events.jsonl')),
66
+ sourceRepo: 'evolver-v2',
67
+ proxyTraces: {
68
+ dir: events.tracesDir(env),
69
+ ...(nodeSecret ? { readOptions: { nodeSecret } } : {}),
70
+ },
71
+ },
72
+ };
73
+ }
@@ -1,4 +1,5 @@
1
1
  import { spawn } from 'node:child_process';
2
+ export type ServiceTarget = 'launchd' | 'systemd' | 'windows';
2
3
  export interface DaemonCommand {
3
4
  command: string;
4
5
  args: string[];
@@ -9,7 +10,7 @@ interface ProcessIdentity {
9
10
  parentPid?: number;
10
11
  startedAt?: number;
11
12
  }
12
- interface LifecyclePaths {
13
+ export interface LifecyclePaths {
13
14
  home: string;
14
15
  stateDir: string;
15
16
  logDir: string;
@@ -33,13 +34,38 @@ export interface LifecycleResult {
33
34
  logFile?: string;
34
35
  files?: string[];
35
36
  service?: string;
37
+ autoexecHome?: string;
38
+ actions?: string[];
36
39
  }
40
+ type UnixRecoveryControllerModule = Pick<typeof import('@evomap/evolver-proxy'), 'provisionStableUnixRecoveryController' | 'stableUnixRecoveryControllerPathForTarget' | 'UNIX_RECOVERY_CONTROLLER_ARG'>;
41
+ type LoadUnixRecoveryController = () => Promise<UnixRecoveryControllerModule>;
37
42
  interface RunLifecycleDeps {
38
43
  argv1?: string;
39
44
  env?: NodeJS.ProcessEnv;
45
+ loadUnixRecoveryController?: LoadUnixRecoveryController;
46
+ removeAutoexecService?: (target: ServiceTarget, dryRun: boolean) => LifecycleResult;
47
+ bootstrap?: BootstrapServiceDeps;
40
48
  stdout?: (text: string) => void;
41
49
  stderr?: (text: string) => void;
42
50
  }
51
+ export interface BootstrapServiceDeps {
52
+ platform?: NodeJS.Platform;
53
+ run?: (command: string, args: readonly string[]) => ServiceControlResult;
54
+ uid?: number;
55
+ install?: (target: ServiceTarget, flags: Record<string, string | true>, env: NodeJS.ProcessEnv, argv1: string | undefined, loadUnixRecoveryController?: LoadUnixRecoveryController) => Promise<LifecycleResult>;
56
+ }
57
+ interface ServiceControlResult {
58
+ status: number | null;
59
+ error?: unknown;
60
+ }
61
+ export interface RemoveAutoexecServiceDeps {
62
+ paths?: Partial<Record<ServiceTarget, string>>;
63
+ run?: (command: string, args: readonly string[]) => ServiceControlResult;
64
+ exists?: (path: string) => boolean;
65
+ remove?: (path: string) => void;
66
+ write?: (path: string, content: string, mode: number) => void;
67
+ uid?: number;
68
+ }
43
69
  export type SessionStartSpawn = (command: string, args: readonly string[], options: Parameters<typeof spawn>[2]) => ReturnType<typeof spawn>;
44
70
  interface SessionStartAutostartDeps {
45
71
  stderr?: (text: string) => void;
@@ -49,6 +75,7 @@ interface SessionStartAutostartDeps {
49
75
  export interface StopLifecycleDeps {
50
76
  processCommandLine?: (pid: number) => string | undefined;
51
77
  processIdentity?: (pid: number) => ProcessIdentity | undefined;
78
+ platform?: NodeJS.Platform;
52
79
  }
53
80
  export declare function runLifecycleCommand(argv: readonly string[], deps?: RunLifecycleDeps): Promise<number>;
54
81
  export declare function maybeAutoRestartProxyForSessionStart(env?: NodeJS.ProcessEnv, argv1?: string | undefined, deps?: SessionStartAutostartDeps): Promise<void>;
@@ -59,14 +86,30 @@ export declare function lifecycleStatus(paths: LifecyclePaths, env?: NodeJS.Proc
59
86
  quietSettingsReadError?: boolean;
60
87
  stderr?: (text: string) => void;
61
88
  }): Promise<LifecycleStatus>;
89
+ /** Extended connection status for `evolver daily`: includes hub_auth_status and last_sync_at from proxy. */
90
+ export interface DailyConnectionStatus extends LifecycleStatus {
91
+ hubAuthStatus?: string;
92
+ lastSyncAt?: string;
93
+ }
94
+ /** Fetch enriched connection status for the daily summary. Builds on lifecycleStatus, adding hub details. */
95
+ export declare function dailyConnectionStatus(paths: LifecyclePaths, env?: NodeJS.ProcessEnv, options?: {
96
+ timeoutMs?: number;
97
+ stderr?: (text: string) => void;
98
+ }): Promise<DailyConnectionStatus>;
62
99
  export declare function lifecyclePaths(env?: NodeJS.ProcessEnv): LifecyclePaths;
63
100
  export declare function renderSystemdUnit(opts?: {
64
101
  envFile?: string;
65
102
  workingDirectory?: string;
66
103
  execStart?: string;
104
+ lifecycleStateDir?: string;
67
105
  selfUpdateStateDir?: string;
68
106
  selfUpdateTarget?: string;
69
107
  }): string;
108
+ export declare function renderAutoexecSystemdUnit(opts: {
109
+ envFile?: string;
110
+ workingDirectory?: string;
111
+ execStart: string;
112
+ }): string;
70
113
  export declare function renderLaunchdPlist(opts?: {
71
114
  envFile?: string;
72
115
  workingDirectory?: string;
@@ -74,20 +117,43 @@ export declare function renderLaunchdPlist(opts?: {
74
117
  proxyBin?: string;
75
118
  programArguments?: readonly string[];
76
119
  logDir?: string;
120
+ lifecycleStateDir?: string;
77
121
  selfUpdateStateDir?: string;
78
122
  selfUpdateTarget?: string;
123
+ label?: string;
124
+ logName?: string;
125
+ selfUpdateSupervisor?: boolean;
126
+ }): string;
127
+ export declare function renderAutoexecLaunchdPlist(opts: {
128
+ envFile?: string;
129
+ workingDirectory?: string;
130
+ programArguments: readonly string[];
131
+ logDir?: string;
79
132
  }): string;
80
133
  export declare function renderWindowsInstaller(defaults?: {
81
134
  evolverBin?: string;
82
135
  nodePath?: string;
83
136
  proxyBin?: string;
84
137
  envFile?: string;
138
+ lifecycleStateDir?: string;
85
139
  selfUpdateStateDir?: string;
86
140
  }): string;
141
+ export declare function renderWindowsAutoexecInstaller(defaults?: {
142
+ evolverBin?: string;
143
+ nodePath?: string;
144
+ cliBin?: string;
145
+ envFile?: string;
146
+ autoexecHome?: string;
147
+ workingDirectory?: string;
148
+ }): string;
149
+ export declare function removeAutoexecService(target: ServiceTarget, dryRun: boolean, deps?: RemoveAutoexecServiceDeps): LifecycleResult;
87
150
  export declare function resolveDaemonCommand(env: NodeJS.ProcessEnv, execPath?: string, argv1?: string | undefined): DaemonCommand;
88
151
  export declare function resolveSelfUpdatingExecutable(execPath: string, argv1: string | undefined): DaemonCommand | undefined;
152
+ export declare function resolveAutoexecDaemonCommand(env: NodeJS.ProcessEnv, execPath?: string, argv1?: string | undefined, autoexecHome?: string): DaemonCommand | undefined;
89
153
  export declare function resolveProxyBinPath(): string | undefined;
90
154
  export declare function resolveStableNodePath(): string;
91
155
  export declare function sessionStartHookVerboseEnabled(env?: NodeJS.ProcessEnv): boolean;
92
156
  export declare function proxyExpected(env?: NodeJS.ProcessEnv): boolean;
157
+ declare function writeWindowsHelper(preferredPath: string, content: string): string;
158
+ export declare const _writeWindowsHelperForTest: typeof writeWindowsHelper;
93
159
  export {};