@tangle-network/agent-runtime 0.169.0 → 0.170.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.
@@ -11,6 +11,7 @@ import { CostLedger, canonicalJson, makeProposalFinding } from "@tangle-network/
11
11
  import { campaignScenarioIdentity, campaignSplitDigestFromIdentities, compareOptimizationMethods, decodeExternalTextCandidate, gitWorktreeAdapter, readExternalOptimizerObservationArtifact, readGepaCandidatePopulationArtifact, verifyCodeSurface } from "@tangle-network/agent-eval/campaign";
12
12
  import { createHash, randomUUID } from "node:crypto";
13
13
  import { basename, join, resolve } from "node:path";
14
+ import { realpath } from "node:fs/promises";
14
15
  import { existsSync, readFileSync, readdirSync } from "node:fs";
15
16
  import { spawnSync } from "node:child_process";
16
17
  import { isDeepStrictEqual } from "node:util";
@@ -1246,14 +1247,34 @@ function defaultDistillerFor(opts, findings) {
1246
1247
  async function discardPreparedBaseline(worktree, baselineWorktree, cause) {
1247
1248
  return rethrowAfterCleanup(cause, () => worktree.discard(baselineWorktree), "improve(): code preparation failed");
1248
1249
  }
1250
+ /**
1251
+ * The real path of a repository root, for the one comparison that needs it.
1252
+ *
1253
+ * Git prints a RESOLVED worktree path, and the Eval worktree adapter compares what git
1254
+ * printed against the root it was handed. A root whose PREFIX is a symlink therefore never
1255
+ * matches: on macOS the OS hands out temp roots under /var, a symlink to /private/var, so the
1256
+ * adapter refuses to finalize or discard a worktree it created seconds earlier. Resolve once
1257
+ * here, where the caller's root meets git, instead of at every caller.
1258
+ *
1259
+ * A directory that does not exist yet — `worktreeDir` is created on demand — keeps its
1260
+ * lexical form; the adapter creates it under a root that is already resolved.
1261
+ */
1262
+ async function realRoot(path) {
1263
+ try {
1264
+ return await realpath(path);
1265
+ } catch (err) {
1266
+ if (err.code !== "ENOENT") throw err;
1267
+ return resolve(path);
1268
+ }
1269
+ }
1249
1270
  /** Create a clean incumbent checkout and the candidate producer for a code run. */
1250
1271
  async function prepareCodeRun(code) {
1251
1272
  const authorProfile = agentProfileSchema.parse(code.profile);
1252
1273
  assertExecutableAgentProfile(authorProfile, "improve(code) author");
1253
1274
  const baseRef = code.baseRef ?? "main";
1254
1275
  const worktree = code.worktree ?? gitWorktreeAdapter({
1255
- repoRoot: code.repoRoot,
1256
- ...code.worktreeDir ? { worktreeDir: code.worktreeDir } : {}
1276
+ repoRoot: await realRoot(code.repoRoot),
1277
+ ...code.worktreeDir ? { worktreeDir: await realRoot(code.worktreeDir) } : {}
1257
1278
  });
1258
1279
  const baselineWorktree = await worktree.create({
1259
1280
  baseRef,
@@ -3037,4 +3058,4 @@ function sameOrderedValues(left, right) {
3037
3058
  //#endregion
3038
3059
  export { agentImprovementTargetInput as A, ROLLOUT_POLICY_EXTENSION as B, optimizationActivationReceiptFromMetadata as C, agentImprovementProfileSurfaceDigest as D, agentImprovementProfileDiffs as E, isAgentImprovementProfileSurface as F, structuralRolloutPolicyFromProfile as G, normalizeRolloutPolicy as H, isAgentProfileMeasuredSurface as I, defaultBuildPrompt as J, agenticGenerator as K, improve as L, agentProfileImprovementStateDigest as M, assertProfileImprovementTargetsShareIdentity as N, agentImprovementProfileSurfaceInput as O, buildAgentImprovementActivationTargets as P, withMethodRuntimeControls as R, createOptimizationActivationReceipt as S, AGENT_PROFILE_MEASURED_SURFACES as T, parseRolloutPolicy as U, applyRolloutPolicyToProfile as V, serializeRolloutPolicy as W, profilePolicyWithBudget as _, executeAgentCandidateExperimentCell as a, profileTaskScenarioIdentity as b, requireSealedCandidateExperiment as c, verifyAgentImprovementActivation as d, verifyAgentImprovementProposal as f, profileImprovementMetadata as g, createProfileImprovementCostLedger as h, createAgentImprovementProposal as i, agentImprovementTargetProfileDiffs as j, agentImprovementTargetDigest as k, reviewAgentImprovementProposal as l, verifyCandidateExecutionEvidence as m, createAgentImprovementActivation as n, proposeAgentImprovement as o, verifyAgentImprovementReview as p, commandVerifier as q, createAgentImprovementMeasuredComparison as r, proposeAgentProfileImprovement as s, AgentCandidateExperimentCellExecutionError as t, runAgentCandidateExperiment as u, profilePreparationAccounting as v, AGENT_IMPROVEMENT_PROFILE_SURFACES as w, sealProfileImprovementBenchmark as x, profileStateDigest as y, rawTraceDistiller as z };
3039
3060
 
3040
- //# sourceMappingURL=improvement-cycle-BAKN_f4x.js.map
3061
+ //# sourceMappingURL=improvement-cycle-BYCnKZ_G.js.map