@evomap/evolver-core 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.
- package/assets/gep/genes.jsonl +5 -5
- package/dist/algo/bans.d.ts +10 -1
- package/dist/algo/bans.js +56 -6
- package/dist/algo/candidateAssembly.d.ts +25 -2
- package/dist/algo/candidateAssembly.js +171 -26
- package/dist/algo/capabilityCandidates.js +10 -0
- package/dist/algo/conversationSniffer.js +25 -8
- package/dist/algo/cycleEngine.d.ts +63 -5
- package/dist/algo/cycleEngine.js +320 -42
- package/dist/algo/cycleFailureClassifier.d.ts +1 -1
- package/dist/algo/evolutionEvent.d.ts +26 -0
- package/dist/algo/evolutionEvent.js +32 -0
- package/dist/algo/exploration.d.ts +7 -0
- package/dist/algo/exploration.js +16 -3
- package/dist/algo/geneHealth.d.ts +36 -3
- package/dist/algo/geneHealth.js +47 -4
- package/dist/algo/geneIntake.d.ts +46 -1
- package/dist/algo/geneIntake.js +121 -10
- package/dist/algo/geneSelection.d.ts +126 -6
- package/dist/algo/geneSelection.js +479 -36
- package/dist/algo/index.d.ts +6 -1
- package/dist/algo/index.js +6 -1
- package/dist/algo/kautoProjection.d.ts +41 -0
- package/dist/algo/kautoProjection.js +95 -0
- package/dist/algo/kautoValidator.d.ts +68 -0
- package/dist/algo/kautoValidator.js +256 -0
- package/dist/algo/memoryGraph.d.ts +62 -0
- package/dist/algo/memoryGraph.js +86 -0
- package/dist/algo/orchestrator.d.ts +17 -1
- package/dist/algo/orchestrator.js +30 -4
- package/dist/algo/publishEligibility.d.ts +34 -0
- package/dist/algo/publishEligibility.js +52 -0
- package/dist/algo/solidify.d.ts +11 -2
- package/dist/algo/solidify.js +37 -7
- package/dist/algo/ucb1.d.ts +53 -0
- package/dist/algo/ucb1.js +156 -0
- package/dist/assetrepair/hubRejection.d.ts +12 -0
- package/dist/assetrepair/hubRejection.js +109 -0
- package/dist/assetrepair/index.d.ts +2 -0
- package/dist/assetrepair/index.js +2 -0
- package/dist/assetrepair/repair.d.ts +33 -0
- package/dist/assetrepair/repair.js +155 -0
- package/dist/assetstore/assetSidecarRecords.d.ts +28 -0
- package/dist/assetstore/assetSidecarRecords.js +384 -0
- package/dist/assetstore/assetSidecarRecovery.d.ts +48 -0
- package/dist/assetstore/assetSidecarRecovery.js +288 -0
- package/dist/assetstore/assetStoreHealth.d.ts +81 -0
- package/dist/assetstore/assetStoreHealth.js +319 -0
- package/dist/assetstore/assetStoreLayout.d.ts +2 -0
- package/dist/assetstore/assetStoreLayout.js +6 -0
- package/dist/assetstore/assetStoreStorage.d.ts +42 -0
- package/dist/assetstore/assetStoreStorage.js +336 -0
- package/dist/assetstore/assetSyncLedger.d.ts +91 -1
- package/dist/assetstore/assetSyncLedger.js +718 -59
- package/dist/assetstore/foreignJsonlSource.d.ts +48 -0
- package/dist/assetstore/foreignJsonlSource.js +150 -0
- package/dist/assetstore/index.d.ts +5 -0
- package/dist/assetstore/index.js +5 -0
- package/dist/assetstore/learningHistory.js +3 -3
- package/dist/assetstore/localAssetStoreSnapshot.d.ts +51 -0
- package/dist/assetstore/localAssetStoreSnapshot.js +329 -0
- package/dist/assetstore/localJsonl.d.ts +12 -1
- package/dist/assetstore/localJsonl.js +251 -42
- package/dist/assetstore/provenance.d.ts +93 -4
- package/dist/assetstore/provenance.js +368 -84
- package/dist/assetstore/provider.d.ts +63 -0
- package/dist/assetstore/provider.js +97 -6
- package/dist/assetstore/reviewFilter.d.ts +19 -1
- package/dist/assetstore/reviewFilter.js +39 -1
- package/dist/assetstore/reviewLedger.d.ts +8 -2
- package/dist/assetstore/reviewLedger.js +71 -45
- package/dist/assetstore/unionReadStore.d.ts +25 -0
- package/dist/assetstore/unionReadStore.js +119 -0
- package/dist/benchmark/antiGeneBenchmark.d.ts +2 -0
- package/dist/benchmark/antiGeneBenchmark.js +4 -3
- package/dist/benchmark/antiGeneRollout.d.ts +2 -0
- package/dist/benchmark/antiGeneRollout.js +4 -3
- package/dist/benchmark/index.d.ts +3 -1
- package/dist/benchmark/index.js +3 -1
- package/dist/benchmark/selectionFlatAbstention.d.ts +152 -0
- package/dist/benchmark/selectionFlatAbstention.js +481 -0
- package/dist/benchmark/triggerShift.d.ts +62 -0
- package/dist/benchmark/triggerShift.js +106 -0
- package/dist/bootstrap/envFingerprint.d.ts +9 -0
- package/dist/bootstrap/envFingerprint.js +5 -0
- package/dist/bootstrap/index.d.ts +3 -1
- package/dist/bootstrap/index.js +3 -1
- package/dist/bootstrap/lifecycleBootstrap.d.ts +111 -0
- package/dist/bootstrap/lifecycleBootstrap.js +433 -0
- package/dist/bootstrap/v1EnvCompat.d.ts +113 -0
- package/dist/bootstrap/v1EnvCompat.js +303 -0
- package/dist/events/eventArchive.d.ts +2 -0
- package/dist/events/eventArchive.js +13 -3
- package/dist/events/eventSchema.d.ts +7 -7
- package/dist/events/eventStore.d.ts +2 -0
- package/dist/events/eventStore.js +5 -1
- package/dist/events/ingest.d.ts +2 -1
- package/dist/events/ingest.js +15 -0
- package/dist/events/paths.d.ts +12 -10
- package/dist/events/paths.js +24 -20
- package/dist/events/public.d.ts +2 -2
- package/dist/events/public.js +2 -2
- package/dist/events/reports.d.ts +2 -0
- package/dist/events/reports.js +4 -0
- package/dist/exec/autoExec.d.ts +68 -4
- package/dist/exec/autoExec.js +392 -33
- package/dist/exec/autonomousCycle.d.ts +31 -4
- package/dist/exec/autonomousCycle.js +71 -13
- package/dist/exec/claudeBridge.d.ts +80 -15
- package/dist/exec/claudeBridge.js +845 -76
- package/dist/exec/executionBinding.d.ts +414 -0
- package/dist/exec/executionBinding.js +588 -0
- package/dist/exec/index.d.ts +1 -0
- package/dist/exec/index.js +1 -0
- package/dist/exec/openPrRegistry.d.ts +8 -2
- package/dist/exec/openPrRegistry.js +32 -22
- package/dist/exec/prompt.js +14 -1
- package/dist/exec/proofOfWork.d.ts +1 -1
- package/dist/exec/proofOfWork.js +2 -2
- package/dist/exec/runnerRegistry.d.ts +153 -36
- package/dist/exec/runnerRegistry.js +848 -65
- package/dist/exec/selfPr.js +1 -7
- package/dist/feedback/envelope.d.ts +61 -0
- package/dist/feedback/envelope.js +168 -0
- package/dist/feedback/index.d.ts +1 -0
- package/dist/feedback/index.js +1 -0
- package/dist/hooks/hooks.js +1 -0
- package/dist/hub/assetCallLog.d.ts +35 -1
- package/dist/hub/assetCallLog.js +124 -1
- package/dist/hub/bindings.d.ts +8 -1
- package/dist/hub/bindings.js +29 -8
- package/dist/hub/capability.d.ts +130 -4
- package/dist/hub/conversationDistiller.d.ts +19 -0
- package/dist/hub/conversationDistiller.js +115 -37
- package/dist/hub/fake.d.ts +3 -2
- package/dist/hub/fake.js +2 -1
- package/dist/hub/index.d.ts +1 -0
- package/dist/hub/index.js +1 -0
- package/dist/hub/questionGenerator.d.ts +5 -1
- package/dist/hub/questionGenerator.js +8 -6
- package/dist/hub/recipeCompose.d.ts +27 -0
- package/dist/hub/recipeCompose.js +90 -0
- package/dist/hub/sanitize.js +122 -7
- package/dist/index.d.ts +6 -1
- package/dist/index.js +7 -1
- package/dist/issueReporter/index.d.ts +156 -0
- package/dist/issueReporter/index.js +1688 -0
- package/dist/mailbox/dispatch.d.ts +1 -1
- package/dist/mailbox/dispatch.js +22 -6
- package/dist/mailbox/envelope.d.ts +7 -1
- package/dist/mailbox/envelope.js +9 -2
- package/dist/mailbox/ipcServer.d.ts +12 -2
- package/dist/mailbox/ipcServer.js +183 -13
- package/dist/mailbox/store.d.ts +89 -3
- package/dist/mailbox/store.js +895 -41
- package/dist/modelCompatibility.d.ts +164 -0
- package/dist/modelCompatibility.js +309 -0
- package/dist/observers/valueDigestObserver.d.ts +9 -0
- package/dist/observers/valueDigestObserver.js +35 -2
- package/dist/ops/cleanup.js +1 -1
- package/dist/ops/evolutionGraphProjection.d.ts +20 -0
- package/dist/ops/evolutionGraphProjection.js +315 -0
- package/dist/ops/index.d.ts +2 -1
- package/dist/ops/index.js +2 -1
- package/dist/ops/savingsCore.js +1 -2
- package/dist/ops/selfUpdate.d.ts +18 -1
- package/dist/ops/selfUpdate.js +88 -23
- package/dist/ops/valueOutreach.d.ts +3 -1
- package/dist/ops/valueOutreach.js +5 -1
- package/dist/personality/schema.d.ts +24 -24
- package/dist/schema/evolutionGraph.d.ts +784 -0
- package/dist/schema/evolutionGraph.js +187 -0
- package/dist/schema/index.d.ts +1 -0
- package/dist/schema/index.js +1 -0
- package/dist/schema/proofOfWork.d.ts +125 -6
- package/dist/schema/proofOfWork.js +102 -4
- package/dist/schema/signal.d.ts +3 -3
- package/dist/schema/signal.js +1 -1
- package/dist/shadow/shadowHub.js +1 -0
- package/dist/signals/curriculum.d.ts +55 -0
- package/dist/signals/curriculum.js +202 -0
- package/dist/signals/cycleHistoryFromEvents.js +17 -8
- package/dist/signals/expand.d.ts +15 -1
- package/dist/signals/expand.js +169 -1
- package/dist/signals/extractor.d.ts +2 -2
- package/dist/signals/extractor.js +31 -6
- package/dist/signals/index.d.ts +4 -1
- package/dist/signals/index.js +4 -1
- package/dist/signals/metaSignals.d.ts +4 -0
- package/dist/signals/metaSignals.js +42 -0
- package/dist/signals/scopeVocabulary.d.ts +75 -0
- package/dist/signals/scopeVocabulary.js +91 -0
- package/dist/signals/signalGate.js +1 -1
- package/dist/signals/taskDomain.d.ts +22 -0
- package/dist/signals/taskDomain.js +43 -0
- package/dist/strategy/constraintAblation.d.ts +64 -0
- package/dist/strategy/constraintAblation.js +2820 -0
- package/dist/strategy/constraintAblationPredicates.d.ts +31 -0
- package/dist/strategy/constraintAblationPredicates.js +339 -0
- package/dist/strategy/index.d.ts +2 -1
- package/dist/strategy/index.js +2 -1
- package/dist/trace/index.d.ts +3 -1
- package/dist/trace/index.js +3 -1
- package/dist/trace/learningTrace.d.ts +216 -0
- package/dist/trace/learningTrace.js +298 -0
- package/dist/trace/proxyTurns.d.ts +31 -0
- package/dist/trace/proxyTurns.js +137 -0
- package/dist/trace/trajectory.d.ts +8 -0
- package/dist/trace/trajectory.js +14 -2
- package/dist/util/fetchPort.d.ts +1 -0
- package/dist/util/fetchPort.js +11 -0
- package/dist/util/fileLock.d.ts +113 -7
- package/dist/util/fileLock.js +1035 -80
- package/dist/util/index.d.ts +3 -1
- package/dist/util/index.js +2 -1
- package/dist/verify/index.d.ts +2 -1
- package/dist/verify/index.js +1 -1
- package/dist/verify/sandboxRunner.d.ts +30 -0
- package/dist/verify/sandboxRunner.js +370 -27
- package/dist/verify/sandboxedValidation.d.ts +16 -2
- package/dist/verify/sandboxedValidation.js +200 -22
- package/dist/verify/validation.d.ts +35 -4
- package/dist/verify/validation.js +164 -16
- package/dist/wire/geneHints.d.ts +88 -16
- package/dist/wire/geneHints.js +124 -15
- package/dist/wire/index.d.ts +8 -3
- package/dist/wire/index.js +2 -2
- package/dist/wire/schemaGate.d.ts +21 -0
- package/dist/wire/schemaGate.js +119 -10
- package/dist/workflow/dsl.d.ts +24 -3
- package/dist/workflow/dsl.js +4 -0
- package/dist/workflow/engine.d.ts +5 -1
- package/dist/workflow/engine.js +3 -0
- package/dist/workflow/index.d.ts +3 -1
- package/dist/workflow/index.js +3 -1
- package/dist/workflow/runtime.d.ts +110 -0
- package/dist/workflow/runtime.js +1298 -0
- package/dist/workflow/stateStore.d.ts +172 -0
- package/dist/workflow/stateStore.js +1044 -0
- package/package.json +12 -4
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* V1 → V2 environment variable compatibility layer (#698).
|
|
3
|
+
*
|
|
4
|
+
* Evolver V1 used several env var names that are no longer recognized by V2
|
|
5
|
+
* resolvers. When operators upgrade from V1 to V2 without updating their env
|
|
6
|
+
* files, these legacy names silently do nothing. This module detects the
|
|
7
|
+
* presence of deprecated V1 env vars and emits structured warnings so
|
|
8
|
+
* operators know which knobs to migrate.
|
|
9
|
+
*
|
|
10
|
+
* ## Migration map
|
|
11
|
+
*
|
|
12
|
+
* | V1 name | V2 equivalent | Notes |
|
|
13
|
+
* |---|---|---|
|
|
14
|
+
* | `OPENCLAW_WORKSPACE` | *(manual)* | Partial V2 support does not preserve V1 workspace and bridge semantics |
|
|
15
|
+
* | `EVOLVER_NO_PARENT_GIT` | *(none)* | V2 uses `EVOLVER_REPO_ROOT` or nearest Git root |
|
|
16
|
+
* | `EVOLVER_VERBOSE` | *(none)* | V2 has no global switch; opt in to feature-specific diagnostics manually |
|
|
17
|
+
* | `EVOLVER_OPENAI_COMPATIBLE_BASE_URLS` | *(manual)* | Defensive compatibility spelling; canonical V1 used the EVOMAP-prefixed key |
|
|
18
|
+
* | `EVOMAP_OPENAI_COMPATIBLE_BASE_URLS` | *(manual)* | Canonical V1 compatible-origin allowlist; selected base and credential were separate |
|
|
19
|
+
* | `EVOLVER_AUTO_ISSUE` | *(none)* | V2 creates local drafts; submit requires explicit approval-gated flow |
|
|
20
|
+
* | `EVOLVER_ROLLBACK_MODE` | *(none)* | V2 uses worktree/snapshot/recovery policy |
|
|
21
|
+
* | `WORKER_ENABLED` | *(none)* | No merchant-worker resolver in V2 |
|
|
22
|
+
* | `WORKER_DOMAINS` | *(none)* | No merchant-worker resolver in V2 |
|
|
23
|
+
* | `WORKER_MAX_LOAD` | *(none)* | No merchant-worker resolver in V2 |
|
|
24
|
+
* | `EVOLVER_MEMORY_GRAPH_AUTO_ROTATE` | *(none)* | V2 LocalMemoryGraph always performs bounded maintenance |
|
|
25
|
+
* | `EVOLVER_MEMORY_GRAPH_MAX_SIZE_MB` | *(none)* | V2 LocalMemoryGraph uses a fixed 4 MiB active-file limit |
|
|
26
|
+
* | `EVOLVER_MEMORY_GRAPH_RETENTION_COUNT` | *(none)* | V2 LocalMemoryGraph retains three archives by default |
|
|
27
|
+
* | `GITHUB_TOKEN` | `GITHUB_TOKEN` | Already supported by V2 issue reporter and PR tooling |
|
|
28
|
+
*
|
|
29
|
+
* GITHUB_TOKEN is NOT deprecated — it's actively used. We only note its
|
|
30
|
+
* presence for observability.
|
|
31
|
+
*/
|
|
32
|
+
/**
|
|
33
|
+
* The canonical table of V1 → V2 env var deprecations.
|
|
34
|
+
*
|
|
35
|
+
* Order matters for deterministic output; the scan iterates this list
|
|
36
|
+
* and checks each entry against the provided `env` object.
|
|
37
|
+
*/
|
|
38
|
+
export const V1_DEPRECATION_TABLE = [
|
|
39
|
+
{
|
|
40
|
+
v1Name: 'OPENCLAW_WORKSPACE',
|
|
41
|
+
v2Equivalent: null,
|
|
42
|
+
migrationAction: 'manual',
|
|
43
|
+
guidance: 'OPENCLAW_WORKSPACE is still read directly by the pending-signals resolver. ' +
|
|
44
|
+
'Do not copy it verbatim: identify the Git repo root before setting EVOLVER_REPO_ROOT, ' +
|
|
45
|
+
'and migrate V1 bridge behavior separately.',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
v1Name: 'EVOLVER_NO_PARENT_GIT',
|
|
49
|
+
v2Equivalent: null,
|
|
50
|
+
migrationAction: 'remove',
|
|
51
|
+
guidance: 'V2 uses EVOLVER_REPO_ROOT or the nearest Git root for workspace detection. ' +
|
|
52
|
+
'Prefer EVOLVER_REPO_ROOT; EVOLVER_NO_PARENT_GIT has no V2 effect.',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
v1Name: 'EVOLVER_VERBOSE',
|
|
56
|
+
v2Equivalent: null,
|
|
57
|
+
migrationAction: 'remove',
|
|
58
|
+
guidance: 'V2 has no global verbose switch. Remove this variable and opt in to a ' +
|
|
59
|
+
'feature-specific flag such as EVOLVER_HOOK_VERBOSE=1 only when hook diagnostics are needed.',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
v1Name: 'EVOLVER_OPENAI_COMPATIBLE_BASE_URLS',
|
|
63
|
+
v2Equivalent: null,
|
|
64
|
+
migrationAction: 'manual',
|
|
65
|
+
guidance: 'This compatibility spelling was not resolved by the canonical V1 runtime, but it is tracked defensively. ' +
|
|
66
|
+
'V2 has no multi-base or arbitrary OpenAI-compatible resolver. Review the workload before cutover. ' +
|
|
67
|
+
'While either legacy list key remains set, configure the exact canonical pair EVOLVER_LLM_OPENAI_BASE_URL ' +
|
|
68
|
+
'and EVOLVER_LLM_OPENAI_API_KEY for one official https://*.api.openai.com/v1 endpoint. ' +
|
|
69
|
+
'LiteLLM, OpenRouter, Azure OpenAI, MiniMax, DeepSeek, Moonshot, and custom endpoints are not drop-in routes; ' +
|
|
70
|
+
'do not copy their credentials into the V2 OpenAI route.',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
v1Name: 'EVOMAP_OPENAI_COMPATIBLE_BASE_URLS',
|
|
74
|
+
v2Equivalent: null,
|
|
75
|
+
migrationAction: 'manual',
|
|
76
|
+
guidance: 'Canonical V1 treated this comma-separated value as an allowed-origin list; EVOMAP_OPENAI_BASE_URL still selected one ' +
|
|
77
|
+
'endpoint and EVOMAP_OPENAI_API_KEY or OPENAI_API_KEY supplied its credential. V2 requires a workload-by-workload review ' +
|
|
78
|
+
'and has no automatic mapping. While the legacy list remains set, only the exact canonical pair ' +
|
|
79
|
+
'EVOLVER_LLM_OPENAI_BASE_URL and EVOLVER_LLM_OPENAI_API_KEY acknowledges migration; otherwise keep the incompatible ' +
|
|
80
|
+
'workload outside the V2 OpenAI route.',
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
v1Name: 'EVOLVER_AUTO_ISSUE',
|
|
84
|
+
v2Equivalent: null,
|
|
85
|
+
migrationAction: 'remove',
|
|
86
|
+
guidance: 'V2 does not auto-submit issues. It creates local drafts and requires ' +
|
|
87
|
+
'explicit approval-gated submission via `evolver issue-report submit`.',
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
v1Name: 'EVOLVER_ROLLBACK_MODE',
|
|
91
|
+
v2Equivalent: null,
|
|
92
|
+
migrationAction: 'remove',
|
|
93
|
+
guidance: 'V2 uses worktree, snapshot, and recovery policy instead of legacy hard-reset. ' +
|
|
94
|
+
'Remove this variable; it has no effect.',
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
v1Name: 'WORKER_ENABLED',
|
|
98
|
+
v2Equivalent: null,
|
|
99
|
+
migrationAction: 'remove',
|
|
100
|
+
guidance: 'V2 has no merchant-worker resolver. Remove this variable; it has no effect.',
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
v1Name: 'WORKER_DOMAINS',
|
|
104
|
+
v2Equivalent: null,
|
|
105
|
+
migrationAction: 'remove',
|
|
106
|
+
guidance: 'V2 has no merchant-worker resolver. Remove this variable; it has no effect.',
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
v1Name: 'WORKER_MAX_LOAD',
|
|
110
|
+
v2Equivalent: null,
|
|
111
|
+
migrationAction: 'remove',
|
|
112
|
+
guidance: 'V2 has no merchant-worker resolver. Remove this variable; it has no effect.',
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
v1Name: 'EVOLVER_MEMORY_GRAPH_AUTO_ROTATE',
|
|
116
|
+
v2Equivalent: null,
|
|
117
|
+
migrationAction: 'remove',
|
|
118
|
+
guidance: 'V2 LocalMemoryGraph always rotates and compacts automatically at its bounded defaults. ' +
|
|
119
|
+
'There is no environment override; remove this variable.',
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
v1Name: 'EVOLVER_MEMORY_GRAPH_MAX_SIZE_MB',
|
|
123
|
+
v2Equivalent: null,
|
|
124
|
+
migrationAction: 'remove',
|
|
125
|
+
guidance: 'V2 LocalMemoryGraph uses a fixed 4 MiB active-file limit before rotation and compaction. ' +
|
|
126
|
+
'There is no environment override; remove this variable.',
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
v1Name: 'EVOLVER_MEMORY_GRAPH_RETENTION_COUNT',
|
|
130
|
+
v2Equivalent: null,
|
|
131
|
+
migrationAction: 'remove',
|
|
132
|
+
guidance: 'V2 LocalMemoryGraph retains three archives by default and prunes older archives automatically. ' +
|
|
133
|
+
'There is no environment override; remove this variable.',
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
v1Name: 'EVOLVER_ATP',
|
|
137
|
+
v2Equivalent: null,
|
|
138
|
+
migrationAction: 'manual',
|
|
139
|
+
guidance: 'V1 auto/on/off controlled merchant/provider lifecycle, which has no one-to-one V2 resolver. '
|
|
140
|
+
+ 'Review the missing merchant workflow before removing this key. Do not map it to `evolver atp enable` '
|
|
141
|
+
+ 'or EVOLVER_ATP_AUTOBUY; those controls authorize autonomous buyer spending. If V1 off meant no '
|
|
142
|
+
+ 'provider or delivery activity, set EVOLVER_ATP_AUTODELIVER=off explicitly as hardening, not as an equivalent mapping.',
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
v1Name: 'EVOLVER_SESSION_SOURCE',
|
|
146
|
+
v2Equivalent: null,
|
|
147
|
+
migrationAction: 'manual',
|
|
148
|
+
guidance: 'V1 auto/cursor/openclaw/merge selected session collectors, which has no one-to-one V2 resolver. '
|
|
149
|
+
+ 'Review the workload before removing this key. Supported trajectory export requires explicit runtime '
|
|
150
|
+
+ 'discovery or transcript-directory controls; setting another aggregate key does not restore OpenClaw collection.',
|
|
151
|
+
},
|
|
152
|
+
];
|
|
153
|
+
/**
|
|
154
|
+
* Scan the provided environment for deprecated V1 env vars and return
|
|
155
|
+
* structured results. This function is purely read-only and never mutates
|
|
156
|
+
* the `env` object.
|
|
157
|
+
*
|
|
158
|
+
* @param env The environment to scan (defaults to `process.env`).
|
|
159
|
+
* @returns Structured scan results including detected deprecations.
|
|
160
|
+
*/
|
|
161
|
+
export function scanV1EnvCompat(env = typeof process !== 'undefined' ? process.env : {}) {
|
|
162
|
+
const detected = [];
|
|
163
|
+
for (const entry of V1_DEPRECATION_TABLE) {
|
|
164
|
+
const value = env[entry.v1Name];
|
|
165
|
+
if (value !== undefined && value.trim() !== '') {
|
|
166
|
+
detected.push(entry);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
const githubTokenPresent = (env['GITHUB_TOKEN'] !== undefined && env['GITHUB_TOKEN'].trim() !== '') ||
|
|
170
|
+
(env['GH_TOKEN'] !== undefined && env['GH_TOKEN'].trim() !== '');
|
|
171
|
+
return { detected, githubTokenPresent };
|
|
172
|
+
}
|
|
173
|
+
/** Resolve the migration action while preserving compatibility with pre-action table entries. */
|
|
174
|
+
export function resolveV1EnvMigrationAction(entry) {
|
|
175
|
+
return entry.migrationAction ?? (entry.v2Equivalent ? 'map' : 'remove');
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Emit deprecation warnings to the provided logger for all detected
|
|
179
|
+
* deprecated V1 env vars. This is the primary integration point for
|
|
180
|
+
* entrypoints that want human-readable console output.
|
|
181
|
+
*
|
|
182
|
+
* @param result The scan result from `scanV1EnvCompat`.
|
|
183
|
+
* @param warn Logger function (defaults to `console.warn`).
|
|
184
|
+
*/
|
|
185
|
+
export function emitV1DeprecationWarnings(result, warn = (msg) => console.warn(msg)) {
|
|
186
|
+
for (const dep of result.detected) {
|
|
187
|
+
const action = resolveV1EnvMigrationAction(dep);
|
|
188
|
+
const v2Hint = action === 'map' && dep.v2Equivalent
|
|
189
|
+
? ` Use ${dep.v2Equivalent} instead.`
|
|
190
|
+
: '';
|
|
191
|
+
const lead = action === 'manual'
|
|
192
|
+
? `Deprecated env var ${dep.v1Name} is set and requires manual migration.`
|
|
193
|
+
: action === 'map'
|
|
194
|
+
? `Deprecated env var ${dep.v1Name} is set.`
|
|
195
|
+
: `Deprecated env var ${dep.v1Name} is set but has no V2 resolver.`;
|
|
196
|
+
warn(`[evolver:v1-compat] ${lead}${v2Hint} ${dep.guidance}`);
|
|
197
|
+
}
|
|
198
|
+
// githubTokenPresent is intentionally not warned: GITHUB_TOKEN/GH_TOKEN remain
|
|
199
|
+
// supported by V2 issue reporter / PR tooling. Flag retained for callers/tests.
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Convenience function: scan + emit in one call. Intended for early
|
|
203
|
+
* bootstrap in CLI/proxy/MCP entrypoints.
|
|
204
|
+
*
|
|
205
|
+
* @param env The environment to scan.
|
|
206
|
+
* @param warn Logger function.
|
|
207
|
+
* @returns The scan result (useful for programmatic inspection).
|
|
208
|
+
*/
|
|
209
|
+
export function checkV1EnvCompat(env = typeof process !== 'undefined' ? process.env : {}, warn) {
|
|
210
|
+
const result = scanV1EnvCompat(env);
|
|
211
|
+
if (result.detected.length > 0) {
|
|
212
|
+
emitV1DeprecationWarnings(result, warn);
|
|
213
|
+
}
|
|
214
|
+
return result;
|
|
215
|
+
}
|
|
216
|
+
const V1_IMPLICIT_DEFAULT_CAVEATS = [
|
|
217
|
+
'V1 treated unset EVOLVER_ATP and EVOLVER_SESSION_SOURCE as auto. A clean key scan therefore does not prove '
|
|
218
|
+
+ 'merchant/provider or session-collection workflow parity; audit both before cutover.',
|
|
219
|
+
];
|
|
220
|
+
/**
|
|
221
|
+
* Build an offline V1→V2 env translation report.
|
|
222
|
+
* Does not write files; callers decide how to present or apply suggestions.
|
|
223
|
+
* Raw values are retained only as v2Value for mappable non-secret keys.
|
|
224
|
+
* GITHUB_TOKEN and GH_TOKEN are reported as keep without retaining their values.
|
|
225
|
+
*/
|
|
226
|
+
export function translateV1Env(env = typeof process !== 'undefined' ? process.env : {}) {
|
|
227
|
+
const suggestions = [];
|
|
228
|
+
for (const entry of V1_DEPRECATION_TABLE) {
|
|
229
|
+
const raw = env[entry.v1Name];
|
|
230
|
+
if (raw === undefined || raw.trim() === '')
|
|
231
|
+
continue;
|
|
232
|
+
const action = resolveV1EnvMigrationAction(entry);
|
|
233
|
+
if (action === 'map') {
|
|
234
|
+
if (!entry.v2Equivalent)
|
|
235
|
+
throw new Error(`missing V2 equivalent for ${entry.v1Name}`);
|
|
236
|
+
suggestions.push({
|
|
237
|
+
v1Name: entry.v1Name,
|
|
238
|
+
action: 'map',
|
|
239
|
+
v2Name: entry.v2Equivalent,
|
|
240
|
+
v2Value: raw,
|
|
241
|
+
guidance: entry.guidance,
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
suggestions.push({
|
|
246
|
+
v1Name: entry.v1Name,
|
|
247
|
+
action,
|
|
248
|
+
guidance: entry.guidance,
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
const githubTokenPresent = (env['GITHUB_TOKEN'] !== undefined && env['GITHUB_TOKEN'].trim() !== '') ||
|
|
253
|
+
(env['GH_TOKEN'] !== undefined && env['GH_TOKEN'].trim() !== '');
|
|
254
|
+
if (githubTokenPresent) {
|
|
255
|
+
const key = env['GITHUB_TOKEN']?.trim() ? 'GITHUB_TOKEN' : 'GH_TOKEN';
|
|
256
|
+
suggestions.push({
|
|
257
|
+
v1Name: key,
|
|
258
|
+
action: 'keep',
|
|
259
|
+
v2Name: key,
|
|
260
|
+
guidance: 'GITHUB_TOKEN/GH_TOKEN remain valid for issue submit and gh-based PR tooling. ' +
|
|
261
|
+
'Prefer GH_TOKEN when using the GitHub CLI.',
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
return {
|
|
265
|
+
suggestions,
|
|
266
|
+
detectedCount: suggestions.filter((s) => s.action !== 'keep').length,
|
|
267
|
+
mappableCount: suggestions.filter((s) => s.action === 'map').length,
|
|
268
|
+
manualCount: suggestions.filter((s) => s.action === 'manual').length,
|
|
269
|
+
removableCount: suggestions.filter((s) => s.action === 'remove').length,
|
|
270
|
+
githubTokenPresent,
|
|
271
|
+
caveats: V1_IMPLICIT_DEFAULT_CAVEATS,
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
/** Human-readable report (never prints secret-looking values; only key names + actions). */
|
|
275
|
+
export function formatV1EnvTranslationReport(report) {
|
|
276
|
+
const lines = [
|
|
277
|
+
'V1 → V2 env translation (offline, no writes):',
|
|
278
|
+
` detected_deprecated=${report.detectedCount} map=${report.mappableCount} manual=${report.manualCount} remove=${report.removableCount} github_token=${report.githubTokenPresent ? 'present' : 'absent'}`,
|
|
279
|
+
];
|
|
280
|
+
for (const caveat of report.caveats ?? [])
|
|
281
|
+
lines.push(` caveat: ${caveat}`);
|
|
282
|
+
if (report.suggestions.length === 0) {
|
|
283
|
+
lines.push(' (no explicit V1-only knobs detected)');
|
|
284
|
+
return `${lines.join('\n')}\n`;
|
|
285
|
+
}
|
|
286
|
+
for (const s of report.suggestions) {
|
|
287
|
+
if (s.action === 'map') {
|
|
288
|
+
lines.push(` map ${s.v1Name} → ${s.v2Name}`);
|
|
289
|
+
}
|
|
290
|
+
else if (s.action === 'manual') {
|
|
291
|
+
lines.push(` review ${s.v1Name} (manual migration required)`);
|
|
292
|
+
}
|
|
293
|
+
else if (s.action === 'remove') {
|
|
294
|
+
lines.push(` drop ${s.v1Name} (no V2 resolver)`);
|
|
295
|
+
}
|
|
296
|
+
else {
|
|
297
|
+
lines.push(` keep ${s.v1Name} (still valid in V2)`);
|
|
298
|
+
}
|
|
299
|
+
lines.push(` ${s.guidance}`);
|
|
300
|
+
}
|
|
301
|
+
lines.push(' See docs/migration-guide.md and docs/config-env.md § V1 变量不再是 V2 的有效配置.');
|
|
302
|
+
return `${lines.join('\n')}\n`;
|
|
303
|
+
}
|
|
@@ -61,5 +61,7 @@ export declare function rootEventArchiveSegmentName(firstSeq: number, lastSeq: n
|
|
|
61
61
|
export declare function planRootEventArchive(opts: RootEventArchiveOptions): RootEventArchivePlan;
|
|
62
62
|
export declare function archiveRootEvents(opts: RootEventArchiveOptions): RootEventArchiveResult;
|
|
63
63
|
export declare function readRootEventHistory(path: string, archiveDir?: string): RootEvent[];
|
|
64
|
+
/** Strict replay for control-plane decisions that must fail closed on partial or conflicting history. */
|
|
65
|
+
export declare function readRootEventHistoryStrict(path: string): RootEvent[];
|
|
64
66
|
export declare function validateRootEventHistory(path: string): void;
|
|
65
67
|
export declare function inspectRootEventArchive(path: string): RootEventArchiveStats;
|
|
@@ -131,6 +131,9 @@ export function archiveRootEvents(opts) {
|
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
export function readRootEventHistory(path, archiveDir = rootEventArchiveDir(path)) {
|
|
134
|
+
// Snapshot active first. Writers publish archive segments before replacing active, so this prevents a reader
|
|
135
|
+
// from combining an old archive inventory with the new active tail and temporarily dropping the rotated prefix.
|
|
136
|
+
const active = readEventsLenient(path);
|
|
134
137
|
const bySeq = new Map();
|
|
135
138
|
for (const file of archiveSegmentFiles(archiveDir)) {
|
|
136
139
|
for (const event of readEventsLenient(join(archiveDir, file))) {
|
|
@@ -143,13 +146,20 @@ export function readRootEventHistory(path, archiveDir = rootEventArchiveDir(path
|
|
|
143
146
|
}
|
|
144
147
|
// Preserve the pre-archive fail-soft behavior for routine commands. The active log is the current writer
|
|
145
148
|
// source, so it deterministically wins an active/archive conflict without crashing status/report readers.
|
|
146
|
-
for (const event of
|
|
149
|
+
for (const event of active)
|
|
147
150
|
bySeq.set(event.seq, event);
|
|
148
151
|
return [...bySeq.values()].sort((a, b) => a.seq - b.seq);
|
|
149
152
|
}
|
|
150
|
-
|
|
153
|
+
/** Strict replay for control-plane decisions that must fail closed on partial or conflicting history. */
|
|
154
|
+
export function readRootEventHistoryStrict(path) {
|
|
151
155
|
const active = readActiveStrict(path);
|
|
152
|
-
readValidatedArchive(path, active);
|
|
156
|
+
const bySeq = readValidatedArchive(path, active);
|
|
157
|
+
for (const line of active)
|
|
158
|
+
bySeq.set(line.event.seq, line.event);
|
|
159
|
+
return [...bySeq.values()].sort((left, right) => left.seq - right.seq);
|
|
160
|
+
}
|
|
161
|
+
export function validateRootEventHistory(path) {
|
|
162
|
+
void readRootEventHistoryStrict(path);
|
|
153
163
|
}
|
|
154
164
|
export function inspectRootEventArchive(path) {
|
|
155
165
|
const archiveDir = rootEventArchiveDir(path);
|
|
@@ -81,6 +81,11 @@ export declare const rootEvent: z.ZodObject<{
|
|
|
81
81
|
}>>;
|
|
82
82
|
}, "strip", z.ZodTypeAny, {
|
|
83
83
|
type: string;
|
|
84
|
+
actor: {
|
|
85
|
+
kind: "machine" | "human";
|
|
86
|
+
id?: string | undefined;
|
|
87
|
+
};
|
|
88
|
+
schemaVersion: string;
|
|
84
89
|
ts: string;
|
|
85
90
|
human: {
|
|
86
91
|
severity: "warn" | "info" | "notice" | "error";
|
|
@@ -92,12 +97,7 @@ export declare const rootEvent: z.ZodObject<{
|
|
|
92
97
|
};
|
|
93
98
|
seq: number;
|
|
94
99
|
eventId: string;
|
|
95
|
-
schemaVersion: string;
|
|
96
100
|
replayability: "deterministic" | "stochastic_recorded" | "stochastic_unreproducible";
|
|
97
|
-
actor: {
|
|
98
|
-
kind: "machine" | "human";
|
|
99
|
-
id?: string | undefined;
|
|
100
|
-
};
|
|
101
101
|
payload?: unknown;
|
|
102
102
|
}, {
|
|
103
103
|
type: string;
|
|
@@ -113,12 +113,12 @@ export declare const rootEvent: z.ZodObject<{
|
|
|
113
113
|
seq: number;
|
|
114
114
|
eventId: string;
|
|
115
115
|
payload?: unknown;
|
|
116
|
-
schemaVersion?: string | undefined;
|
|
117
|
-
replayability?: "deterministic" | "stochastic_recorded" | "stochastic_unreproducible" | undefined;
|
|
118
116
|
actor?: {
|
|
119
117
|
kind?: "machine" | "human" | undefined;
|
|
120
118
|
id?: string | undefined;
|
|
121
119
|
} | undefined;
|
|
120
|
+
schemaVersion?: string | undefined;
|
|
121
|
+
replayability?: "deterministic" | "stochastic_recorded" | "stochastic_unreproducible" | undefined;
|
|
122
122
|
}>;
|
|
123
123
|
export type RootEvent = z.infer<typeof rootEvent>;
|
|
124
124
|
/** append 入参: seq/eventId/ts 由 store 生成. */
|
|
@@ -22,6 +22,8 @@ export declare class EventStore {
|
|
|
22
22
|
private appendLocked;
|
|
23
23
|
/** 读全部事件 (跳过尾部半行/损坏行). */
|
|
24
24
|
readAll(): RootEvent[];
|
|
25
|
+
/** Fail-closed replay for decision policies that cannot safely consume a partial history. */
|
|
26
|
+
readAllStrict(): RootEvent[];
|
|
25
27
|
iterate(fromSeq?: number): Generator<RootEvent>;
|
|
26
28
|
tail(n?: number): RootEvent[];
|
|
27
29
|
/** 截断尾部半行 (崩溃恢复). */
|
|
@@ -2,7 +2,7 @@ import { openSync, writeSync, fsyncSync, closeSync, statSync, readSync, mkdirSyn
|
|
|
2
2
|
import { dirname } from 'node:path';
|
|
3
3
|
import { monotonicFactory } from 'ulid';
|
|
4
4
|
import { acquireLock, releaseLock } from '../util/fileLock.js';
|
|
5
|
-
import { readRootEventHistory } from './eventArchive.js';
|
|
5
|
+
import { readRootEventHistory, readRootEventHistoryStrict } from './eventArchive.js';
|
|
6
6
|
// Monotonic ULIDs: plain ulid() randomizes the low 80 bits, so two ids minted in the SAME millisecond can sort
|
|
7
7
|
// out of order — the event log wants time-sortable eventIds (and a flaky CI test proved it). The monotonic
|
|
8
8
|
// factory increments within a millisecond, guaranteeing each successive eventId is strictly greater.
|
|
@@ -76,6 +76,10 @@ export class EventStore {
|
|
|
76
76
|
readAll() {
|
|
77
77
|
return readRootEventHistory(this.path);
|
|
78
78
|
}
|
|
79
|
+
/** Fail-closed replay for decision policies that cannot safely consume a partial history. */
|
|
80
|
+
readAllStrict() {
|
|
81
|
+
return readRootEventHistoryStrict(this.path);
|
|
82
|
+
}
|
|
79
83
|
*iterate(fromSeq = 0) {
|
|
80
84
|
for (const e of this.readAll())
|
|
81
85
|
if (e.seq >= fromSeq)
|
package/dist/events/ingest.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { EventStore, type EventStoreOptions } from './eventStore.js';
|
|
|
2
2
|
import type { RawEvent, RootEvent } from './eventSchema.js';
|
|
3
3
|
import type { EventSink } from './sink.js';
|
|
4
4
|
/** 已知事件类型 (军杰 §9; 可 registerEventType 扩展). */
|
|
5
|
-
export declare const EVENT_TYPES: readonly ["cycle.started", "cycle.signals_collected", "cycle.solidified", "cycle.failed", "cycle.aborted", "cycle.heartbeat", "cycle.consumed", "decision.gene_selected", "decision.triggered", "decision.suppressed", "personality.selected", "personality.risk_gated", "personality.mutated", "personality.stats_updated", "personality.pivoted", "signals.extracted", "mutation.built", "capsule.produced", "evolution_event.projected", "observer.quarantined", "observer.dead_letter", "actor.human.nudge", "actor.human.intervene", "actor.human.teach", "actor.human.observe", "actor.human.review.approve", "actor.human.review.reject", "gene.distilled", "gene.distill_shadowed", "anti_gene.distilled", "anti_gene.distill_shadowed", "anti_gene.benchmark_result", "anti_gene.rollout_result", "reflection.recorded", "material.batch_ready", "value.reuse_hit", "value.inject", "value.reuse_outcome", "value.recall"];
|
|
5
|
+
export declare const EVENT_TYPES: readonly ["cycle.started", "cycle.signals_collected", "cycle.solidified", "cycle.failed", "cycle.aborted", "cycle.heartbeat", "cycle.consumed", "decision.gene_selected", "decision.triggered", "decision.suppressed", "personality.selected", "personality.risk_gated", "personality.mutated", "personality.stats_updated", "personality.pivoted", "signals.extracted", "mutation.built", "capsule.produced", "evolution_event.projected", "observer.quarantined", "observer.dead_letter", "actor.human.nudge", "actor.human.intervene", "actor.human.teach", "actor.human.observe", "actor.human.review.approve", "actor.human.review.reject", "actor.human.trust.promote", "actor.human.trust.revoke", "actor.human.sidecar.recover", "gene.distilled", "gene.distill_shadowed", "anti_gene.distilled", "anti_gene.distill_shadowed", "anti_gene.benchmark_result", "anti_gene.rollout_result", "reflection.recorded", "material.batch_ready", "value.reuse_hit", "value.inject", "value.reuse_outcome", "value.recall", "execution.binding.created", "execution.started", "execution.decision", "execution.terminal", "execution.recovered", "governance.projection.revoked", "governance.projection.reinstated"];
|
|
6
6
|
export type EventType = (typeof EVENT_TYPES)[number];
|
|
7
7
|
export declare function registerEventType(t: string): void;
|
|
8
8
|
export declare function isKnownEventType(t: string): boolean;
|
|
@@ -25,6 +25,7 @@ export declare class Ingestor {
|
|
|
25
25
|
constructor(opts: IngestorOptions);
|
|
26
26
|
ingest(raw: RawEvent): Promise<RootEvent>;
|
|
27
27
|
readAll(): RootEvent[];
|
|
28
|
+
readAllStrict(): RootEvent[];
|
|
28
29
|
iterate(fromSeq?: number): Generator<RootEvent>;
|
|
29
30
|
tail(n?: number): RootEvent[];
|
|
30
31
|
recover(): {
|
package/dist/events/ingest.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { dirname, join } from 'node:path';
|
|
1
2
|
import { EventStore } from './eventStore.js';
|
|
3
|
+
import { createIssueDraftForEventBestEffort } from '../issueReporter/index.js';
|
|
2
4
|
/** 已知事件类型 (军杰 §9; 可 registerEventType 扩展). */
|
|
3
5
|
export const EVENT_TYPES = [
|
|
4
6
|
'cycle.started', 'cycle.signals_collected', 'cycle.solidified', 'cycle.failed',
|
|
@@ -10,12 +12,19 @@ export const EVENT_TYPES = [
|
|
|
10
12
|
'observer.quarantined', 'observer.dead_letter',
|
|
11
13
|
'actor.human.nudge', 'actor.human.intervene', 'actor.human.teach', 'actor.human.observe',
|
|
12
14
|
'actor.human.review.approve', 'actor.human.review.reject',
|
|
15
|
+
'actor.human.trust.promote', 'actor.human.trust.revoke',
|
|
16
|
+
'actor.human.sidecar.recover',
|
|
13
17
|
'gene.distilled', 'gene.distill_shadowed',
|
|
14
18
|
'anti_gene.distilled', 'anti_gene.distill_shadowed',
|
|
15
19
|
'anti_gene.benchmark_result', 'anti_gene.rollout_result',
|
|
16
20
|
'reflection.recorded',
|
|
17
21
|
'material.batch_ready',
|
|
18
22
|
'value.reuse_hit', 'value.inject', 'value.reuse_outcome', 'value.recall',
|
|
23
|
+
'execution.binding.created', 'execution.started', 'execution.decision', 'execution.terminal', 'execution.recovered',
|
|
24
|
+
// K_auto EvidenceProjection: coordinate-level partial revocation over (version, claim, scope, runtime,
|
|
25
|
+
// verifier). A revoked event distrusts one (coordinate, value) pair; a reinstated event withdraws it. The
|
|
26
|
+
// authoritative root-event stream is the single source of truth (see algo/kautoProjection.projectRevocations).
|
|
27
|
+
'governance.projection.revoked', 'governance.projection.reinstated',
|
|
19
28
|
];
|
|
20
29
|
const knownTypes = new Set(EVENT_TYPES);
|
|
21
30
|
export function registerEventType(t) { knownTypes.add(t); }
|
|
@@ -49,11 +58,17 @@ export class Ingestor {
|
|
|
49
58
|
if (raw.actor?.kind === 'human' && !raw.actor.id)
|
|
50
59
|
throw new IngestValidationError('actor.kind=human 必带 actor.id (审计, 军杰 §9.7)');
|
|
51
60
|
const evt = await this.store.append(raw);
|
|
61
|
+
createIssueDraftForEventBestEffort(evt, {
|
|
62
|
+
rootDir: join(dirname(this.store.path), 'issue-reporter'),
|
|
63
|
+
workspaceScope: process.cwd(),
|
|
64
|
+
env: process.env,
|
|
65
|
+
});
|
|
52
66
|
this.sink?.dispatch(evt);
|
|
53
67
|
return evt;
|
|
54
68
|
}
|
|
55
69
|
// 读 passthrough (写只能经 ingest)
|
|
56
70
|
readAll() { return this.store.readAll(); }
|
|
71
|
+
readAllStrict() { return this.store.readAllStrict(); }
|
|
57
72
|
iterate(fromSeq = 0) { return this.store.iterate(fromSeq); }
|
|
58
73
|
tail(n = 1) { return this.store.tail(n); }
|
|
59
74
|
recover() { return this.store.recover(); }
|
package/dist/events/paths.d.ts
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
/** ~/.evomap, 可 EVOLVER_HOME/EVOMAP_HOME 覆盖. */
|
|
2
|
-
export declare function evomapHome(): string;
|
|
3
|
-
export declare function rootEventsPath(): string;
|
|
4
|
-
export declare function mvDir(): string;
|
|
2
|
+
export declare function evomapHome(env?: Readonly<Record<string, string | undefined>>): string;
|
|
3
|
+
export declare function rootEventsPath(env?: Readonly<Record<string, string | undefined>>): string;
|
|
4
|
+
export declare function mvDir(env?: Readonly<Record<string, string | undefined>>): string;
|
|
5
5
|
/** 可进化人格模型持久化文件 (五维向量 + 各键统计 + 变更历史). v1 personality_state.json 的 v2 落点. */
|
|
6
|
-
export declare function personalityStatePath(): string;
|
|
7
|
-
export declare function assetsDir(): string;
|
|
6
|
+
export declare function personalityStatePath(env?: Readonly<Record<string, string | undefined>>): string;
|
|
7
|
+
export declare function assetsDir(env?: Readonly<Record<string, string | undefined>>): string;
|
|
8
8
|
/** M1 raw-material substrate (append-only jsonl consumed by the cycle). */
|
|
9
|
-
export declare function materialDir(): string;
|
|
9
|
+
export declare function materialDir(env?: Readonly<Record<string, string | undefined>>): string;
|
|
10
10
|
/** MaterialStore backing file. */
|
|
11
|
-
export declare function materialStorePath(): string;
|
|
11
|
+
export declare function materialStorePath(env?: Readonly<Record<string, string | undefined>>): string;
|
|
12
12
|
/** Per-source watermark cursor used to make re-ingest idempotent (file-level dedup). */
|
|
13
|
-
export declare function materialWatermarkPath(): string;
|
|
13
|
+
export declare function materialWatermarkPath(env?: Readonly<Record<string, string | undefined>>): string;
|
|
14
14
|
/** Proxy LLM-trace day-files dir (`llm-trace-YYYYMMDD.jsonl`), the route-savings source for the value ledger.
|
|
15
15
|
* Mirrors the proxy's EVOLVER_LLM_TRACE_DIR default so the outreach layer reads what the proxy wrote. */
|
|
16
|
-
export declare function tracesDir(): string;
|
|
16
|
+
export declare function tracesDir(env?: Readonly<Record<string, string | undefined>>): string;
|
|
17
17
|
/** Hub-asset audit trail (`asset_call_log.jsonl`): one JSONL line per hub-asset interaction (search hit/miss,
|
|
18
18
|
* reuse/reference, publish, review). Written best-effort by AssetCallLog; the desktop's RecallHistory / 召回历程
|
|
19
19
|
* reads it. Defaults to the evomap home root, beside assets/ + evolution/.
|
|
20
20
|
* NOTE(reuse/#234): confirm this matches where the proxy/RecallHistory reads — best-effort append, so a path
|
|
21
21
|
* mismatch degrades the audit line, never the reuse write itself. */
|
|
22
|
-
export declare function assetCallLogPath(): string;
|
|
22
|
+
export declare function assetCallLogPath(env?: Readonly<Record<string, string | undefined>>): string;
|
|
23
|
+
/** Learning Ops local output dir: per-run LearningPacket drafts + trace-event JSONL (hub upload is a later slice). */
|
|
24
|
+
export declare function learningTraceDir(env?: Readonly<Record<string, string | undefined>>): string;
|
package/dist/events/paths.js
CHANGED
|
@@ -1,44 +1,48 @@
|
|
|
1
1
|
import { homedir } from 'node:os';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
/** ~/.evomap, 可 EVOLVER_HOME/EVOMAP_HOME 覆盖. */
|
|
4
|
-
export function evomapHome() {
|
|
5
|
-
return
|
|
4
|
+
export function evomapHome(env = process.env) {
|
|
5
|
+
return env['EVOLVER_HOME'] ?? env['EVOMAP_HOME'] ?? join(homedir(), '.evomap');
|
|
6
6
|
}
|
|
7
|
-
export function rootEventsPath() {
|
|
8
|
-
return join(evomapHome(), 'evolution', 'root_events.jsonl');
|
|
7
|
+
export function rootEventsPath(env = process.env) {
|
|
8
|
+
return join(evomapHome(env), 'evolution', 'root_events.jsonl');
|
|
9
9
|
}
|
|
10
|
-
export function mvDir() {
|
|
11
|
-
return join(evomapHome(), 'evolution', 'mv');
|
|
10
|
+
export function mvDir(env = process.env) {
|
|
11
|
+
return join(evomapHome(env), 'evolution', 'mv');
|
|
12
12
|
}
|
|
13
13
|
/** 可进化人格模型持久化文件 (五维向量 + 各键统计 + 变更历史). v1 personality_state.json 的 v2 落点. */
|
|
14
|
-
export function personalityStatePath() {
|
|
15
|
-
return join(evomapHome(), 'evolution', 'personality_state.json');
|
|
14
|
+
export function personalityStatePath(env = process.env) {
|
|
15
|
+
return join(evomapHome(env), 'evolution', 'personality_state.json');
|
|
16
16
|
}
|
|
17
|
-
export function assetsDir() {
|
|
18
|
-
return join(evomapHome(), 'assets');
|
|
17
|
+
export function assetsDir(env = process.env) {
|
|
18
|
+
return join(evomapHome(env), 'assets');
|
|
19
19
|
}
|
|
20
20
|
/** M1 raw-material substrate (append-only jsonl consumed by the cycle). */
|
|
21
|
-
export function materialDir() {
|
|
22
|
-
return join(evomapHome(), 'evolution', 'material');
|
|
21
|
+
export function materialDir(env = process.env) {
|
|
22
|
+
return join(evomapHome(env), 'evolution', 'material');
|
|
23
23
|
}
|
|
24
24
|
/** MaterialStore backing file. */
|
|
25
|
-
export function materialStorePath() {
|
|
26
|
-
return join(materialDir(), 'material.jsonl');
|
|
25
|
+
export function materialStorePath(env = process.env) {
|
|
26
|
+
return join(materialDir(env), 'material.jsonl');
|
|
27
27
|
}
|
|
28
28
|
/** Per-source watermark cursor used to make re-ingest idempotent (file-level dedup). */
|
|
29
|
-
export function materialWatermarkPath() {
|
|
30
|
-
return join(materialDir(), 'watermark.json');
|
|
29
|
+
export function materialWatermarkPath(env = process.env) {
|
|
30
|
+
return join(materialDir(env), 'watermark.json');
|
|
31
31
|
}
|
|
32
32
|
/** Proxy LLM-trace day-files dir (`llm-trace-YYYYMMDD.jsonl`), the route-savings source for the value ledger.
|
|
33
33
|
* Mirrors the proxy's EVOLVER_LLM_TRACE_DIR default so the outreach layer reads what the proxy wrote. */
|
|
34
|
-
export function tracesDir() {
|
|
35
|
-
return
|
|
34
|
+
export function tracesDir(env = process.env) {
|
|
35
|
+
return env['EVOLVER_LLM_TRACE_DIR'] ?? join(evomapHome(env), 'proxy', 'traces');
|
|
36
36
|
}
|
|
37
37
|
/** Hub-asset audit trail (`asset_call_log.jsonl`): one JSONL line per hub-asset interaction (search hit/miss,
|
|
38
38
|
* reuse/reference, publish, review). Written best-effort by AssetCallLog; the desktop's RecallHistory / 召回历程
|
|
39
39
|
* reads it. Defaults to the evomap home root, beside assets/ + evolution/.
|
|
40
40
|
* NOTE(reuse/#234): confirm this matches where the proxy/RecallHistory reads — best-effort append, so a path
|
|
41
41
|
* mismatch degrades the audit line, never the reuse write itself. */
|
|
42
|
-
export function assetCallLogPath() {
|
|
43
|
-
return join(evomapHome(), 'asset_call_log.jsonl');
|
|
42
|
+
export function assetCallLogPath(env = process.env) {
|
|
43
|
+
return join(evomapHome(env), 'asset_call_log.jsonl');
|
|
44
|
+
}
|
|
45
|
+
/** Learning Ops local output dir: per-run LearningPacket drafts + trace-event JSONL (hub upload is a later slice). */
|
|
46
|
+
export function learningTraceDir(env = process.env) {
|
|
47
|
+
return env['EVOLVER_LEARNING_TRACE_DIR'] ?? join(evomapHome(env), 'evolution', 'learning-trace');
|
|
44
48
|
}
|
package/dist/events/public.d.ts
CHANGED
|
@@ -7,10 +7,10 @@ export type { EventCountsMV } from './projectors.js';
|
|
|
7
7
|
export { LineTooLargeError, MAX_LINE_BYTES } from './eventStore.js';
|
|
8
8
|
export { ArchiveSegmentConflictError, InvalidRootEventArchiveError, InvalidRootEventLogError, RootEventHistoryGapError, archiveRootEvents, inspectRootEventArchive, planRootEventArchive, readRootEventHistory, rootEventArchiveDir, rootEventArchiveSegmentName, validateRootEventHistory, ROOT_EVENT_ARCHIVE_DEFAULT_KEEP_EVENTS, } from './eventArchive.js';
|
|
9
9
|
export type { RootEventArchiveOptions, RootEventArchivePlan, RootEventArchiveResult, RootEventArchiveStats, } from './eventArchive.js';
|
|
10
|
-
export { rootEventsPath, evomapHome, mvDir, personalityStatePath, assetsDir, materialDir, materialStorePath, materialWatermarkPath, tracesDir, assetCallLogPath } from './paths.js';
|
|
10
|
+
export { rootEventsPath, evomapHome, mvDir, personalityStatePath, assetsDir, materialDir, materialStorePath, materialWatermarkPath, tracesDir, assetCallLogPath, learningTraceDir } from './paths.js';
|
|
11
11
|
export { EVENT_SCHEMA_VERSION } from './eventSchema.js';
|
|
12
12
|
export type { RootEvent, RawEvent, HumanNarrative, Actor, Replayability } from './eventSchema.js';
|
|
13
|
-
export { readEvents, statusReport, listCycles, showCycle, listTriggers, dailySummary, buildNarrativeSnapshot, NARRATIVE_DEFAULT_LIMIT, NARRATIVE_MAX_LIMIT, } from './reports.js';
|
|
13
|
+
export { readEvents, statusReport, listCycles, showCycle, listTriggers, dailySummary, dailyCapsuleCount, buildNarrativeSnapshot, NARRATIVE_DEFAULT_LIMIT, NARRATIVE_MAX_LIMIT, } from './reports.js';
|
|
14
14
|
export { buildRetentionReport, defaultMaterialCursorPath, defaultMaterialCursorPaths, RETENTION_DEFAULT_MAX_MATERIAL_BYTES, RETENTION_DEFAULT_MAX_MATERIAL_RECORDS, RETENTION_DEFAULT_MAX_ROOT_BYTES, RETENTION_DEFAULT_MAX_ROOT_EVENTS, RETENTION_DEFAULT_ROOT_TAIL_EVENTS, RETENTION_DEFAULT_WATCH_RATIO, } from './retention.js';
|
|
15
15
|
export type { ReportEvent, StatusReport, CycleSummary, CycleTimeline, TriggerRow, DailySummary, NarrativeEntry, NarrativeOutcome, NarrativeSnapshot, NarrativeSnapshotOptions, } from './reports.js';
|
|
16
16
|
export type { MaterialRetentionSnapshot, RetentionReport, RetentionReportOptions, RetentionState, RetentionThresholds, RootRetentionSnapshot, } from './retention.js';
|
package/dist/events/public.js
CHANGED
|
@@ -3,7 +3,7 @@ export { Replayer } from './replayer.js';
|
|
|
3
3
|
export { eventCountsProjector, DEFAULT_PROJECTORS } from './projectors.js';
|
|
4
4
|
export { LineTooLargeError, MAX_LINE_BYTES } from './eventStore.js';
|
|
5
5
|
export { ArchiveSegmentConflictError, InvalidRootEventArchiveError, InvalidRootEventLogError, RootEventHistoryGapError, archiveRootEvents, inspectRootEventArchive, planRootEventArchive, readRootEventHistory, rootEventArchiveDir, rootEventArchiveSegmentName, validateRootEventHistory, ROOT_EVENT_ARCHIVE_DEFAULT_KEEP_EVENTS, } from './eventArchive.js';
|
|
6
|
-
export { rootEventsPath, evomapHome, mvDir, personalityStatePath, assetsDir, materialDir, materialStorePath, materialWatermarkPath, tracesDir, assetCallLogPath } from './paths.js';
|
|
6
|
+
export { rootEventsPath, evomapHome, mvDir, personalityStatePath, assetsDir, materialDir, materialStorePath, materialWatermarkPath, tracesDir, assetCallLogPath, learningTraceDir } from './paths.js';
|
|
7
7
|
export { EVENT_SCHEMA_VERSION } from './eventSchema.js';
|
|
8
|
-
export { readEvents, statusReport, listCycles, showCycle, listTriggers, dailySummary, buildNarrativeSnapshot, NARRATIVE_DEFAULT_LIMIT, NARRATIVE_MAX_LIMIT, } from './reports.js';
|
|
8
|
+
export { readEvents, statusReport, listCycles, showCycle, listTriggers, dailySummary, dailyCapsuleCount, buildNarrativeSnapshot, NARRATIVE_DEFAULT_LIMIT, NARRATIVE_MAX_LIMIT, } from './reports.js';
|
|
9
9
|
export { buildRetentionReport, defaultMaterialCursorPath, defaultMaterialCursorPaths, RETENTION_DEFAULT_MAX_MATERIAL_BYTES, RETENTION_DEFAULT_MAX_MATERIAL_RECORDS, RETENTION_DEFAULT_MAX_ROOT_BYTES, RETENTION_DEFAULT_MAX_ROOT_EVENTS, RETENTION_DEFAULT_ROOT_TAIL_EVENTS, RETENTION_DEFAULT_WATCH_RATIO, } from './retention.js';
|
package/dist/events/reports.d.ts
CHANGED
|
@@ -61,6 +61,8 @@ export interface DailySummary {
|
|
|
61
61
|
suppressedFailures: number;
|
|
62
62
|
}
|
|
63
63
|
export declare function dailySummary(evts: readonly ReportEvent[], dayPrefix: string): DailySummary;
|
|
64
|
+
/** 统计指定日期前缀的 capsule.produced 事件数. */
|
|
65
|
+
export declare function dailyCapsuleCount(evts: readonly ReportEvent[], dayPrefix: string): number;
|
|
64
66
|
export type NarrativeOutcome = 'success' | 'failed' | 'inert' | 'unknown';
|
|
65
67
|
export interface NarrativeEntry {
|
|
66
68
|
seq: number;
|
package/dist/events/reports.js
CHANGED
|
@@ -85,6 +85,10 @@ export function dailySummary(evts, dayPrefix) {
|
|
|
85
85
|
suppressedFailures,
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
|
+
/** 统计指定日期前缀的 capsule.produced 事件数. */
|
|
89
|
+
export function dailyCapsuleCount(evts, dayPrefix) {
|
|
90
|
+
return evts.filter((e) => e.type === 'capsule.produced' && e.ts.startsWith(dayPrefix)).length;
|
|
91
|
+
}
|
|
88
92
|
export const NARRATIVE_DEFAULT_LIMIT = 30;
|
|
89
93
|
export const NARRATIVE_MAX_LIMIT = 200;
|
|
90
94
|
const NARRATIVE_EVENTS = new Set([
|