@evomap/evolver-cli 2.0.0-beta.2 → 2.0.0-beta.22

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 (124) hide show
  1. package/dist/antiGeneBenchmark.js +2 -0
  2. package/dist/antiGeneRollout.js +9 -3
  3. package/dist/assetHealth.d.ts +6 -0
  4. package/dist/assetHealth.js +107 -0
  5. package/dist/assetRepair.d.ts +24 -0
  6. package/dist/assetRepair.js +172 -0
  7. package/dist/assetSidecarRecovery.d.ts +14 -0
  8. package/dist/assetSidecarRecovery.js +171 -0
  9. package/dist/assetTrust.d.ts +24 -0
  10. package/dist/assetTrust.js +231 -0
  11. package/dist/atp.d.ts +10 -5
  12. package/dist/atp.js +119 -26
  13. package/dist/atpAutoBuyer.d.ts +120 -0
  14. package/dist/atpAutoBuyer.js +814 -0
  15. package/dist/atpAutoDeliver.js +2 -2
  16. package/dist/autoDistillAntiGene.js +7 -5
  17. package/dist/autoDistillLlm.d.ts +26 -0
  18. package/dist/autoDistillLlm.js +119 -22
  19. package/dist/autoDistillTranscript.js +3 -2
  20. package/dist/autoexec.d.ts +111 -24
  21. package/dist/autoexec.js +887 -120
  22. package/dist/autoexecConfig.d.ts +10 -0
  23. package/dist/autoexecConfig.js +69 -0
  24. package/dist/cli.js +13 -0
  25. package/dist/cliContracts.d.ts +33 -2
  26. package/dist/cliContracts.js +818 -78
  27. package/dist/commandCatalog.d.ts +72 -0
  28. package/dist/commandCatalog.js +120 -0
  29. package/dist/commands.d.ts +1 -0
  30. package/dist/commands.js +1 -0
  31. package/dist/curriculumCapabilityGaps.d.ts +6 -0
  32. package/dist/curriculumCapabilityGaps.js +24 -0
  33. package/dist/cycleConsumer.d.ts +17 -2
  34. package/dist/cycleConsumer.js +374 -50
  35. package/dist/dashboard.d.ts +13 -1
  36. package/dist/dashboard.js +235 -18
  37. package/dist/dispatch.d.ts +9 -2
  38. package/dist/dispatch.js +29 -6
  39. package/dist/distillAdmission.d.ts +13 -0
  40. package/dist/distillAdmission.js +35 -0
  41. package/dist/distillObserver.js +27 -12
  42. package/dist/distillPrimitives.d.ts +11 -8
  43. package/dist/distillPrimitives.js +116 -22
  44. package/dist/doctor.d.ts +13 -0
  45. package/dist/doctor.js +177 -10
  46. package/dist/identityHome.d.ts +9 -0
  47. package/dist/identityHome.js +47 -0
  48. package/dist/index.d.ts +73 -40
  49. package/dist/index.js +745 -207
  50. package/dist/issueReport.d.ts +7 -0
  51. package/dist/issueReport.js +291 -0
  52. package/dist/learningTrace.d.ts +15 -0
  53. package/dist/learningTrace.js +73 -0
  54. package/dist/lifecycle.d.ts +199 -2
  55. package/dist/lifecycle.js +4999 -152
  56. package/dist/lifecycleBootstrapTransaction.d.ts +235 -0
  57. package/dist/lifecycleBootstrapTransaction.js +2182 -0
  58. package/dist/localMemoryGraph.d.ts +184 -0
  59. package/dist/localMemoryGraph.js +2689 -0
  60. package/dist/login.d.ts +1 -1
  61. package/dist/login.js +3 -3
  62. package/dist/materialPackage.js +3 -6
  63. package/dist/materialSnapshot.d.ts +35 -1
  64. package/dist/materialSnapshot.js +265 -18
  65. package/dist/memoryGraphOps.d.ts +8 -0
  66. package/dist/memoryGraphOps.js +140 -0
  67. package/dist/migrate/assetFormatMap.d.ts +61 -0
  68. package/dist/migrate/assetFormatMap.js +53 -0
  69. package/dist/migrate/envTranslate.d.ts +26 -0
  70. package/dist/migrate/envTranslate.js +147 -0
  71. package/dist/migrate/fieldMap.d.ts +7 -5
  72. package/dist/migrate/fieldMap.js +20 -14
  73. package/dist/migrate/oauthImport.d.ts +66 -0
  74. package/dist/migrate/oauthImport.js +667 -0
  75. package/dist/migrate/v1Import.d.ts +98 -1
  76. package/dist/migrate/v1Import.js +1532 -71
  77. package/dist/modelCompatibility.d.ts +10 -0
  78. package/dist/modelCompatibility.js +296 -0
  79. package/dist/promptRecallHook.d.ts +24 -0
  80. package/dist/promptRecallHook.js +425 -0
  81. package/dist/recallVerifyReport.d.ts +37 -0
  82. package/dist/recallVerifyReport.js +244 -0
  83. package/dist/recipe.d.ts +14 -2
  84. package/dist/recipe.js +543 -65
  85. package/dist/repairedAssetStore.d.ts +2 -0
  86. package/dist/repairedAssetStore.js +12 -0
  87. package/dist/requiredSandboxValidation.d.ts +5 -0
  88. package/dist/requiredSandboxValidation.js +4 -0
  89. package/dist/reuse.d.ts +18 -4
  90. package/dist/reuse.js +375 -107
  91. package/dist/reviewFilter.d.ts +3 -1
  92. package/dist/reviewFilter.js +3 -1
  93. package/dist/runtimeCapabilities.d.ts +18 -0
  94. package/dist/runtimeCapabilities.js +81 -0
  95. package/dist/runtimeSessionSource.d.ts +8 -2
  96. package/dist/runtimeSessionSource.js +63 -11
  97. package/dist/selectionPolicyConfig.d.ts +8 -0
  98. package/dist/selectionPolicyConfig.js +18 -0
  99. package/dist/semanticIdfConfig.d.ts +2 -0
  100. package/dist/semanticIdfConfig.js +4 -0
  101. package/dist/sessionIngest.d.ts +43 -0
  102. package/dist/sessionIngest.js +180 -0
  103. package/dist/setupHooks.d.ts +5 -0
  104. package/dist/setupHooks.js +330 -14
  105. package/dist/skill2gep.d.ts +13 -9
  106. package/dist/skill2gep.js +99 -36
  107. package/dist/skillDistill.d.ts +8 -4
  108. package/dist/skillDistill.js +39 -9
  109. package/dist/solo/mode.js +1 -0
  110. package/dist/sync.d.ts +13 -1
  111. package/dist/sync.js +1947 -265
  112. package/dist/thesis.d.ts +1 -1
  113. package/dist/thesis.js +20 -3
  114. package/dist/trajectoryExport.js +21 -3
  115. package/dist/v1Compat.d.ts +1 -0
  116. package/dist/v1Compat.js +9 -0
  117. package/dist/valueDigest.js +8 -1
  118. package/dist/windowsLegacyTaskCleanup.d.ts +228 -0
  119. package/dist/windowsLegacyTaskCleanup.js +1475 -0
  120. package/dist/workflow.d.ts +39 -0
  121. package/dist/workflow.js +386 -0
  122. package/dist/workflowRuntime.d.ts +66 -0
  123. package/dist/workflowRuntime.js +638 -0
  124. package/package.json +14 -7
@@ -0,0 +1,10 @@
1
+ export type AutoExecRunner = 'claude' | 'codex' | 'cursor' | 'gemini';
2
+ export interface AutoExecConfig {
3
+ allowedRoots: string[];
4
+ pollMs: number;
5
+ timeoutMs: number;
6
+ runner: AutoExecRunner;
7
+ workflowValidationProfiles: Record<string, string[]>;
8
+ }
9
+ /** Read <base>/config.json with deny-by-default workflow and autoexec safety settings. */
10
+ export declare function readAutoExecConfig(base: string): AutoExecConfig;
@@ -0,0 +1,69 @@
1
+ import { existsSync, readFileSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { verify } from '@evomap/evolver-core';
4
+ // Default resident-loop cadence: 30s base, still multiplied by idle sleepMultiplier and single-flight gated.
5
+ const DEFAULT_POLL_MS = 30_000;
6
+ const DEFAULT_TIMEOUT_MS = 600_000;
7
+ const MAX_VALIDATION_PROFILES = 32;
8
+ const MAX_VALIDATION_COMMANDS = 16;
9
+ const MAX_VALIDATION_COMMAND_LENGTH = 300;
10
+ const PROFILE_NAME_RE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;
11
+ const SECRET_TEXT_RE = /(?:\bBearer\s+[A-Za-z0-9._~+/=-]{8,}|\b(?:sk|gh[oprsu])_[A-Za-z0-9_-]{8,}|-----BEGIN [A-Z ]*PRIVATE KEY-----|\b(?:password|passwd|secret|token|api[_-]?key)\s*[:=]\s*\S+)/i;
12
+ function parseRunner(value) {
13
+ return value === 'codex' || value === 'cursor' || value === 'gemini' ? value : 'claude';
14
+ }
15
+ function isSafeValidationCommand(value) {
16
+ if (typeof value !== 'string')
17
+ return false;
18
+ const command = value.trim();
19
+ if (command.length === 0 || command.length > MAX_VALIDATION_COMMAND_LENGTH)
20
+ return false;
21
+ if (SECRET_TEXT_RE.test(command) || verify.SHELL_METACHARS.test(command))
22
+ return false;
23
+ return true;
24
+ }
25
+ function parseValidationProfiles(value) {
26
+ if (typeof value !== 'object' || value === null || Array.isArray(value))
27
+ return {};
28
+ const profiles = {};
29
+ for (const [name, commands] of Object.entries(value).slice(0, MAX_VALIDATION_PROFILES)) {
30
+ if (!PROFILE_NAME_RE.test(name) || !Array.isArray(commands) || commands.length === 0 || commands.length > MAX_VALIDATION_COMMANDS)
31
+ continue;
32
+ if (!commands.every(isSafeValidationCommand))
33
+ continue;
34
+ profiles[name] = commands.map((command) => command.trim());
35
+ }
36
+ return profiles;
37
+ }
38
+ /** Read <base>/config.json with deny-by-default workflow and autoexec safety settings. */
39
+ export function readAutoExecConfig(base) {
40
+ const path = join(base, 'config.json');
41
+ const defaults = {
42
+ allowedRoots: [],
43
+ pollMs: DEFAULT_POLL_MS,
44
+ timeoutMs: DEFAULT_TIMEOUT_MS,
45
+ runner: 'claude',
46
+ workflowValidationProfiles: {},
47
+ };
48
+ if (!existsSync(path))
49
+ return defaults;
50
+ try {
51
+ const parsed = JSON.parse(readFileSync(path, 'utf8'));
52
+ return {
53
+ allowedRoots: Array.isArray(parsed['allowedRoots'])
54
+ ? parsed['allowedRoots'].filter((root) => typeof root === 'string' && root.trim().length > 0)
55
+ : [],
56
+ pollMs: typeof parsed['pollMs'] === 'number' && Number.isSafeInteger(parsed['pollMs']) && parsed['pollMs'] > 0
57
+ ? parsed['pollMs']
58
+ : DEFAULT_POLL_MS,
59
+ timeoutMs: typeof parsed['timeoutMs'] === 'number' && Number.isSafeInteger(parsed['timeoutMs']) && parsed['timeoutMs'] > 0
60
+ ? parsed['timeoutMs']
61
+ : DEFAULT_TIMEOUT_MS,
62
+ runner: parseRunner(parsed['runner']),
63
+ workflowValidationProfiles: parseValidationProfiles(parsed['workflowValidationProfiles']),
64
+ };
65
+ }
66
+ catch {
67
+ return defaults;
68
+ }
69
+ }
package/dist/cli.js CHANGED
@@ -1,11 +1,24 @@
1
1
  #!/usr/bin/env node
2
2
  import { settleCliProcess } from './cliLifecycle.js';
3
+ import { bootstrap } from '@evomap/evolver-core';
3
4
  const argv = process.argv.slice(2);
5
+ // Emit deprecation warnings for any V1 env vars still present in the environment.
6
+ bootstrap.checkV1EnvCompat(process.env);
4
7
  async function main() {
5
8
  if (argv[0] === 'proxy-token') {
6
9
  const { runProxyToken } = await import('./proxyToken.js');
7
10
  return runProxyToken(argv.slice(1));
8
11
  }
12
+ if (argv[0] === 'inject' && argv[1] === 'prompt-recall') {
13
+ const recallMode = String(process.env['EVOLVER_RECALL_MODE'] ?? '').trim().toLowerCase();
14
+ const hasEnvFile = Boolean(process.env['EVOLVER_ENV_FILE']?.trim());
15
+ if (!hasEnvFile && recallMode !== 'shadow' && recallMode !== 'enforce') {
16
+ process.stdout.write('{}\n');
17
+ return 0;
18
+ }
19
+ const { runPromptRecallHook } = await import('./promptRecallHook.js');
20
+ return runPromptRecallHook(argv.slice(2));
21
+ }
9
22
  const { dispatch } = await import('./dispatch.js');
10
23
  // Single dispatch path (registry in dispatch.ts): async handler if the verb is registered, else the runCli core.
11
24
  // Promise.resolve normalizes the sync (runCli → number) and async (handler → Promise<number>) branches to one exit.
@@ -1,8 +1,8 @@
1
- import { assetstore } from '@evomap/evolver-core';
1
+ import { assetstore, hub } from '@evomap/evolver-core';
2
2
  type WritableLike = {
3
3
  write(chunk: string): unknown;
4
4
  };
5
- type ContractReason = 'missing_id' | 'cli_unavailable' | 'auth_required' | 'not_found' | 'network_error' | 'unsupported' | 'internal_error' | 'redaction_unavailable' | 'leak_detected' | 'schema_invalid' | 'bundle_required' | 'quality_gate_failed' | 'insufficient_credits';
5
+ type ContractReason = 'missing_id' | 'cli_unavailable' | 'auth_required' | 'not_found' | 'network_error' | 'unsupported' | 'internal_error' | 'redaction_unavailable' | 'leak_detected' | 'schema_invalid' | 'bundle_required' | 'quality_gate_failed' | 'gene_unproven' | 'insufficient_credits' | 'unsafe_validation_command';
6
6
  export interface ReuseParseResult {
7
7
  ok: boolean;
8
8
  assetId?: string;
@@ -13,7 +13,11 @@ export interface ReuseParseResult {
13
13
  export interface PublishParseResult {
14
14
  ok: boolean;
15
15
  assetRefs?: string[];
16
+ geneRef?: string;
17
+ autoPair?: boolean;
16
18
  dryRun?: boolean;
19
+ repair?: boolean;
20
+ noRecipe?: boolean;
17
21
  jsonOut?: boolean;
18
22
  reason?: ContractReason;
19
23
  message?: string;
@@ -24,7 +28,10 @@ interface GateSummary {
24
28
  schema?: 'pass' | 'fail';
25
29
  bundle?: 'pass' | 'fail';
26
30
  quality?: 'pass' | 'fail';
31
+ quality_evidence?: PublishQualityEvidenceSource;
32
+ validation_command?: 'pass' | 'fail';
27
33
  }
34
+ type PublishQualityEvidenceSource = 'local_history' | 'bundle_seed' | 'none' | 'unavailable';
28
35
  interface PublishAssetSummary {
29
36
  asset_id?: string;
30
37
  type?: assetstore.AssetKind;
@@ -34,6 +41,7 @@ export type PublishBundleResult = {
34
41
  original: assetstore.AssetRecord[];
35
42
  sanitized: assetstore.AssetRecord[];
36
43
  blockReasons: ContractReason[];
44
+ blockMessages?: Partial<Record<ContractReason, string>>;
37
45
  gates: GateSummary;
38
46
  assets: PublishAssetSummary[];
39
47
  } | {
@@ -48,9 +56,27 @@ interface HubCallResult {
48
56
  body?: unknown;
49
57
  }
50
58
  interface ContractHubTransport {
59
+ validationCapabilityOptional?: boolean;
51
60
  fetchAssetById(assetId: string): Promise<assetstore.AssetRecord | null>;
52
61
  validate(bundle: readonly assetstore.AssetRecord[]): Promise<HubCallResult>;
53
62
  publish(bundle: readonly assetstore.AssetRecord[]): Promise<HubCallResult>;
63
+ composeRecipe?(payload: hub.RecipeComposeInput): Promise<hub.RecipeComposeResult>;
64
+ }
65
+ interface PrivateContractProxy {
66
+ status(): Promise<unknown>;
67
+ fetchAsset(args: {
68
+ assetId: string;
69
+ expectedHubMode: 'private';
70
+ }): Promise<unknown>;
71
+ validateAssetBundle(bundle: {
72
+ assets: unknown[];
73
+ expected_hub_mode?: 'private';
74
+ }): Promise<unknown>;
75
+ submitAssetBundle(bundle: {
76
+ assets: unknown[];
77
+ expected_hub_mode?: 'private';
78
+ compose_recipe?: boolean;
79
+ }): Promise<unknown>;
54
80
  }
55
81
  export interface CliContractDeps {
56
82
  out?: WritableLike;
@@ -61,12 +87,17 @@ export interface CliContractDeps {
61
87
  fetchAssetById?: (assetId: string) => Promise<assetstore.AssetRecord | null>;
62
88
  validate?: (bundle: readonly assetstore.AssetRecord[]) => Promise<HubCallResult>;
63
89
  publish?: (bundle: readonly assetstore.AssetRecord[]) => Promise<HubCallResult>;
90
+ callLog?: Pick<hub.AssetCallLog, 'append'>;
91
+ /** Test seam for private-mode proxy discovery. Production resolves the loopback proxy from env/settings. */
92
+ resolveProxyClient?: (env: NodeJS.ProcessEnv) => PrivateContractProxy | undefined;
64
93
  }
65
94
  export declare function runReuseCommand(args: readonly string[], deps?: CliContractDeps): Promise<number>;
66
95
  export declare function runPublishCommand(args: readonly string[], deps?: CliContractDeps): Promise<number>;
67
96
  export declare function parseReuseArgs(args: readonly string[]): ReuseParseResult;
68
97
  export declare function parsePublishArgs(args: readonly string[]): PublishParseResult;
69
98
  export declare function buildPublishBundle(refs: readonly string[], deps?: CliContractDeps): Promise<PublishBundleResult>;
99
+ /** Resolve `<asset_id|logical_id|path>` the way publish does. Shared so `asset-repair` speaks the same refs. */
100
+ export declare function loadAssetRef(ref: string, deps: CliContractDeps): Promise<assetstore.AssetRecord>;
70
101
  export declare function hasExplicitValidatePass(body: unknown): boolean;
71
102
  export declare function _inspectCliContractsForTest(value: unknown): string;
72
103
  export {};