agentwheel 0.22.2 → 0.22.3

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/dist/index.js CHANGED
@@ -18513,7 +18513,7 @@ var init_fleet = __esm({
18513
18513
  // src/mutation/repository.ts
18514
18514
  import { createHash as createHash8 } from "crypto";
18515
18515
  import { lstat as lstat3, readFile as readFile12, readlink, readdir as readdir5 } from "fs/promises";
18516
- import { posix as posix4, relative as relative7, resolve as resolve15, sep as sep5 } from "path";
18516
+ import { dirname as dirname10, posix as posix4, relative as relative7, resolve as resolve15, sep as sep5 } from "path";
18517
18517
  async function discoverGitRepository(start) {
18518
18518
  const probe = await runProcess("git", ["-C", start, "rev-parse", "--show-toplevel"], { allowExitCodes: [0, 128] });
18519
18519
  if (probe.exitCode !== 0) return void 0;
@@ -18540,6 +18540,9 @@ async function assertGitPreflight(repository) {
18540
18540
  }
18541
18541
  }
18542
18542
  async function assertHeadLease(repositoryRoot, expectedHead, head, paths, provider) {
18543
+ return assertHeadLeaseWithRecovery(repositoryRoot, expectedHead, head, paths, provider, []);
18544
+ }
18545
+ async function assertHeadLeaseWithRecovery(repositoryRoot, expectedHead, head, paths, provider, recoveryPaths, terminalChanges = /* @__PURE__ */ new Map()) {
18543
18546
  if (head === expectedHead) return;
18544
18547
  if (provider?.headLease !== "path-scoped" || paths.length === 0) {
18545
18548
  throw new Error(`Git HEAD lease mismatch: expected ${expectedHead}, found ${head}.`);
@@ -18575,10 +18578,65 @@ async function assertHeadLease(repositoryRoot, expectedHead, head, paths, provid
18575
18578
  "-z",
18576
18579
  commit
18577
18580
  ])).stdout);
18578
- if (touched.some((path) => protectedPaths.some((protectedPath) => path === protectedPath || path.startsWith(`${protectedPath}/`) || protectedPath.startsWith(`${path}/`)))) {
18579
- throw new Error(`Git HEAD lease overlaps protected paths in intervening commit ${commit}.`);
18581
+ for (const path of touched) {
18582
+ if (!protectedPaths.some((protectedPath) => overlaps(path, protectedPath))) continue;
18583
+ if (terminalChanges.get(commit)?.has(path)) continue;
18584
+ const proof = recoveryPaths.find((entry) => entry.path === path && paths.includes(path));
18585
+ if (!proof || overlaps(path, ".agentwheel/config.json") || overlaps(path, ".syncwheel/manifest.json") || await gitPathMode(repositoryRoot, commit, path) !== "100644" || await hashHeadPath(repositoryRoot, expectedHead, path) !== proof.beforeSha256 || await hashHeadPath(repositoryRoot, commit, path) !== proof.afterSha256 || await hashHeadPath(repositoryRoot, head, path) !== proof.afterSha256 || await hashWorkingPath(repositoryRoot, path) !== proof.afterSha256) {
18586
+ throw new Error(`Git HEAD lease overlaps protected paths in intervening commit ${commit}.`);
18587
+ }
18588
+ }
18589
+ }
18590
+ }
18591
+ function overlaps(left, right) {
18592
+ return left === right || left.startsWith(`${right}/`) || right.startsWith(`${left}/`);
18593
+ }
18594
+ async function committedRecoveryPaths(repositoryRoot, expectedHead, head, declarations, receiptPaths, provider) {
18595
+ await verifyRevisionPaths(repositoryRoot, expectedHead, receiptPaths);
18596
+ const committed = [];
18597
+ for (const entry of receiptPaths) {
18598
+ if (!declarations.includes(entry.path)) throw new Error(`Recovery path was not declared: ${entry.path}.`);
18599
+ if (await hashHeadPath(repositoryRoot, head, entry.path) === entry.afterSha256 && entry.beforeSha256 !== entry.afterSha256) {
18600
+ await assertRecoveryFileIdentity(repositoryRoot, expectedHead, head, entry.path);
18601
+ committed.push(entry);
18580
18602
  }
18581
18603
  }
18604
+ await assertHeadLeaseWithRecovery(repositoryRoot, expectedHead, head, declarations, provider, committed);
18605
+ return committed;
18606
+ }
18607
+ async function verifyCompletedRecoveryPaths(repositoryRoot, expectedHead, declarations, savedPaths, provider, productCommitSha, productPaths, controlCommitSha) {
18608
+ const head = await currentHead(repositoryRoot);
18609
+ await verifyRevisionPaths(repositoryRoot, expectedHead, savedPaths);
18610
+ for (const entry of savedPaths) {
18611
+ await assertRecoveryFileIdentity(repositoryRoot, expectedHead, head, entry.path);
18612
+ if (await hashHeadPath(repositoryRoot, head, entry.path) !== entry.afterSha256) {
18613
+ throw new Error(`Committed recovery path changed during provider completion: ${entry.path}.`);
18614
+ }
18615
+ }
18616
+ const terminalChanges = /* @__PURE__ */ new Map();
18617
+ if (productCommitSha) terminalChanges.set(productCommitSha, new Set(productPaths));
18618
+ if (controlCommitSha) terminalChanges.set(controlCommitSha, /* @__PURE__ */ new Set([".syncwheel/manifest.json"]));
18619
+ await assertHeadLeaseWithRecovery(repositoryRoot, expectedHead, head, declarations, provider, savedPaths, terminalChanges);
18620
+ }
18621
+ async function gitPathMode(repositoryRoot, head, path) {
18622
+ const tree = (await runProcess("git", ["-C", repositoryRoot, "ls-tree", "-z", head, "--", path])).stdout.toString("utf8");
18623
+ const entry = tree.split("\0").find((value) => value.slice(value.indexOf(" ") + 1) === path);
18624
+ return entry?.split(" ")[0];
18625
+ }
18626
+ async function assertRecoveryFileIdentity(repositoryRoot, expectedHead, head, path) {
18627
+ if (await gitPathMode(repositoryRoot, expectedHead, path) !== "100644" || await gitPathMode(repositoryRoot, head, path) !== "100644") {
18628
+ throw new Error(`Recovery requires an existing regular non-executable Git file: ${path}.`);
18629
+ }
18630
+ const absolute = resolve15(repositoryRoot, ...path.split("/"));
18631
+ const stats = await lstat3(absolute);
18632
+ if (!stats.isFile() || (stats.mode & 73) !== 0) throw new Error(`Recovery file identity changed: ${path}.`);
18633
+ let ancestor = dirname10(absolute);
18634
+ while (true) {
18635
+ if ((await lstat3(ancestor)).isSymbolicLink()) throw new Error(`Recovery symlink ancestor is unsupported: ${path}.`);
18636
+ const parent = dirname10(ancestor);
18637
+ if (parent === ancestor) break;
18638
+ ancestor = parent;
18639
+ }
18582
18640
  }
18583
18641
  function isAgentwheelWritablePath(path) {
18584
18642
  return /^\.agentwheel(?:\/|$)/u.test(path) || /^profiles\/[^/]+\/\.agentwheel(?:\/|$)/u.test(path);
@@ -19279,7 +19337,7 @@ var init_providers = __esm({
19279
19337
  // src/mutation/coordinator.ts
19280
19338
  import { randomUUID as randomUUID2 } from "crypto";
19281
19339
  import { homedir as homedir6 } from "os";
19282
- import { dirname as dirname10, isAbsolute as isAbsolute12, relative as relative8, resolve as resolve17, sep as sep6 } from "path";
19340
+ import { dirname as dirname11, isAbsolute as isAbsolute12, relative as relative8, resolve as resolve17, sep as sep6 } from "path";
19283
19341
  function dirtyRepositoryPaths(repositoryRoot, baseline, paths) {
19284
19342
  const conflicts = /* @__PURE__ */ new Set();
19285
19343
  for (const path of paths) {
@@ -19353,12 +19411,15 @@ async function resumeMutation(operationId, action) {
19353
19411
  );
19354
19412
  receipt = await updateMutationReceipt(receipt, { paths, status: "mutation-applied" });
19355
19413
  }
19356
- await invokeRevisionProvider(provider, providerRequest(receipt, "preflight", paths), {
19414
+ const request = action === "recover" && receipt.runtimeJournals.length > 0 ? await recoveryProviderRequest(receipt, paths) : providerRequest(receipt, action, paths);
19415
+ await invokeRevisionProvider(provider, revisionProviderRequestSchema.parse({ ...request, action: "preflight" }), {
19357
19416
  workspaceRoot: receipt.workspaceRoot
19358
19417
  });
19359
- const response = await invokeRevisionProvider(provider, providerRequest(receipt, action, paths), {
19418
+ if (action === "recover") await verifyRecoveryProjection(receipt, request);
19419
+ const response = await invokeRevisionProvider(provider, request, {
19360
19420
  workspaceRoot: receipt.workspaceRoot
19361
19421
  });
19422
+ await verifyCompletedRecoveryProjection(receipt, request, response);
19362
19423
  return updateMutationReceipt(receipt, {
19363
19424
  status: receiptStatusForProvider(response.status),
19364
19425
  providerResponse: response,
@@ -19401,17 +19462,19 @@ async function recoverMutationRuntime(operationId, options = {}) {
19401
19462
  `Mutation '${receipt.operationId}' repository HEAD lease changed before runtime recovery.`
19402
19463
  );
19403
19464
  }
19404
- await assertHeadLease(
19465
+ if (receipt.noCommit) await assertHeadLease(receipt.repositoryRoot, receipt.expectedHead, repository.head, [], receipt.provider);
19466
+ else await committedRecoveryPaths(
19405
19467
  receipt.repositoryRoot,
19406
19468
  receipt.expectedHead,
19407
19469
  repository.head,
19408
- receipt.noCommit ? [] : declarations,
19470
+ declarations,
19471
+ receipt.paths,
19409
19472
  receipt.provider
19410
19473
  );
19411
19474
  await assertGitPreflight(repository);
19412
19475
  await collectIntroducedPaths(receipt.repositoryRoot, receipt.expectedHead, baseline, declarations);
19413
19476
  }
19414
- mutation = GovernedMutation.activateExisting(receipt, baseline, lock);
19477
+ mutation = GovernedMutation.activateExisting(receipt, baseline, lock, options.beforeProviderCompletion);
19415
19478
  const [{ recoverPendingApply: recoverPendingApply2 }, { readLinkedLocalApplyJournal: readLinkedLocalApplyJournal2 }] = await Promise.all([
19416
19479
  Promise.resolve().then(() => (init_apply(), apply_exports)),
19417
19480
  Promise.resolve().then(() => (init_transaction(), transaction_exports))
@@ -19523,7 +19586,7 @@ async function mutationPolicyForWorkspace(workspaceRoot, globalRoot = homedir6()
19523
19586
  const globalConfig2 = await readWorkspaceConfig(globalRoot);
19524
19587
  const global = globalConfig2.schemaVersion === 4 ? globalConfig2.mutationPolicy : void 0;
19525
19588
  let existingRoot = resolve17(workspaceRoot);
19526
- while (!await pathExists(existingRoot) && dirname10(existingRoot) !== existingRoot) existingRoot = dirname10(existingRoot);
19589
+ while (!await pathExists(existingRoot) && dirname11(existingRoot) !== existingRoot) existingRoot = dirname11(existingRoot);
19527
19590
  const owner = await resolveWorkspaceOwnershipScope(existingRoot, { globalRoot });
19528
19591
  const fleetConfig = owner.fleetId ? await readWorkspaceConfig(owner.root) : void 0;
19529
19592
  const fleet = fleetConfig?.schemaVersion === 4 ? fleetConfig.mutationPolicy : void 0;
@@ -19545,6 +19608,50 @@ function mergeMutationPolicies(global, scoped) {
19545
19608
  revisioning
19546
19609
  });
19547
19610
  }
19611
+ async function recoveryProviderRequest(receipt, paths) {
19612
+ const request = providerRequest(receipt, "recover", paths);
19613
+ if (receipt.noCommit) return request;
19614
+ const head = await currentHead(request.repositoryRoot);
19615
+ const committed = await committedRecoveryPaths(
19616
+ request.repositoryRoot,
19617
+ request.expectedHead,
19618
+ head,
19619
+ readMutationPathDeclarations(receipt.operationId),
19620
+ paths,
19621
+ receipt.provider
19622
+ );
19623
+ if (committed.length === 0) return request;
19624
+ const saved = new Set(committed.map((entry) => entry.path));
19625
+ return revisionProviderRequestSchema.parse({
19626
+ ...request,
19627
+ expectedHead: head,
19628
+ paths: paths.filter((entry) => !saved.has(entry.path))
19629
+ });
19630
+ }
19631
+ async function verifyCompletedRecoveryProjection(receipt, request, response) {
19632
+ if (request.expectedHead === receipt.expectedHead) return;
19633
+ if (response.action !== "recover" && response.action !== "finalize") throw new Error("Recovery requires a terminal provider response.");
19634
+ const remaining = new Set(request.paths.map((entry) => entry.path));
19635
+ await verifyCompletedRecoveryPaths(
19636
+ request.repositoryRoot,
19637
+ receipt.expectedHead,
19638
+ readMutationPathDeclarations(receipt.operationId),
19639
+ receipt.paths.filter((entry) => !remaining.has(entry.path)),
19640
+ receipt.provider,
19641
+ response.productCommitSha,
19642
+ request.paths.map((entry) => entry.path),
19643
+ response.controlCommitSha
19644
+ );
19645
+ }
19646
+ async function verifyRecoveryProjection(receipt, request) {
19647
+ if (request.expectedHead === receipt.expectedHead) return;
19648
+ if (await currentHead(request.repositoryRoot) !== request.expectedHead) throw new Error("Recovery projection HEAD changed.");
19649
+ const verified = await recoveryProviderRequest(receipt, receipt.paths);
19650
+ if (JSON.stringify(verified) !== JSON.stringify(request)) throw new Error("Recovery projection changed before provider completion.");
19651
+ const repository = await discoverGitRepository(request.repositoryRoot);
19652
+ if (!repository) throw new Error("Recovery repository disappeared.");
19653
+ await assertGitPreflight(repository);
19654
+ }
19548
19655
  function providerRequest(receipt, action, paths) {
19549
19656
  if (!receipt.repositoryRoot || !receipt.expectedHead || !receipt.provider) {
19550
19657
  throw new Error(`Mutation '${receipt.operationId}' is missing revision provider request state.`);
@@ -19614,17 +19721,21 @@ var init_coordinator = __esm({
19614
19721
  init_repository();
19615
19722
  init_session_ownership();
19616
19723
  GovernedMutation = class _GovernedMutation {
19617
- constructor(policy, receipt, baseline, lock) {
19724
+ constructor(policy, receipt, baseline, lock, runtimeRecovery = false, beforeProviderCompletion) {
19618
19725
  this.policy = policy;
19619
19726
  this.receipt = receipt;
19620
19727
  this.baseline = baseline;
19621
19728
  this.lock = lock;
19729
+ this.runtimeRecovery = runtimeRecovery;
19730
+ this.beforeProviderCompletion = beforeProviderCompletion;
19622
19731
  this.operationId = receipt.operationId;
19623
19732
  }
19624
19733
  policy;
19625
19734
  receipt;
19626
19735
  baseline;
19627
19736
  lock;
19737
+ runtimeRecovery;
19738
+ beforeProviderCompletion;
19628
19739
  operationId;
19629
19740
  closed = false;
19630
19741
  static async begin(options) {
@@ -19730,7 +19841,7 @@ var init_coordinator = __esm({
19730
19841
  );
19731
19842
  }
19732
19843
  this.receipt = await updateMutationReceipt(this.receipt, { status: "handler-succeeded" });
19733
- paths = await this.collectPaths();
19844
+ paths = await this.collectPaths(action === "recover" && this.runtimeRecovery);
19734
19845
  this.receipt = await updateMutationReceipt(this.receipt, { paths, status: "mutation-applied" });
19735
19846
  } catch (error46) {
19736
19847
  this.receipt = await updateMutationReceipt(this.receipt, {
@@ -19748,12 +19859,16 @@ var init_coordinator = __esm({
19748
19859
  return this.receipt;
19749
19860
  }
19750
19861
  const provider = this.policy.revisioning.provider;
19751
- await invokeRevisionProvider(provider, providerRequest(this.receipt, "preflight", paths), {
19862
+ const request = this.runtimeRecovery && action === "recover" ? await recoveryProviderRequest(this.receipt, paths) : providerRequest(this.receipt, action, paths);
19863
+ await invokeRevisionProvider(provider, revisionProviderRequestSchema.parse({ ...request, action: "preflight" }), {
19752
19864
  workspaceRoot: this.receipt.workspaceRoot
19753
19865
  });
19754
- const response = await invokeRevisionProvider(provider, providerRequest(this.receipt, action, paths), {
19866
+ if (this.runtimeRecovery) await verifyRecoveryProjection(this.receipt, request);
19867
+ await this.beforeProviderCompletion?.();
19868
+ const response = await invokeRevisionProvider(provider, request, {
19755
19869
  workspaceRoot: this.receipt.workspaceRoot
19756
19870
  });
19871
+ await verifyCompletedRecoveryProjection(this.receipt, request, response);
19757
19872
  this.receipt = await updateMutationReceipt(this.receipt, {
19758
19873
  status: receiptStatusForProvider(response.status),
19759
19874
  providerResponse: response
@@ -19813,7 +19928,7 @@ var init_coordinator = __esm({
19813
19928
  const runtimeJournals = upsertRuntimeJournal(this.receipt.runtimeJournals, existing, status);
19814
19929
  this.receipt = await updateMutationReceipt(this.receipt, { runtimeJournals });
19815
19930
  }
19816
- static activateExisting(receipt, baseline, lock) {
19931
+ static activateExisting(receipt, baseline, lock, beforeProviderCompletion) {
19817
19932
  if (receipt.revisionMode === "commit-after-verify" && !receipt.provider) {
19818
19933
  throw new Error(`Mutation '${receipt.operationId}' is missing its revision provider recovery policy.`);
19819
19934
  }
@@ -19831,24 +19946,41 @@ var init_coordinator = __esm({
19831
19946
  journal: "required",
19832
19947
  revisioning: { mode: "off" }
19833
19948
  });
19834
- const mutation = new _GovernedMutation(policy, receipt, baseline, lock);
19949
+ const mutation = new _GovernedMutation(policy, receipt, baseline, lock, true, beforeProviderCompletion);
19835
19950
  activeMutation = mutation;
19836
19951
  return mutation;
19837
19952
  }
19838
- async collectPaths() {
19953
+ async collectPaths(recover = false) {
19839
19954
  if (!this.receipt.repositoryRoot || !this.receipt.expectedHead || !this.baseline) return [];
19840
19955
  const declarations = [.../* @__PURE__ */ new Set([
19841
19956
  ...declaredMutationPaths(),
19842
19957
  ...readMutationPathDeclarations(this.receipt.operationId)
19843
19958
  ])].sort((a, b) => a.localeCompare(b));
19844
- if (this.receipt.provider) await assertHeadLease(
19959
+ const head = await currentHead(this.receipt.repositoryRoot);
19960
+ const committed = recover && !this.receipt.noCommit ? await committedRecoveryPaths(
19961
+ this.receipt.repositoryRoot,
19962
+ this.receipt.expectedHead,
19963
+ head,
19964
+ declarations,
19965
+ this.receipt.paths,
19966
+ this.receipt.provider
19967
+ ) : [];
19968
+ if (this.receipt.provider && !recover) await assertHeadLease(
19845
19969
  this.receipt.repositoryRoot,
19846
19970
  this.receipt.expectedHead,
19847
- await currentHead(this.receipt.repositoryRoot),
19971
+ head,
19848
19972
  this.receipt.noCommit ? [] : declarations,
19849
19973
  this.receipt.provider
19850
19974
  );
19851
- return collectIntroducedPaths(this.receipt.repositoryRoot, this.receipt.expectedHead, this.baseline, declarations);
19975
+ if (recover && this.receipt.noCommit) await assertHeadLease(
19976
+ this.receipt.repositoryRoot,
19977
+ this.receipt.expectedHead,
19978
+ head,
19979
+ [],
19980
+ this.receipt.provider
19981
+ );
19982
+ const introduced = await collectIntroducedPaths(this.receipt.repositoryRoot, this.receipt.expectedHead, this.baseline, declarations);
19983
+ return [...committed, ...introduced].sort((a, b) => a.path.localeCompare(b.path));
19852
19984
  }
19853
19985
  async close() {
19854
19986
  if (this.closed) return;
@@ -19864,12 +19996,12 @@ var init_coordinator = __esm({
19864
19996
  // src/transport/ownership-snapshot.ts
19865
19997
  import { createHash as createHash10 } from "crypto";
19866
19998
  import { lstat as lstat4, readdir as readdir6, readFile as readFile14 } from "fs/promises";
19867
- import { dirname as dirname11, join as join14, relative as relative9, resolve as resolve18 } from "path";
19999
+ import { dirname as dirname12, join as join14, relative as relative9, resolve as resolve18 } from "path";
19868
20000
  async function assertSnapshotAncestors(path) {
19869
20001
  let current = resolve18(path);
19870
20002
  while (true) {
19871
20003
  if ((await lstat4(current)).isSymbolicLink()) throw new Error(`Symlink path is unsupported: ${current}`);
19872
- const parent = dirname11(current);
20004
+ const parent = dirname12(current);
19873
20005
  if (parent === current) return;
19874
20006
  current = parent;
19875
20007
  }
@@ -19935,7 +20067,7 @@ __export(transaction_exports, {
19935
20067
  });
19936
20068
  import { createHash as createHash11 } from "crypto";
19937
20069
  import { cp as cp2, lstat as lstat5, mkdir as mkdir7, open as open4, rm as rm5, stat as stat4 } from "fs/promises";
19938
- import { dirname as dirname12, join as join15, relative as relative10, resolve as resolve19, sep as sep7 } from "path";
20070
+ import { dirname as dirname13, join as join15, relative as relative10, resolve as resolve19, sep as sep7 } from "path";
19939
20071
  async function assertNoSymlinkPath2(path) {
19940
20072
  const absolute = resolve19(path);
19941
20073
  let current = absolute;
@@ -19945,7 +20077,7 @@ async function assertNoSymlinkPath2(path) {
19945
20077
  } catch (error46) {
19946
20078
  if (error46.code !== "ENOENT") throw error46;
19947
20079
  }
19948
- const parent = dirname12(current);
20080
+ const parent = dirname13(current);
19949
20081
  if (parent === current) break;
19950
20082
  current = parent;
19951
20083
  }
@@ -20016,7 +20148,7 @@ async function syncMetadataPath(path, directoryOnly = false) {
20016
20148
  await file2.close();
20017
20149
  }
20018
20150
  }
20019
- const directory = await open4(directoryOnly ? path : dirname12(path), "r");
20151
+ const directory = await open4(directoryOnly ? path : dirname13(path), "r");
20020
20152
  try {
20021
20153
  await directory.sync();
20022
20154
  } finally {
@@ -20166,7 +20298,7 @@ async function removeApplyJournal(targetRoot, adapter, transport = localTranspor
20166
20298
  if (existing?.mutation) await beginResolveMutationRuntimeJournal(existing.mutation.operationId, path);
20167
20299
  await transport.rm(applyJournalPath(targetRoot, adapter, scope));
20168
20300
  await transport.rm(applyBackupDir(targetRoot, adapter, scope));
20169
- if ((existing?.metadataAudit || existing?.metadataGuards) && transport.kind === "local") await syncMetadataPath(dirname12(path), true);
20301
+ if ((existing?.metadataAudit || existing?.metadataGuards) && transport.kind === "local") await syncMetadataPath(dirname13(path), true);
20170
20302
  if (existing?.mutation) await resolveMutationRuntimeJournal(existing.mutation.operationId, path);
20171
20303
  }
20172
20304
  async function abortApplyJournal(targetRoot, adapter, transport = localTransport, scope = {}) {
@@ -20317,7 +20449,7 @@ async function recordBackup(operation, index, targetRoot, adapter, transport = l
20317
20449
  await transport.copyWithin(operation.destPath, backupPath, operation.kind);
20318
20450
  } else {
20319
20451
  await rm5(backupPath, { recursive: true, force: true });
20320
- await mkdir7(dirname12(backupPath), { recursive: true });
20452
+ await mkdir7(dirname13(backupPath), { recursive: true });
20321
20453
  await cp2(operation.destPath, backupPath, { recursive: operation.kind === "dir", dereference: true });
20322
20454
  }
20323
20455
  return {
@@ -20416,14 +20548,14 @@ var init_transaction = __esm({
20416
20548
  // src/install/toml-merge.ts
20417
20549
  import { mkdir as mkdir8, readFile as readFile16, writeFile as writeFile8 } from "fs/promises";
20418
20550
  import { parse as parseToml } from "smol-toml";
20419
- import { dirname as dirname13 } from "path";
20551
+ import { dirname as dirname14 } from "path";
20420
20552
  async function mergeCodexTomlMcp(sourcePath, destPath) {
20421
20553
  const source = JSON.parse(await readFile16(sourcePath, "utf8"));
20422
20554
  const servers = extractMcpServers(source);
20423
20555
  const current = await pathExists(destPath) ? await readFile16(destPath, "utf8") : "";
20424
20556
  const withoutManaged = removeManagedMcpSections(current, Object.keys(servers));
20425
20557
  const merged = appendMcpServers(withoutManaged, servers);
20426
- await mkdir8(dirname13(destPath), { recursive: true });
20558
+ await mkdir8(dirname14(destPath), { recursive: true });
20427
20559
  await writeFile8(destPath, merged, "utf8");
20428
20560
  }
20429
20561
  function mismatchedCodexTomlMcpServers(source, currentContent) {
@@ -20573,13 +20705,13 @@ var init_toml_merge = __esm({
20573
20705
 
20574
20706
  // src/install/yaml-merge.ts
20575
20707
  import { mkdir as mkdir9, readFile as readFile17, writeFile as writeFile9 } from "fs/promises";
20576
- import { dirname as dirname14 } from "path";
20708
+ import { dirname as dirname15 } from "path";
20577
20709
  import { parse as parse7, stringify } from "yaml";
20578
20710
  async function mergeYamlFile(sourcePath, destPath) {
20579
20711
  const source = parseYamlValue(await readFile17(sourcePath, "utf8"));
20580
20712
  const current = await pathExists(destPath) ? parseYamlValue(await readFile17(destPath, "utf8")) : {};
20581
20713
  const merged = deepMerge2(current, source);
20582
- await mkdir9(dirname14(destPath), { recursive: true });
20714
+ await mkdir9(dirname15(destPath), { recursive: true });
20583
20715
  await writeFile9(destPath, stringify(merged), "utf8");
20584
20716
  }
20585
20717
  function parseYamlValue(content) {
@@ -20638,7 +20770,7 @@ var init_yaml_merge = __esm({
20638
20770
 
20639
20771
  // src/install/merge-removal.ts
20640
20772
  import { mkdir as mkdir10, readFile as readFile18, writeFile as writeFile10 } from "fs/promises";
20641
- import { dirname as dirname15 } from "path";
20773
+ import { dirname as dirname16 } from "path";
20642
20774
  import { parse as parse8, stringify as stringify2 } from "yaml";
20643
20775
  function assertExactMergeContribution(contribution, strategy, currentContent) {
20644
20776
  if (strategy === "codex-toml-mcp") {
@@ -20723,7 +20855,7 @@ async function removeMergeContribution(destPath, strategy, removal) {
20723
20855
  }
20724
20856
  const current = parseMergeDestination(content, strategy);
20725
20857
  removeIntroducedContent(current, removal);
20726
- await mkdir10(dirname15(destPath), { recursive: true });
20858
+ await mkdir10(dirname16(destPath), { recursive: true });
20727
20859
  await writeFile10(destPath, strategy === "yaml-deep" ? stringify2(current) : `${JSON.stringify(current, null, 2)}
20728
20860
  `, "utf8");
20729
20861
  }
@@ -20993,7 +21125,7 @@ var init_desired = __esm({
20993
21125
  import { createHash as createHash12 } from "crypto";
20994
21126
  import { mkdtemp as mkdtemp2, readFile as readFile19, realpath as realpath2, rm as rm6, writeFile as writeFile11 } from "fs/promises";
20995
21127
  import { tmpdir as tmpdir3 } from "os";
20996
- import { basename as basename2, dirname as dirname16, join as join16, relative as relative11 } from "path";
21128
+ import { basename as basename2, dirname as dirname17, join as join16, relative as relative11 } from "path";
20997
21129
  function exactManagedInstructionBlockSnapshot(content, selector) {
20998
21130
  const beginCount = [...content.matchAll(new RegExp(`<!-- BEGIN openpack:include ${escapeRegex2(selector)}(?=\\s|-->)`, "gu"))].length;
20999
21131
  const endCount = [...content.matchAll(new RegExp(`<!-- END openpack:include ${escapeRegex2(selector)}(?=\\s|-->)`, "gu"))].length;
@@ -21176,7 +21308,7 @@ function assertCleanBlock(block, selector) {
21176
21308
  }
21177
21309
  }
21178
21310
  function referencesAgentsMd(content, claudePath, agentsPath) {
21179
- const claudeDir = dirname16(claudePath);
21311
+ const claudeDir = dirname17(claudePath);
21180
21312
  for (const rawLine of content.split(/\r?\n/)) {
21181
21313
  const line = rawLine.trim();
21182
21314
  const atImport = /^@import\s+(.+)$/i.exec(line);
@@ -21186,7 +21318,7 @@ function referencesAgentsMd(content, claudePath, agentsPath) {
21186
21318
  const cleaned = referenced.trim().replace(/^["']|["']$/g, "");
21187
21319
  if (!/AGENTS\.md$/i.test(cleaned)) continue;
21188
21320
  const candidate = cleaned.startsWith("/") ? cleaned : join16(claudeDir, cleaned);
21189
- if (relative11(dirname16(agentsPath), candidate).replaceAll("\\", "/") === "AGENTS.md") return true;
21321
+ if (relative11(dirname17(agentsPath), candidate).replaceAll("\\", "/") === "AGENTS.md") return true;
21190
21322
  if (candidate === agentsPath) return true;
21191
21323
  }
21192
21324
  return false;
@@ -21246,7 +21378,7 @@ import { execFile as execFile5 } from "child_process";
21246
21378
  import { createHash as createHash13, randomUUID as randomUUID3 } from "crypto";
21247
21379
  import { chmod as chmod3, link as link2, lstat as lstat6, mkdir as mkdir11, mkdtemp as mkdtemp3, open as open5, readFile as readFile20, rm as rm7, writeFile as writeFile12 } from "fs/promises";
21248
21380
  import { tmpdir as tmpdir4 } from "os";
21249
- import { basename as basename3, dirname as dirname17, join as join17, resolve as resolve20 } from "path";
21381
+ import { basename as basename3, dirname as dirname18, join as join17, resolve as resolve20 } from "path";
21250
21382
  import { promisify as promisify5 } from "util";
21251
21383
  async function applyInstallPlan(plan, sourceLock, options = {}) {
21252
21384
  return applyPlanTransactionally(plan, { ...options, sourceLock });
@@ -21714,7 +21846,7 @@ async function createPrivateAuditDirectory(path) {
21714
21846
  } catch (error46) {
21715
21847
  if (error46.code !== "ENOENT") throw error46;
21716
21848
  }
21717
- await createPrivateAuditDirectory(dirname17(path));
21849
+ await createPrivateAuditDirectory(dirname18(path));
21718
21850
  try {
21719
21851
  await mkdir11(path, { mode: 448 });
21720
21852
  } catch (error46) {
@@ -21725,14 +21857,14 @@ async function createPrivateAuditDirectory(path) {
21725
21857
  }
21726
21858
  await chmod3(path, 448);
21727
21859
  await syncMetadataPath(path, true);
21728
- await syncMetadataPath(dirname17(path), true);
21860
+ await syncMetadataPath(dirname18(path), true);
21729
21861
  }
21730
21862
  async function writeAuditFileExclusive(path, content, validateCallerPath) {
21731
21863
  await assertNoSymlinkPath2(path);
21732
- await createPrivateAuditDirectory(dirname17(path));
21864
+ await createPrivateAuditDirectory(dirname18(path));
21733
21865
  await assertNoSymlinkPath2(path);
21734
21866
  await validateCallerPath();
21735
- await syncMetadataPath(dirname17(dirname17(path)), true);
21867
+ await syncMetadataPath(dirname18(dirname18(path)), true);
21736
21868
  const temporary = `${path}.pending-${randomUUID3()}`;
21737
21869
  try {
21738
21870
  const handle = await open5(temporary, "wx", 384);
@@ -21748,7 +21880,7 @@ async function writeAuditFileExclusive(path, content, validateCallerPath) {
21748
21880
  } catch (error46) {
21749
21881
  if (error46.code !== "EEXIST" || await readFile20(path, "utf8") !== content) throw error46;
21750
21882
  }
21751
- const directory = await open5(dirname17(path), "r");
21883
+ const directory = await open5(dirname18(path), "r");
21752
21884
  try {
21753
21885
  await directory.sync();
21754
21886
  } finally {
@@ -22407,7 +22539,7 @@ async function validateOpenClawConfig(configPath, destPath, transport) {
22407
22539
  if (!transport.execFile) {
22408
22540
  throw new Error(`Cannot validate OpenClaw config over ${transport.description}: transport does not support command execution.`);
22409
22541
  }
22410
- const openClawHome = dirname17(destPath);
22542
+ const openClawHome = dirname18(destPath);
22411
22543
  const bundledBin = join17(openClawHome, "npm", "node_modules", ".bin", "openclaw");
22412
22544
  const script = String.raw`
22413
22545
  set -euo pipefail
@@ -22494,7 +22626,7 @@ import { createHash as createHash32 } from "crypto";
22494
22626
  import { existsSync } from "fs";
22495
22627
  import { mkdir as mkdir28, mkdtemp as mkdtemp6, readFile as readFile45, realpath as realpath4, rm as rm16, writeFile as writeFile24 } from "fs/promises";
22496
22628
  import { homedir as homedir18, tmpdir as tmpdir7 } from "os";
22497
- import { basename as basename24, dirname as dirname41, isAbsolute as isAbsolute17, join as join66, relative as relative22, resolve as resolve48, sep as sep12 } from "path";
22629
+ import { basename as basename24, dirname as dirname42, isAbsolute as isAbsolute17, join as join66, relative as relative22, resolve as resolve48, sep as sep12 } from "path";
22498
22630
  import { fileURLToPath as fileURLToPath4 } from "url";
22499
22631
  import { Command } from "commander";
22500
22632
 
@@ -22587,7 +22719,7 @@ import { basename as basename8, join as join28, relative as relative12 } from "p
22587
22719
  // src/staging/codex-subagents.ts
22588
22720
  init_fs();
22589
22721
  import { mkdir as mkdir12, readFile as readFile21, writeFile as writeFile13 } from "fs/promises";
22590
- import { basename as basename4, dirname as dirname18, join as join18 } from "path";
22722
+ import { basename as basename4, dirname as dirname19, join as join18 } from "path";
22591
22723
  import { parse as parseYaml } from "yaml";
22592
22724
  var requiredCodexAgentFields = ["name", "description", "developer_instructions"];
22593
22725
  async function renderCodexSubagents(artifacts, stageRoot, adapter) {
@@ -22633,7 +22765,7 @@ async function renderCodexSubagent(artifact, stageRoot) {
22633
22765
  }
22634
22766
  const markdown = await readFile21(markdownPath, "utf8");
22635
22767
  const toml = markdownToCodexAgentToml(agentName, markdown);
22636
- await mkdir12(dirname18(renderedPath), { recursive: true });
22768
+ await mkdir12(dirname19(renderedPath), { recursive: true });
22637
22769
  await writeFile13(renderedPath, toml, "utf8");
22638
22770
  return {
22639
22771
  ...artifact,
@@ -22716,7 +22848,7 @@ function escapeRegExp2(value) {
22716
22848
  // src/staging/copilot-artifacts.ts
22717
22849
  init_fs();
22718
22850
  import { mkdir as mkdir13, readFile as readFile22, writeFile as writeFile14 } from "fs/promises";
22719
- import { basename as basename5, dirname as dirname19, join as join19 } from "path";
22851
+ import { basename as basename5, dirname as dirname20, join as join19 } from "path";
22720
22852
  async function renderCopilotArtifacts(artifacts, stageRoot, adapter) {
22721
22853
  if (adapter?.name !== "copilot") return artifacts;
22722
22854
  const names = /* @__PURE__ */ new Set();
@@ -22747,7 +22879,7 @@ async function renderCopilotSubagent(artifact, stageRoot) {
22747
22879
  throw new Error(`Copilot subagent ${artifact.relativePath} must be a .md file or directory containing AGENTS.md.`);
22748
22880
  }
22749
22881
  const markdown = await readFile22(markdownPath, "utf8");
22750
- await mkdir13(dirname19(renderedPath), { recursive: true });
22882
+ await mkdir13(dirname20(renderedPath), { recursive: true });
22751
22883
  await writeFile14(renderedPath, ensureCopilotAgentDescription(agentName, markdown), "utf8");
22752
22884
  return {
22753
22885
  ...artifact,
@@ -22803,7 +22935,7 @@ function yamlString(value) {
22803
22935
  // src/staging/openclaw-subagents.ts
22804
22936
  init_fs();
22805
22937
  import { mkdir as mkdir14, readFile as readFile23, writeFile as writeFile15 } from "fs/promises";
22806
- import { basename as basename6, dirname as dirname20, join as join20 } from "path";
22938
+ import { basename as basename6, dirname as dirname21, join as join20 } from "path";
22807
22939
  async function renderOpenClawSubagents(artifacts, stageRoot, adapter) {
22808
22940
  if (adapter?.name !== "openclaw") return artifacts;
22809
22941
  const names = /* @__PURE__ */ new Set();
@@ -22837,10 +22969,10 @@ async function renderOpenClawSubagent(artifact, stageRoot) {
22837
22969
 
22838
22970
  ${parsed.description ?? `OpenClaw subagent ${agentId}.`}`;
22839
22971
  const renderedPath = join20(stageRoot, ".agentwheel-rendered", "openclaw-subagents", agentId, "AGENTS.md");
22840
- await mkdir14(dirname20(renderedPath), { recursive: true });
22972
+ await mkdir14(dirname21(renderedPath), { recursive: true });
22841
22973
  await writeFile15(renderedPath, `${body}
22842
22974
  `, "utf8");
22843
- const renderedDir = dirname20(renderedPath);
22975
+ const renderedDir = dirname21(renderedPath);
22844
22976
  return {
22845
22977
  ...artifact,
22846
22978
  name: agentId,
@@ -25391,7 +25523,7 @@ function errorMessage2(error46) {
25391
25523
 
25392
25524
  // src/source/clawhub.ts
25393
25525
  import { mkdir as mkdir15, rm as rm8, writeFile as writeFile16 } from "fs/promises";
25394
- import { basename as basename10, dirname as dirname21, join as join32, resolve as resolve22 } from "path";
25526
+ import { basename as basename10, dirname as dirname22, join as join32, resolve as resolve22 } from "path";
25395
25527
 
25396
25528
  // src/model/package.ts
25397
25529
  init_main();
@@ -25964,7 +26096,7 @@ async function writeGeneratedPackage(root, packageInfo) {
25964
26096
  };
25965
26097
  const pluginPath = join32(root, "plugins", pluginId, "clawhub.json");
25966
26098
  await rm8(root, { recursive: true, force: true });
25967
- await mkdir15(dirname21(pluginPath), { recursive: true });
26099
+ await mkdir15(dirname22(pluginPath), { recursive: true });
25968
26100
  await writeFile16(join32(root, "openpack.json"), `${JSON.stringify({
25969
26101
  schemaVersion: CURRENT_OPENPACK_SCHEMA_VERSION,
25970
26102
  name: `clawhub/${name}`,
@@ -25997,7 +26129,7 @@ function cachePathFor(packageName, cacheRoot) {
25997
26129
  import { execFile as execFile6 } from "child_process";
25998
26130
  import { mkdir as mkdir17, rename as rename6, rm as rm10, stat as stat7 } from "fs/promises";
25999
26131
  import { homedir as homedir8 } from "os";
26000
- import { basename as basename11, dirname as dirname23, join as join35, resolve as resolve23, sep as sep8 } from "path";
26132
+ import { basename as basename11, dirname as dirname24, join as join35, resolve as resolve23, sep as sep8 } from "path";
26001
26133
  import { promisify as promisify6 } from "util";
26002
26134
  init_fs();
26003
26135
 
@@ -26080,7 +26212,7 @@ function isMissingFile(error46) {
26080
26212
  init_fs();
26081
26213
  import { randomUUID as randomUUID4 } from "crypto";
26082
26214
  import { mkdir as mkdir16, readdir as readdir9, readFile as readFile29, rm as rm9, stat as stat6, writeFile as writeFile17 } from "fs/promises";
26083
- import { dirname as dirname22, join as join34 } from "path";
26215
+ import { dirname as dirname23, join as join34 } from "path";
26084
26216
  var snapshotNamePattern = /^(.*)-([0-9a-f]{12})$/i;
26085
26217
  var leaseMarker = ".agentwheel-lease-";
26086
26218
  async function pruneGitCache(cacheRoot, options = {}) {
@@ -26148,7 +26280,7 @@ async function removeGeneratedEntries(root, preserveGit) {
26148
26280
  }
26149
26281
  }
26150
26282
  async function pruneGitCacheUnlocked(cacheRoot, options) {
26151
- const referencedCommits = await referencedGraphLockCommits(join34(dirname22(cacheRoot), "locks"));
26283
+ const referencedCommits = await referencedGraphLockCommits(join34(dirname23(cacheRoot), "locks"));
26152
26284
  const entries = await readdir9(cacheRoot, { withFileTypes: true });
26153
26285
  const groups = /* @__PURE__ */ new Map();
26154
26286
  for (const entry of entries) {
@@ -26215,7 +26347,7 @@ async function walkGraphLocks(root, visit2) {
26215
26347
  }
26216
26348
  }
26217
26349
  async function hasLiveSnapshotLease(snapshotPath, dryRun) {
26218
- const directory = dirname22(snapshotPath);
26350
+ const directory = dirname23(snapshotPath);
26219
26351
  const prefix = `${snapshotPath.slice(directory.length + 1)}${leaseMarker}`;
26220
26352
  const entries = await readdir9(directory, { withFileTypes: true });
26221
26353
  let live = false;
@@ -26354,7 +26486,7 @@ var GitSourceDriver = class {
26354
26486
  async fetch(resolved) {
26355
26487
  return withFilesystemLock(`${resolved.resolvedPath}.lock`, resolved.cacheLockTimeoutMs ?? 3e4, async () => {
26356
26488
  const parsed = parseGitSource(resolved.source);
26357
- const cacheRoot = dirname23(resolved.resolvedPath);
26489
+ const cacheRoot = dirname24(resolved.resolvedPath);
26358
26490
  await mkdir17(cacheRoot, { recursive: true });
26359
26491
  await assertOwnedByCurrentUser(cacheRoot);
26360
26492
  if (await pathExists(resolved.resolvedPath)) await assertOwnedByCurrentUser(resolved.resolvedPath);
@@ -26449,9 +26581,9 @@ async function resolveCommit(checkoutPath, ref) {
26449
26581
  throw lastError;
26450
26582
  }
26451
26583
  async function snapshotCommit(checkoutPath, commit) {
26452
- const snapshotPath = join35(dirname23(checkoutPath), `${basename11(checkoutPath)}-${commit.slice(0, 12)}`);
26584
+ const snapshotPath = join35(dirname24(checkoutPath), `${basename11(checkoutPath)}-${commit.slice(0, 12)}`);
26453
26585
  if (await pathExists(snapshotPath)) return snapshotPath;
26454
- const tempPath = join35(dirname23(checkoutPath), `${basename11(snapshotPath)}.tmp-${process.pid}-${Date.now()}`);
26586
+ const tempPath = join35(dirname24(checkoutPath), `${basename11(snapshotPath)}.tmp-${process.pid}-${Date.now()}`);
26455
26587
  const tempIndexPath = `${tempPath}.index`;
26456
26588
  await rm10(tempPath, { recursive: true, force: true });
26457
26589
  await rm10(tempIndexPath, { force: true });
@@ -26489,7 +26621,7 @@ async function assertOwnedByCurrentUser(path) {
26489
26621
 
26490
26622
  // src/source/mcp-registry.ts
26491
26623
  import { mkdir as mkdir18, writeFile as writeFile18 } from "fs/promises";
26492
- import { basename as basename12, dirname as dirname24, join as join36, resolve as resolve24 } from "path";
26624
+ import { basename as basename12, dirname as dirname25, join as join36, resolve as resolve24 } from "path";
26493
26625
  init_fs();
26494
26626
  var registryBaseUrl = "https://registry.modelcontextprotocol.io/v0.1";
26495
26627
  var sourcePrefix2 = "mcp-registry:";
@@ -26597,7 +26729,7 @@ function isSafeHttpUrl(value) {
26597
26729
  async function writeGeneratedPackage2(root, server) {
26598
26730
  const serverId = installNameFor3(server.serverName);
26599
26731
  const mcpPath = join36(root, "mcp", `${serverId}.json`);
26600
- await mkdir18(dirname24(mcpPath), { recursive: true });
26732
+ await mkdir18(dirname25(mcpPath), { recursive: true });
26601
26733
  await writeFile18(join36(root, "openpack.json"), `${JSON.stringify({
26602
26734
  schemaVersion: CURRENT_OPENPACK_SCHEMA_VERSION,
26603
26735
  name: `mcp-registry/${server.serverName}`,
@@ -26631,14 +26763,14 @@ import { createHash as createHash16, randomUUID as randomUUID5 } from "crypto";
26631
26763
  import { execFile as execFile7 } from "child_process";
26632
26764
  import { cp as cp3, mkdir as mkdir19, readFile as readFile30, rename as rename7, rm as rm11 } from "fs/promises";
26633
26765
  import { homedir as homedir9 } from "os";
26634
- import { basename as basename14, dirname as dirname26, join as join38, resolve as resolve25 } from "path";
26766
+ import { basename as basename14, dirname as dirname27, join as join38, resolve as resolve25 } from "path";
26635
26767
  import { promisify as promisify7 } from "util";
26636
26768
  import * as defaultSkillKit from "@skillkit/core";
26637
26769
 
26638
26770
  // src/source/skill-artifacts.ts
26639
26771
  init_fs();
26640
26772
  import { readdir as readdir10, stat as stat8 } from "fs/promises";
26641
- import { basename as basename13, dirname as dirname25, extname as extname2, join as join37 } from "path";
26773
+ import { basename as basename13, dirname as dirname26, extname as extname2, join as join37 } from "path";
26642
26774
  async function artifactsFromSkillPaths(paths, packageName) {
26643
26775
  const artifacts = [];
26644
26776
  const seen = /* @__PURE__ */ new Set();
@@ -26675,7 +26807,7 @@ async function artifactFromSkillPath(item, packageName) {
26675
26807
  };
26676
26808
  }
26677
26809
  if (stats.isFile() && basename13(item.path).toLowerCase() === "skill.md") {
26678
- const dir = dirname25(item.path);
26810
+ const dir = dirname26(item.path);
26679
26811
  const name = sanitizeSkillName(item.name ?? basename13(dir));
26680
26812
  return {
26681
26813
  type: "skills",
@@ -26783,7 +26915,7 @@ var SkillKitSourceDriver = class {
26783
26915
  sourceHash: await hashPath(resolved.resolvedPath)
26784
26916
  };
26785
26917
  }
26786
- const specCachePath = cachePathFor4(spec, dirname26(dirname26(resolved.resolvedPath)));
26918
+ const specCachePath = cachePathFor4(spec, dirname27(dirname27(resolved.resolvedPath)));
26787
26919
  const refIdentity = resolved.requestedRef ?? "default";
26788
26920
  const lockPath = `${specCachePath}.ref-${createHash16("sha256").update(refIdentity).digest("hex")}.lock`;
26789
26921
  const inflightKey = `${lockPath}\0${requestedCommit ?? "movable"}`;
@@ -26804,11 +26936,11 @@ var SkillKitSourceDriver = class {
26804
26936
  throw new Error("SkillKit provider API unavailable or cannot resolve source. Expected @skillkit/core detectProvider().clone().");
26805
26937
  }
26806
26938
  const materialized = await withFilesystemLock(lockPath, resolved.cacheLockTimeoutMs ?? 3e4, async () => {
26807
- const immutablePath = requestedCommit ? cachePathFor4(spec, dirname26(dirname26(specCachePath)), requestedCommit) : void 0;
26939
+ const immutablePath = requestedCommit ? cachePathFor4(spec, dirname27(dirname27(specCachePath)), requestedCommit) : void 0;
26808
26940
  if (immutablePath && await pathExists(immutablePath)) {
26809
26941
  return { path: immutablePath, commit: requestedCommit, cacheIdentity: requestedCommit };
26810
26942
  }
26811
- await mkdir19(dirname26(specCachePath), { recursive: true });
26943
+ await mkdir19(dirname27(specCachePath), { recursive: true });
26812
26944
  const candidatePath = `${specCachePath}.agentwheel-tmp-${process.pid}-${randomUUID5()}`;
26813
26945
  const publishPath = `${candidatePath}.publish`;
26814
26946
  let result;
@@ -26830,7 +26962,7 @@ var SkillKitSourceDriver = class {
26830
26962
  `SkillKit provider resolved ${resolvedIdentity.commit ?? "non-Git content"} instead of requested commit ${requestedCommit}`
26831
26963
  );
26832
26964
  }
26833
- const cachePath = cachePathFor4(spec, dirname26(dirname26(specCachePath)), resolvedIdentity.cacheKey);
26965
+ const cachePath = cachePathFor4(spec, dirname27(dirname27(specCachePath)), resolvedIdentity.cacheKey);
26834
26966
  if (await pathExists(cachePath)) {
26835
26967
  return { path: cachePath, commit: resolvedIdentity.commit, cacheIdentity: resolvedIdentity.cacheKey };
26836
26968
  }
@@ -27101,7 +27233,7 @@ init_identify();
27101
27233
 
27102
27234
  // src/staging/staging.ts
27103
27235
  import { chmod as chmod4, cp as cp5, mkdir as mkdir22, mkdtemp as mkdtemp4, readdir as readdir13, stat as stat12 } from "fs/promises";
27104
- import { basename as basename19, dirname as dirname30, join as join43, relative as relative16, resolve as resolve29, sep as sep10 } from "path";
27236
+ import { basename as basename19, dirname as dirname31, join as join43, relative as relative16, resolve as resolve29, sep as sep10 } from "path";
27105
27237
  import { tmpdir as tmpdir5 } from "os";
27106
27238
  init_fs();
27107
27239
 
@@ -27110,7 +27242,7 @@ init_artifact();
27110
27242
  init_fs();
27111
27243
  import { createHash as createHash17 } from "crypto";
27112
27244
  import { readdir as readdir11, readFile as readFile31, stat as stat10, writeFile as writeFile19 } from "fs/promises";
27113
- import { basename as basename16, dirname as dirname27, extname as extname3, join as join40, relative as relative15, resolve as resolve28, sep as sep9 } from "path";
27245
+ import { basename as basename16, dirname as dirname28, extname as extname3, join as join40, relative as relative15, resolve as resolve28, sep as sep9 } from "path";
27114
27246
  var includePattern = /<!--\s*openpack:include(\?)?\s+([^>]+?)\s*-->/g;
27115
27247
  var escapedIncludePattern = /<!--\s*openpack\\:include(\?)?\s+([^>]+?)\s*-->/g;
27116
27248
  var generatedPattern = /<!--\s*(?:BEGIN|END)\s+openpack:include\b/;
@@ -27365,11 +27497,11 @@ async function listMarkdownFiles(root) {
27365
27497
  function composeEntriesForFile(artifact, file2) {
27366
27498
  if (!artifact.compose?.length) return [];
27367
27499
  if (artifact.kind === "file") return [resolve28(artifact.stagedPath ?? artifact.sourcePath), resolve28(file2)].every(Boolean) && resolve28(artifact.stagedPath ?? artifact.sourcePath) === resolve28(file2) ? artifact.compose : [];
27368
- return basename16(file2) === "SKILL.md" && dirname27(file2) === resolve28(artifact.stagedPath ?? artifact.sourcePath) ? artifact.compose : [];
27500
+ return basename16(file2) === "SKILL.md" && dirname28(file2) === resolve28(artifact.stagedPath ?? artifact.sourcePath) ? artifact.compose : [];
27369
27501
  }
27370
27502
  function isPrimaryMarkdownFile(artifact, file2) {
27371
27503
  if (artifact.kind === "file") return resolve28(artifact.stagedPath ?? artifact.sourcePath) === resolve28(file2);
27372
- return basename16(file2) === "SKILL.md" && dirname27(file2) === resolve28(artifact.stagedPath ?? artifact.sourcePath);
27504
+ return basename16(file2) === "SKILL.md" && dirname28(file2) === resolve28(artifact.stagedPath ?? artifact.sourcePath);
27373
27505
  }
27374
27506
  function orderedForExpansion(artifacts) {
27375
27507
  return [...artifacts].sort((a, b) => Number(a.type === "fragments") - Number(b.type === "fragments"));
@@ -27417,7 +27549,7 @@ function artifactPathMap(artifacts) {
27417
27549
  // src/staging/customize.ts
27418
27550
  init_fs();
27419
27551
  import { cp as cp4, mkdir as mkdir20, readdir as readdir12, readFile as readFile32, writeFile as writeFile20 } from "fs/promises";
27420
- import { dirname as dirname28, join as join41 } from "path";
27552
+ import { dirname as dirname29, join as join41 } from "path";
27421
27553
  async function applyCustomizations(artifacts, options) {
27422
27554
  let next = [...artifacts];
27423
27555
  next = await applyReplacements2(next, options, "override", installableArtifactTypes());
@@ -27441,7 +27573,7 @@ async function applyInstructionOverlay(artifacts, options) {
27441
27573
  const managed = await readFile32(artifact.stagedPath ?? artifact.sourcePath, "utf8");
27442
27574
  const local = await readFile32(overlayPath, "utf8");
27443
27575
  const composedPath = join41(options.stageRoot, ".agentwheel-composed", "instructions", "AGENTS.md");
27444
- await mkdir20(dirname28(composedPath), { recursive: true });
27576
+ await mkdir20(dirname29(composedPath), { recursive: true });
27445
27577
  await writeFile20(
27446
27578
  composedPath,
27447
27579
  [
@@ -27514,7 +27646,7 @@ async function applyReplacements2(artifacts, options, channel, artifactTypes) {
27514
27646
  const artifactKind = entry.isDirectory() ? "dir" : "file";
27515
27647
  const existing = byKey.get(artifactMapKey);
27516
27648
  const stagedPath = join41(options.stageRoot, ".agentwheel-composed", channel, type, entry.name);
27517
- await mkdir20(dirname28(stagedPath), { recursive: true });
27649
+ await mkdir20(dirname29(stagedPath), { recursive: true });
27518
27650
  await cp4(full, stagedPath, { recursive: artifactKind === "dir", dereference: true });
27519
27651
  byKey.set(artifactMapKey, {
27520
27652
  ...existing,
@@ -27560,7 +27692,7 @@ async function sortedDirEntries2(path) {
27560
27692
  // src/staging/claude-subagents.ts
27561
27693
  init_fs();
27562
27694
  import { mkdir as mkdir21, readFile as readFile33, writeFile as writeFile21 } from "fs/promises";
27563
- import { basename as basename18, dirname as dirname29, join as join42 } from "path";
27695
+ import { basename as basename18, dirname as dirname30, join as join42 } from "path";
27564
27696
  async function renderClaudeSubagents(artifacts, stageRoot, adapter) {
27565
27697
  if (adapter?.name !== "claude") return artifacts;
27566
27698
  const names = /* @__PURE__ */ new Set();
@@ -27591,7 +27723,7 @@ async function renderClaudeSubagent(artifact, stageRoot) {
27591
27723
  }
27592
27724
  const content = await readFile33(markdownPath, "utf8");
27593
27725
  const renderedPath = join42(stageRoot, ".agentwheel-rendered", "claude-subagents", `${agentName}.md`);
27594
- await mkdir21(dirname29(renderedPath), { recursive: true });
27726
+ await mkdir21(dirname30(renderedPath), { recursive: true });
27595
27727
  await writeFile21(renderedPath, content.endsWith("\n") ? content : `${content}
27596
27728
  `, "utf8");
27597
27729
  return {
@@ -27634,7 +27766,7 @@ async function stageResolvedArtifactsRaw(resolved, artifacts, parentDir = tmpdir
27634
27766
  await removeOnFailure(root, async () => {
27635
27767
  for (const artifact of artifacts) {
27636
27768
  const stagedPath = join43(root, artifact.relativePath);
27637
- await mkdir22(dirname30(stagedPath), { recursive: true });
27769
+ await mkdir22(dirname31(stagedPath), { recursive: true });
27638
27770
  await cp5(artifact.sourcePath, stagedPath, {
27639
27771
  recursive: artifact.kind === "dir",
27640
27772
  dereference: true,
@@ -27740,7 +27872,7 @@ async function copyAsset(asset, source, dest) {
27740
27872
  throw new Error(`Asset include source is not a file or directory: ${source}`);
27741
27873
  }
27742
27874
  if (!asset.include?.length) {
27743
- await mkdir22(dirname30(dest), { recursive: true });
27875
+ await mkdir22(dirname31(dest), { recursive: true });
27744
27876
  await cp5(source, dest, { recursive: true, dereference: true });
27745
27877
  if (asset.mode === "copy") await normalizeCopiedModes(dest);
27746
27878
  return;
@@ -27752,7 +27884,7 @@ async function copyAsset(asset, source, dest) {
27752
27884
  }
27753
27885
  }
27754
27886
  async function copyAssetFile(source, dest, asset) {
27755
- await mkdir22(dirname30(dest), { recursive: true });
27887
+ await mkdir22(dirname31(dest), { recursive: true });
27756
27888
  await cp5(source, dest, { dereference: true });
27757
27889
  if (asset.mode === "copy") await chmod4(dest, 420);
27758
27890
  }
@@ -27808,7 +27940,7 @@ init_adapter();
27808
27940
  init_artifact();
27809
27941
  init_workspace();
27810
27942
  import { appendFile, cp as cp6, lstat as lstat7, mkdir as mkdir23, readdir as readdir15, rm as rm13 } from "fs/promises";
27811
- import { dirname as dirname32, join as join46, relative as relative17 } from "path";
27943
+ import { dirname as dirname33, join as join46, relative as relative17 } from "path";
27812
27944
 
27813
27945
  // src/resolve/graph.ts
27814
27946
  import { createHash as createHash19 } from "crypto";
@@ -27946,7 +28078,7 @@ import { resolve as resolve31 } from "path";
27946
28078
  // src/registry/client.ts
27947
28079
  import { readFile as readFile35, rm as rm12, stat as stat13 } from "fs/promises";
27948
28080
  import { homedir as homedir11 } from "os";
27949
- import { dirname as dirname31, join as join44, resolve as resolve30 } from "path";
28081
+ import { dirname as dirname32, join as join44, resolve as resolve30 } from "path";
27950
28082
  import { fileURLToPath as fileURLToPath2 } from "url";
27951
28083
 
27952
28084
  // src/model/registry.ts
@@ -28067,7 +28199,7 @@ var RegistryClient = class {
28067
28199
  const stats = await stat13(fullPath);
28068
28200
  return readFile35(stats.isDirectory() ? join44(fullPath, "index.json") : fullPath, "utf8");
28069
28201
  }
28070
- const resolved = await this.git.fetch(await this.git.resolve(source, { cacheRoot: join44(dirname31(this.cachePath), "registry-repos") }));
28202
+ const resolved = await this.git.fetch(await this.git.resolve(source, { cacheRoot: join44(dirname32(this.cachePath), "registry-repos") }));
28071
28203
  return readFile35(join44(resolved.resolvedPath, "index.json"), "utf8");
28072
28204
  }
28073
28205
  warnCompatibility(entries) {
@@ -29194,7 +29326,7 @@ init_declarations();
29194
29326
  async function remember(workspaceRoot, runtime, text) {
29195
29327
  const overlayPath = join46(workspaceRoot, ".agentwheel", "overlays", runtime, "instructions.local.md");
29196
29328
  declareMutationPath(overlayPath);
29197
- await mkdir23(dirname32(overlayPath), { recursive: true });
29329
+ await mkdir23(dirname33(overlayPath), { recursive: true });
29198
29330
  await appendFile(overlayPath, `${text.trim()}
29199
29331
  `, "utf8");
29200
29332
  return { overlayPath };
@@ -29227,7 +29359,7 @@ async function ejectArtifact(workspaceRoot, item) {
29227
29359
  } else {
29228
29360
  declareMutationPath(ejectedPath);
29229
29361
  }
29230
- await mkdir23(dirname32(ejectedPath), { recursive: true });
29362
+ await mkdir23(dirname33(ejectedPath), { recursive: true });
29231
29363
  await rm13(ejectedPath, { recursive: true, force: true });
29232
29364
  await cp6(sourcePath, ejectedPath, { recursive: artifact.kind === "dir", dereference: true });
29233
29365
  return {
@@ -29346,7 +29478,7 @@ init_adapter();
29346
29478
  init_graph_lock();
29347
29479
  import { createHash as createHash21 } from "crypto";
29348
29480
  import { mkdir as mkdir25, readdir as readdir16 } from "fs/promises";
29349
- import { basename as basename21, dirname as dirname34, join as join49, posix as posix7, resolve as resolve34 } from "path";
29481
+ import { basename as basename21, dirname as dirname35, join as join49, posix as posix7, resolve as resolve34 } from "path";
29350
29482
  init_paths();
29351
29483
  init_merge_removal();
29352
29484
  init_transaction();
@@ -30034,7 +30166,7 @@ init_zod();
30034
30166
  init_fs();
30035
30167
  import { mkdir as mkdir24, readFile as readFile38 } from "fs/promises";
30036
30168
  import { homedir as homedir13 } from "os";
30037
- import { dirname as dirname33, join as join48 } from "path";
30169
+ import { dirname as dirname34, join as join48 } from "path";
30038
30170
  var trustStoreSchema = external_exports.object({
30039
30171
  version: external_exports.literal(1),
30040
30172
  acceptedSources: external_exports.array(external_exports.string().min(1)).default([])
@@ -30110,7 +30242,7 @@ async function readTrustStore(path) {
30110
30242
  return trustStoreSchema.parse(JSON.parse(await readFile38(path, "utf8")));
30111
30243
  }
30112
30244
  async function writeTrustStore(path, store) {
30113
- await mkdir24(dirname33(path), { recursive: true });
30245
+ await mkdir24(dirname34(path), { recursive: true });
30114
30246
  await writeJsonAtomic(path, trustStoreSchema.parse(store));
30115
30247
  }
30116
30248
  function defaultTrustStorePath() {
@@ -30610,7 +30742,7 @@ async function discoverTargetApplyJournal(options) {
30610
30742
  continue;
30611
30743
  }
30612
30744
  if (!journal.graphLockPath || !journal.graphLock || !journal.graphLockDigest) continue;
30613
- if (resolve34(dirname34(journal.graphLockPath)) !== resolve34(dirname34(options.graphLockPath))) continue;
30745
+ if (resolve34(dirname35(journal.graphLockPath)) !== resolve34(dirname35(options.graphLockPath))) continue;
30614
30746
  if (options.transport.kind === "ssh") {
30615
30747
  throw new Error(
30616
30748
  `Legacy SSH apply journal at ${item.path} does not record its original endpoint; Agentwheel cannot prove endpoint identity, so the journal was preserved.`
@@ -30752,7 +30884,7 @@ async function resolvePriorTargetState(options) {
30752
30884
  return {};
30753
30885
  }
30754
30886
  async function discoverLegacyStateCandidates(options) {
30755
- const directory = dirname34(options.graphLockPath);
30887
+ const directory = dirname35(options.graphLockPath);
30756
30888
  let names;
30757
30889
  try {
30758
30890
  names = await readdir16(directory);
@@ -31040,7 +31172,7 @@ function mcpServerNames(strategy, removal) {
31040
31172
  return new Set(Object.keys(servers));
31041
31173
  }
31042
31174
  function globalConfigRoot(globalRoot) {
31043
- return dirname34(dirname34(globalWorkspaceConfigPath(globalRoot)));
31175
+ return dirname35(dirname35(globalWorkspaceConfigPath(globalRoot)));
31044
31176
  }
31045
31177
  function ownedByWorkspace(owner, desiredOwner, workspaceRoot, ownsSubWorkspaces) {
31046
31178
  if (owner === desiredOwner) return true;
@@ -31188,7 +31320,7 @@ function targetLabel(target) {
31188
31320
  init_workspace();
31189
31321
  init_run_as_identity();
31190
31322
  init_fs();
31191
- import { basename as basename22, dirname as dirname35, join as join50, resolve as resolve35 } from "path";
31323
+ import { basename as basename22, dirname as dirname36, join as join50, resolve as resolve35 } from "path";
31192
31324
  var runtimeMarkers = [
31193
31325
  { adapter: "openclaw", dirs: [".openclaw", ".clawdbot", ".moltbot"] },
31194
31326
  { adapter: "claude", dirs: [".claude"] },
@@ -31314,7 +31446,7 @@ async function detectRuntimeTargets(cwd = process.cwd(), adapterFilter) {
31314
31446
  if (adapterFilter && marker.adapter !== adapterFilter) continue;
31315
31447
  for (const dir of marker.dirs) {
31316
31448
  if (basename22(root) === dir) {
31317
- matches.push({ adapter: marker.adapter, targetRoot: dirname35(root) });
31449
+ matches.push({ adapter: marker.adapter, targetRoot: dirname36(root) });
31318
31450
  } else if (await pathExists(join50(root, dir))) {
31319
31451
  matches.push({ adapter: marker.adapter, targetRoot: root });
31320
31452
  }
@@ -31361,7 +31493,7 @@ function dedupeTargets(matches) {
31361
31493
  function runtimeScanRoot(request) {
31362
31494
  const root = resolve35(request.targetRoot ?? request.cwd ?? process.cwd());
31363
31495
  if (request.targetRoot) return root;
31364
- return runtimeMarkers.some((marker) => marker.dirs.includes(basename22(root))) ? dirname35(root) : root;
31496
+ return runtimeMarkers.some((marker) => marker.dirs.includes(basename22(root))) ? dirname36(root) : root;
31365
31497
  }
31366
31498
 
31367
31499
  // src/lifecycle/profile.ts
@@ -31695,7 +31827,7 @@ init_selection();
31695
31827
  // src/cli/update-check.ts
31696
31828
  import { mkdir as mkdir26, readFile as readFile39, writeFile as writeFile22 } from "fs/promises";
31697
31829
  import { homedir as homedir14 } from "os";
31698
- import { dirname as dirname36, join as join51 } from "path";
31830
+ import { dirname as dirname37, join as join51 } from "path";
31699
31831
  var DEFAULT_TTL_MS = 24 * 60 * 60 * 1e3;
31700
31832
  var DEFAULT_TIMEOUT_MS = 300;
31701
31833
  var REGISTRY_URL = "https://registry.npmjs.org/agentwheel";
@@ -31748,7 +31880,7 @@ async function readCache(path) {
31748
31880
  }
31749
31881
  }
31750
31882
  async function writeCache(path, cache) {
31751
- await mkdir26(dirname36(path), { recursive: true });
31883
+ await mkdir26(dirname37(path), { recursive: true });
31752
31884
  await writeFile22(path, `${JSON.stringify(cache, null, 2)}
31753
31885
  `, "utf8");
31754
31886
  }
@@ -31984,11 +32116,11 @@ init_graph_lock();
31984
32116
 
31985
32117
  // src/cli/version.ts
31986
32118
  import { readFileSync as readFileSync2 } from "fs";
31987
- import { dirname as dirname37, join as join54 } from "path";
32119
+ import { dirname as dirname38, join as join54 } from "path";
31988
32120
  import { fileURLToPath as fileURLToPath3 } from "url";
31989
32121
  var FALLBACK_VERSION = "0.0.0";
31990
32122
  function resolveCliVersion() {
31991
- let dir = dirname37(fileURLToPath3(import.meta.url));
32123
+ let dir = dirname38(fileURLToPath3(import.meta.url));
31992
32124
  while (true) {
31993
32125
  try {
31994
32126
  const pkg = JSON.parse(readFileSync2(join54(dir, "package.json"), "utf8"));
@@ -31997,7 +32129,7 @@ function resolveCliVersion() {
31997
32129
  }
31998
32130
  } catch {
31999
32131
  }
32000
- const parent = dirname37(dir);
32132
+ const parent = dirname38(dir);
32001
32133
  if (parent === dir) return FALLBACK_VERSION;
32002
32134
  dir = parent;
32003
32135
  }
@@ -32906,7 +33038,7 @@ init_graph_lock();
32906
33038
  init_manifest();
32907
33039
  import { createHash as createHash26 } from "crypto";
32908
33040
  import { lstat as lstat8, readdir as readdir17 } from "fs/promises";
32909
- import { basename as basename23, dirname as dirname38, join as join57, posix as posix8, relative as relative18, resolve as resolve42 } from "path";
33041
+ import { basename as basename23, dirname as dirname39, join as join57, posix as posix8, relative as relative18, resolve as resolve42 } from "path";
32910
33042
  async function inventoryHistoricalLocks(fleetRoot) {
32911
33043
  const root = join57(fleetRoot, ".agentwheel", "locks");
32912
33044
  const found = [];
@@ -32953,7 +33085,7 @@ async function planLegacyRecovery(input) {
32953
33085
  const { graphPlan, installRoot, targetKey: targetKey2, adapter, installationType, historicalLocks, transport } = input;
32954
33086
  assertCompleteGraphPlan(graphPlan);
32955
33087
  const binding = {
32956
- targetLockDir: dirname38(graphPlan.graphLockPath),
33088
+ targetLockDir: dirname39(graphPlan.graphLockPath),
32957
33089
  stableLockPath: graphPlan.graphLockPath,
32958
33090
  stableStateKey: graphPlan.plan.stateKey,
32959
33091
  currentFingerprint: graphPlan.targetFingerprint,
@@ -33065,7 +33197,7 @@ function claimFor(item, entry, locks, binding) {
33065
33197
  const evidence = [];
33066
33198
  const owner = "workspaceOwner" in entry ? entry.workspaceOwner : legacyUnownedWorkspaceOwner;
33067
33199
  const sameRoot = binding.transportKind === "ssh" ? posix8.normalize(item.manifest.targetRoot) === posix8.normalize(binding.installRoot) : resolve42(item.manifest.targetRoot) === resolve42(binding.installRoot);
33068
- const inTargetDir = matches.filter((candidate) => resolve42(dirname38(candidate.path)) === resolve42(binding.targetLockDir));
33200
+ const inTargetDir = matches.filter((candidate) => resolve42(dirname39(candidate.path)) === resolve42(binding.targetLockDir));
33069
33201
  const boundLocks = inTargetDir.filter((candidate) => lockBindsState(candidate, item, binding));
33070
33202
  if (owner !== binding.expectedOwner) evidence.push("workspace owner differs from selected Fleet target");
33071
33203
  if (item.manifest.version !== 2 || item.manifest.installationType !== binding.installationType) evidence.push("installation type differs or manifest is legacy v1");
@@ -35114,7 +35246,7 @@ init_fleet();
35114
35246
  // src/lifecycle/fleet-normalize.ts
35115
35247
  import { createHash as createHash31 } from "crypto";
35116
35248
  import { homedir as homedir17 } from "os";
35117
- import { dirname as dirname40, isAbsolute as isAbsolute16, join as join65, relative as relative21, resolve as resolve47 } from "path";
35249
+ import { dirname as dirname41, isAbsolute as isAbsolute16, join as join65, relative as relative21, resolve as resolve47 } from "path";
35118
35250
  init_manifest2();
35119
35251
  init_paths();
35120
35252
  init_merge_removal();
@@ -35140,7 +35272,7 @@ init_caller_write_trust();
35140
35272
  import { AsyncLocalStorage } from "async_hooks";
35141
35273
  import { readFile as readLocalFile, readdir as readLocalDir, rm as removeLocal, mkdir as mkdir27, open as open6, rename as rename9 } from "fs/promises";
35142
35274
  import { randomUUID as randomUUID8 } from "crypto";
35143
- import { dirname as dirname39, isAbsolute as isAbsolute15, relative as relative20, resolve as resolve46, sep as sep11 } from "path";
35275
+ import { dirname as dirname40, isAbsolute as isAbsolute15, relative as relative20, resolve as resolve46, sep as sep11 } from "path";
35144
35276
  var contexts = new AsyncLocalStorage();
35145
35277
  var inside = (root, path) => {
35146
35278
  const rel = relative20(root, resolve46(path));
@@ -35202,7 +35334,7 @@ async function normalizationRemove(path, options) {
35202
35334
  }
35203
35335
  await assertNormalizationCallerWrite(path);
35204
35336
  await removeLocal(path, options);
35205
- if (normalizationIdentities().length) await syncMetadataPath(dirname39(path), true);
35337
+ if (normalizationIdentities().length) await syncMetadataPath(dirname40(path), true);
35206
35338
  }
35207
35339
  async function normalizationWriteJson(path, data) {
35208
35340
  const transport = normalizationTransport(path);
@@ -35216,7 +35348,7 @@ async function normalizationWriteJson(path, data) {
35216
35348
  }
35217
35349
  await assertNormalizationCallerWrite(path);
35218
35350
  await assertNoSymlinkPath2(path);
35219
- await mkdir27(dirname39(path), { recursive: true, mode: 448 });
35351
+ await mkdir27(dirname40(path), { recursive: true, mode: 448 });
35220
35352
  await assertNormalizationCallerWrite(path);
35221
35353
  const temporary = `${path}.pending-${randomUUID8()}`;
35222
35354
  try {
@@ -35230,8 +35362,8 @@ async function normalizationWriteJson(path, data) {
35230
35362
  await file2.close();
35231
35363
  }
35232
35364
  await rename9(temporary, path);
35233
- await syncMetadataPath(dirname39(path), true);
35234
- await syncMetadataPath(dirname39(dirname39(path)), true);
35365
+ await syncMetadataPath(dirname40(path), true);
35366
+ await syncMetadataPath(dirname40(dirname40(path)), true);
35235
35367
  } finally {
35236
35368
  await removeLocal(temporary, { force: true });
35237
35369
  }
@@ -36282,7 +36414,7 @@ async function releasedTargetStateForGraph(scope, graph, identityFleetId = scope
36282
36414
  ...current,
36283
36415
  stateKey,
36284
36416
  targetFingerprint,
36285
- graphLockPath: join65(dirname40(graph.path), `${targetFingerprint}.graph-lock.json`),
36417
+ graphLockPath: join65(dirname41(graph.path), `${targetFingerprint}.graph-lock.json`),
36286
36418
  manifestPath: installManifestPath(current.installRoot, current.adapter, {
36287
36419
  installationType: current.installationType,
36288
36420
  stateKey
@@ -37536,7 +37668,7 @@ ownershipCommand.command("recovery-plan").description("write a read-only per-pat
37536
37668
  const adapter = await resolveAdapterForTarget(target, {});
37537
37669
  const transport = transportForTarget(target);
37538
37670
  const requestedReport = normalizeCliPath(options.report);
37539
- const reportPath = join66(await realpath4(dirname41(requestedReport)), basename24(requestedReport));
37671
+ const reportPath = join66(await realpath4(dirname42(requestedReport)), basename24(requestedReport));
37540
37672
  const reportInsideTarget = relative22(resolve48(target.targetRoot), reportPath);
37541
37673
  if (reportInsideTarget === "" || !reportInsideTarget.startsWith("..") && !isAbsolute17(reportInsideTarget)) {
37542
37674
  throw new Error("Recovery report must be outside the runtime target root.");
@@ -40559,7 +40691,7 @@ async function initPackage(root) {
40559
40691
  await writeFile24(instructionsPath, "# Agent Instructions\n", "utf8");
40560
40692
  }
40561
40693
  async function defaultBootstrapPackage(_root) {
40562
- const packageRoot = await findAgentwheelPackageRoot(dirname41(fileURLToPath4(import.meta.url)));
40694
+ const packageRoot = await findAgentwheelPackageRoot(dirname42(fileURLToPath4(import.meta.url)));
40563
40695
  if (!packageRoot) return void 0;
40564
40696
  return {
40565
40697
  name: "agentwheel",
@@ -40606,7 +40738,7 @@ async function findAgentwheelPackageRoot(start) {
40606
40738
  let current = resolve48(start);
40607
40739
  while (true) {
40608
40740
  if (await findPackageManifestPath(current, { warnLegacy: false })) return current;
40609
- const parent = dirname41(current);
40741
+ const parent = dirname42(current);
40610
40742
  if (parent === current) return void 0;
40611
40743
  current = parent;
40612
40744
  }
package/openpack.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 2,
3
3
  "name": "NestDevLab/agentwheel",
4
- "version": "0.22.2",
4
+ "version": "0.22.3",
5
5
  "provides": [
6
6
  { "type": "skills", "path": "skills" }
7
7
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentwheel",
3
- "version": "0.22.2",
3
+ "version": "0.22.3",
4
4
  "description": "Weave skills, rules, and instructions across every AI agent.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -5,7 +5,7 @@ allowed-tools: [Bash]
5
5
  license: MIT
6
6
  metadata:
7
7
  author: NestDevLab
8
- version: "0.22.2"
8
+ version: "0.22.3"
9
9
  ---
10
10
 
11
11
  # agentwheel
@@ -5,7 +5,7 @@ allowed-tools: [Bash]
5
5
  license: MIT
6
6
  metadata:
7
7
  author: NestDevLab
8
- version: "0.22.2"
8
+ version: "0.22.3"
9
9
  ---
10
10
 
11
11
  # Agentwheel Discovery