@tangle-network/agent-knowledge 16.0.0 → 17.0.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.
@@ -1,3 +1,3 @@
1
- import { C as deterministicRng, D as toOffPolicyTrajectory, E as retrievalHoldoutConfigHash, S as applySessionStickyRetrievalHoldout, T as resetRetrievalHoldoutRegistry, _ as createAgentMemoryBranch, a as createNeo4jAgentMemoryAdapter, b as renderMemoryContext, c as runAgentMemoryImprovement, d as compareAgentMemoryLearning, f as runAgentMemoryLearningExperiment, g as buildAgentMemorySequencesFromBenchmarkCases, h as buildAgentMemorySequenceScenarios, i as AgentMemoryWriteInputSchema, l as createGraphitiMemoryAdapter, m as agentMemorySequenceJudge, n as AgentMemoryKindSchema, o as createMem0MemoryAdapter, p as runAgentMemoryExperiment, r as AgentMemoryScopeSchema, s as mem0MemoryAdapterIdentity, t as AgentMemoryHitSchema, u as graphitiMemoryAdapterIdentity, v as forkAgentMemoryBranchSnapshot, w as emitRetrievalHoldoutBypass, x as applyRetrievalHoldout, y as defaultGetMemoryContext } from "../memory-BxwOtvd7.js";
1
+ import { C as deterministicRng, D as toOffPolicyTrajectory, E as retrievalHoldoutConfigHash, S as applySessionStickyRetrievalHoldout, T as resetRetrievalHoldoutRegistry, _ as createAgentMemoryBranch, a as createNeo4jAgentMemoryAdapter, b as renderMemoryContext, c as runAgentMemoryImprovement, d as compareAgentMemoryLearning, f as runAgentMemoryLearningExperiment, g as buildAgentMemorySequencesFromBenchmarkCases, h as buildAgentMemorySequenceScenarios, i as AgentMemoryWriteInputSchema, l as createGraphitiMemoryAdapter, m as agentMemorySequenceJudge, n as AgentMemoryKindSchema, o as createMem0MemoryAdapter, p as runAgentMemoryExperiment, r as AgentMemoryScopeSchema, s as mem0MemoryAdapterIdentity, t as AgentMemoryHitSchema, u as graphitiMemoryAdapterIdentity, v as forkAgentMemoryBranchSnapshot, w as emitRetrievalHoldoutBypass, x as applyRetrievalHoldout, y as defaultGetMemoryContext } from "../memory-ce9n5O24.js";
2
2
  import { C as sleepForMemoryRecovery, S as runBoundedMemoryLifecycle, U as memoryHitToSourceRecord, W as memoryWriteResultToSourceRecord, b as memoryRecoveryDelayMs, f as acquireAgentMemoryRunLease, h as DEFAULT_MEMORY_CLEANUP_TIMEOUT_MS, m as AgentMemoryLifecycleUnsafeError, p as AgentMemoryLifecycleTimeoutError, x as resolveMemoryCleanupTimeoutMs, y as createMemoryExecutionPool } from "../benchmarks-BbPJdmHe.js";
3
3
  export { AgentMemoryHitSchema, AgentMemoryKindSchema, AgentMemoryLifecycleTimeoutError, AgentMemoryLifecycleUnsafeError, AgentMemoryScopeSchema, AgentMemoryWriteInputSchema, DEFAULT_MEMORY_CLEANUP_TIMEOUT_MS, acquireAgentMemoryRunLease, agentMemorySequenceJudge, applyRetrievalHoldout, applySessionStickyRetrievalHoldout, buildAgentMemorySequenceScenarios, buildAgentMemorySequencesFromBenchmarkCases, compareAgentMemoryLearning, createAgentMemoryBranch, createGraphitiMemoryAdapter, createMem0MemoryAdapter, createMemoryExecutionPool, createNeo4jAgentMemoryAdapter, defaultGetMemoryContext, deterministicRng, emitRetrievalHoldoutBypass, forkAgentMemoryBranchSnapshot, graphitiMemoryAdapterIdentity, mem0MemoryAdapterIdentity, memoryHitToSourceRecord, memoryRecoveryDelayMs, memoryWriteResultToSourceRecord, renderMemoryContext, resetRetrievalHoldoutRegistry, resolveMemoryCleanupTimeoutMs, retrievalHoldoutConfigHash, runAgentMemoryExperiment, runAgentMemoryImprovement, runAgentMemoryLearningExperiment, runBoundedMemoryLifecycle, sleepForMemoryRecovery, toOffPolicyTrajectory };
@@ -3626,22 +3626,27 @@ function decidePromotion(input) {
3626
3626
  cellIds: finalEvaluation.pairs.map((pair) => `${pair.sequenceId}:${pair.rep}`)
3627
3627
  }, options.significance);
3628
3628
  const tolerance = options.criticalDimensionTolerance ?? .05;
3629
- const criticalDimensions = (options.criticalDimensions ?? DEFAULT_CRITICAL_DIMENSIONS).map((dimension) => {
3629
+ const criticalChecks = (options.criticalDimensions ?? DEFAULT_CRITICAL_DIMENSIONS).map((dimension) => {
3630
3630
  const expectedN = applicableSequenceCount(options.finalSequences, dimension) * (options.reps ?? 1);
3631
- const comparison = heldoutSignificance(pairedDimension(finalEvaluation, dimension), {
3631
+ const pairs = pairedDimension(finalEvaluation, dimension);
3632
+ const comparison = heldoutSignificance(pairs, {
3632
3633
  ...options.significance,
3633
- deltaThreshold: 0
3634
+ deltaThreshold: -tolerance
3634
3635
  });
3636
+ const measured = expectedN > 0 && pairs.before.length === expectedN;
3635
3637
  return {
3636
- dimension,
3637
- n: comparison.n,
3638
- expectedN,
3639
- measured: expectedN > 0 && comparison.n === expectedN,
3640
- meanDelta: comparison.bootstrap.mean,
3641
- low: comparison.bootstrap.low,
3642
- high: comparison.bootstrap.high,
3643
- tolerance,
3644
- regressed: expectedN > 0 && comparison.n === expectedN && comparison.bootstrap.low < -tolerance
3638
+ decision: comparison.decision,
3639
+ report: {
3640
+ dimension,
3641
+ n: comparison.n,
3642
+ expectedN,
3643
+ measured,
3644
+ meanDelta: comparison.bootstrap.mean,
3645
+ low: comparison.decision.low,
3646
+ high: comparison.decision.high,
3647
+ tolerance,
3648
+ regressed: measured && !comparison.decision.indeterminate && comparison.decision.high < -tolerance
3649
+ }
3645
3650
  };
3646
3651
  });
3647
3652
  const reasons = [];
@@ -3650,10 +3655,13 @@ function decidePromotion(input) {
3650
3655
  const optimizerSource = input.optimization.comparison.best.provenance?.source;
3651
3656
  if (optimizerSource && optimizerSource.evidence !== "observed") reasons.push("external optimizer package identity was not observed");
3652
3657
  if (totalCost.totalCostUsd > (options.maxTotalCostUsd ?? 0)) reasons.push(`total cost ${totalCost.totalCostUsd} exceeds the configured limit ${options.maxTotalCostUsd ?? 0}`);
3653
- if (!significance.significant) reasons.push(significance.fewRuns ? `only ${significance.n} paired final cells; more are required` : "final lift is not confidently above the promotion threshold");
3658
+ if (!significance.significant) reasons.push(significance.fewRuns ? `only ${significance.n} paired final observations; at least ${significance.minimumRequired} are required` : "final lift is not confidently above the promotion threshold");
3654
3659
  if (winnerScore < (options.minFinalScore ?? 0)) reasons.push(`winner final score ${winnerScore} is below the required minimum`);
3655
- for (const dimension of criticalDimensions) if (!dimension.measured) reasons.push(dimension.expectedN === 0 ? `critical dimension ${dimension.dimension} has no applicable final histories` : `critical dimension ${dimension.dimension} was measured on ${dimension.n}/${dimension.expectedN} applicable paired final cells`);
3656
- else if (dimension.regressed) reasons.push(`${dimension.dimension} may regress beyond ${tolerance}`);
3660
+ for (const { report: dimension, decision } of criticalChecks) if (!dimension.measured) reasons.push(dimension.expectedN === 0 ? `critical dimension ${dimension.dimension} has no applicable final histories` : `critical dimension ${dimension.dimension} was measured on ${dimension.n}/${dimension.expectedN} applicable paired final cells`);
3661
+ else if (!decision.sufficient) reasons.push(`critical dimension ${dimension.dimension} needs at least ${decision.minimumPairs} paired final observations; measured ${decision.n}`);
3662
+ else if (decision.indeterminate) reasons.push(`critical dimension ${dimension.dimension} has an indeterminate final interval`);
3663
+ else if (dimension.regressed) reasons.push(`critical dimension ${dimension.dimension} regresses beyond ${tolerance}`);
3664
+ else if (!decision.promote) reasons.push(`critical dimension ${dimension.dimension} does not exclude a regression beyond ${tolerance}`);
3657
3665
  return {
3658
3666
  status: reasons.length === 0 ? "promote" : "hold",
3659
3667
  reasons,
@@ -3661,7 +3669,7 @@ function decidePromotion(input) {
3661
3669
  winnerScore,
3662
3670
  lift: winnerScore - baselineScore,
3663
3671
  significance,
3664
- criticalDimensions
3672
+ criticalDimensions: criticalChecks.map((check) => check.report)
3665
3673
  };
3666
3674
  }
3667
3675
  function normalizedPromotionPolicy(options) {
@@ -3672,7 +3680,8 @@ function normalizedPromotionPolicy(options) {
3672
3680
  confidence: options.significance?.confidence ?? .95,
3673
3681
  resamples: options.significance?.resamples ?? 2e3,
3674
3682
  seed: options.significance?.seed ?? 1337,
3675
- statistic: options.significance?.statistic ?? "mean"
3683
+ statistic: options.significance?.statistic ?? "mean",
3684
+ ...options.significance?.independentUnitByScenarioId === void 0 ? {} : { independentUnitByScenarioId: [...options.significance.independentUnitByScenarioId].sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0) }
3676
3685
  },
3677
3686
  criticalDimensions: [...options.criticalDimensions ?? DEFAULT_CRITICAL_DIMENSIONS],
3678
3687
  criticalDimensionTolerance: options.criticalDimensionTolerance ?? .05,
@@ -4214,6 +4223,13 @@ function assertIndependentSequences(train, selection, final) {
4214
4223
  //#region src/memory/improvement/run.ts
4215
4224
  /** Optimizes memory configuration with an external method and activates only a fresh final win. */
4216
4225
  async function runAgentMemoryImprovement(options) {
4226
+ if (options.significance !== void 0) options = {
4227
+ ...options,
4228
+ significance: {
4229
+ ...options.significance,
4230
+ ...options.significance.independentUnitByScenarioId === void 0 ? {} : { independentUnitByScenarioId: new Map(options.significance.independentUnitByScenarioId) }
4231
+ }
4232
+ };
4217
4233
  assertMemoryImprovementOptions(options);
4218
4234
  const storage = options.storage ?? fsCampaignStorage();
4219
4235
  const runDir = resolveRunDir(options.runDir, options.repo);
@@ -5382,4 +5398,4 @@ const AgentMemoryWriteInputSchema = z.object({
5382
5398
  //#endregion
5383
5399
  export { runSerializedKnowledgeOptimization as A, deterministicRng as C, toOffPolicyTrajectory as D, retrievalHoldoutConfigHash as E, assertImmutableRef as M, jsonCandidateCodec as O, applySessionStickyRetrievalHoldout as S, resetRetrievalHoldoutRegistry as T, createAgentMemoryBranch as _, createNeo4jAgentMemoryAdapter as a, renderMemoryContext as b, runAgentMemoryImprovement as c, compareAgentMemoryLearning as d, runAgentMemoryLearningExperiment as f, buildAgentMemorySequencesFromBenchmarkCases as g, buildAgentMemorySequenceScenarios as h, AgentMemoryWriteInputSchema as i, scenarioContentFingerprint as j, jsonObjectCandidateCodec as k, createGraphitiMemoryAdapter as l, agentMemorySequenceJudge as m, AgentMemoryKindSchema as n, createMem0MemoryAdapter as o, runAgentMemoryExperiment as p, AgentMemoryScopeSchema as r, mem0MemoryAdapterIdentity as s, AgentMemoryHitSchema as t, graphitiMemoryAdapterIdentity as u, forkAgentMemoryBranchSnapshot as v, emitRetrievalHoldoutBypass as w, applyRetrievalHoldout as x, defaultGetMemoryContext as y };
5384
5400
 
5385
- //# sourceMappingURL=memory-BxwOtvd7.js.map
5401
+ //# sourceMappingURL=memory-ce9n5O24.js.map