@tangle-network/agent-knowledge 4.0.0 → 4.1.0
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/AGENTS.md +32 -18
- package/CHANGELOG.md +32 -0
- package/README.md +31 -19
- package/dist/benchmarks/index.d.ts +51 -3
- package/dist/benchmarks/index.js +1 -1
- package/dist/{chunk-EUAXSBMH.js → chunk-AKYJG2MR.js} +224 -224
- package/dist/chunk-AKYJG2MR.js.map +1 -0
- package/dist/{chunk-DW6APRTX.js → chunk-BBCIB4UL.js} +2486 -2457
- package/dist/chunk-BBCIB4UL.js.map +1 -0
- package/dist/{chunk-UWOTQNBI.js → chunk-CPMLJYA3.js} +1886 -1842
- package/dist/chunk-CPMLJYA3.js.map +1 -0
- package/dist/{chunk-WCYW2GDA.js → chunk-MYFM6LKH.js} +2 -2
- package/dist/chunk-MYFM6LKH.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/index.d.ts +48 -52
- package/dist/index.js +2906 -2874
- package/dist/index.js.map +1 -1
- package/dist/memory/index.d.ts +129 -6
- package/dist/memory/index.js +2 -2
- package/dist/sources/index.d.ts +17 -33
- package/dist/sources/index.js +1 -1
- package/dist/{index-Bqg1mBPt.d.ts → types-DP38encz.d.ts} +127 -284
- package/docs/eval/investment-material-facts.md +28 -29
- package/docs/eval/rag-eval-roadmap.md +6 -5
- package/docs/results/adaptive.md +13 -13
- package/docs/results/claim-grounding.md +11 -11
- package/docs/results/cost-quality.md +4 -4
- package/docs/results/investment-thesis.md +56 -56
- package/docs/results/research-driving.md +54 -54
- package/docs/two-agent-research-ab.md +94 -94
- package/package.json +4 -7
- package/dist/chunk-DW6APRTX.js.map +0 -1
- package/dist/chunk-EUAXSBMH.js.map +0 -1
- package/dist/chunk-UWOTQNBI.js.map +0 -1
- package/dist/chunk-WCYW2GDA.js.map +0 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { JsonValue, Scenario, DispatchContext, RunImprovementLoopResult, ParameterCandidate, JudgeConfig, Gate, RunImprovementLoopOptions, MutableSurface, SurfaceProposer, CampaignStorage, CostLedgerHandle, CampaignResult } from '@tangle-network/agent-eval/campaign';
|
|
2
2
|
import { c as KnowledgeIndex, S as SourceRecord } from './types-6x0OpfW6.js';
|
|
3
|
-
import { OffPolicyTrajectory } from '@tangle-network/agent-eval/rl';
|
|
4
3
|
|
|
5
4
|
type RetrievalConfig = Record<string, JsonValue>;
|
|
6
5
|
type RetrievalParameterSearchSpace = Record<string, readonly JsonValue[]>;
|
|
@@ -158,30 +157,106 @@ declare function buildRetrievalParameterCandidates(searchSpace: RetrievalParamet
|
|
|
158
157
|
declare function retrievalParameterSweepProposer(options: RetrievalParameterSweepProposerOptions): SurfaceProposer;
|
|
159
158
|
declare function runRetrievalImprovementLoop(options: RunRetrievalImprovementLoopOptions): Promise<RunRetrievalImprovementLoopResult>;
|
|
160
159
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
160
|
+
type AgentMemoryKind = 'message' | 'entity' | 'fact' | 'preference' | 'observation' | 'reasoning-trace';
|
|
161
|
+
interface AgentMemoryScope {
|
|
162
|
+
tenantId?: string;
|
|
163
|
+
userId?: string;
|
|
164
|
+
agentId?: string;
|
|
165
|
+
teamId?: string;
|
|
166
|
+
runId?: string;
|
|
167
|
+
sessionId?: string;
|
|
168
|
+
namespace?: string;
|
|
169
|
+
tags?: Record<string, string>;
|
|
164
170
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
171
|
+
interface AgentMemoryHit {
|
|
172
|
+
id: string;
|
|
173
|
+
uri: string;
|
|
174
|
+
kind: AgentMemoryKind;
|
|
175
|
+
text: string;
|
|
176
|
+
title?: string;
|
|
177
|
+
score?: number;
|
|
178
|
+
normalizedScore?: number;
|
|
179
|
+
confidence?: number;
|
|
180
|
+
createdAt?: string;
|
|
181
|
+
validUntil?: string;
|
|
182
|
+
lastVerifiedAt?: string;
|
|
183
|
+
metadata?: Record<string, unknown>;
|
|
173
184
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
+
interface AgentMemoryContext {
|
|
186
|
+
query: string;
|
|
187
|
+
text: string;
|
|
188
|
+
hits: AgentMemoryHit[];
|
|
189
|
+
sourceRecords: SourceRecord[];
|
|
190
|
+
metadata?: Record<string, unknown>;
|
|
191
|
+
}
|
|
192
|
+
interface AgentMemorySearchOptions {
|
|
193
|
+
scope?: AgentMemoryScope;
|
|
194
|
+
limit?: number;
|
|
195
|
+
minScore?: number;
|
|
196
|
+
kinds?: AgentMemoryKind[];
|
|
197
|
+
metadata?: Record<string, unknown>;
|
|
198
|
+
/**
|
|
199
|
+
* Opt-in randomized retrieval holdout (epsilon-dropout) for treatment-effect logging.
|
|
200
|
+
* Absent by default; when absent, retrieval behavior is unchanged. See ./holdout.
|
|
201
|
+
*/
|
|
202
|
+
holdout?: RetrievalHoldoutConfig;
|
|
203
|
+
}
|
|
204
|
+
interface AgentMemoryWriteInput {
|
|
205
|
+
kind: AgentMemoryKind;
|
|
206
|
+
text: string;
|
|
207
|
+
id?: string;
|
|
208
|
+
title?: string;
|
|
209
|
+
role?: 'system' | 'user' | 'assistant' | 'tool';
|
|
210
|
+
entityName?: string;
|
|
211
|
+
entityType?: string;
|
|
212
|
+
category?: string;
|
|
213
|
+
predicate?: string;
|
|
214
|
+
subject?: string;
|
|
215
|
+
object?: string;
|
|
216
|
+
confidence?: number;
|
|
217
|
+
scope?: AgentMemoryScope;
|
|
218
|
+
metadata?: Record<string, unknown>;
|
|
219
|
+
}
|
|
220
|
+
interface AgentMemoryWriteResult {
|
|
221
|
+
accepted: boolean;
|
|
222
|
+
id: string;
|
|
223
|
+
uri: string;
|
|
224
|
+
kind: AgentMemoryKind;
|
|
225
|
+
sourceRecord?: SourceRecord;
|
|
226
|
+
metadata?: Record<string, unknown>;
|
|
227
|
+
}
|
|
228
|
+
type AgentMemoryBranchIsolation = {
|
|
229
|
+
mode: 'scoped';
|
|
230
|
+
/** False when writes may outlive the worker process that issued them. */
|
|
231
|
+
processExitSafe?: boolean;
|
|
232
|
+
/** Wait before clearing an abandoned branch so accepted asynchronous writes become visible. */
|
|
233
|
+
recoveryDelayMs?: number;
|
|
234
|
+
} | {
|
|
235
|
+
mode: 'instance';
|
|
236
|
+
branchId: string;
|
|
237
|
+
/** True only when the dedicated instance also enforces every logical scope. */
|
|
238
|
+
supportsLogicalScopes?: boolean;
|
|
239
|
+
} | {
|
|
240
|
+
mode: 'unsupported';
|
|
241
|
+
reason: string;
|
|
242
|
+
};
|
|
243
|
+
interface AgentMemoryAdapter {
|
|
244
|
+
readonly id: string;
|
|
245
|
+
/** How this adapter prevents candidate branches from reading each other's state. */
|
|
246
|
+
readonly branchIsolation?: AgentMemoryBranchIsolation;
|
|
247
|
+
search(query: string, options?: AgentMemorySearchOptions): Promise<AgentMemoryHit[]>;
|
|
248
|
+
getContext(query: string, options?: AgentMemorySearchOptions): Promise<AgentMemoryContext>;
|
|
249
|
+
write(input: AgentMemoryWriteInput): Promise<AgentMemoryWriteResult>;
|
|
250
|
+
/** Delete exactly this scope. Repeated and concurrent calls for the same scope must be safe. */
|
|
251
|
+
clear?(scope?: AgentMemoryScope): Promise<void>;
|
|
252
|
+
flush?(): Promise<void>;
|
|
253
|
+
close?(): Promise<void>;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Optional session-level retrieval dropout for estimating whether delivered memories affect
|
|
257
|
+
* task outcomes. The feature is disabled unless configured, and consumers persist events
|
|
258
|
+
* through `onEvent`.
|
|
259
|
+
*/
|
|
185
260
|
interface RetrievalHoldoutConfig {
|
|
186
261
|
/** Per-session probability that one eligible watchlist item is suppressed. 0 logs the full schema without ever dropping. */
|
|
187
262
|
epsilon: number;
|
|
@@ -198,20 +273,20 @@ interface RetrievalHoldoutConfig {
|
|
|
198
273
|
* sessionIdHash/scopeHash, so PII-bearing identifiers (tenantId/userId/tags) never reach a
|
|
199
274
|
* consumer-controlled sink unless the consumer explicitly owns that decision. Note that
|
|
200
275
|
* replaying assignment draws from logs alone needs the plaintext sessionId, so
|
|
201
|
-
* privacy-
|
|
276
|
+
* privacy-preserving logs require the consumer's own sessionId mapping for replay.
|
|
202
277
|
*/
|
|
203
278
|
includePlaintextIdentifiers?: boolean;
|
|
204
279
|
/**
|
|
205
280
|
* Cap on tracked sessions per experiment config in the sticky wrapper's registry.
|
|
206
|
-
*
|
|
281
|
+
* The default is 10,000.
|
|
207
282
|
*/
|
|
208
283
|
maxTrackedSessions?: number;
|
|
209
284
|
/**
|
|
210
285
|
* Uniform-[0,1) generator keyed by a string. Defaults to a sha256-derived deterministic
|
|
211
|
-
* generator so every assignment is replayable from the logged keys alone
|
|
286
|
+
* generator so every assignment is replayable from the logged keys alone.
|
|
212
287
|
*/
|
|
213
288
|
rng?: (key: string) => number;
|
|
214
|
-
/** Receives one event per retrieval call,
|
|
289
|
+
/** Receives one event per retrieval call, including calls where nothing is dropped. */
|
|
215
290
|
onEvent: (event: RetrievalHoldoutEvent) => void;
|
|
216
291
|
}
|
|
217
292
|
interface RetrievalHoldoutEligibleItem {
|
|
@@ -228,19 +303,18 @@ interface RetrievalHoldoutEvent {
|
|
|
228
303
|
eventId: string;
|
|
229
304
|
ts: string;
|
|
230
305
|
adapterId?: string;
|
|
231
|
-
/** Plaintext session id
|
|
306
|
+
/** Plaintext session id, emitted only when `includePlaintextIdentifiers` is true. */
|
|
232
307
|
sessionId?: string;
|
|
233
308
|
/** Consumer-supplied experiment/outcome join id (scope.tags.taskId); deliberately plaintext. */
|
|
234
309
|
taskId?: string;
|
|
235
310
|
/** 1-based call counter within the session; 0 when the call is outside session randomization. */
|
|
236
311
|
callIndex: number;
|
|
237
312
|
/**
|
|
238
|
-
* sha256(sessionId) prefix
|
|
239
|
-
* reference for the assignment draws (previously named rngKey; identical derivation, deduped).
|
|
313
|
+
* sha256(sessionId) prefix used as the privacy-preserving join key and assignment seed.
|
|
240
314
|
*/
|
|
241
315
|
sessionIdHash?: string;
|
|
242
316
|
queryHash?: string;
|
|
243
|
-
/** Verbatim scope
|
|
317
|
+
/** Verbatim scope, emitted only when `includePlaintextIdentifiers` is true. */
|
|
244
318
|
scope?: AgentMemoryScope;
|
|
245
319
|
/** sha256 prefix of the canonical-JSON scope (keys sorted, undefined stripped). */
|
|
246
320
|
scopeHash?: string;
|
|
@@ -302,223 +376,30 @@ interface RetrievalHoldoutResult {
|
|
|
302
376
|
}
|
|
303
377
|
/** Adapter context paths that answer without retrieval, so no holdout draw can happen. */
|
|
304
378
|
type RetrievalHoldoutBypassReason = 'short-term-context' | 'raw-string-context';
|
|
305
|
-
/**
|
|
306
|
-
* Deterministic uniform [0,1) for assignment draws. The sha256 key derivation is ours — it makes
|
|
307
|
-
* every draw replayable from the logged keys alone (design rule D5) — while the generator core is
|
|
308
|
-
* the substrate's `mulberry32` (@tangle-network/agent-eval statistics vocabulary), seeded with the
|
|
309
|
-
* top 32 bits of the digest, so the statistical machinery is reused rather than forked.
|
|
310
|
-
*/
|
|
311
|
-
declare function deterministicRng(key: string): number;
|
|
312
|
-
/**
|
|
313
|
-
* Value-hash of the knobs that DEFINE the experiment (epsilon + watchlist, order-independent).
|
|
314
|
-
* Everything else on the config (callbacks, attribution stamps, privacy flags) does not change
|
|
315
|
-
* which assignments are drawn, so it stays out of the hash.
|
|
316
|
-
*/
|
|
317
|
-
declare function retrievalHoldoutConfigHash(config: Pick<RetrievalHoldoutConfig, 'epsilon' | 'watchlist'>): string;
|
|
318
|
-
/**
|
|
319
|
-
* Pure per-call holdout: takes post-filter hits, returns delivered hits plus the log event
|
|
320
|
-
* and the next session state. Suppression only removes items (no backfill), and it happens
|
|
321
|
-
* before rendering so a drop session's context is byte-identical to a natural smaller retrieval.
|
|
322
|
-
*/
|
|
323
|
-
declare function applyRetrievalHoldout(hits: AgentMemoryHit[], config: RetrievalHoldoutConfig, ctx?: RetrievalHoldoutCallContext): RetrievalHoldoutResult;
|
|
324
|
-
/**
|
|
325
|
-
* Logs a holdout event for adapter context paths that answer WITHOUT going through the
|
|
326
|
-
* search→render seam (Neo4j short-term conversation context, raw-string getContext results),
|
|
327
|
-
* so a consumer with a holdout configured still sees every call and the fraction-under-experiment
|
|
328
|
-
* denominator stays honest instead of silently losing these calls. No suppression is applied:
|
|
329
|
-
* dropping is only meaningful for retrieved memory hits, never for conversation context.
|
|
330
|
-
*/
|
|
331
|
-
declare function emitRetrievalHoldoutBypass(hits: AgentMemoryHit[], config: RetrievalHoldoutConfig, ctx: Omit<RetrievalHoldoutCallContext, 'session'>, bypassReason: RetrievalHoldoutBypassReason): RetrievalHoldoutEvent;
|
|
332
|
-
/**
|
|
333
|
-
* Clears all sticky-session state. For test isolation and experiment-epoch boundaries;
|
|
334
|
-
* sessions in flight afterwards re-draw deterministically (same rng keys), so with the default
|
|
335
|
-
* rng a reset is invisible in the logs unless eligibility sets changed in between.
|
|
336
|
-
*/
|
|
337
|
-
declare function resetRetrievalHoldoutRegistry(): void;
|
|
338
|
-
/**
|
|
339
|
-
* Convenience wrapper that threads session state internally, keyed by the VALUE of the
|
|
340
|
-
* experiment-defining knobs (configHash = epsilon + sorted watchlist) plus sessionId, so a fresh
|
|
341
|
-
* config object per call — the natural pattern when options are built inline — keeps full
|
|
342
|
-
* stickiness. Distinct experiments never share session state; two config objects with the same
|
|
343
|
-
* epsilon/watchlist are the same experiment by definition.
|
|
344
|
-
*/
|
|
345
|
-
declare function applySessionStickyRetrievalHoldout(hits: AgentMemoryHit[], config: RetrievalHoldoutConfig, ctx?: Omit<RetrievalHoldoutCallContext, 'session'>): RetrievalHoldoutResult;
|
|
346
|
-
/** Aggregated view of one session's holdout exposure — the randomization unit of this design. */
|
|
347
|
-
interface RetrievalHoldoutSessionSummary {
|
|
348
|
-
/** `${configHash}:${sessionIdHash}` — the trajectory's runId. */
|
|
349
|
-
runId: string;
|
|
350
|
-
configHash: string;
|
|
351
|
-
sessionIdHash: string;
|
|
352
|
-
sessionHoldout: boolean;
|
|
353
|
-
sessionTargetId: string | null;
|
|
354
|
-
/** Item actually suppressed in this session (equals sessionTargetId when a drop occurred). */
|
|
355
|
-
droppedId: string | null;
|
|
356
|
-
/** |watchlist ∩ E| at the session's first intersecting randomized call; 0 when never intersecting. */
|
|
357
|
-
firstCandidateCount: number;
|
|
358
|
-
/** Randomized retrieval calls observed for this session. */
|
|
359
|
-
callCount: number;
|
|
360
|
-
/** Adapter bypass calls observed for this session (logged, never randomized). */
|
|
361
|
-
bypassCallCount: number;
|
|
362
|
-
/** Session-level probability of the OBSERVED assignment under the behavior policy. */
|
|
363
|
-
behaviorProb: number;
|
|
364
|
-
/** True when the session's events disagree on arm or target (e.g. registry eviction re-draw). */
|
|
365
|
-
mixedExposure: boolean;
|
|
366
|
-
/** Present only on sessions surfaced in `excluded` rather than converted. */
|
|
367
|
-
exclusionReason?: 'mixed-exposure' | 'no-randomized-calls';
|
|
368
|
-
}
|
|
369
|
-
interface RetrievalHoldoutOffPolicyOptions {
|
|
370
|
-
/**
|
|
371
|
-
* Realized outcome PER SESSION, keyed by sessionIdHash — the session is the randomization
|
|
372
|
-
* unit, so rewards are per session, never per call. A missing entry for an included session
|
|
373
|
-
* throws: silently dropping unscored sessions would corrupt the estimator's denominator, so
|
|
374
|
-
* filter events to scored sessions upstream instead.
|
|
375
|
-
*/
|
|
376
|
-
rewards: Record<string, number>;
|
|
377
|
-
/**
|
|
378
|
-
* Target-policy probability of the session's observed assignment. Default models the
|
|
379
|
-
* always-deliver-in-full policy: 1 for full-delivery sessions, 0 for drop sessions.
|
|
380
|
-
*/
|
|
381
|
-
targetProb?: (session: RetrievalHoldoutSessionSummary) => number;
|
|
382
|
-
/** Per-session reward-model prediction enabling `doublyRobust`; when absent, qHat is null. */
|
|
383
|
-
qHat?: (session: RetrievalHoldoutSessionSummary) => number | null;
|
|
384
|
-
}
|
|
385
|
-
interface RetrievalHoldoutOffPolicyResult {
|
|
386
|
-
/** One trajectory per (configHash, sessionIdHash) — never per call. */
|
|
387
|
-
trajectories: OffPolicyTrajectory[];
|
|
388
|
-
/** 1:1 with `trajectories` (same order): the diagnostic view of each converted session. */
|
|
389
|
-
sessions: RetrievalHoldoutSessionSummary[];
|
|
390
|
-
/** Sessions surfaced but NOT converted (mixed exposure, bypass-only) — counted, never hidden. */
|
|
391
|
-
excluded: RetrievalHoldoutSessionSummary[];
|
|
392
|
-
/** Events with no sessionIdHash: outside session randomization, cannot join a reward. */
|
|
393
|
-
unattributableEvents: number;
|
|
394
|
-
}
|
|
395
|
-
/**
|
|
396
|
-
* Maps holdout logs onto agent-eval's `OffPolicyTrajectory`, ONE TRAJECTORY PER SESSION, so
|
|
397
|
-
* EXP-007's analysis consumes the substrate's `inverseProbabilityWeighting` /
|
|
398
|
-
* `selfNormalizedImportanceWeighting` / `doublyRobust` estimators directly. This matches the
|
|
399
|
-
* PREREG estimator (session-sticky self-normalized IPW): the design randomizes per SESSION —
|
|
400
|
-
* the arm coin is flipped once (P(holdout) = epsilon) and the sticky target is drawn once,
|
|
401
|
-
* uniformly over watchlist ∩ E at the session's first intersecting call.
|
|
402
|
-
*
|
|
403
|
-
* Session-level action space and behavior probabilities (they sum to 1 by construction):
|
|
404
|
-
* - full delivery (control arm observed): `1 − epsilon`;
|
|
405
|
-
* - drop candidate i of k = |watchlist ∩ E_first|: `epsilon / k` each (the draw event's logged
|
|
406
|
-
* `dropPropensity`);
|
|
407
|
-
* - sessions whose eligibility sets never intersect the watchlist: probability 1 — full
|
|
408
|
-
* delivery was certain in either arm.
|
|
409
|
-
*
|
|
410
|
-
* Per-call events are repeated observations WITHIN one session-level randomization; per-call
|
|
411
|
-
* IPW is statistically invalid for this design (per-call "propensities" imply an action
|
|
412
|
-
* distribution summing to more than 1 and bias IPS downward). Calls where the sticky target is
|
|
413
|
-
* absent from E, and adapter bypass calls, fold into the session summary (callCount /
|
|
414
|
-
* bypassCallCount) instead of generating independent propensities.
|
|
415
|
-
*
|
|
416
|
-
* Join contract: `rewards` is keyed by `sessionIdHash` (sha256(sessionId) first 16 hex — compute
|
|
417
|
-
* the same prefix over the outcome table's session ids, or log with
|
|
418
|
-
* `includePlaintextIdentifiers: true` and join on raw ids upstream). Events are grouped per
|
|
419
|
-
* (configHash, sessionIdHash) so different experiment configs are never pooled. Mixed-exposure
|
|
420
|
-
* sessions (arm or target disagreement, e.g. after registry eviction) are excluded from the
|
|
421
|
-
* trajectories and surfaced in `excluded` for the analysis to count.
|
|
422
|
-
* Pre-registration for EXP-007 stays in the research repo by design; the manifest vocabulary for
|
|
423
|
-
* it is agent-eval's `HypothesisManifest` / `signManifest` / `evaluateHypothesis` exports.
|
|
424
|
-
*/
|
|
425
|
-
declare function toOffPolicyTrajectory(events: RetrievalHoldoutEvent[], options: RetrievalHoldoutOffPolicyOptions): RetrievalHoldoutOffPolicyResult;
|
|
426
379
|
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
userId?: string;
|
|
431
|
-
agentId?: string;
|
|
432
|
-
teamId?: string;
|
|
433
|
-
runId?: string;
|
|
434
|
-
sessionId?: string;
|
|
435
|
-
namespace?: string;
|
|
436
|
-
tags?: Record<string, string>;
|
|
437
|
-
}
|
|
438
|
-
interface AgentMemoryHit {
|
|
439
|
-
id: string;
|
|
440
|
-
uri: string;
|
|
441
|
-
kind: AgentMemoryKind;
|
|
442
|
-
text: string;
|
|
443
|
-
title?: string;
|
|
444
|
-
score?: number;
|
|
445
|
-
normalizedScore?: number;
|
|
446
|
-
confidence?: number;
|
|
447
|
-
createdAt?: string;
|
|
448
|
-
validUntil?: string;
|
|
449
|
-
lastVerifiedAt?: string;
|
|
450
|
-
metadata?: Record<string, unknown>;
|
|
451
|
-
}
|
|
452
|
-
interface AgentMemoryContext {
|
|
453
|
-
query: string;
|
|
454
|
-
text: string;
|
|
455
|
-
hits: AgentMemoryHit[];
|
|
456
|
-
sourceRecords: SourceRecord[];
|
|
457
|
-
metadata?: Record<string, unknown>;
|
|
458
|
-
}
|
|
459
|
-
interface AgentMemorySearchOptions {
|
|
460
|
-
scope?: AgentMemoryScope;
|
|
461
|
-
limit?: number;
|
|
462
|
-
minScore?: number;
|
|
463
|
-
kinds?: AgentMemoryKind[];
|
|
464
|
-
metadata?: Record<string, unknown>;
|
|
465
|
-
/**
|
|
466
|
-
* Opt-in randomized retrieval holdout (epsilon-dropout) for treatment-effect logging.
|
|
467
|
-
* Absent by default; when absent, retrieval behavior is unchanged. See ./holdout.
|
|
468
|
-
*/
|
|
469
|
-
holdout?: RetrievalHoldoutConfig;
|
|
470
|
-
}
|
|
471
|
-
interface AgentMemoryWriteInput {
|
|
472
|
-
kind: AgentMemoryKind;
|
|
473
|
-
text: string;
|
|
474
|
-
id?: string;
|
|
475
|
-
title?: string;
|
|
476
|
-
role?: 'system' | 'user' | 'assistant' | 'tool';
|
|
477
|
-
entityName?: string;
|
|
478
|
-
entityType?: string;
|
|
479
|
-
category?: string;
|
|
480
|
-
predicate?: string;
|
|
481
|
-
subject?: string;
|
|
482
|
-
object?: string;
|
|
483
|
-
confidence?: number;
|
|
484
|
-
scope?: AgentMemoryScope;
|
|
485
|
-
metadata?: Record<string, unknown>;
|
|
486
|
-
}
|
|
487
|
-
interface AgentMemoryWriteResult {
|
|
488
|
-
accepted: boolean;
|
|
489
|
-
id: string;
|
|
490
|
-
uri: string;
|
|
491
|
-
kind: AgentMemoryKind;
|
|
492
|
-
sourceRecord?: SourceRecord;
|
|
493
|
-
metadata?: Record<string, unknown>;
|
|
380
|
+
interface AgentMemoryRunLease {
|
|
381
|
+
assertOwned(): Promise<void> | void;
|
|
382
|
+
release(): Promise<void> | void;
|
|
494
383
|
}
|
|
495
|
-
type
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
branchId: string;
|
|
504
|
-
/** True only when the dedicated instance also enforces every logical scope. */
|
|
505
|
-
supportsLogicalScopes?: boolean;
|
|
506
|
-
} | {
|
|
507
|
-
mode: 'unsupported';
|
|
508
|
-
reason: string;
|
|
509
|
-
};
|
|
510
|
-
interface AgentMemoryAdapter {
|
|
511
|
-
readonly id: string;
|
|
512
|
-
/** How this adapter prevents candidate branches from reading each other's state. */
|
|
513
|
-
readonly branchIsolation?: AgentMemoryBranchIsolation;
|
|
514
|
-
search(query: string, options?: AgentMemorySearchOptions): Promise<AgentMemoryHit[]>;
|
|
515
|
-
getContext(query: string, options?: AgentMemorySearchOptions): Promise<AgentMemoryContext>;
|
|
516
|
-
write(input: AgentMemoryWriteInput): Promise<AgentMemoryWriteResult>;
|
|
517
|
-
/** Delete exactly this scope. Repeated and concurrent calls for the same scope must be safe. */
|
|
518
|
-
clear?(scope?: AgentMemoryScope): Promise<void>;
|
|
519
|
-
flush?(): Promise<void>;
|
|
520
|
-
close?(): Promise<void>;
|
|
384
|
+
type AgentMemoryAcquireRunLease = (input: {
|
|
385
|
+
experimentId: string;
|
|
386
|
+
runDir: string;
|
|
387
|
+
}) => AgentMemoryRunLease | Promise<AgentMemoryRunLease>;
|
|
388
|
+
type AgentMemoryControllerMode = 'process-local';
|
|
389
|
+
interface OwnedAgentMemoryRunLease {
|
|
390
|
+
assertOwned(): Promise<void>;
|
|
391
|
+
release(): Promise<void>;
|
|
521
392
|
}
|
|
393
|
+
declare function acquireAgentMemoryRunLease(input: {
|
|
394
|
+
experimentId: string;
|
|
395
|
+
runDir: string;
|
|
396
|
+
storage: CampaignStorage;
|
|
397
|
+
customStorage: boolean;
|
|
398
|
+
lockFileName: string;
|
|
399
|
+
label: string;
|
|
400
|
+
controllerMode?: AgentMemoryControllerMode;
|
|
401
|
+
acquireRunLease?: AgentMemoryAcquireRunLease;
|
|
402
|
+
}): Promise<OwnedAgentMemoryRunLease>;
|
|
522
403
|
|
|
523
404
|
type KnowledgeBenchmarkTaskKind = 'retrieval' | 'rag-answer' | 'hallucination' | 'kb-improvement' | 'memory-ingest' | 'memory-recall' | 'memory-temporal' | 'memory-update' | 'memory-forgetting' | 'memory-reasoning' | 'memory-summarization' | 'memory-recommendation' | 'memory-multiparty';
|
|
524
405
|
type KnowledgeAnswerBenchmarkTaskKind = 'rag-answer' | 'hallucination' | 'kb-improvement';
|
|
@@ -780,43 +661,5 @@ interface BuildRetrievalBenchmarkCasesFromQrelsOptions {
|
|
|
780
661
|
documentTarget?: (documentId: string, qrel: KnowledgeRetrievalBenchmarkQrel) => RetrievalGoldTarget;
|
|
781
662
|
splitOf?: (queryId: string) => KnowledgeBenchmarkSplit;
|
|
782
663
|
}
|
|
783
|
-
declare const INDUSTRY_RAG_BENCHMARKS: readonly (KnowledgeBenchmarkSpec & {
|
|
784
|
-
taskKind: 'retrieval' | KnowledgeAnswerBenchmarkTaskKind;
|
|
785
|
-
})[];
|
|
786
|
-
declare const INDUSTRY_MEMORY_BENCHMARKS: readonly (KnowledgeBenchmarkSpec & {
|
|
787
|
-
taskKind: KnowledgeMemoryBenchmarkTaskKind;
|
|
788
|
-
})[];
|
|
789
|
-
declare function buildIndustryRagBenchmarkSmokeCases(specs?: readonly (KnowledgeBenchmarkSpec & {
|
|
790
|
-
taskKind: 'retrieval' | KnowledgeAnswerBenchmarkTaskKind;
|
|
791
|
-
})[]): KnowledgeBenchmarkCase[];
|
|
792
|
-
declare function respondToIndustryRagBenchmarkSmokeCase(input: {
|
|
793
|
-
case: KnowledgeBenchmarkCase;
|
|
794
|
-
}): KnowledgeBenchmarkArtifact;
|
|
795
|
-
declare function buildIndustryMemoryBenchmarkSmokeCases(specs?: readonly (KnowledgeBenchmarkSpec & {
|
|
796
|
-
taskKind: KnowledgeMemoryBenchmarkTaskKind;
|
|
797
|
-
})[]): KnowledgeMemoryBenchmarkCase[];
|
|
798
|
-
declare function respondToIndustryMemoryBenchmarkSmokeCase(input: {
|
|
799
|
-
case: KnowledgeMemoryBenchmarkCase;
|
|
800
|
-
}): KnowledgeBenchmarkArtifact;
|
|
801
|
-
declare function buildFirstPartyMemoryLifecycleBenchmarkCases(): KnowledgeMemoryBenchmarkCase[];
|
|
802
|
-
declare function runMemoryAdapterBenchmark(options: RunMemoryAdapterBenchmarkOptions): Promise<RunMemoryAdapterBenchmarkResult>;
|
|
803
|
-
declare function createNoopMemoryBenchmarkAdapter(id?: string): AgentMemoryAdapter;
|
|
804
|
-
declare function createInMemoryBenchmarkAdapter(options?: {
|
|
805
|
-
id?: string;
|
|
806
|
-
}): AgentMemoryAdapter;
|
|
807
|
-
declare function parseKnowledgeBenchmarkJsonl<T = unknown>(text: string): T[];
|
|
808
|
-
declare function parseKnowledgeBenchmarkQrels(text: string): KnowledgeRetrievalBenchmarkQrel[];
|
|
809
|
-
declare function buildRetrievalBenchmarkCasesFromQrels(options: BuildRetrievalBenchmarkCasesFromQrelsOptions): KnowledgeRetrievalBenchmarkCase[];
|
|
810
|
-
declare function runKnowledgeBenchmarkSuite<TArtifact = KnowledgeBenchmarkArtifact>(options: RunKnowledgeBenchmarkSuiteOptions<TArtifact>): Promise<RunKnowledgeBenchmarkSuiteResult<TArtifact>>;
|
|
811
|
-
declare function renderKnowledgeBenchmarkReportMarkdown(report: KnowledgeBenchmarkReport): string;
|
|
812
|
-
declare function buildKnowledgeBenchmarkScenarios(cases: readonly KnowledgeBenchmarkCase[], splits?: readonly KnowledgeBenchmarkSplit[]): KnowledgeBenchmarkScenario[];
|
|
813
|
-
declare function knowledgeBenchmarkJudge<TArtifact = KnowledgeBenchmarkArtifact>(): JudgeConfig<TArtifact, KnowledgeBenchmarkScenario>;
|
|
814
|
-
declare function scoreKnowledgeBenchmarkArtifact<TArtifact>(testCase: KnowledgeBenchmarkCase, artifact: TArtifact): KnowledgeBenchmarkEvaluation;
|
|
815
|
-
declare function summarizeKnowledgeBenchmarkCampaign<TArtifact>(input: {
|
|
816
|
-
scenarios: readonly KnowledgeBenchmarkScenario[];
|
|
817
|
-
campaign: CampaignResult<TArtifact, KnowledgeBenchmarkScenario>;
|
|
818
|
-
}): KnowledgeBenchmarkReport;
|
|
819
|
-
declare function scoreMemoryBenchmarkArtifact<TArtifact>(testCase: KnowledgeMemoryBenchmarkCase, artifact: TArtifact): KnowledgeBenchmarkEvaluation;
|
|
820
|
-
declare function isKnowledgeMemoryBenchmarkCase(testCase: KnowledgeBenchmarkCase): testCase is KnowledgeMemoryBenchmarkCase;
|
|
821
664
|
|
|
822
|
-
export { type
|
|
665
|
+
export { type RetrievalHoldoutConfig as $, type AgentMemoryAcquireRunLease as A, type BuildRetrievalBenchmarkCasesFromQrelsOptions as B, type KnowledgeBenchmarkSpec as C, type KnowledgeBenchmarkSplit as D, type KnowledgeBenchmarkTaskKind as E, type KnowledgeClaimMatcher as F, type KnowledgeMemoryBenchmarkCase as G, type KnowledgeMemoryBenchmarkTaskKind as H, type KnowledgeMemoryEvent as I, type KnowledgeMemoryFactMatcher as J, type KnowledgeAnswerBenchmarkCase as K, type KnowledgeRetrievalBenchmarkCase as L, type KnowledgeRetrievalBenchmarkQrel as M, type KnowledgeRetrievalBenchmarkQuery as N, type MemoryAdapterBenchmarkCandidate as O, type MemoryAdapterBenchmarkRankingRow as P, type OwnedAgentMemoryRunLease as Q, type RunRetrievalImprovementLoopResult as R, type RetrievalConfig as S, type RetrievalEvalArtifact as T, type RetrievalEvalRetriever as U, type RetrievalEvalRetrieverInput as V, type RetrievalEvalRetrieverResult as W, type RetrievalEvalScenario as X, type RetrievalGoldTarget as Y, type RetrievalHoldoutBypassReason as Z, type RetrievalHoldoutCallContext as _, type RunRetrievalImprovementLoopOptions as a, type RetrievalHoldoutEligibleItem as a0, type RetrievalHoldoutEvent as a1, type RetrievalHoldoutResult as a2, type RetrievalHoldoutSessionState as a3, type RetrievalMetricSummary as a4, type RetrievalMetricWeights as a5, type RetrievalParameterSearchSpace as a6, type RetrievalParameterSweepProposerOptions as a7, type RetrievalRecallJudgeOptions as a8, type RetrievedKnowledgeHit as a9, type RetrievedSourceSpan as aa, type RunKnowledgeBenchmarkSuiteOptions as ab, type RunKnowledgeBenchmarkSuiteResult as ac, type RunMemoryAdapterBenchmarkOptions as ad, type RunMemoryAdapterBenchmarkResult as ae, acquireAgentMemoryRunLease as af, buildRetrievalEvalDispatch as ag, buildRetrievalParameterCandidates as ah, retrievalConfigFromSurface as ai, retrievalConfigSurface as aj, retrievalParameterSweepProposer as ak, retrievalRecallJudge as al, runRetrievalImprovementLoop as am, scoreRetrievalArtifact as an, type AgentMemoryAdapter as b, type AgentMemoryBranchIsolation as c, type AgentMemoryContext as d, type AgentMemoryControllerMode as e, type AgentMemoryHit as f, type AgentMemoryKind as g, type AgentMemoryRunLease as h, type AgentMemoryScope as i, type AgentMemorySearchOptions as j, type AgentMemoryWriteInput as k, type AgentMemoryWriteResult as l, type BuildRetrievalEvalDispatchOptions as m, type BuildRetrievalParameterCandidatesOptions as n, type KnowledgeAnswerBenchmarkTaskKind as o, type KnowledgeBenchmarkArtifact as p, type KnowledgeBenchmarkCase as q, type KnowledgeBenchmarkCaseBase as r, type KnowledgeBenchmarkDistribution as s, type KnowledgeBenchmarkEvaluation as t, type KnowledgeBenchmarkFamily as u, type KnowledgeBenchmarkReport as v, type KnowledgeBenchmarkResponder as w, type KnowledgeBenchmarkScenario as x, type KnowledgeBenchmarkSliceSummary as y, type KnowledgeBenchmarkSource as z };
|