@tangle-network/agent-runtime 0.200.0 → 0.201.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,8 +1,8 @@
1
1
  import { at as RuntimeStreamEvent, b as LoopTraceEvent } from "./types-Q0PMagdm.js";
2
2
  import { d as RunAnalystLoopOpts, f as RunAnalystLoopResult } from "./types-zWfqDjeL.js";
3
3
  import { $n as defaultRedactor, Cn as ToolSpec, Ji as RuntimeTelemetryOptions, Qn as Redactor, at as AgentEnvironmentProviderRef, er as resolveRedactor, ot as AgentEnvironmentProviderRegistry } from "./stream-agent-turn-CJWthifS.js";
4
- import { D as AgentCandidateRunFinalization, O as AgentCandidateTaskExecution, a as AgentCandidateExecutionPorts, c as AgentCandidateExecutorPort, r as AgentCandidateBenchmarkGraderPort, y as AgentCandidateOutputArtifactPort } from "./types-1s_29INY.js";
5
- import { T as AgentCandidateExecutionClaimStore, _ as PrepareAgentCandidateExecutionOptions, o as CreateProtectedAgentCandidateModelPortOptions, p as parseAgentCandidateProfileActivation, y as ExecutePreparedAgentCandidateOptions } from "./protected-model-port-BtXp2dUY.js";
4
+ import { D as AgentCandidateRunFinalization, O as AgentCandidateTaskExecution, a as AgentCandidateExecutionPorts, c as AgentCandidateExecutorPort, r as AgentCandidateBenchmarkGraderPort, y as AgentCandidateOutputArtifactPort } from "./types-CuXu5zuS.js";
5
+ import { T as AgentCandidateExecutionClaimStore, _ as PrepareAgentCandidateExecutionOptions, o as CreateProtectedAgentCandidateModelPortOptions, p as parseAgentCandidateProfileActivation, y as ExecutePreparedAgentCandidateOptions } from "./protected-model-port-BlLP8ja6.js";
6
6
  import { A as ImproveMethodResult, L as ImproveResult, N as ImproveOptions, a as AgentImprovementActivationTransitionInput, c as CreateAgentImprovementActivationResultOptions, d as ProfileImprovementActivationTransitionInput, f as SealedCandidateActivationTransitionInput, h as verifyAgentImprovementActivationResult, i as AgentImprovementActivationTransition, k as ImproveMethodOptions, l as ExecuteAgentImprovementActivationInput, m as executeAgentImprovementActivation, n as AgentImprovementActivationResultStore, o as AgentProfileImprovementActivationOperation, p as createAgentImprovementActivationResult, r as AgentImprovementActivationTargetPlan, s as AgentProfileImprovementActivationTargetPlan, t as AgentImprovementActivationReconciliation, u as ExecuteAgentImprovementActivationOptions, z as ImproveScenarioPartitions } from "./activation-BPxs-Iu2.js";
7
7
  import { AgentCandidateBenchmarkCellRef, AgentCandidateBundle, AgentCandidateEvaluationPolicy, AgentCandidateExperiment, AgentCandidateExperimentMaterial, AgentCandidateExperimentMeasurement, AgentCandidateLineage, AgentCandidateProfileActivation as CandidateProfileMaterialization, AgentImprovementActivation, AgentImprovementActivation as AgentImprovementActivation$1, AgentImprovementActivationIntent, AgentImprovementActivationIntent as AgentImprovementActivationIntent$1, AgentImprovementActivationOutcome, AgentImprovementActivationResult, AgentImprovementActivationTarget, AgentImprovementActivationTargetState, AgentImprovementActivationTargetTransition, AgentImprovementEvaluation, AgentImprovementEvaluation as AgentImprovementEvaluation$1, AgentImprovementMeasuredComparison, AgentImprovementMeasuredComparison as AgentImprovementMeasuredComparison$1, AgentImprovementProposal, AgentImprovementProposal as AgentImprovementProposal$1, AgentImprovementReview, AgentImprovementReview as AgentImprovementReview$1, AgentImprovementReviewDecision, AgentImprovementReviewDecision as AgentImprovementReviewDecision$1, AgentImprovementSource, AgentImprovementSurface, AgentProfile, AgentProfileDiff, AgentProfileImprovementChange, AgentProfileImprovementExecutionRef, AgentProfileImprovementExperiment, AgentProfileImprovementMeasuredComparison, AgentProfileImprovementMeasurement, AgentProfileImprovementRunReceipt, AgentProfileImprovementTaskMaterial, AgentProfileMcpServer, CandidateExecutionEvidence, CandidateExecutionEvidence as CandidateExecutionEvidence$1, Sha256Digest } from "@tangle-network/agent-interface";
8
8
  import { CostLedgerHandle, TraceStore } from "@tangle-network/agent-eval";
@@ -1,9 +1,9 @@
1
1
  import { $n as buildRuntimeEventOtelSpans, Zn as buildLoopOtelSpans, _n as resolveAgentEnvironmentProvider, r as resolveRedactor, rr as flatOtelSpan, t as defaultRedactor, tr as createOtelExporter } from "./redact-h-oaw11Q.js";
2
- import { C as optimizationActivationReceiptFromMetadata, D as agentImprovementProfileSurfaceDigest, E as agentImprovementProfileDiffs, F as isAgentImprovementProfileSurface, I as isAgentProfileMeasuredSurface, N as assertProfileImprovementTargetsShareIdentity, O as agentImprovementProfileSurfaceInput, P as buildAgentImprovementActivationTargets, S as createOptimizationActivationReceipt, T as AGENT_PROFILE_MEASURED_SURFACES, _ as profilePolicyWithBudget, a as executeAgentCandidateExperimentCell, b as profileTaskScenarioIdentity, d as verifyAgentImprovementActivation, f as verifyAgentImprovementProposal, g as profileImprovementMetadata, h as createProfileImprovementCostLedger, i as createAgentImprovementProposal, j as agentImprovementTargetProfileDiffs, l as reviewAgentImprovementProposal, m as verifyCandidateExecutionEvidence, n as createAgentImprovementActivation, o as proposeAgentImprovement, p as verifyAgentImprovementReview, r as createAgentImprovementMeasuredComparison, s as proposeAgentProfileImprovement, t as AgentCandidateExperimentCellExecutionError, u as runAgentCandidateExperiment, v as profilePreparationAccounting, w as AGENT_IMPROVEMENT_PROFILE_SURFACES, x as sealProfileImprovementBenchmark, y as profileStateDigest$1 } from "./improvement-cycle-yia1ST3c.js";
2
+ import { C as optimizationActivationReceiptFromMetadata, D as agentImprovementProfileSurfaceDigest, E as agentImprovementProfileDiffs, F as isAgentImprovementProfileSurface, I as isAgentProfileMeasuredSurface, N as assertProfileImprovementTargetsShareIdentity, O as agentImprovementProfileSurfaceInput, P as buildAgentImprovementActivationTargets, S as createOptimizationActivationReceipt, T as AGENT_PROFILE_MEASURED_SURFACES, _ as profilePolicyWithBudget, a as executeAgentCandidateExperimentCell, b as profileTaskScenarioIdentity, d as verifyAgentImprovementActivation, f as verifyAgentImprovementProposal, g as profileImprovementMetadata, h as createProfileImprovementCostLedger, i as createAgentImprovementProposal, j as agentImprovementTargetProfileDiffs, l as reviewAgentImprovementProposal, m as verifyCandidateExecutionEvidence, n as createAgentImprovementActivation, o as proposeAgentImprovement, p as verifyAgentImprovementReview, r as createAgentImprovementMeasuredComparison, s as proposeAgentProfileImprovement, t as AgentCandidateExperimentCellExecutionError, u as runAgentCandidateExperiment, v as profilePreparationAccounting, w as AGENT_IMPROVEMENT_PROFILE_SURFACES, x as sealProfileImprovementBenchmark, y as profileStateDigest$1 } from "./improvement-cycle-VH_ZGcIj.js";
3
3
  import { o as canonicalCandidateDigest$1, u as immutableCandidateValue } from "./protected-redaction-wGo44k2K.js";
4
- import { A as omitUndefinedObjectFields, M as parseExactAgentProfile, a as AGENT_CANDIDATE_EXECUTION_SUPPORT, j as parseAgentCandidateProfileActivation, w as applyExactAgentProfileDiff } from "./prepare-CAO1yXov.js";
5
- import { n as executeAgentImprovementActivation, r as verifyAgentImprovementActivationResult, t as createAgentImprovementActivationResult } from "./activation-Ct-BTTzF.js";
6
- import { n as exactProcessProviderAsCandidateExecutor, t as createProtectedAgentCandidateModelPort } from "./protected-model-port-B5avcRiQ.js";
4
+ import { A as omitUndefinedObjectFields, M as parseExactAgentProfile, a as AGENT_CANDIDATE_EXECUTION_SUPPORT, j as parseAgentCandidateProfileActivation, w as applyExactAgentProfileDiff } from "./prepare-Dc30WRB0.js";
5
+ import { n as executeAgentImprovementActivation, r as verifyAgentImprovementActivationResult, t as createAgentImprovementActivationResult } from "./activation-C_FN2aqK.js";
6
+ import { n as exactProcessProviderAsCandidateExecutor, t as createProtectedAgentCandidateModelPort } from "./protected-model-port-D5gDcnrH.js";
7
7
  import { agentImprovementSourceSchema, agentProfileImprovementArmSchema, applyAgentProfileDiff } from "@tangle-network/agent-interface";
8
8
  import { contentHash } from "@tangle-network/agent-eval";
9
9
  import { assertProposalFindings } from "@tangle-network/agent-eval/analyst";
@@ -2066,6 +2066,7 @@ function detachPreparedCandidateState(input) {
2066
2066
  ...input.memoryReservation ? { memoryReservation: immutableCandidateValue(input.memoryReservation) } : {},
2067
2067
  ...input.knowledge ? { knowledge: Object.freeze({
2068
2068
  candidate: immutableCandidateValue(input.knowledge.candidate),
2069
+ ...input.knowledge.stateScope ? { stateScope: immutableCandidateValue(input.knowledge.stateScope) } : {},
2069
2070
  snapshot: immutableCandidateValue(input.knowledge.snapshot),
2070
2071
  files: immutableExecutorFiles(input.knowledge.files),
2071
2072
  ...input.knowledge.retrievalConfig ? { retrievalConfig: Uint8Array.from(input.knowledge.retrievalConfig) } : {}
@@ -2134,6 +2135,7 @@ function knowledgeView(knowledge) {
2134
2135
  const retrievalConfig = knowledge.retrievalConfig ? Uint8Array.from(knowledge.retrievalConfig) : void 0;
2135
2136
  return Object.freeze({
2136
2137
  candidate: knowledge.candidate,
2138
+ ...knowledge.stateScope ? { stateScope: immutableCandidateValue(knowledge.stateScope) } : {},
2137
2139
  snapshot: knowledge.snapshot,
2138
2140
  files: Object.freeze(knowledge.files.map((file) => profileFileView(file))),
2139
2141
  ...retrievalConfig ? { get retrievalConfig() {
@@ -2190,7 +2192,7 @@ function assertPreparedKnowledge(state) {
2190
2192
  if (expected || actual) throw new Error("prepared knowledge does not match the candidate bundle");
2191
2193
  return;
2192
2194
  }
2193
- if (canonicalCandidateDigest$1(actual.candidate) !== canonicalCandidateDigest$1(expected.candidate) || canonicalCandidateDigest$1(actual.snapshot) !== canonicalCandidateDigest$1(expected.snapshot) || state.executionPlan.value.material.knowledgeManifestDigest !== expected.snapshot.digest) throw new Error("prepared knowledge identity does not match the candidate bundle");
2195
+ if (canonicalCandidateDigest$1(actual.candidate) !== canonicalCandidateDigest$1(expected.candidate) || canonicalCandidateDigest$1(actual.stateScope ?? null) !== canonicalCandidateDigest$1(expected.stateScope ?? null) || canonicalCandidateDigest$1(actual.snapshot) !== canonicalCandidateDigest$1(expected.snapshot) || state.executionPlan.value.material.knowledgeManifestDigest !== expected.snapshot.digest) throw new Error("prepared knowledge identity does not match the candidate bundle");
2194
2196
  assertWorkspaceExecutorFiles(actual.files, expected.snapshot.material);
2195
2197
  if (!expected.retrievalConfig || !actual.retrievalConfig) {
2196
2198
  if (expected.retrievalConfig || actual.retrievalConfig) throw new Error("prepared knowledge retrieval config does not match the candidate bundle");
@@ -3984,11 +3986,12 @@ async function prepareAgentCandidateKnowledge(candidate, ports, arm) {
3984
3986
  destination: root
3985
3987
  });
3986
3988
  const expectedHash = arm === "baseline" ? knowledge.candidate.baseHash : knowledge.candidate.candidateHash;
3987
- const actualHash = `sha256:${await hashKnowledgeBase(root)}`;
3989
+ const actualHash = `sha256:${await hashKnowledgeBase(root, knowledge.stateScope)}`;
3988
3990
  if (actualHash !== expectedHash) throw new Error(`materialized ${arm} knowledge does not match its measured content: expected ${expectedHash}, got ${actualHash}`);
3989
3991
  const files = await readMaterializedWorkspaceFiles(root, knowledge.snapshot.material);
3990
3992
  return Object.freeze({
3991
3993
  candidate: knowledge.candidate,
3994
+ ...knowledge.stateScope ? { stateScope: Object.freeze({ ...knowledge.stateScope }) } : {},
3992
3995
  snapshot: knowledge.snapshot,
3993
3996
  files: Object.freeze(files.map((file) => Object.freeze({
3994
3997
  path: file.path,
@@ -4604,4 +4607,4 @@ function errorMessage(error) {
4604
4607
  //#endregion
4605
4608
  export { assertTerminalMatchesStaged as $, omitUndefinedObjectFields as A, captureMaterializedWorkspace as B, agentCandidateProfileAsAgentProfile as C, createAgentCandidateProfileActivation as D, candidateProfileAgentPaths as E, assertNoGitIndirection as F, InMemoryAgentCandidateExecutionClaimStore as G, scanMaterializedWorkspaceManifest as H, readCandidateGitTreeFiles as I, candidateCleanupTimeout as J, candidateClaimFileInternals as K, runCandidateGit as L, parseExactAgentProfile as M, parseExactAgentProfileDiff as N, freezeGenericAgentCandidateProfile as O, parseExactCandidateProfile as P, assertTerminalMatchesClaim as Q, assertAgentCandidateExecutionRoots as R, PI_CANDIDATE_SESSION_DIR_ENV as S, assertCandidateProfileBinding as T, verifyBytes as U, readVerifiedArtifact as V, verifyMaterializedWorkspace as W, assertRecoveryMatchesStaged as X, withinCandidateCleanupDeadline as Y, assertTerminalAllowedInPhase as Z, beginPreparedCandidateDisposal as _, AGENT_CANDIDATE_EXECUTION_SUPPORT as a, terminalRecord as at, CANDIDATE_TRACE_TAGS as b, executePreparedAgentCandidate as c, persistCandidateOutputArtifact as d, recoveredTerminalRecord as et, sealAgentCandidateModelSettlement as f, assertPreparedCandidateIntegrity as g, candidateExecutionClaim as h, candidateKnowledgeExecutionPaths as i, sealTerminalDigest as it, parseAgentCandidateProfileActivation as j, materializeAgentCandidateProfilePlan as k, RecoveryAgentCandidateTraceStore as l, sealAgentCandidateExecutorStopAcknowledgement as m, CANDIDATE_KNOWLEDGE_RETRIEVAL_CONFIG_ENV as n, rejectedStage as nt, verifiedResourceTextByDigest as o, assertExactObjectKeys as ot, usdToNanos as p, candidateCleanupDeadline as q, CANDIDATE_KNOWLEDGE_ROOT_ENV as r, requireStagedTerminal as rt, verifyAgentCandidateBundle as s, isWellFormedUnicode as st, prepareAgentCandidateExecution as t, rejectedFinish as tt, persistCandidateModelSettlementEvidence as u, consumePreparedCandidateExecution as v, applyExactAgentProfileDiff as w, PI_CANDIDATE_AGENT_DIR_ENV as x, CANDIDATE_TRACE_ENV as y, candidateWorkspaceManifest as z };
4606
4609
 
4607
- //# sourceMappingURL=prepare-CAO1yXov.js.map
4610
+ //# sourceMappingURL=prepare-Dc30WRB0.js.map