@evomap/evolver-cli 2.0.0-beta.19 → 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 (68) hide show
  1. package/dist/antiGeneBenchmark.js +2 -0
  2. package/dist/antiGeneRollout.js +2 -0
  3. package/dist/assetRepair.d.ts +24 -0
  4. package/dist/assetRepair.js +172 -0
  5. package/dist/autoDistillAntiGene.js +7 -5
  6. package/dist/autoDistillLlm.d.ts +20 -0
  7. package/dist/autoDistillLlm.js +77 -15
  8. package/dist/autoexec.d.ts +11 -0
  9. package/dist/autoexec.js +65 -10
  10. package/dist/autoexecConfig.js +2 -1
  11. package/dist/cliContracts.d.ts +10 -0
  12. package/dist/cliContracts.js +407 -81
  13. package/dist/commandCatalog.d.ts +72 -0
  14. package/dist/commandCatalog.js +120 -0
  15. package/dist/cycleConsumer.d.ts +9 -0
  16. package/dist/cycleConsumer.js +14 -3
  17. package/dist/dispatch.d.ts +0 -1
  18. package/dist/dispatch.js +10 -4
  19. package/dist/distillObserver.js +23 -6
  20. package/dist/doctor.d.ts +11 -0
  21. package/dist/doctor.js +81 -6
  22. package/dist/index.d.ts +5 -1
  23. package/dist/index.js +200 -68
  24. package/dist/lifecycle.d.ts +126 -3
  25. package/dist/lifecycle.js +4390 -188
  26. package/dist/lifecycleBootstrapTransaction.d.ts +235 -0
  27. package/dist/lifecycleBootstrapTransaction.js +2182 -0
  28. package/dist/localMemoryGraph.d.ts +90 -3
  29. package/dist/localMemoryGraph.js +2031 -231
  30. package/dist/materialSnapshot.d.ts +2 -0
  31. package/dist/materialSnapshot.js +8 -0
  32. package/dist/memoryGraphOps.d.ts +8 -0
  33. package/dist/memoryGraphOps.js +140 -0
  34. package/dist/migrate/assetFormatMap.d.ts +61 -0
  35. package/dist/migrate/assetFormatMap.js +53 -0
  36. package/dist/migrate/envTranslate.js +2 -0
  37. package/dist/migrate/fieldMap.d.ts +7 -5
  38. package/dist/migrate/fieldMap.js +20 -14
  39. package/dist/migrate/v1Import.d.ts +80 -1
  40. package/dist/migrate/v1Import.js +961 -120
  41. package/dist/modelCompatibility.d.ts +10 -0
  42. package/dist/modelCompatibility.js +296 -0
  43. package/dist/recipe.d.ts +7 -1
  44. package/dist/recipe.js +113 -11
  45. package/dist/repairedAssetStore.d.ts +2 -0
  46. package/dist/repairedAssetStore.js +12 -0
  47. package/dist/reuse.d.ts +4 -1
  48. package/dist/reuse.js +212 -107
  49. package/dist/reviewFilter.d.ts +3 -1
  50. package/dist/reviewFilter.js +3 -1
  51. package/dist/runtimeSessionSource.d.ts +5 -0
  52. package/dist/selectionPolicyConfig.d.ts +8 -0
  53. package/dist/selectionPolicyConfig.js +18 -0
  54. package/dist/semanticIdfConfig.d.ts +2 -0
  55. package/dist/semanticIdfConfig.js +4 -0
  56. package/dist/sessionIngest.d.ts +7 -1
  57. package/dist/sessionIngest.js +25 -1
  58. package/dist/setupHooks.js +12 -6
  59. package/dist/skill2gep.js +57 -6
  60. package/dist/skillDistill.js +1 -0
  61. package/dist/sync.d.ts +1 -1
  62. package/dist/sync.js +761 -174
  63. package/dist/thesis.js +2 -0
  64. package/dist/valueDigest.js +8 -1
  65. package/dist/windowsLegacyTaskCleanup.d.ts +228 -0
  66. package/dist/windowsLegacyTaskCleanup.js +1475 -0
  67. package/dist/workflowRuntime.js +7 -6
  68. package/package.json +7 -7
@@ -16,6 +16,12 @@ import { resolveProxyBinPath, resolveStableNodePath } from './lifecycle.js';
16
16
  import { reviewLedgerForStore } from './reviewFilter.js';
17
17
  import { maybeEmitNonGitWorkspaceNotice } from './nonGitWorkspaceNotice.js';
18
18
  const requireFromHere = createRequire(import.meta.url);
19
+ function configuredHomeDir() {
20
+ const configured = process.platform === 'win32'
21
+ ? process.env['USERPROFILE']
22
+ : process.env['HOME'];
23
+ return configured && configured.trim() ? configured : homedir();
24
+ }
19
25
  function parseFlags(argv) {
20
26
  const out = {};
21
27
  for (let i = 0; i < argv.length; i++) {
@@ -70,7 +76,7 @@ function defaultRuntimeAvailable(runtime, configRoot, scope) {
70
76
  const resolution = resolveOpenCodeConfig({
71
77
  configRoot,
72
78
  scope,
73
- homeDir: homedir(),
79
+ homeDir: configuredHomeDir(),
74
80
  xdgConfigHome: process.env['XDG_CONFIG_HOME'],
75
81
  opencodeConfig: process.env['OPENCODE_CONFIG'],
76
82
  opencodeConfigDir: process.env['OPENCODE_CONFIG_DIR'],
@@ -79,7 +85,7 @@ function defaultRuntimeAvailable(runtime, configRoot, scope) {
79
85
  }
80
86
  const pathOptions = {
81
87
  configRoot,
82
- homeDir: homedir(),
88
+ homeDir: configuredHomeDir(),
83
89
  kiroHome: process.env['KIRO_HOME'],
84
90
  };
85
91
  const evidenceRoots = scope === 'project'
@@ -92,7 +98,7 @@ function defaultRuntimeAvailable(runtime, configRoot, scope) {
92
98
  }
93
99
  function displaySetupPath(path, configRoot, scope) {
94
100
  if (scope === 'user') {
95
- const home = homedir();
101
+ const home = configuredHomeDir();
96
102
  const homePath = safeRelativePath(home, path);
97
103
  if (homePath === '')
98
104
  return '~';
@@ -495,7 +501,7 @@ export async function runSetupHooks(argv, store, review, deps = {}) {
495
501
  server,
496
502
  scope,
497
503
  dryRun: true,
498
- homeDir: homedir(),
504
+ homeDir: configuredHomeDir(),
499
505
  kiroHome: process.env['KIRO_HOME'],
500
506
  xdgConfigHome: process.env['XDG_CONFIG_HOME'],
501
507
  opencodeConfig: process.env['OPENCODE_CONFIG'],
@@ -542,7 +548,7 @@ export async function runSetupHooks(argv, store, review, deps = {}) {
542
548
  r = uninstallInjection(runtime, {
543
549
  configRoot,
544
550
  scope,
545
- homeDir: homedir(),
551
+ homeDir: configuredHomeDir(),
546
552
  kiroHome: process.env['KIRO_HOME'],
547
553
  xdgConfigHome: process.env['XDG_CONFIG_HOME'],
548
554
  opencodeConfig: process.env['OPENCODE_CONFIG'],
@@ -659,7 +665,7 @@ export async function runSetupHooks(argv, store, review, deps = {}) {
659
665
  ...(cursorGenes ? { genes: cursorGenes } : {}),
660
666
  force: f['force'] === true,
661
667
  dryRun: f['dry-run'] === true,
662
- homeDir: homedir(),
668
+ homeDir: configuredHomeDir(),
663
669
  kiroHome: process.env['KIRO_HOME'],
664
670
  xdgConfigHome: process.env['XDG_CONFIG_HOME'],
665
671
  opencodeConfig: process.env['OPENCODE_CONFIG'],
package/dist/skill2gep.js CHANGED
@@ -14,6 +14,19 @@ export const MAX_STRATEGY_STEPS = 28;
14
14
  const SKILL2GEP_ID_PREFIX = 'gene_s2g_';
15
15
  /** Default max-files constraint for a distilled gene (v1 skillDistiller.DISTILLED_MAX_FILES). */
16
16
  const SKILL_MAX_FILES = 12;
17
+ const WORKFLOW_SECTION_KEYWORDS = [
18
+ 'workflow', 'strategy', 'steps', 'procedure', 'quick start', 'how to',
19
+ 'human gate', 'output contract', 'release', 'rollback', 'promotion',
20
+ 'process each', 'request process', 'request path',
21
+ '工作流', '流程', '步骤', '核心方法', '方法', '快速规则', '规则',
22
+ '输出门', '输出门槛', '人工确认', '人工门', '回滚', '发布', '晋级',
23
+ ];
24
+ // 安全与请求章节属于策略,而不是可选说明;丢失它们会让蒸馏后的 Skill 缺少审批和信任边界契约。
25
+ const GOVERNANCE_SECTION_KEYWORDS = [
26
+ 'security', 'safety', 'credential', 'approval', 'adversarial',
27
+ 'trust boundary', 'content isolation', 'untrusted content',
28
+ 'protect x data', 'protect data', 'data protection', 'privacy', 'legal basis', 'consent',
29
+ ];
17
30
  function sectionHeadingMatches(heading, keyword) {
18
31
  if (/^[a-z0-9 ]+$/i.test(keyword)) {
19
32
  const forms = keyword === 'verify'
@@ -105,6 +118,49 @@ export function parseSkillMd(skillMd, opts = {}) {
105
118
  }
106
119
  return steps;
107
120
  };
121
+ /** 将只有 prose 的安全章节中的声明式防护规则保留为有界策略语句。 */
122
+ const extractGovernanceStatements = (blocks) => {
123
+ const statements = [];
124
+ for (const block of blocks) {
125
+ let fenceMarker;
126
+ for (const rawLine of String(block || '').split(/\n/)) {
127
+ const line = rawLine.trim();
128
+ if (fenceMarker !== undefined) {
129
+ const closingFence = line.match(/^(`+|~+)$/);
130
+ if (closingFence !== null
131
+ && closingFence[1][0] === fenceMarker.char
132
+ && closingFence[1].length >= fenceMarker.length) {
133
+ fenceMarker = undefined;
134
+ }
135
+ continue;
136
+ }
137
+ const openingFence = line.match(/^(`{3,}|~{3,})(?:.*)?$/);
138
+ if (openingFence !== null) {
139
+ fenceMarker = { char: openingFence[1][0], length: openingFence[1].length };
140
+ continue;
141
+ }
142
+ if (!line || /^<\/?[A-Z0-9_-]+(?:>|\s)/.test(line))
143
+ continue;
144
+ const listItem = line.match(/^(?:\d+\.|[-*])\s+(.+?)\s*$/);
145
+ const statement = (listItem ? listItem[1] : line).replace(/^>\s?/, '').trim();
146
+ if (statement.length >= 5 && statement.length <= 300 && !statements.includes(statement)) {
147
+ statements.push(statement);
148
+ }
149
+ }
150
+ }
151
+ return statements;
152
+ };
153
+ const matchingGovernanceBlocks = sectionOccurrences
154
+ .filter(({ key }) => GOVERNANCE_SECTION_KEYWORDS.some((kw) => sectionHeadingMatches(key, kw)))
155
+ .map(({ lines: occurrenceLines }) => occurrenceLines.join('\n').trim());
156
+ const selectStrategySteps = (workflowSteps, governanceSteps) => {
157
+ const workflow = [...new Set(workflowSteps)];
158
+ const governance = [...new Set(governanceSteps)];
159
+ if (workflow.length + governance.length <= MAX_STRATEGY_STEPS)
160
+ return [...workflow, ...governance];
161
+ return [...governance.slice(0, MAX_STRATEGY_STEPS), ...workflow]
162
+ .slice(0, MAX_STRATEGY_STEPS);
163
+ };
108
164
  // --- signals: frontmatter.description + the trigger/when section, tokenized to [a-z0-9_] (3..40, has-letter) ---
109
165
  const signals = [];
110
166
  const signalSource = (frontmatter['description'] || '') + '\n' + pickSection([
@@ -117,12 +173,7 @@ export function parseSkillMd(skillMd, opts = {}) {
117
173
  signals.push(s);
118
174
  });
119
175
  // --- strategy: workflow + governance-tail sections; avoid: anti-pattern sections ---
120
- const strategy = extractSteps(pickSectionsAll([
121
- 'workflow', 'strategy', 'steps', 'procedure', 'quick start', 'how to',
122
- 'human gate', 'output contract', 'release', 'rollback', 'promotion',
123
- '工作流', '流程', '步骤', '核心方法', '方法', '快速规则', '规则',
124
- '输出门', '输出门槛', '人工确认', '人工门', '回滚', '发布', '晋级',
125
- ]));
176
+ const strategy = selectStrategySteps(extractSteps(pickSectionsAll(WORKFLOW_SECTION_KEYWORDS)), extractGovernanceStatements(matchingGovernanceBlocks));
126
177
  const avoid = extractSteps(pickSectionsAll([
127
178
  'avoid', 'pitfall', 'anti-pattern', 'common mistake', 'do not', 'forbidden', "don't",
128
179
  '不要做', '不要', '常见错误', '避免', '陷阱', '禁止',
@@ -222,6 +222,7 @@ export async function runSkillDistill(argv, injected = {}) {
222
222
  return 1;
223
223
  }
224
224
  process.stdout.write(`skill-distill: gene ${res.geneId} ${res.quarantined ? 'QUARANTINED (awaiting `evolver review --approve`)' : 'recorded'}\n`);
225
+ process.stdout.write(' preferred hub artifact is Recipe (`evolver recipe build --publish`), not Skill Store\n');
225
226
  if (res.capsuleId)
226
227
  process.stdout.write(` → capsule ${res.capsuleId} (real execution evidence)\n`);
227
228
  else {
package/dist/sync.d.ts CHANGED
@@ -5,7 +5,7 @@ export interface SyncAccountAssetLister {
5
5
  listAccountAssets(opts: AccountAssetListOptions): Promise<AccountAssetListResult>;
6
6
  }
7
7
  export interface SyncAccountAssetHub extends SyncAccountAssetLister {
8
- fetchAssetById(assetId: string): Promise<assetstore.AssetRecord | null>;
8
+ fetchAssetById(assetId: string, options?: hubNs.FetchAssetByIdOptions): Promise<assetstore.AssetRecord | null>;
9
9
  }
10
10
  export interface SyncCliDeps {
11
11
  hub?: SyncAccountAssetLister | SyncAccountAssetHub;