@evomap/evolver-core 2.0.0-beta.1 → 2.0.0-beta.10
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 -0
- package/dist/algo/candidateAssembly.js +23 -14
- package/dist/algo/capabilityCandidates.d.ts +2 -0
- package/dist/algo/capabilityCandidates.js +5 -0
- package/dist/algo/conversationSniffer.d.ts +18 -0
- package/dist/algo/conversationSniffer.js +149 -0
- package/dist/algo/cycleEngine.d.ts +11 -0
- package/dist/algo/cycleEngine.js +14 -6
- package/dist/algo/cycleFailureClassifier.d.ts +1 -1
- package/dist/algo/cycleFailureClassifier.js +13 -5
- package/dist/algo/geneIntake.d.ts +14 -4
- package/dist/algo/geneIntake.js +37 -9
- package/dist/algo/geneSelection.d.ts +18 -1
- package/dist/algo/geneSelection.js +42 -18
- package/dist/algo/index.d.ts +2 -0
- package/dist/algo/index.js +2 -0
- package/dist/algo/memoryGraph.d.ts +62 -0
- package/dist/algo/memoryGraph.js +86 -0
- package/dist/algo/orchestrator.d.ts +3 -0
- package/dist/algo/orchestrator.js +14 -2
- package/dist/assetstore/assetSidecarRecords.d.ts +28 -0
- package/dist/assetstore/assetSidecarRecords.js +376 -0
- package/dist/assetstore/assetSidecarRecovery.d.ts +48 -0
- package/dist/assetstore/assetSidecarRecovery.js +288 -0
- package/dist/assetstore/assetStoreHealth.d.ts +75 -0
- package/dist/assetstore/assetStoreHealth.js +277 -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 +327 -0
- package/dist/assetstore/assetSyncLedger.d.ts +118 -0
- package/dist/assetstore/assetSyncLedger.js +745 -0
- package/dist/assetstore/index.d.ts +5 -1
- package/dist/assetstore/index.js +5 -1
- package/dist/assetstore/localJsonl.d.ts +12 -3
- package/dist/assetstore/localJsonl.js +131 -39
- package/dist/assetstore/pendingSignals.js +3 -1
- package/dist/assetstore/provenance.d.ts +27 -4
- package/dist/assetstore/provenance.js +107 -56
- package/dist/assetstore/provider.d.ts +26 -0
- package/dist/assetstore/provider.js +50 -0
- package/dist/assetstore/reviewFilter.js +5 -2
- package/dist/assetstore/reviewLedger.d.ts +14 -2
- package/dist/assetstore/reviewLedger.js +78 -43
- package/dist/assetstore/seedGenes.d.ts +3 -0
- package/dist/assetstore/seedGenes.js +134 -0
- package/dist/benchmark/antiGeneBenchmark.d.ts +2 -0
- package/dist/benchmark/antiGeneBenchmark.js +11 -1
- package/dist/benchmark/antiGeneImpact.d.ts +16 -0
- package/dist/benchmark/antiGeneImpact.js +34 -0
- package/dist/benchmark/antiGeneRollout.d.ts +2 -0
- package/dist/benchmark/antiGeneRollout.js +13 -1
- package/dist/benchmark/index.d.ts +2 -1
- package/dist/benchmark/index.js +2 -1
- package/dist/benchmark/triggerShift.d.ts +62 -0
- package/dist/benchmark/triggerShift.js +106 -0
- package/dist/events/eventArchive.d.ts +65 -0
- package/dist/events/eventArchive.js +343 -0
- package/dist/events/eventStore.js +2 -12
- package/dist/events/ingest.d.ts +1 -1
- package/dist/events/ingest.js +9 -0
- package/dist/events/paths.d.ts +10 -10
- package/dist/events/paths.js +20 -20
- package/dist/events/public.d.ts +3 -1
- package/dist/events/public.js +2 -1
- package/dist/events/retention.d.ts +24 -1
- package/dist/events/retention.js +133 -37
- package/dist/exec/autoExec.d.ts +6 -1
- package/dist/exec/autoExec.js +34 -0
- package/dist/exec/autonomousCycle.d.ts +2 -0
- package/dist/exec/autonomousCycle.js +5 -0
- package/dist/exec/claudeBridge.d.ts +21 -3
- package/dist/exec/claudeBridge.js +413 -26
- package/dist/exec/openPrRegistry.d.ts +8 -2
- package/dist/exec/openPrRegistry.js +32 -22
- package/dist/exec/prompt.js +9 -0
- package/dist/exec/runnerRegistry.d.ts +90 -18
- package/dist/exec/runnerRegistry.js +603 -42
- package/dist/exec/selfPrObfuscation.d.ts +2 -1
- package/dist/exec/selfPrObfuscation.js +19 -6
- package/dist/hub/agentDirectory.d.ts +90 -0
- package/dist/hub/agentDirectory.js +104 -0
- package/dist/hub/bindings.js +23 -3
- package/dist/hub/capability.d.ts +14 -2
- package/dist/hub/fake.d.ts +4 -2
- package/dist/hub/fake.js +3 -2
- package/dist/hub/index.d.ts +1 -0
- package/dist/hub/index.js +1 -0
- package/dist/hub/sanitize.js +3 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/issueReporter/index.d.ts +156 -0
- package/dist/issueReporter/index.js +1688 -0
- package/dist/mailbox/catalog.js +3 -0
- package/dist/mailbox/ipcServer.js +2 -2
- package/dist/mailbox/store.d.ts +14 -0
- package/dist/mailbox/store.js +44 -2
- package/dist/material/consumer.js +9 -6
- package/dist/material/index.d.ts +1 -0
- package/dist/material/index.js +1 -0
- package/dist/material/materialArchive.d.ts +81 -0
- package/dist/material/materialArchive.js +466 -0
- package/dist/material/materialStore.d.ts +1 -0
- package/dist/material/materialStore.js +6 -13
- package/dist/ops/savingsCore.js +1 -2
- package/dist/ops/selfUpdate.d.ts +10 -1
- package/dist/ops/selfUpdate.js +64 -15
- package/dist/personality/schema.d.ts +12 -12
- package/dist/schema/common.d.ts +1 -1
- package/dist/schema/common.js +1 -1
- package/dist/schema/material.d.ts +5 -5
- package/dist/strategy/constraintAblation.d.ts +64 -0
- package/dist/strategy/constraintAblation.js +3074 -0
- package/dist/strategy/index.d.ts +2 -1
- package/dist/strategy/index.js +2 -1
- package/dist/trace/trajectoryExport.js +2 -2
- package/dist/util/fetchPort.d.ts +1 -0
- package/dist/util/fetchPort.js +11 -0
- package/dist/util/fileLock.d.ts +24 -5
- package/dist/util/fileLock.js +288 -72
- package/dist/util/index.d.ts +1 -0
- package/dist/util/index.js +1 -0
- package/dist/wire/geneHints.d.ts +42 -1
- package/dist/wire/geneHints.js +52 -1
- package/dist/wire/index.d.ts +14 -2
- package/dist/wire/index.js +1 -1
- 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 +6 -1
package/dist/mailbox/catalog.js
CHANGED
|
@@ -14,6 +14,7 @@ export const MESSAGE_CATALOG = {
|
|
|
14
14
|
task_complete: { direction: 'outbound', handler: 'proxy', feedsMaterial: false, ttlClass: 'default' },
|
|
15
15
|
task_subscribe: { direction: 'outbound', handler: 'proxy', feedsMaterial: false, ttlClass: 'control' },
|
|
16
16
|
task_unsubscribe: { direction: 'outbound', handler: 'proxy', feedsMaterial: false, ttlClass: 'control' },
|
|
17
|
+
dm_outbound: { direction: 'outbound', handler: 'proxy', feedsMaterial: false, ttlClass: 'default' },
|
|
17
18
|
atp_order: { direction: 'outbound', handler: 'proxy', feedsMaterial: false, ttlClass: 'default' },
|
|
18
19
|
atp_deliver: { direction: 'outbound', handler: 'proxy', feedsMaterial: false, ttlClass: 'default' },
|
|
19
20
|
atp_settle: { direction: 'outbound', handler: 'proxy', feedsMaterial: false, ttlClass: 'default' },
|
|
@@ -23,6 +24,8 @@ export const MESSAGE_CATALOG = {
|
|
|
23
24
|
asset_publish_result: { direction: 'inbound', handler: 'core', feedsMaterial: false, ttlClass: 'default' }, // 拒绝进 Material 在 dispatch 决定
|
|
24
25
|
pending_evomap_task: { direction: 'inbound', handler: 'agent', feedsMaterial: false, ttlClass: 'default' },
|
|
25
26
|
task_available: { direction: 'inbound', handler: 'agent', feedsMaterial: false, ttlClass: 'default' },
|
|
27
|
+
task_claim_result: { direction: 'inbound', handler: 'agent', feedsMaterial: false, ttlClass: 'default' },
|
|
28
|
+
task_complete_result: { direction: 'inbound', handler: 'agent', feedsMaterial: false, ttlClass: 'default' },
|
|
26
29
|
work_assigned: { direction: 'inbound', handler: 'agent', feedsMaterial: false, ttlClass: 'default' },
|
|
27
30
|
dialog_message: { direction: 'inbound', handler: 'agent', feedsMaterial: true, ttlClass: 'default' },
|
|
28
31
|
peer_review_request: { direction: 'inbound', handler: 'agent', feedsMaterial: true, ttlClass: 'default' },
|
|
@@ -69,7 +69,7 @@ export class MailboxIpcServer {
|
|
|
69
69
|
this.onAuthFailure?.();
|
|
70
70
|
}
|
|
71
71
|
catch { /* auth failure handling must never weaken fail-closed IPC auth */ }
|
|
72
|
-
return this.json(res, 401, { error: '
|
|
72
|
+
return this.json(res, 401, { error: 'Unauthorized', code: 'unauthorized' });
|
|
73
73
|
}
|
|
74
74
|
const url = new URL(req.url ?? '/', 'http://localhost');
|
|
75
75
|
const route = `${req.method} ${url.pathname}`;
|
|
@@ -129,7 +129,7 @@ export class MailboxIpcServer {
|
|
|
129
129
|
return this.json(res, 404, { error: 'unknown route' });
|
|
130
130
|
}
|
|
131
131
|
catch (e) {
|
|
132
|
-
return this.json(res, 400, { error: e instanceof Error ? e.message : String(e) });
|
|
132
|
+
return this.json(res, 400, { error: e instanceof Error ? e.message : String(e), code: 'invalid_request' });
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
readJson(req) {
|
package/dist/mailbox/store.d.ts
CHANGED
|
@@ -22,8 +22,22 @@ export declare class MailboxStore {
|
|
|
22
22
|
status?: Status;
|
|
23
23
|
handler?: string;
|
|
24
24
|
runtimeNamespace?: string;
|
|
25
|
+
type?: string;
|
|
26
|
+
direction?: Envelope['direction'];
|
|
27
|
+
typeDirections?: readonly {
|
|
28
|
+
type: string;
|
|
29
|
+
direction: Envelope['direction'];
|
|
30
|
+
}[];
|
|
31
|
+
newestFirst?: boolean;
|
|
32
|
+
offset?: number;
|
|
25
33
|
limit?: number;
|
|
26
34
|
}): Envelope[];
|
|
35
|
+
countMessages(opts?: {
|
|
36
|
+
status?: Status;
|
|
37
|
+
runtimeNamespace?: string;
|
|
38
|
+
type?: string;
|
|
39
|
+
direction?: Envelope['direction'];
|
|
40
|
+
}): number;
|
|
27
41
|
countByStatus(status: Status): number;
|
|
28
42
|
/** pending 计数(可按 handler/runtimeNamespace 分区), 用于 agent wake 去抖. */
|
|
29
43
|
countPending(handler?: string, runtimeNamespace?: string): number;
|
package/dist/mailbox/store.js
CHANGED
|
@@ -120,6 +120,7 @@ export class MailboxStore {
|
|
|
120
120
|
schemaVersion TEXT, feedsMaterial INTEGER, dlq INTEGER DEFAULT 0, leasedUntil INTEGER, workerId TEXT, lastError TEXT)`);
|
|
121
121
|
this.db.exec('CREATE INDEX IF NOT EXISTS idx_status ON messages(status, handler)');
|
|
122
122
|
this.db.exec('CREATE INDEX IF NOT EXISTS idx_corr ON messages(correlationId)');
|
|
123
|
+
this.db.exec('CREATE INDEX IF NOT EXISTS idx_message_view ON messages(runtimeNamespace,type,direction,status,createdAt)');
|
|
123
124
|
this.db.exec('CREATE TABLE IF NOT EXISTS idempotency (key TEXT PRIMARY KEY, result TEXT, at INTEGER)');
|
|
124
125
|
this.db.exec('CREATE TABLE IF NOT EXISTS kv (k TEXT PRIMARY KEY, v TEXT)');
|
|
125
126
|
}
|
|
@@ -157,7 +158,21 @@ export class MailboxStore {
|
|
|
157
158
|
where.push('runtimeNamespace = ?');
|
|
158
159
|
args.push(opts.runtimeNamespace);
|
|
159
160
|
}
|
|
160
|
-
|
|
161
|
+
if (opts.type) {
|
|
162
|
+
where.push('type = ?');
|
|
163
|
+
args.push(opts.type);
|
|
164
|
+
}
|
|
165
|
+
if (opts.direction) {
|
|
166
|
+
where.push('direction = ?');
|
|
167
|
+
args.push(opts.direction);
|
|
168
|
+
}
|
|
169
|
+
if (opts.typeDirections && opts.typeDirections.length > 0) {
|
|
170
|
+
const selectors = opts.typeDirections.slice(0, 20);
|
|
171
|
+
where.push(`(${selectors.map(() => '(type = ? AND direction = ?)').join(' OR ')})`);
|
|
172
|
+
for (const selector of selectors)
|
|
173
|
+
args.push(selector.type, selector.direction);
|
|
174
|
+
}
|
|
175
|
+
const sql = `SELECT * FROM messages ${where.length ? `WHERE ${where.join(' AND ')}` : ''} ORDER BY createdAt ${opts.newestFirst ? 'DESC' : 'ASC'} LIMIT ?`;
|
|
161
176
|
// Clamp the LIMIT bind. The IPC list route feeds this `?limit=` straight from an external query string, so a
|
|
162
177
|
// non-finite value (NaN from `?limit=abc`, Infinity from `?limit=1e400`) would bind as null/error and a huge
|
|
163
178
|
// finite value is an unbounded read (memory DoS) even on the token-authed endpoint. Finite + positive + capped.
|
|
@@ -165,7 +180,34 @@ export class MailboxStore {
|
|
|
165
180
|
? Math.min(Math.floor(opts.limit), 10_000)
|
|
166
181
|
: 1000;
|
|
167
182
|
args.push(lim);
|
|
168
|
-
|
|
183
|
+
const offset = Number.isFinite(opts.offset) && opts.offset > 0
|
|
184
|
+
? Math.min(Math.floor(opts.offset), 10_000)
|
|
185
|
+
: 0;
|
|
186
|
+
const pagedSql = `${sql} OFFSET ?`;
|
|
187
|
+
args.push(offset);
|
|
188
|
+
return this.db.prepare(pagedSql).all(...args).map(rowToEnvelope);
|
|
189
|
+
}
|
|
190
|
+
countMessages(opts = {}) {
|
|
191
|
+
const where = [];
|
|
192
|
+
const args = [];
|
|
193
|
+
if (opts.status) {
|
|
194
|
+
where.push('status = ?');
|
|
195
|
+
args.push(opts.status);
|
|
196
|
+
}
|
|
197
|
+
if (opts.runtimeNamespace) {
|
|
198
|
+
where.push('runtimeNamespace = ?');
|
|
199
|
+
args.push(opts.runtimeNamespace);
|
|
200
|
+
}
|
|
201
|
+
if (opts.type) {
|
|
202
|
+
where.push('type = ?');
|
|
203
|
+
args.push(opts.type);
|
|
204
|
+
}
|
|
205
|
+
if (opts.direction) {
|
|
206
|
+
where.push('direction = ?');
|
|
207
|
+
args.push(opts.direction);
|
|
208
|
+
}
|
|
209
|
+
const row = this.db.prepare(`SELECT COUNT(*) c FROM messages ${where.length ? `WHERE ${where.join(' AND ')}` : ''}`).get(...args);
|
|
210
|
+
return Number(row['c']);
|
|
169
211
|
}
|
|
170
212
|
countByStatus(status) {
|
|
171
213
|
return Number(this.db.prepare('SELECT COUNT(*) c FROM messages WHERE status = ?').get(status)['c']);
|
|
@@ -11,9 +11,10 @@ export class ConsumerGroups {
|
|
|
11
11
|
if (opts.path && existsSync(opts.path)) {
|
|
12
12
|
try {
|
|
13
13
|
const o = JSON.parse(readFileSync(opts.path, 'utf8'));
|
|
14
|
-
for (const [k, v] of Object.entries(o))
|
|
15
|
-
if (typeof v === 'number' && Number.
|
|
14
|
+
for (const [k, v] of Object.entries(o)) {
|
|
15
|
+
if (typeof v === 'number' && Number.isSafeInteger(v) && v >= 0)
|
|
16
16
|
this.committed.set(k, v);
|
|
17
|
+
}
|
|
17
18
|
}
|
|
18
19
|
catch { /* corrupt cursor → start from 0 (idempotent re-claim) */ }
|
|
19
20
|
}
|
|
@@ -21,16 +22,18 @@ export class ConsumerGroups {
|
|
|
21
22
|
cur(group) { return this.committed.get(group) ?? 0; }
|
|
22
23
|
/** 取下一批未 ack 的 (不推进 committed → 崩溃重启再 claim 拿到同批). */
|
|
23
24
|
claim(group, batchSize) {
|
|
24
|
-
|
|
25
|
-
return all.slice(this.cur(group), this.cur(group) + batchSize);
|
|
25
|
+
return this.opts.store.readRange(this.cur(group), batchSize);
|
|
26
26
|
}
|
|
27
27
|
/** ack: 把 committed 推过 acked 的连续前缀. */
|
|
28
28
|
ack(group, materialIds) {
|
|
29
29
|
const ackSet = new Set(materialIds);
|
|
30
|
-
const all = this.opts.store.readAll();
|
|
31
30
|
let c = this.cur(group);
|
|
32
|
-
|
|
31
|
+
const claimed = this.opts.store.readRange(c, ackSet.size);
|
|
32
|
+
for (const record of claimed) {
|
|
33
|
+
if (!ackSet.has(record.materialId))
|
|
34
|
+
break;
|
|
33
35
|
c += 1;
|
|
36
|
+
}
|
|
34
37
|
this.committed.set(group, c);
|
|
35
38
|
this.persist();
|
|
36
39
|
}
|
package/dist/material/index.d.ts
CHANGED
package/dist/material/index.js
CHANGED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { type Material } from '../schema/material.js';
|
|
2
|
+
export declare const MATERIAL_ARCHIVE_DEFAULT_KEEP_RECORDS = 1000;
|
|
3
|
+
export declare class InvalidMaterialLogError extends Error {
|
|
4
|
+
readonly line: number;
|
|
5
|
+
readonly code = "MATERIAL_ARCHIVE_INVALID_LOG";
|
|
6
|
+
constructor(line: number, reason: string);
|
|
7
|
+
}
|
|
8
|
+
export declare class InvalidMaterialArchiveError extends Error {
|
|
9
|
+
readonly segment: string;
|
|
10
|
+
readonly line: number;
|
|
11
|
+
readonly code = "MATERIAL_ARCHIVE_INVALID_ARCHIVE";
|
|
12
|
+
constructor(segment: string, line: number, reason: string);
|
|
13
|
+
}
|
|
14
|
+
export declare class MaterialArchiveRangeError extends Error {
|
|
15
|
+
readonly code = "MATERIAL_ARCHIVE_RANGE_INVALID";
|
|
16
|
+
constructor(reason: string);
|
|
17
|
+
}
|
|
18
|
+
export declare class MaterialArchiveSegmentConflictError extends Error {
|
|
19
|
+
readonly archiveId: string;
|
|
20
|
+
readonly code = "MATERIAL_ARCHIVE_SEGMENT_CONFLICT";
|
|
21
|
+
constructor(archiveId: string);
|
|
22
|
+
}
|
|
23
|
+
export declare class InvalidMaterialArchiveCursorError extends Error {
|
|
24
|
+
readonly code = "MATERIAL_ARCHIVE_CURSOR_INVALID";
|
|
25
|
+
constructor(reason: string);
|
|
26
|
+
}
|
|
27
|
+
export interface MaterialArchiveOptions {
|
|
28
|
+
path: string;
|
|
29
|
+
cursorPaths?: readonly string[];
|
|
30
|
+
keepRecords?: number;
|
|
31
|
+
}
|
|
32
|
+
export interface MaterialArchiveCursor {
|
|
33
|
+
group: string;
|
|
34
|
+
position: number;
|
|
35
|
+
}
|
|
36
|
+
export interface MaterialArchivePlan {
|
|
37
|
+
mode: 'preview';
|
|
38
|
+
activeRecords: number;
|
|
39
|
+
physicalActiveRecords: number;
|
|
40
|
+
archiveRecords: number;
|
|
41
|
+
historyRecords: number;
|
|
42
|
+
keepRecords: number;
|
|
43
|
+
minCursor: number;
|
|
44
|
+
cursors: MaterialArchiveCursor[];
|
|
45
|
+
overlapRecords: number;
|
|
46
|
+
wouldArchive: number;
|
|
47
|
+
retainedRecords: number;
|
|
48
|
+
archiveId: string | null;
|
|
49
|
+
}
|
|
50
|
+
export interface MaterialArchiveResult {
|
|
51
|
+
mode: 'write';
|
|
52
|
+
activeRecordsBefore: number;
|
|
53
|
+
physicalActiveRecordsBefore: number;
|
|
54
|
+
keepRecords: number;
|
|
55
|
+
minCursor: number;
|
|
56
|
+
cursors: MaterialArchiveCursor[];
|
|
57
|
+
archivedRecords: number;
|
|
58
|
+
retainedRecords: number;
|
|
59
|
+
archiveRecords: number;
|
|
60
|
+
historyRecords: number;
|
|
61
|
+
recoveredOverlap: number;
|
|
62
|
+
archiveId: string | null;
|
|
63
|
+
}
|
|
64
|
+
export interface MaterialArchiveStats {
|
|
65
|
+
exists: boolean;
|
|
66
|
+
segments: number;
|
|
67
|
+
bytes: number;
|
|
68
|
+
records: number;
|
|
69
|
+
invalidLines: number;
|
|
70
|
+
firstOffset: number | null;
|
|
71
|
+
lastOffset: number | null;
|
|
72
|
+
}
|
|
73
|
+
export declare function materialArchiveDir(path: string): string;
|
|
74
|
+
export declare function materialArchiveSegmentName(start: number, end: number): string;
|
|
75
|
+
export declare function planMaterialArchive(opts: MaterialArchiveOptions): MaterialArchivePlan;
|
|
76
|
+
export declare function archiveMaterialStore(opts: MaterialArchiveOptions): MaterialArchiveResult;
|
|
77
|
+
/** Operational, fail-soft full history reader. Strict archive writes validate every line and range. */
|
|
78
|
+
export declare function readMaterialHistory(path: string): Material[];
|
|
79
|
+
/** Absolute-offset range reader used by durable consumers after active records move into archive segments. */
|
|
80
|
+
export declare function readMaterialRange(path: string, start: number, count: number): Material[];
|
|
81
|
+
export declare function inspectMaterialArchive(path: string): MaterialArchiveStats;
|