hunter-harness 0.2.20 → 0.2.22

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.
Files changed (2) hide show
  1. package/dist/bin.js +25 -17
  2. package/package.json +1 -1
package/dist/bin.js CHANGED
@@ -1233,7 +1233,7 @@ async function assertNoSymlinks(root, relativePath) {
1233
1233
  async function withRetry(action, options) {
1234
1234
  const attempts = options.attempts ?? 3;
1235
1235
  const sleep = options.sleep ?? (async (milliseconds) => {
1236
- await new Promise((resolve8) => setTimeout(resolve8, milliseconds));
1236
+ await new Promise((resolve9) => setTimeout(resolve9, milliseconds));
1237
1237
  });
1238
1238
  let lastError;
1239
1239
  for (let attempt = 1; attempt <= attempts; attempt += 1) {
@@ -1732,7 +1732,7 @@ function decideUpdate(policy, dirty) {
1732
1732
  // ../core/dist/project/initialize.js
1733
1733
  import { createHash as createHash4 } from "node:crypto";
1734
1734
  import { readFile as readFile4, stat as stat2, writeFile as writeFile3 } from "node:fs/promises";
1735
- import { basename, join as join5, resolve as resolve3 } from "node:path";
1735
+ import { basename, join as join5, resolve as resolve4 } from "node:path";
1736
1736
  import { parse as parseYaml2, stringify as stringifyYaml } from "yaml";
1737
1737
 
1738
1738
  // ../core/dist/transaction/transaction.js
@@ -2250,7 +2250,7 @@ function managedTargetsFor(adapter, bundle, context) {
2250
2250
  // ../core/dist/project/profile-bundle.js
2251
2251
  import { createHash as createHash3 } from "node:crypto";
2252
2252
  import { readFile as readFile3, readdir as readdir2 } from "node:fs/promises";
2253
- import { join as join4 } from "node:path";
2253
+ import { join as join4, resolve as resolve3 } from "node:path";
2254
2254
  var AdapterBundleError = class extends Error {
2255
2255
  code;
2256
2256
  exitCode = 7;
@@ -2274,7 +2274,13 @@ function validateRelativeBundlePath2(path) {
2274
2274
  throw new Error("invalid Harness Bundle path");
2275
2275
  }
2276
2276
  }
2277
+ var bundleCache = /* @__PURE__ */ new Map();
2277
2278
  async function loadAgentBundle(resourcesRoot, profile, agent) {
2279
+ const cacheKey = `${resolve3(resourcesRoot)}:${profile}:${agent}`;
2280
+ const cached = bundleCache.get(cacheKey);
2281
+ if (cached) {
2282
+ return { manifest: cached.manifest, files: new Map(cached.files) };
2283
+ }
2278
2284
  const manifestPath = join4(resourcesRoot, "harness", "manifests", profile, `${agent}.json`);
2279
2285
  let manifestText;
2280
2286
  try {
@@ -2318,7 +2324,9 @@ async function loadAgentBundle(resourcesRoot, profile, agent) {
2318
2324
  }
2319
2325
  files.set(item2.path, bytes);
2320
2326
  }
2321
- return { manifest: raw, files };
2327
+ const result = { manifest: raw, files };
2328
+ bundleCache.set(cacheKey, result);
2329
+ return { manifest: result.manifest, files: new Map(result.files) };
2322
2330
  }
2323
2331
  async function managedBundleTargets(resourcesRoot, profile, agent = "claude-code") {
2324
2332
  const bundle = await loadAgentBundle(resourcesRoot, profile, agent);
@@ -2533,7 +2541,7 @@ function mergeOwnedTargets(owned) {
2533
2541
  });
2534
2542
  }
2535
2543
  async function initializeProject(options) {
2536
- const root = resolve3(options.projectRoot);
2544
+ const root = resolve4(options.projectRoot);
2537
2545
  const config = initConfigSchema.parse(options.config);
2538
2546
  const existing = await existingProjectConfig(root);
2539
2547
  const profile = config.profile;
@@ -2741,7 +2749,7 @@ async function enrichContextIndexWithVerification(root, agents, profile, resourc
2741
2749
  // ../core/dist/project/refresh.js
2742
2750
  import { createHash as createHash5 } from "node:crypto";
2743
2751
  import { readFile as readFile5, readdir as readdir3, rmdir } from "node:fs/promises";
2744
- import { dirname as dirname3, join as join6, resolve as resolve4 } from "node:path";
2752
+ import { dirname as dirname3, join as join6, resolve as resolve5 } from "node:path";
2745
2753
  import { parse as parseYaml3, stringify as stringifyYaml2 } from "yaml";
2746
2754
  var INSTALLED_STATE_PATH = ".harness/state/local/installed-harness-bundle.json";
2747
2755
  var CONTEXT_INDEX_PATH2 = ".harness/context-index.json";
@@ -2836,7 +2844,7 @@ async function readInstalledState(root) {
2836
2844
  };
2837
2845
  }
2838
2846
  async function readInstalledAgentConfiguration(projectRoot) {
2839
- const installed = await readInstalledState(resolve4(projectRoot));
2847
+ const installed = await readInstalledState(resolve5(projectRoot));
2840
2848
  return {
2841
2849
  agents: installed.adapters,
2842
2850
  profiles: Object.fromEntries(installed.adapters.map((agent) => [
@@ -3029,7 +3037,7 @@ function stateWithoutInstalledAt(value) {
3029
3037
  return copy;
3030
3038
  }
3031
3039
  async function refreshProject(options) {
3032
- const root = resolve4(options.projectRoot);
3040
+ const root = resolve5(options.projectRoot);
3033
3041
  const installed = await readInstalledState(root);
3034
3042
  const oldAgents = installed.adapters.length > 0 ? installed.adapters : ["claude-code"];
3035
3043
  const selectedAgents = sortHarnessAgents(options.agents);
@@ -3299,7 +3307,7 @@ function buildMarkerCoreHash(text) {
3299
3307
  }
3300
3308
  }
3301
3309
  async function collectFreshness(options) {
3302
- const root = resolve4(options.projectRoot);
3310
+ const root = resolve5(options.projectRoot);
3303
3311
  const installed = await readInstalledState(root);
3304
3312
  const codebuddySurface2 = options.codebuddySurface ?? "both";
3305
3313
  const agents = [];
@@ -3882,7 +3890,7 @@ function resolvePushAuth(input) {
3882
3890
 
3883
3891
  // ../core/dist/push/push.js
3884
3892
  import { lstat as lstat3, readFile as readFile10, readdir as readdir4, rm as rm5 } from "node:fs/promises";
3885
- import { join as join11, relative, resolve as resolve6 } from "node:path";
3893
+ import { join as join11, relative, resolve as resolve7 } from "node:path";
3886
3894
  import { parse as parseYaml5, stringify as stringifyYaml4 } from "yaml";
3887
3895
 
3888
3896
  // ../core/dist/state/baseline.js
@@ -3945,7 +3953,7 @@ async function acquireProtocolLock(projectRoot, operation, options = {}) {
3945
3953
 
3946
3954
  // ../core/dist/sync/synchronize.js
3947
3955
  import { lstat as lstat2, readFile as readFile9, rm as rm4 } from "node:fs/promises";
3948
- import { join as join10, resolve as resolve5 } from "node:path";
3956
+ import { join as join10, resolve as resolve6 } from "node:path";
3949
3957
 
3950
3958
  // ../core/dist/update/conflicts.js
3951
3959
  function operationTargetPath(operation) {
@@ -4359,7 +4367,7 @@ async function saveConflictReport(root, requestId, manifest, plan) {
4359
4367
  });
4360
4368
  }
4361
4369
  async function synchronizeArtifacts(options, initialBaseline) {
4362
- const root = resolve5(options.projectRoot);
4370
+ const root = resolve6(options.projectRoot);
4363
4371
  const projectId = options.project.project.project_id;
4364
4372
  if (projectId === null) {
4365
4373
  throw new Error("PROJECT_NOT_BOUND");
@@ -4536,7 +4544,7 @@ function baselineEntryFromOperation(manifest, operation, localContent) {
4536
4544
  };
4537
4545
  }
4538
4546
  async function advanceBaselineFromArtifact(options, baseline) {
4539
- const root = resolve5(options.projectRoot);
4547
+ const root = resolve6(options.projectRoot);
4540
4548
  if (options.manifest.project_version === null) {
4541
4549
  throw new Error("artifact manifest missing project_version");
4542
4550
  }
@@ -4698,7 +4706,7 @@ async function walkHarnessEntries(root, directory, output) {
4698
4706
  }
4699
4707
  }
4700
4708
  async function managedFiles(projectRoot, project) {
4701
- const root = resolve6(projectRoot);
4709
+ const root = resolve7(projectRoot);
4702
4710
  const paths = [];
4703
4711
  const adapters = getAdapters(enabledHarnessAgents(project));
4704
4712
  const managedFiles2 = [
@@ -4950,7 +4958,7 @@ async function bindProject(root, project, baseline, projectId) {
4950
4958
  return { project: nextProject, baseline: nextBaseline };
4951
4959
  }
4952
4960
  async function pushProject(options) {
4953
- const root = resolve6(options.projectRoot);
4961
+ const root = resolve7(options.projectRoot);
4954
4962
  let project = await readProject(root);
4955
4963
  let baseline = await readBaseline(root);
4956
4964
  const profile = parseHarnessProfile(project.project.profiles[0]);
@@ -5449,7 +5457,7 @@ async function cleanupOldTransactions(projectRoot, now = /* @__PURE__ */ new Dat
5449
5457
 
5450
5458
  // ../core/dist/update/update.js
5451
5459
  import { readFile as readFile13 } from "node:fs/promises";
5452
- import { join as join14, resolve as resolve7 } from "node:path";
5460
+ import { join as join14, resolve as resolve8 } from "node:path";
5453
5461
  import { parse as parseYaml8 } from "yaml";
5454
5462
  var UpdateWorkflowError = class extends Error {
5455
5463
  exitCode;
@@ -5462,7 +5470,7 @@ var UpdateWorkflowError = class extends Error {
5462
5470
  }
5463
5471
  };
5464
5472
  async function updateProject(options) {
5465
- const root = resolve7(options.projectRoot);
5473
+ const root = resolve8(options.projectRoot);
5466
5474
  let project;
5467
5475
  try {
5468
5476
  project = projectConfigSchema.parse(parseYaml8(await readFile13(join14(root, ".harness", "project.yaml"), "utf8")));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hunter-harness",
3
- "version": "0.2.20",
3
+ "version": "0.2.22",
4
4
  "description": "Local-first, server-governed agent harness",
5
5
  "license": "MIT",
6
6
  "type": "module",