@tangle-network/agent-knowledge 6.2.0 → 7.0.2
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/CHANGELOG.md +34 -1
- package/README.md +31 -1
- package/dist/benchmarks/index.d.ts +1 -1
- package/dist/benchmarks/index.js +1 -1
- package/dist/{benchmarks-CmW6iORW.js → benchmarks-CPl4AO1k.js} +74 -6
- package/dist/benchmarks-CPl4AO1k.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/{ids-DRqPZ42_.js → ids-Bevz_pXV.js} +6 -2
- package/dist/ids-Bevz_pXV.js.map +1 -0
- package/dist/{index-DHebFLgU.d.ts → index-BEVmwlfJ.d.ts} +186 -7
- package/dist/index-BEVmwlfJ.d.ts.map +1 -0
- package/dist/{index-3z3lFJnE.d.ts → index-D0wc4GYg.d.ts} +2 -2
- package/dist/{index-3z3lFJnE.d.ts.map → index-D0wc4GYg.d.ts.map} +1 -1
- package/dist/index.d.ts +42 -16
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +86 -35
- package/dist/index.js.map +1 -1
- package/dist/{inspect-LUMkas6A.js → inspect-CJQGYuKa.js} +156 -33
- package/dist/inspect-CJQGYuKa.js.map +1 -0
- package/dist/memory/index.d.ts +3 -3
- package/dist/memory/index.js +3 -3
- package/dist/{memory-C6KPRhoU.js → memory-DAFfGTJH.js} +1093 -194
- package/dist/memory-DAFfGTJH.js.map +1 -0
- package/dist/sources/index.js +1 -1
- package/dist/{types-Cd57BPRt.d.ts → types-BOfmvDe-.d.ts} +21 -6
- package/dist/{types-Cd57BPRt.d.ts.map → types-BOfmvDe-.d.ts.map} +1 -1
- package/dist/viz/index.d.ts +1 -1
- package/docs/architecture.md +10 -6
- package/package.json +3 -3
- package/dist/benchmarks-CmW6iORW.js.map +0 -1
- package/dist/ids-DRqPZ42_.js.map +0 -1
- package/dist/index-DHebFLgU.d.ts.map +0 -1
- package/dist/inspect-LUMkas6A.js.map +0 -1
- package/dist/memory-C6KPRhoU.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Added `runAgentMemoryLearningExperiment` for matched stateful-versus-stateless memory measurement under one shared cost limit.
|
|
8
|
+
- Added exact paired gain, explicitly labeled transfer probes, and repeated-probe forgetting reports.
|
|
9
|
+
- Limited learning gain to post-first-step probes, averaged repetitions within independent sequences, and added per-candidate intervals.
|
|
10
|
+
- Added recorded arm order for counterbalanced runs and exact sequence references for safe crash recovery.
|
|
11
|
+
- Added abort and resume support, content-addressed comparison and probe evidence, and exact cell artifact hashes.
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- Memory experiment artifacts and cache identities now record `memoryMode` and a full `comparisonRef`; non-equivalent arms fail comparison.
|
|
16
|
+
|
|
17
|
+
## 7.0.1
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- Updated `@tangle-network/agent-eval` to `0.135.4` and `@tangle-network/agent-interface` to `0.37.0` so one installed stack uses the same exact trace-ingestion, source-identity, and interface contracts without older nested copies.
|
|
22
|
+
|
|
23
|
+
## 7.0.0
|
|
24
|
+
|
|
25
|
+
### Breaking Changes
|
|
26
|
+
|
|
27
|
+
- Changed research source confirmation from URI strings to exact `SourceRecord` values and versioned the durable claim ledger schema so every observation is bound to its registry id, original URI, and full SHA-256 content hash.
|
|
28
|
+
- URI-only 6.2 ledgers now fail with `ClaimLedgerMigrationRequiredError` and remain untouched for explicit archive-and-reverify migration; they are never guessed into the exact-source schema.
|
|
29
|
+
|
|
30
|
+
### Fixed
|
|
31
|
+
|
|
32
|
+
- Prevented registering one version of a URI from activating claims extracted from different bytes at that URI, including concurrent writers and crash recovery.
|
|
33
|
+
- Snapshotted source proposals before asynchronous work, preserved the exact submitted raw bytes, and used full content hashes in raw-source paths.
|
|
34
|
+
- Kept one-sided contradiction observations pending until both claims have exact registered support, preventing a missing counterpart from satisfying completion.
|
|
35
|
+
|
|
3
36
|
## 6.2.0
|
|
4
37
|
|
|
5
38
|
### Added
|
|
@@ -36,7 +69,7 @@
|
|
|
36
69
|
|
|
37
70
|
- Load `proper-lockfile` with a dynamic import inside the functions that take a lock, instead of at module scope.
|
|
38
71
|
It pulls in `graceful-fs`, which patches Node's `fs` at import time (`fs.close = ...`).
|
|
39
|
-
workerd exposes those as getter-only accessors, so the assignment threw while Cloudflare validated an uploaded Worker (`Cannot set property close of #<Object> which has only a getter [code: 10021]`), rejecting the whole Worker
|
|
72
|
+
workerd exposes those as getter-only accessors, so the assignment threw while Cloudflare validated an uploaded Worker (`Cannot set property close of #<Object> which has only a getter [code: 10021]`), rejecting the whole Worker, including consumers that never take a lock.
|
|
40
73
|
`verify:package` now fails on any static import of a module that patches a Node builtin, because `wrangler deploy --dry-run` bundles without executing and cannot see this class of failure.
|
|
41
74
|
|
|
42
75
|
## 6.1.8
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ Supply application callbacks for those decisions, or use `@tangle-network/agent-
|
|
|
9
9
|
## Install
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
pnpm add @tangle-network/agent-knowledge@
|
|
12
|
+
pnpm add @tangle-network/agent-knowledge@7.0.0 @tangle-network/agent-eval@0.135.2
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
Requires Node.js 20.19 or later.
|
|
@@ -239,6 +239,36 @@ Positive external work without a receipt is recorded as incomplete cost accounti
|
|
|
239
239
|
Use `0` only for a free local path.
|
|
240
240
|
Paid memory improvement defaults to a zero-dollar total limit; set `maxTotalCostUsd` and `maximumEvaluationCostUsd` before enabling paid work.
|
|
241
241
|
|
|
242
|
+
Use `runAgentMemoryLearningExperiment` to measure whether retained memory helps across ordered steps:
|
|
243
|
+
|
|
244
|
+
```ts
|
|
245
|
+
import { runAgentMemoryLearningExperiment } from '@tangle-network/agent-knowledge/memory'
|
|
246
|
+
|
|
247
|
+
const result = await runAgentMemoryLearningExperiment({
|
|
248
|
+
experimentId: 'support-memory',
|
|
249
|
+
runDir: 'support-memory',
|
|
250
|
+
candidates: [memoryCandidate],
|
|
251
|
+
sequences,
|
|
252
|
+
seed: 42,
|
|
253
|
+
reps: 5,
|
|
254
|
+
armOrder: 'stateful-first',
|
|
255
|
+
costCeiling: 10,
|
|
256
|
+
})
|
|
257
|
+
|
|
258
|
+
console.log(result.comparison.gain)
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
The function runs matched stateful and stateless arms with the same immutable candidate, tasks, executor, policy, seed, and repetitions.
|
|
262
|
+
The stateless arm clears declared scopes between steps; adapters must support scoped `clear`.
|
|
263
|
+
Gain excludes first-step probes and averages candidates and repetitions within each independent sequence.
|
|
264
|
+
Use `transferKey` on later probes for transfer and repeat one `retentionKey` across steps for forgetting.
|
|
265
|
+
Unmarked probes are not assigned those meanings.
|
|
266
|
+
|
|
267
|
+
Both arms share one cost limit and must have identical comparison references.
|
|
268
|
+
Run independent experiments with opposite `armOrder` values when provider behavior may drift.
|
|
269
|
+
Each saved probe includes the exact scoring input and content hash, so protect the run directory like the memory data itself.
|
|
270
|
+
Pass `signal` to cancel; rerun the same options and directory to resume completed work and cost records.
|
|
271
|
+
|
|
242
272
|
## Run benchmarks
|
|
243
273
|
|
|
244
274
|
`@tangle-network/agent-knowledge/benchmarks` provides common case and report types for:
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as KnowledgeBenchmarkResponder, B as KnowledgeMemoryEvent, C as KnowledgeBenchmarkArtifact, Ct as createInMemoryBenchmarkAdapter, D as KnowledgeBenchmarkEvaluation, E as KnowledgeBenchmarkDistribution, F as KnowledgeBenchmarkSplit, G as MemoryAdapterBenchmarkCandidate, H as KnowledgeRetrievalBenchmarkCase, I as KnowledgeBenchmarkTaskKind, J as RunKnowledgeBenchmarkSuiteResult, K as MemoryAdapterBenchmarkRankingRow, L as KnowledgeClaimMatcher, M as KnowledgeBenchmarkSliceSummary, N as KnowledgeBenchmarkSource, O as KnowledgeBenchmarkFamily, P as KnowledgeBenchmarkSpec, R as KnowledgeMemoryBenchmarkCase, S as KnowledgeAnswerBenchmarkTaskKind, T as KnowledgeBenchmarkCaseBase, U as KnowledgeRetrievalBenchmarkQrel, V as KnowledgeMemoryFactMatcher, W as KnowledgeRetrievalBenchmarkQuery, X as RunMemoryAdapterBenchmarkResult, Y as RunMemoryAdapterBenchmarkOptions, _ as buildIndustryRagBenchmarkSmokeCases, a as runKnowledgeBenchmarkSuite, b as BuildRetrievalBenchmarkCasesFromQrelsOptions, c as buildRetrievalBenchmarkCasesFromQrels, d as summarizeKnowledgeBenchmarkCampaign, f as runMemoryAdapterBenchmark, g as buildIndustryMemoryBenchmarkSmokeCases, h as buildFirstPartyMemoryLifecycleBenchmarkCases, i as renderKnowledgeBenchmarkReportMarkdown, j as KnowledgeBenchmarkScenario, k as KnowledgeBenchmarkReport, l as parseKnowledgeBenchmarkJsonl, m as INDUSTRY_RAG_BENCHMARKS, n as buildKnowledgeBenchmarkScenarios, o as scoreKnowledgeBenchmarkArtifact, p as INDUSTRY_MEMORY_BENCHMARKS, q as RunKnowledgeBenchmarkSuiteOptions, r as knowledgeBenchmarkJudge, s as scoreMemoryBenchmarkArtifact, t as isKnowledgeMemoryBenchmarkCase, u as parseKnowledgeBenchmarkQrels, v as respondToIndustryMemoryBenchmarkSmokeCase, w as KnowledgeBenchmarkCase, wt as createNoopMemoryBenchmarkAdapter, x as KnowledgeAnswerBenchmarkCase, y as respondToIndustryRagBenchmarkSmokeCase, z as KnowledgeMemoryBenchmarkTaskKind } from "../index-
|
|
1
|
+
import { A as KnowledgeBenchmarkResponder, B as KnowledgeMemoryEvent, C as KnowledgeBenchmarkArtifact, Ct as createInMemoryBenchmarkAdapter, D as KnowledgeBenchmarkEvaluation, E as KnowledgeBenchmarkDistribution, F as KnowledgeBenchmarkSplit, G as MemoryAdapterBenchmarkCandidate, H as KnowledgeRetrievalBenchmarkCase, I as KnowledgeBenchmarkTaskKind, J as RunKnowledgeBenchmarkSuiteResult, K as MemoryAdapterBenchmarkRankingRow, L as KnowledgeClaimMatcher, M as KnowledgeBenchmarkSliceSummary, N as KnowledgeBenchmarkSource, O as KnowledgeBenchmarkFamily, P as KnowledgeBenchmarkSpec, R as KnowledgeMemoryBenchmarkCase, S as KnowledgeAnswerBenchmarkTaskKind, T as KnowledgeBenchmarkCaseBase, U as KnowledgeRetrievalBenchmarkQrel, V as KnowledgeMemoryFactMatcher, W as KnowledgeRetrievalBenchmarkQuery, X as RunMemoryAdapterBenchmarkResult, Y as RunMemoryAdapterBenchmarkOptions, _ as buildIndustryRagBenchmarkSmokeCases, a as runKnowledgeBenchmarkSuite, b as BuildRetrievalBenchmarkCasesFromQrelsOptions, c as buildRetrievalBenchmarkCasesFromQrels, d as summarizeKnowledgeBenchmarkCampaign, f as runMemoryAdapterBenchmark, g as buildIndustryMemoryBenchmarkSmokeCases, h as buildFirstPartyMemoryLifecycleBenchmarkCases, i as renderKnowledgeBenchmarkReportMarkdown, j as KnowledgeBenchmarkScenario, k as KnowledgeBenchmarkReport, l as parseKnowledgeBenchmarkJsonl, m as INDUSTRY_RAG_BENCHMARKS, n as buildKnowledgeBenchmarkScenarios, o as scoreKnowledgeBenchmarkArtifact, p as INDUSTRY_MEMORY_BENCHMARKS, q as RunKnowledgeBenchmarkSuiteOptions, r as knowledgeBenchmarkJudge, s as scoreMemoryBenchmarkArtifact, t as isKnowledgeMemoryBenchmarkCase, u as parseKnowledgeBenchmarkQrels, v as respondToIndustryMemoryBenchmarkSmokeCase, w as KnowledgeBenchmarkCase, wt as createNoopMemoryBenchmarkAdapter, x as KnowledgeAnswerBenchmarkCase, y as respondToIndustryRagBenchmarkSmokeCase, z as KnowledgeMemoryBenchmarkTaskKind } from "../index-D0wc4GYg.js";
|
|
2
2
|
export { type BuildRetrievalBenchmarkCasesFromQrelsOptions, INDUSTRY_MEMORY_BENCHMARKS, INDUSTRY_RAG_BENCHMARKS, type KnowledgeAnswerBenchmarkCase, type KnowledgeAnswerBenchmarkTaskKind, type KnowledgeBenchmarkArtifact, type KnowledgeBenchmarkCase, type KnowledgeBenchmarkCaseBase, type KnowledgeBenchmarkDistribution, type KnowledgeBenchmarkEvaluation, type KnowledgeBenchmarkFamily, type KnowledgeBenchmarkReport, type KnowledgeBenchmarkResponder, type KnowledgeBenchmarkScenario, type KnowledgeBenchmarkSliceSummary, type KnowledgeBenchmarkSource, type KnowledgeBenchmarkSpec, type KnowledgeBenchmarkSplit, type KnowledgeBenchmarkTaskKind, type KnowledgeClaimMatcher, type KnowledgeMemoryBenchmarkCase, type KnowledgeMemoryBenchmarkTaskKind, type KnowledgeMemoryEvent, type KnowledgeMemoryFactMatcher, type KnowledgeRetrievalBenchmarkCase, type KnowledgeRetrievalBenchmarkQrel, type KnowledgeRetrievalBenchmarkQuery, type MemoryAdapterBenchmarkCandidate, type MemoryAdapterBenchmarkRankingRow, type RunKnowledgeBenchmarkSuiteOptions, type RunKnowledgeBenchmarkSuiteResult, type RunMemoryAdapterBenchmarkOptions, type RunMemoryAdapterBenchmarkResult, buildFirstPartyMemoryLifecycleBenchmarkCases, buildIndustryMemoryBenchmarkSmokeCases, buildIndustryRagBenchmarkSmokeCases, buildKnowledgeBenchmarkScenarios, buildRetrievalBenchmarkCasesFromQrels, createInMemoryBenchmarkAdapter, createNoopMemoryBenchmarkAdapter, isKnowledgeMemoryBenchmarkCase, knowledgeBenchmarkJudge, parseKnowledgeBenchmarkJsonl, parseKnowledgeBenchmarkQrels, renderKnowledgeBenchmarkReportMarkdown, respondToIndustryMemoryBenchmarkSmokeCase, respondToIndustryRagBenchmarkSmokeCase, runKnowledgeBenchmarkSuite, runMemoryAdapterBenchmark, scoreKnowledgeBenchmarkArtifact, scoreMemoryBenchmarkArtifact, summarizeKnowledgeBenchmarkCampaign };
|
package/dist/benchmarks/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { B as createNoopMemoryBenchmarkAdapter, F as buildIndustryRagBenchmarkSmokeCases, I as respondToIndustryMemoryBenchmarkSmokeCase, L as respondToIndustryRagBenchmarkSmokeCase, M as INDUSTRY_RAG_BENCHMARKS, N as buildFirstPartyMemoryLifecycleBenchmarkCases, P as buildIndustryMemoryBenchmarkSmokeCases, R as isKnowledgeMemoryBenchmarkCase, a as buildKnowledgeBenchmarkScenarios, c as runKnowledgeBenchmarkSuite, d as summarizeKnowledgeBenchmarkCampaign, i as runMemoryAdapterBenchmark, j as INDUSTRY_MEMORY_BENCHMARKS, l as scoreKnowledgeBenchmarkArtifact, n as parseKnowledgeBenchmarkJsonl, o as knowledgeBenchmarkJudge, r as parseKnowledgeBenchmarkQrels, s as renderKnowledgeBenchmarkReportMarkdown, t as buildRetrievalBenchmarkCasesFromQrels, u as scoreMemoryBenchmarkArtifact, z as createInMemoryBenchmarkAdapter } from "../benchmarks-CPl4AO1k.js";
|
|
2
2
|
export { INDUSTRY_MEMORY_BENCHMARKS, INDUSTRY_RAG_BENCHMARKS, buildFirstPartyMemoryLifecycleBenchmarkCases, buildIndustryMemoryBenchmarkSmokeCases, buildIndustryRagBenchmarkSmokeCases, buildKnowledgeBenchmarkScenarios, buildRetrievalBenchmarkCasesFromQrels, createInMemoryBenchmarkAdapter, createNoopMemoryBenchmarkAdapter, isKnowledgeMemoryBenchmarkCase, knowledgeBenchmarkJudge, parseKnowledgeBenchmarkJsonl, parseKnowledgeBenchmarkQrels, renderKnowledgeBenchmarkReportMarkdown, respondToIndustryMemoryBenchmarkSmokeCase, respondToIndustryRagBenchmarkSmokeCase, runKnowledgeBenchmarkSuite, runMemoryAdapterBenchmark, scoreKnowledgeBenchmarkArtifact, scoreMemoryBenchmarkArtifact, summarizeKnowledgeBenchmarkCampaign };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as stableId, t as sha256 } from "./ids-
|
|
1
|
+
import { r as stableId, t as sha256 } from "./ids-Bevz_pXV.js";
|
|
2
2
|
import { n as searchKnowledge } from "./search-CP0QtBJZ.js";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
import { join } from "node:path";
|
|
@@ -1264,6 +1264,8 @@ function isMemoryProviderActor(actor) {
|
|
|
1264
1264
|
//#endregion
|
|
1265
1265
|
//#region src/memory/lifecycle.ts
|
|
1266
1266
|
const DEFAULT_MEMORY_CLEANUP_TIMEOUT_MS = 18e4;
|
|
1267
|
+
const MEMORY_OPERATION_CANCELLATION_TIMEOUT_MS = 4e3;
|
|
1268
|
+
const MEMORY_CAMPAIGN_DISPATCH_SHUTDOWN_TIMEOUT_MS = 5e3;
|
|
1267
1269
|
var AgentMemoryLifecycleTimeoutError = class extends Error {
|
|
1268
1270
|
operation;
|
|
1269
1271
|
timeoutMs;
|
|
@@ -1296,16 +1298,37 @@ function releaseMemoryAdapterCreatedAfterAbort(input) {
|
|
|
1296
1298
|
} catch {}
|
|
1297
1299
|
}, () => void 0);
|
|
1298
1300
|
}
|
|
1301
|
+
async function createBoundedMemoryAdapter(input) {
|
|
1302
|
+
input.signal?.throwIfAborted();
|
|
1303
|
+
const abortController = new AbortController();
|
|
1304
|
+
const creation = Promise.resolve().then(() => input.create(abortController.signal));
|
|
1305
|
+
releaseMemoryAdapterCreatedAfterAbort({
|
|
1306
|
+
creation,
|
|
1307
|
+
signal: abortController.signal,
|
|
1308
|
+
dispose: input.dispose
|
|
1309
|
+
});
|
|
1310
|
+
return runBoundedMemoryLifecycle({
|
|
1311
|
+
operation: input.operation,
|
|
1312
|
+
timeoutMs: input.timeoutMs,
|
|
1313
|
+
signal: input.signal,
|
|
1314
|
+
abortController,
|
|
1315
|
+
run: () => creation
|
|
1316
|
+
});
|
|
1317
|
+
}
|
|
1299
1318
|
function resolveMemoryCleanupTimeoutMs(value, label) {
|
|
1300
1319
|
const timeoutMs = value ?? 18e4;
|
|
1301
1320
|
if (!Number.isSafeInteger(timeoutMs) || timeoutMs <= 0) throw new Error(`${label} cleanupTimeoutMs must be a positive safe integer`);
|
|
1302
1321
|
return timeoutMs;
|
|
1303
1322
|
}
|
|
1304
1323
|
async function runBoundedMemoryLifecycle(input) {
|
|
1324
|
+
input.signal?.throwIfAborted();
|
|
1325
|
+
if (input.cancellationTimeoutMs !== void 0 && (!Number.isSafeInteger(input.cancellationTimeoutMs) || input.cancellationTimeoutMs <= 0)) throw new Error(`${input.operation} cancellationTimeoutMs must be a positive safe integer`);
|
|
1305
1326
|
const priorTimeout = input.resource ? timedOutResources.get(input.resource) : void 0;
|
|
1306
1327
|
if (priorTimeout) throw new AgentMemoryLifecycleUnsafeError(input.operation, priorTimeout);
|
|
1307
1328
|
let timeout;
|
|
1329
|
+
let cancellationTimeout;
|
|
1308
1330
|
let timeoutError;
|
|
1331
|
+
let relayAbort;
|
|
1309
1332
|
const work = Promise.resolve().then(input.run);
|
|
1310
1333
|
if (input.resource) {
|
|
1311
1334
|
const resource = input.resource;
|
|
@@ -1323,12 +1346,41 @@ async function runBoundedMemoryLifecycle(input) {
|
|
|
1323
1346
|
reject(timeoutError);
|
|
1324
1347
|
}, input.timeoutMs);
|
|
1325
1348
|
});
|
|
1349
|
+
const signal = input.signal;
|
|
1350
|
+
const cancellation = signal ? new Promise((_, reject) => {
|
|
1351
|
+
relayAbort = () => {
|
|
1352
|
+
const error = memoryLifecycleAbortError(input.operation);
|
|
1353
|
+
input.abortController?.abort(error);
|
|
1354
|
+
if (input.cancellationTimeoutMs === void 0) {
|
|
1355
|
+
reject(signal.reason ?? error);
|
|
1356
|
+
return;
|
|
1357
|
+
}
|
|
1358
|
+
cancellationTimeout = setTimeout(() => {
|
|
1359
|
+
timeoutError = new AgentMemoryLifecycleTimeoutError(`${input.operation} cancellation`, input.cancellationTimeoutMs);
|
|
1360
|
+
if (input.resource) timedOutResources.set(input.resource, timeoutError);
|
|
1361
|
+
reject(timeoutError);
|
|
1362
|
+
}, input.cancellationTimeoutMs);
|
|
1363
|
+
};
|
|
1364
|
+
if (signal.aborted) relayAbort();
|
|
1365
|
+
else signal.addEventListener("abort", relayAbort, { once: true });
|
|
1366
|
+
}) : void 0;
|
|
1326
1367
|
try {
|
|
1327
|
-
return await Promise.race([
|
|
1368
|
+
return await Promise.race([
|
|
1369
|
+
work,
|
|
1370
|
+
deadline,
|
|
1371
|
+
...cancellation ? [cancellation] : []
|
|
1372
|
+
]);
|
|
1328
1373
|
} finally {
|
|
1329
1374
|
if (timeout) clearTimeout(timeout);
|
|
1375
|
+
if (cancellationTimeout) clearTimeout(cancellationTimeout);
|
|
1376
|
+
if (relayAbort) signal?.removeEventListener("abort", relayAbort);
|
|
1330
1377
|
}
|
|
1331
1378
|
}
|
|
1379
|
+
function memoryLifecycleAbortError(operation) {
|
|
1380
|
+
const error = /* @__PURE__ */ new Error(`${operation} aborted`);
|
|
1381
|
+
error.name = "AbortError";
|
|
1382
|
+
return error;
|
|
1383
|
+
}
|
|
1332
1384
|
function memoryRecoveryDelayMs(adapter) {
|
|
1333
1385
|
const isolation = adapter.branchIsolation;
|
|
1334
1386
|
if (isolation?.mode !== "scoped" || isolation.processExitSafe !== false) return 0;
|
|
@@ -1336,13 +1388,29 @@ function memoryRecoveryDelayMs(adapter) {
|
|
|
1336
1388
|
if (typeof delayMs !== "number" || !Number.isSafeInteger(delayMs) || delayMs <= 0) throw new Error(`${adapter.id}: processExitSafe=false requires a positive recoveryDelayMs for abandoned writes`);
|
|
1337
1389
|
return delayMs;
|
|
1338
1390
|
}
|
|
1339
|
-
async function sleepForMemoryRecovery(delayMs, assertOwned, timeoutMs = delayMs, operation = "memory recovery visibility wait") {
|
|
1391
|
+
async function sleepForMemoryRecovery(delayMs, assertOwned, timeoutMs = delayMs, operation = "memory recovery visibility wait", signal) {
|
|
1340
1392
|
if (delayMs <= 0) return;
|
|
1341
1393
|
if (!Number.isSafeInteger(timeoutMs) || timeoutMs <= 0) throw new Error(`${operation} timeout must be a positive safe integer`);
|
|
1342
|
-
|
|
1394
|
+
signal?.throwIfAborted();
|
|
1395
|
+
await waitForMemoryRecoveryDelay(Math.min(delayMs, timeoutMs), signal, operation);
|
|
1343
1396
|
await assertOwned();
|
|
1344
1397
|
if (delayMs > timeoutMs) throw new AgentMemoryLifecycleTimeoutError(operation, timeoutMs);
|
|
1345
1398
|
}
|
|
1399
|
+
async function waitForMemoryRecoveryDelay(delayMs, signal, operation) {
|
|
1400
|
+
await new Promise((resolve, reject) => {
|
|
1401
|
+
let timeout;
|
|
1402
|
+
const abort = () => {
|
|
1403
|
+
if (timeout) clearTimeout(timeout);
|
|
1404
|
+
reject(signal?.reason ?? memoryLifecycleAbortError(operation));
|
|
1405
|
+
};
|
|
1406
|
+
timeout = setTimeout(() => {
|
|
1407
|
+
signal?.removeEventListener("abort", abort);
|
|
1408
|
+
resolve();
|
|
1409
|
+
}, delayMs);
|
|
1410
|
+
if (signal?.aborted) abort();
|
|
1411
|
+
else signal?.addEventListener("abort", abort, { once: true });
|
|
1412
|
+
});
|
|
1413
|
+
}
|
|
1346
1414
|
function createMemoryExecutionPool(limit) {
|
|
1347
1415
|
let active = 0;
|
|
1348
1416
|
const waiters = [];
|
|
@@ -2713,6 +2781,6 @@ function defaultDocumentTarget(documentId, targetKind) {
|
|
|
2713
2781
|
}
|
|
2714
2782
|
}
|
|
2715
2783
|
//#endregion
|
|
2716
|
-
export {
|
|
2784
|
+
export { reserveRecoveryAttempts as A, createNoopMemoryBenchmarkAdapter as B, sleepForMemoryRecovery as C, hasSettledPaidCall as D, assertNoInterruptedPaidCalls as E, buildIndustryRagBenchmarkSmokeCases as F, retrievalConfigFromSurface as G, memoryWriteResultToSourceRecord as H, respondToIndustryMemoryBenchmarkSmokeCase as I, scoreRetrievalArtifact as J, retrievalConfigSurface as K, respondToIndustryRagBenchmarkSmokeCase as L, INDUSTRY_RAG_BENCHMARKS as M, buildFirstPartyMemoryLifecycleBenchmarkCases as N, readActiveAttemptJournal as O, buildIndustryMemoryBenchmarkSmokeCases as P, isKnowledgeMemoryBenchmarkCase as R, runBoundedMemoryLifecycle as S, appendDurableJournalEvent as T, buildRetrievalEvalDispatch as U, memoryHitToSourceRecord as V, partitionRetrievalScenarios as W, MEMORY_OPERATION_CANCELLATION_TIMEOUT_MS as _, buildKnowledgeBenchmarkScenarios as a, memoryRecoveryDelayMs as b, runKnowledgeBenchmarkSuite as c, summarizeKnowledgeBenchmarkCampaign as d, acquireAgentMemoryRunLease as f, MEMORY_CAMPAIGN_DISPATCH_SHUTDOWN_TIMEOUT_MS as g, DEFAULT_MEMORY_CLEANUP_TIMEOUT_MS as h, runMemoryAdapterBenchmark as i, INDUSTRY_MEMORY_BENCHMARKS as j, reconcileInterruptedMemoryPaidCalls as k, scoreKnowledgeBenchmarkArtifact as l, AgentMemoryLifecycleUnsafeError as m, parseKnowledgeBenchmarkJsonl as n, knowledgeBenchmarkJudge as o, AgentMemoryLifecycleTimeoutError as p, retrievalRecallJudge as q, parseKnowledgeBenchmarkQrels as r, renderKnowledgeBenchmarkReportMarkdown as s, buildRetrievalBenchmarkCasesFromQrels as t, scoreMemoryBenchmarkArtifact as u, createBoundedMemoryAdapter as v, appendAttemptJournalEvent as w, resolveMemoryCleanupTimeoutMs as x, createMemoryExecutionPool as y, createInMemoryBenchmarkAdapter as z };
|
|
2717
2785
|
|
|
2718
|
-
//# sourceMappingURL=benchmarks-
|
|
2786
|
+
//# sourceMappingURL=benchmarks-CPl4AO1k.js.map
|