enigma-memory 0.1.16 → 0.1.17
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/README.md +14 -10
- package/apps/cli/bin/enigma.mjs +123 -11
- package/docs/benchmark-attestation-network.md +2 -2
- package/docs/benchmark-reproducibility.md +53 -4
- package/docs/blockchain-only-mechanisms.md +12 -0
- package/docs/client-connectors.md +9 -5
- package/docs/demo-proof-network.md +3 -3
- package/docs/developer-ecosystem.md +7 -5
- package/docs/developer-proof-quickstart.md +3 -3
- package/docs/enigma-memory-ready-conformance.md +1 -1
- package/docs/hosted-cloud-product.md +29 -0
- package/docs/install-anywhere.md +13 -10
- package/docs/memory-benchmarks.md +15 -0
- package/docs/memory-drive-health-model.md +41 -0
- package/docs/proof-network-build-notes.md +2 -2
- package/docs/proof-network.md +63 -6
- package/docs/sdk-api.md +1 -1
- package/docs/solana-proof-rail.md +1 -1
- package/package.json +1 -1
- package/packages/hosted-cloud/src/index.js +470 -2
- package/packages/mcp-server/src/index.js +1 -1
- package/packages/passport/src/index.js +730 -0
- package/packages/proof-network/src/index.js +139 -0
- package/scripts/build-benchmark-proof-release.mjs +15 -3
- package/scripts/build-hosted-api-key-lifecycle.mjs +1 -1
- package/scripts/build-hosted-customer-lifecycle.mjs +23 -3
- package/scripts/build-installer-assets.mjs +1 -1
- package/scripts/build-production-unblocker.mjs +409 -409
- package/scripts/build-proof-network-packet.mjs +1 -1
- package/scripts/run-standard-memory-benchmarks.mjs +166 -8
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
validateProofNetworkPacket,
|
|
16
16
|
} from '../packages/proof-network/src/index.js';
|
|
17
17
|
|
|
18
|
-
export const PROOF_NETWORK_PACKET_RELEASE_TARGET = '0.1.
|
|
18
|
+
export const PROOF_NETWORK_PACKET_RELEASE_TARGET = '0.1.17';
|
|
19
19
|
|
|
20
20
|
const HASH_RE = /^(?:sha256:)?[a-f0-9]{64}$/iu;
|
|
21
21
|
const SECRET_VALUE_RE = /(?:Bearer\s+[A-Za-z0-9._~+/=-]{12,}|Basic\s+[A-Za-z0-9+/=-]{12,}|-----BEGIN [A-Z ]*PRIVATE KEY-----|https?:\/\/[^\s/@]+:[^\s/@]+@|sk-[A-Za-z0-9_-]{16,}|AKIA[0-9A-Z]{16}|\b(?:raw[\s_-]*memory|plaintext[\s_-]*prompts?|plain[\s_-]*text[\s_-]*prompts?|private[\s_-]*prompts?|provider[\s_-]*responses?|full[\s_-]*transcript|decrypted[\s_-]*memory|credentials?|secrets?|passwords?|private[\s_-]*keys?|api[\s_-]*key[\s_-]*(?:secret|material|value)|api[\s_-]*secrets?|access[\s_-]*tokens?|refresh[\s_-]*tokens?|token[\s_-]*values?|credential[\s_-]*material|tenant[\s_-]*names?)\b)/iu;
|
|
@@ -62,6 +62,16 @@ const LONGMEMEVAL_SOURCE_URLS = Object.freeze([
|
|
|
62
62
|
'https://huggingface.co/datasets/xiaowu0162/longmemeval-cleaned/resolve/main/longmemeval_s_cleaned.json',
|
|
63
63
|
'https://huggingface.co/datasets/xiaowu0162/longmemeval-cleaned/resolve/main/longmemeval_m_cleaned.json',
|
|
64
64
|
]);
|
|
65
|
+
const LOCOMO_TASK_CATEGORIES = Object.freeze(['multi-session QA', 'event summarization', 'multimodal generation over long conversations']);
|
|
66
|
+
const LONGMEMEVAL_TASK_CATEGORIES = Object.freeze(['information extraction', 'multi-session reasoning', 'temporal reasoning', 'knowledge updates', 'abstention']);
|
|
67
|
+
const DATASET_TASK_CATEGORIES = Object.freeze({ locomo: LOCOMO_TASK_CATEGORIES, longmemeval: LONGMEMEVAL_TASK_CATEGORIES });
|
|
68
|
+
export const STANDARD_MEMORY_BENCHMARK_PROTOCOL_PLAN_SCHEMA = 'enigma.standard_memory_benchmark_protocol_plan.v1';
|
|
69
|
+
const PROTOCOL_REF_RE = /^[a-z0-9][a-z0-9._:/@+-]{2,191}$/u;
|
|
70
|
+
const DEFAULT_ANSWERER_MODEL_REF = 'model:answerer-not-selected';
|
|
71
|
+
const DEFAULT_JUDGE_MODEL_REF = 'model:judge-not-selected';
|
|
72
|
+
const DEFAULT_ANSWER_PROMPT_REF = 'prompt:standard-answer@not-pinned';
|
|
73
|
+
const DEFAULT_JUDGE_PROMPT_REF = 'prompt:standard-judge@not-pinned';
|
|
74
|
+
const DEFAULT_PROTOCOL_REF = 'protocol:apples-to-apples-full-answer@not-pinned';
|
|
65
75
|
|
|
66
76
|
const QUERY_RELEVANCE_STOPWORDS = new Set([
|
|
67
77
|
'about',
|
|
@@ -140,6 +150,23 @@ function parseArgs(argv = process.argv.slice(2)) {
|
|
|
140
150
|
} else if (arg === '--out') {
|
|
141
151
|
options.out = requiredFlagValue(argv, index, arg);
|
|
142
152
|
index += 1;
|
|
153
|
+
} else if (arg === '--protocol-plan') {
|
|
154
|
+
options.protocol_plan = true;
|
|
155
|
+
} else if (arg === '--answerer-ref') {
|
|
156
|
+
options.answerer_ref = requiredFlagValue(argv, index, arg);
|
|
157
|
+
index += 1;
|
|
158
|
+
} else if (arg === '--judge-ref') {
|
|
159
|
+
options.judge_ref = requiredFlagValue(argv, index, arg);
|
|
160
|
+
index += 1;
|
|
161
|
+
} else if (arg === '--answer-prompt-ref') {
|
|
162
|
+
options.answer_prompt_ref = requiredFlagValue(argv, index, arg);
|
|
163
|
+
index += 1;
|
|
164
|
+
} else if (arg === '--judge-prompt-ref') {
|
|
165
|
+
options.judge_prompt_ref = requiredFlagValue(argv, index, arg);
|
|
166
|
+
index += 1;
|
|
167
|
+
} else if (arg === '--protocol-ref') {
|
|
168
|
+
options.protocol_ref = requiredFlagValue(argv, index, arg);
|
|
169
|
+
index += 1;
|
|
143
170
|
} else if (arg === '--dry-run') {
|
|
144
171
|
options.dry_run = true;
|
|
145
172
|
} else if (arg === '--help' || arg === '-h') {
|
|
@@ -241,7 +268,7 @@ export function buildStandardBenchmarkDryRunPlan(options = {}) {
|
|
|
241
268
|
generated_at: options.generated_at ?? new Date().toISOString(),
|
|
242
269
|
package: {
|
|
243
270
|
name: 'enigma-memory',
|
|
244
|
-
version: '0.1.
|
|
271
|
+
version: '0.1.17',
|
|
245
272
|
},
|
|
246
273
|
public_safe: true,
|
|
247
274
|
dry_run: true,
|
|
@@ -261,6 +288,135 @@ export function buildStandardBenchmarkDryRunPlan(options = {}) {
|
|
|
261
288
|
],
|
|
262
289
|
};
|
|
263
290
|
}
|
|
291
|
+
function protocolRef(value, label, fallback) {
|
|
292
|
+
if (value === undefined || value === null) return fallback;
|
|
293
|
+
const normalized = typeof value === 'string' ? value.trim() : String(value);
|
|
294
|
+
if (normalized === '') throw new Error(`${label} must be a non-empty public ref`);
|
|
295
|
+
if (!PROTOCOL_REF_RE.test(normalized)) throw new Error(`${label} must be a lowercase public ref using letters, numbers, . _ : / @ + or -`);
|
|
296
|
+
return normalized;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
function protocolPlanCategorySet(datasets) {
|
|
300
|
+
const categorySet = [];
|
|
301
|
+
const seen = new Set();
|
|
302
|
+
for (const row of datasets) {
|
|
303
|
+
for (const category of DATASET_TASK_CATEGORIES[row.id] ?? []) {
|
|
304
|
+
if (!seen.has(category)) {
|
|
305
|
+
seen.add(category);
|
|
306
|
+
categorySet.push(category);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
return categorySet;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
export function buildStandardBenchmarkProtocolPlan(options = {}) {
|
|
314
|
+
const topK = optionalPositiveInteger(options.top_k ?? options.topK, 'top_k') ?? 5;
|
|
315
|
+
const datasets = datasetPlanRows(options);
|
|
316
|
+
if (datasets.length === 0) throw new Error('Provide --locomo <path> and/or --longmemeval <path>');
|
|
317
|
+
const answererProvided = (options.answerer_ref ?? options.answererModelRef) !== undefined;
|
|
318
|
+
const judgeProvided = (options.judge_ref ?? options.judgeModelRef) !== undefined;
|
|
319
|
+
const answererRef = protocolRef(options.answerer_ref ?? options.answererModelRef, 'answerer_ref', DEFAULT_ANSWERER_MODEL_REF);
|
|
320
|
+
const judgeRef = protocolRef(options.judge_ref ?? options.judgeModelRef, 'judge_ref', DEFAULT_JUDGE_MODEL_REF);
|
|
321
|
+
const answerPromptRef = protocolRef(options.answer_prompt_ref ?? options.answerPromptRef, 'answer_prompt_ref', DEFAULT_ANSWER_PROMPT_REF);
|
|
322
|
+
const judgePromptRef = protocolRef(options.judge_prompt_ref ?? options.judgePromptRef, 'judge_prompt_ref', DEFAULT_JUDGE_PROMPT_REF);
|
|
323
|
+
const protocolRefValue = protocolRef(options.protocol_ref ?? options.protocolRef, 'protocol_ref', DEFAULT_PROTOCOL_REF);
|
|
324
|
+
const promptsFixed = answererProvided && judgeProvided;
|
|
325
|
+
return {
|
|
326
|
+
schema: STANDARD_MEMORY_BENCHMARK_PROTOCOL_PLAN_SCHEMA,
|
|
327
|
+
generated_at: options.generated_at ?? new Date().toISOString(),
|
|
328
|
+
package: {
|
|
329
|
+
name: 'enigma-memory',
|
|
330
|
+
version: '0.1.17',
|
|
331
|
+
},
|
|
332
|
+
public_safe: true,
|
|
333
|
+
protocol_plan: true,
|
|
334
|
+
dry_run: true,
|
|
335
|
+
top_k: topK,
|
|
336
|
+
category_set: protocolPlanCategorySet(datasets),
|
|
337
|
+
datasets_planned: datasets,
|
|
338
|
+
answerer: {
|
|
339
|
+
model_ref: answererRef,
|
|
340
|
+
temperature: 0,
|
|
341
|
+
max_tokens: 1024,
|
|
342
|
+
fixed: answererProvided,
|
|
343
|
+
},
|
|
344
|
+
judge: {
|
|
345
|
+
model_ref: judgeRef,
|
|
346
|
+
kind: 'llm-as-judge-or-exact-match-not-selected',
|
|
347
|
+
temperature: 0,
|
|
348
|
+
max_tokens: 512,
|
|
349
|
+
fixed: judgeProvided,
|
|
350
|
+
},
|
|
351
|
+
prompt_refs: [answerPromptRef, judgePromptRef],
|
|
352
|
+
protocol_refs: [protocolRefValue],
|
|
353
|
+
competitor_adapter_refs: STANDARD_EXTERNAL_COMPETITOR_ADAPTERS.map((adapter) => `adapter:${adapter.id}@not-pinned`),
|
|
354
|
+
external_competitor_adapters: STANDARD_EXTERNAL_COMPETITOR_ADAPTERS.map((adapter) => ({
|
|
355
|
+
...adapter,
|
|
356
|
+
required_artifacts: [...adapter.required_artifacts],
|
|
357
|
+
adapter_ref: `adapter:${adapter.id}@not-pinned`,
|
|
358
|
+
})),
|
|
359
|
+
apples_to_apples_controls: applesToApplesControls(topK),
|
|
360
|
+
protocol_controls: {
|
|
361
|
+
same_answerer_model_for_all_rows: answererProvided,
|
|
362
|
+
same_judge_model_for_all_rows: judgeProvided,
|
|
363
|
+
same_prompts_for_all_rows: promptsFixed,
|
|
364
|
+
same_competitor_adapters_for_enigma_and_baselines: false,
|
|
365
|
+
answerer_model_fixed: answererProvided,
|
|
366
|
+
judge_model_fixed: judgeProvided,
|
|
367
|
+
prompts_fixed: promptsFixed,
|
|
368
|
+
temperature_fixed: false,
|
|
369
|
+
budget_caps_set: false,
|
|
370
|
+
},
|
|
371
|
+
cost_estimate_inputs: {
|
|
372
|
+
dataset_sample_limits: datasets.map((row) => ({ dataset: row.id, sample_limit: row.sample_limit })),
|
|
373
|
+
answerer_temperature: 0,
|
|
374
|
+
answerer_max_tokens: 1024,
|
|
375
|
+
judge_temperature: 0,
|
|
376
|
+
judge_max_tokens: 512,
|
|
377
|
+
max_retries: 0,
|
|
378
|
+
request_timeout_ms: null,
|
|
379
|
+
budget_cap_required_before_run: true,
|
|
380
|
+
budget_cap_set: false,
|
|
381
|
+
},
|
|
382
|
+
benchmark_boundaries: {
|
|
383
|
+
official_dataset_files_required: true,
|
|
384
|
+
credentials_required: false,
|
|
385
|
+
external_provider_calls: false,
|
|
386
|
+
llm_answer_accuracy_scored: false,
|
|
387
|
+
retrieval_evidence_proxy_scored: false,
|
|
388
|
+
raw_question_text_included: false,
|
|
389
|
+
raw_answer_text_included: false,
|
|
390
|
+
raw_conversation_text_included: false,
|
|
391
|
+
provider_deletion_claim: false,
|
|
392
|
+
model_forgetting_claim: false,
|
|
393
|
+
roi_or_provider_invoice_savings_claim: false,
|
|
394
|
+
compliance_certification_claim: false,
|
|
395
|
+
benchmark_leadership_claim: false,
|
|
396
|
+
},
|
|
397
|
+
protocol_boundaries: {
|
|
398
|
+
network_required: false,
|
|
399
|
+
provider_calls_made: false,
|
|
400
|
+
answers_generated: false,
|
|
401
|
+
judged: false,
|
|
402
|
+
competitor_adapters_run: false,
|
|
403
|
+
api_spend_possible: false,
|
|
404
|
+
},
|
|
405
|
+
command_boundaries: offlineCommandBoundaries({ scoresIncluded: false, datasetFilesRead: false }),
|
|
406
|
+
review_rules: [
|
|
407
|
+
'report hash format: sha256:<hex> over the public-safe protocol-plan JSON bytes',
|
|
408
|
+
'dataset ref, runner ref, package ref, environment ref, and verifier ref formats are pinned before a live run',
|
|
409
|
+
'metric scope: this artifact plans the full-answer protocol only; it is not a score',
|
|
410
|
+
'limitation: no provider answer-accuracy, competitor-performance, benchmark-leadership, ROI, provider-deletion, model-forgetting, or compliance claim is made',
|
|
411
|
+
],
|
|
412
|
+
non_claims: [
|
|
413
|
+
'This protocol plan is a readiness artifact: it records the planned full-answer protocol dimensions and does not execute it.',
|
|
414
|
+
'No network is used, no provider APIs are called, no answers are generated, no answers are judged, and no competitor adapters are run.',
|
|
415
|
+
'Answerer/judge model refs, prompt refs, and competitor adapter refs are public-safe references only; they are not credentials, model calls, prompts, or scores.',
|
|
416
|
+
'A scored full-answer run requires a separate credentialed command with frozen models, prompts, evaluator, dataset manifest, and budget caps.',
|
|
417
|
+
],
|
|
418
|
+
};
|
|
419
|
+
}
|
|
264
420
|
|
|
265
421
|
function publicFileName(path) {
|
|
266
422
|
return path === undefined || path === null ? undefined : basename(String(path));
|
|
@@ -830,7 +986,7 @@ export function parseLocomoDataset(data, options = {}) {
|
|
|
830
986
|
source_url: LOCOMO_SOURCE_URL,
|
|
831
987
|
license: 'CC BY-NC 4.0',
|
|
832
988
|
parser: 'conversation session turns as memory records; qa evidence labels mapped to dialog ids such as D1:3 and semicolon-separated labels',
|
|
833
|
-
task_categories: [
|
|
989
|
+
task_categories: [...LOCOMO_TASK_CATEGORIES],
|
|
834
990
|
records,
|
|
835
991
|
queries,
|
|
836
992
|
};
|
|
@@ -906,7 +1062,7 @@ export function parseLongMemEvalDataset(data, options = {}) {
|
|
|
906
1062
|
source_url: LONGMEMEVAL_SOURCE_URLS,
|
|
907
1063
|
license: 'See Hugging Face dataset card and upstream LongMemEval repository for the selected cleaned file.',
|
|
908
1064
|
parser: 'haystack_sessions turns as memory records; has_answer:true turns and answer_session_ids are used as evidence labels; _abs ids are evaluated as abstention cases',
|
|
909
|
-
task_categories: [
|
|
1065
|
+
task_categories: [...LONGMEMEVAL_TASK_CATEGORIES],
|
|
910
1066
|
records,
|
|
911
1067
|
queries,
|
|
912
1068
|
};
|
|
@@ -1110,7 +1266,7 @@ function buildSuiteReport(datasetRows, topK, options) {
|
|
|
1110
1266
|
generated_at: options.generated_at ?? new Date().toISOString(),
|
|
1111
1267
|
package: {
|
|
1112
1268
|
name: 'enigma-memory',
|
|
1113
|
-
version: '0.1.
|
|
1269
|
+
version: '0.1.17',
|
|
1114
1270
|
},
|
|
1115
1271
|
public_safe: true,
|
|
1116
1272
|
top_k: topK,
|
|
@@ -1162,7 +1318,7 @@ function buildSuiteReport(datasetRows, topK, options) {
|
|
|
1162
1318
|
}
|
|
1163
1319
|
|
|
1164
1320
|
function usage() {
|
|
1165
|
-
return `Usage: node scripts/run-standard-memory-benchmarks.mjs [--locomo <path>] [--longmemeval <path>] [--max-locomo-qa <n>] [--max-longmemeval-items <n>] [--top-k <n>] [--out <path>] [--dry-run]\n\nProduces schema ${STANDARD_MEMORY_BENCHMARK_SUITE_SCHEMA}. Raw question, answer, and conversation text are never written to the report. With --longmemeval and --max-longmemeval-items, the local top-level JSON array is streamed for hashing and only the requested sample items are parsed. Use --dry-run to print a public-safe offline execution plan without reading dataset files or producing scores.`;
|
|
1321
|
+
return `Usage: node scripts/run-standard-memory-benchmarks.mjs [--locomo <path>] [--longmemeval <path>] [--max-locomo-qa <n>] [--max-longmemeval-items <n>] [--top-k <n>] [--out <path>] [--dry-run] [--protocol-plan [--answerer-ref <ref>] [--judge-ref <ref>] [--answer-prompt-ref <ref>] [--judge-prompt-ref <ref>] [--protocol-ref <ref>]]\n\nProduces schema ${STANDARD_MEMORY_BENCHMARK_SUITE_SCHEMA}. Raw question, answer, and conversation text are never written to the report. With --longmemeval and --max-longmemeval-items, the local top-level JSON array is streamed for hashing and only the requested sample items are parsed. Use --dry-run to print a public-safe offline execution plan without reading dataset files or producing scores. Use --protocol-plan to print a public-safe full-answer benchmark PROTOCOL plan (schema ${STANDARD_MEMORY_BENCHMARK_PROTOCOL_PLAN_SCHEMA}) recording the planned category set, top-k, answerer/judge model refs, prompt/protocol refs, competitor adapter refs, and cost-estimate inputs, with explicit network_required:false, provider_calls_made:false, answers_generated:false, and judged:false boundaries; it does not call providers, generate answers, judge answers, or run competitor adapters.`;
|
|
1166
1322
|
}
|
|
1167
1323
|
|
|
1168
1324
|
async function main() {
|
|
@@ -1171,9 +1327,11 @@ async function main() {
|
|
|
1171
1327
|
console.log(usage());
|
|
1172
1328
|
return;
|
|
1173
1329
|
}
|
|
1174
|
-
const report = options.
|
|
1175
|
-
?
|
|
1176
|
-
:
|
|
1330
|
+
const report = options.protocol_plan
|
|
1331
|
+
? buildStandardBenchmarkProtocolPlan(options)
|
|
1332
|
+
: options.dry_run
|
|
1333
|
+
? buildStandardBenchmarkDryRunPlan(options)
|
|
1334
|
+
: await runStandardMemoryBenchmarkSuiteFromFiles(options);
|
|
1177
1335
|
const serialized = `${JSON.stringify(report, null, 2)}\n`;
|
|
1178
1336
|
if (options.out) {
|
|
1179
1337
|
const outPath = resolve(options.out);
|