agentwheel 0.20.2 → 0.20.4

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.
@@ -5,8 +5,8 @@ import {
5
5
  commitManifestMetadataJournal,
6
6
  recoverPendingApply,
7
7
  uninstall
8
- } from "./chunk-BAJEWUI6.js";
9
- import "./chunk-Z4N7TB6Q.js";
8
+ } from "./chunk-XL4ZATLD.js";
9
+ import "./chunk-JIATNPDH.js";
10
10
  import "./chunk-7VPI5J5Y.js";
11
11
  export {
12
12
  applyCombinedInstallPlan,
@@ -1322,6 +1322,7 @@ var workspaceProfileMemberSchema = z6.object({
1322
1322
  id: z6.string().min(1).regex(/^[a-z0-9][a-z0-9._-]*$/i),
1323
1323
  workspace: z6.string().min(1),
1324
1324
  profile: z6.string().min(1),
1325
+ fleet: fleetIdSchema.optional(),
1325
1326
  transport: z6.enum(["local", "ssh"]).default("local"),
1326
1327
  host: z6.string().min(1).optional(),
1327
1328
  user: z6.string().min(1).optional(),
@@ -2624,8 +2625,8 @@ async function recoverMutationRuntime(operationId, options = {}) {
2624
2625
  }
2625
2626
  mutation = GovernedMutation.activateExisting(receipt, baseline, lock);
2626
2627
  const [{ recoverPendingApply }, { readLinkedLocalApplyJournal: readLinkedLocalApplyJournal2, removeApplyJournal: removeApplyJournal2, localPathExists: localPathExists2 }] = await Promise.all([
2627
- import("./apply-OGC6E2Y4.js"),
2628
- import("./transaction-7CNV5MAQ.js")
2628
+ import("./apply-MGOL643W.js"),
2629
+ import("./transaction-RJ34P3B6.js")
2629
2630
  ]);
2630
2631
  let missingReservation = false;
2631
2632
  for (const entry of pending) {
@@ -24,7 +24,7 @@ import {
24
24
  rollbackCompletedOperations,
25
25
  sourceLockPath,
26
26
  writeApplyJournal
27
- } from "./chunk-Z4N7TB6Q.js";
27
+ } from "./chunk-JIATNPDH.js";
28
28
  import {
29
29
  pathExists,
30
30
  writeJsonAtomic
package/dist/index.js CHANGED
@@ -33,7 +33,7 @@ import {
33
33
  uninstall,
34
34
  withManifestRevision,
35
35
  writeInstallManifest
36
- } from "./chunk-BAJEWUI6.js";
36
+ } from "./chunk-XL4ZATLD.js";
37
37
  import {
38
38
  CURRENT_WORKSPACE_SCHEMA_VERSION,
39
39
  GovernedMutation,
@@ -94,7 +94,7 @@ import {
94
94
  workspaceSelectionImportSchema,
95
95
  writeApplyJournal,
96
96
  writeWorkspaceConfig
97
- } from "./chunk-Z4N7TB6Q.js";
97
+ } from "./chunk-JIATNPDH.js";
98
98
  import {
99
99
  inferSourceDriverName
100
100
  } from "./chunk-EMDIG24I.js";
@@ -9372,15 +9372,22 @@ async function observe(request, transport) {
9372
9372
  if (candidates.length !== 1) {
9373
9373
  throw new Error(`Destination Fleet manifest has ambiguous ownership for ${sourceEntry.path}.`);
9374
9374
  }
9375
- assertRetirableSourceEntry(sourceEntry);
9375
+ assertRetirableSourceEntry(sourceEntry, normalized.abandonIncompleteMergeOwner === true);
9376
9376
  const destinationEntry = candidates[0];
9377
- await assertContributionCoverage(sourceEntry, destinationEntry, normalized.targetRoot, transport);
9378
- const runtimeHash = await verifyManifestEntryRuntime(normalized.targetRoot, destinationEntry, transport);
9377
+ const coverage = await assertContributionCoverage(
9378
+ sourceEntry,
9379
+ destinationEntry,
9380
+ normalized.targetRoot,
9381
+ transport,
9382
+ normalized.abandonIncompleteMergeOwner === true
9383
+ );
9384
+ const runtimeHash = coverage === "abandoned-incomplete-merge" ? await transport.hashPath(containedArtifactPath(normalized.targetRoot, destinationEntry.path)) : await verifyManifestEntryRuntime(normalized.targetRoot, destinationEntry, transport);
9379
9385
  selected.push({
9380
9386
  path: sourceEntry.path,
9381
9387
  sourceEntryDigest: entryDigest(sourceEntry),
9382
9388
  destinationEntryDigest: entryDigest(destinationEntry),
9383
- runtimeHash
9389
+ runtimeHash,
9390
+ coverage
9384
9391
  });
9385
9392
  }
9386
9393
  selected.sort((a, b) => a.path.localeCompare(b.path) || a.sourceEntryDigest.localeCompare(b.sourceEntryDigest) || a.destinationEntryDigest.localeCompare(b.destinationEntryDigest));
@@ -9458,15 +9465,16 @@ async function requireManifest(request, stateKey, transport, label) {
9458
9465
  }
9459
9466
  return manifest;
9460
9467
  }
9461
- function assertRetirableSourceEntry(entry) {
9468
+ function assertRetirableSourceEntry(entry, abandonIncompleteMergeOwner) {
9462
9469
  if (entry.semanticPlugin || entry.semanticCommand || entry.executed) {
9463
9470
  throw new Error(`Cannot retire semantic source ownership at ${entry.path}.`);
9464
9471
  }
9465
- if (entry.mergeStrategy && !entry.mergeRemoval) {
9472
+ if (entry.mergeStrategy && !hasMergeRemovalContent(entry.mergeRemoval)) {
9473
+ if (abandonIncompleteMergeOwner) return;
9466
9474
  throw new Error(`Cannot retire incomplete merge ownership at ${entry.path}.`);
9467
9475
  }
9468
9476
  }
9469
- async function assertContributionCoverage(source, destination, targetRoot, transport) {
9477
+ async function assertContributionCoverage(source, destination, targetRoot, transport, abandonIncompleteMergeOwner) {
9470
9478
  const sourceManagedBlock = source.mode === "managed-block";
9471
9479
  const destinationManagedBlock = destination.mode === "managed-block";
9472
9480
  const sourceMerge = source.mergeStrategy !== void 0;
@@ -9478,24 +9486,29 @@ async function assertContributionCoverage(source, destination, targetRoot, trans
9478
9486
  `Destination Fleet ownership category ${destinationCategory} cannot replace stale source category ${sourceCategory} at ${source.path}.`
9479
9487
  );
9480
9488
  }
9481
- if (sourceCategory === "plain") return;
9489
+ if (sourceCategory === "plain") return "exact";
9482
9490
  if (sourceManagedBlock) {
9483
9491
  const sourceSelector = managedInstructionSelector(source.logicalSelector, source.artifactType, source.artifactName);
9484
9492
  const destinationSelector = managedInstructionSelector(destination.logicalSelector, destination.artifactType, destination.artifactName);
9485
9493
  if (!sourceManagedBlock || !destinationManagedBlock || sourceSelector !== destinationSelector) {
9486
9494
  throw new Error(`Destination Fleet does not exactly cover stale source managed block contribution at ${source.path}.`);
9487
9495
  }
9488
- return;
9496
+ return "exact";
9489
9497
  }
9490
9498
  if (source.mergeStrategy && destination.mergeStrategy) {
9491
- if (!source.mergeRemoval) throw new Error(`Cannot retire incomplete merge ownership at ${source.path}.`);
9492
- const exactlyCovered = destination.mergeStrategy === source.mergeStrategy && destination.mergeRemoval && contributionSelector(source) === contributionSelector(destination) && canonicalJson(source.mergeRemoval) === canonicalJson(destination.mergeRemoval);
9493
- if (exactlyCovered) return;
9499
+ if (!hasMergeRemovalContent(source.mergeRemoval)) {
9500
+ if (abandonIncompleteMergeOwner) return "abandoned-incomplete-merge";
9501
+ throw new Error(`Cannot retire incomplete merge ownership at ${source.path}.`);
9502
+ }
9503
+ const exactlyCovered = destination.mergeStrategy === source.mergeStrategy && hasMergeRemovalContent(destination.mergeRemoval) && contributionSelector(source) === contributionSelector(destination) && canonicalJson(source.mergeRemoval) === canonicalJson(destination.mergeRemoval);
9504
+ if (exactlyCovered) return "exact";
9494
9505
  const current = await transport.readFile(containedArtifactPath(targetRoot, source.path));
9495
9506
  if (!mergeContributionAbsent(source.mergeRemoval, source.mergeStrategy, current)) {
9496
9507
  throw new Error(`Destination Fleet does not exactly cover or replace stale source merge contribution at ${source.path}.`);
9497
9508
  }
9509
+ return "exact";
9498
9510
  }
9511
+ throw new Error(`Unsupported ownership coverage at ${source.path}.`);
9499
9512
  }
9500
9513
  function contributionSelector(entry) {
9501
9514
  return entry.logicalSelector ?? `${entry.artifactType}/${entry.artifactName}`;
@@ -9915,7 +9928,7 @@ async function collectMember(member, options, chain) {
9915
9928
  }
9916
9929
  }
9917
9930
  async function invokeMemberStatus(member, parentWorkspace, chain, options, cliEntry = process.argv[1]) {
9918
- const args = ["--no-update-check", "status", "--profile", member.profile, "--json"];
9931
+ const args = memberCommandArgs(member, ["status", "--profile", member.profile, "--json"]);
9919
9932
  if (options.refresh) args.push("--refresh");
9920
9933
  if (options.offline) args.push("--offline");
9921
9934
  const env2 = { ...process.env, AGENTWHEEL_COMPOSITE_CHAIN: JSON.stringify(chain) };
@@ -9967,7 +9980,7 @@ async function runMemberAgentwheel(member, parentWorkspace, args, chain) {
9967
9980
  if (member.transport === "local") {
9968
9981
  const result2 = await execFileAsync4(
9969
9982
  process.execPath,
9970
- [process.argv[1], "--no-update-check", ...args],
9983
+ [process.argv[1], ...memberCommandArgs(member, args)],
9971
9984
  {
9972
9985
  cwd: resolve22(parentWorkspace, member.workspace),
9973
9986
  env: env2,
@@ -9981,8 +9994,7 @@ async function runMemberAgentwheel(member, parentWorkspace, args, chain) {
9981
9994
  "&&",
9982
9995
  `AGENTWHEEL_COMPOSITE_CHAIN=${shellQuote2(JSON.stringify(chain))}`,
9983
9996
  "agentwheel",
9984
- "--no-update-check",
9985
- ...args.map(shellQuote2)
9997
+ ...memberCommandArgs(member, args).map(shellQuote2)
9986
9998
  ];
9987
9999
  const result = await execFileAsync4("ssh", [...sshArguments(member), remoteArgs.join(" ")], {
9988
10000
  env: env2,
@@ -9997,6 +10009,12 @@ async function runMemberAgentwheel(member, parentWorkspace, args, chain) {
9997
10009
  throw new Error(`Member ${member.id} command failed: ${detail}`);
9998
10010
  }
9999
10011
  }
10012
+ function memberCommandArgs(member, args) {
10013
+ if (!member.fleet) return ["--no-update-check", ...args];
10014
+ const [command, ...commandArgs] = args;
10015
+ if (!command) throw new Error(`Member ${member.id} command is missing.`);
10016
+ return ["--no-update-check", command, "--fleet", member.fleet, ...commandArgs];
10017
+ }
10000
10018
  function sshArguments(member) {
10001
10019
  const destination = member.user ? `${member.user}@${member.host}` : member.host;
10002
10020
  return [
@@ -12935,7 +12953,7 @@ ownershipCommand.command("handoff").description("transfer one managed artifact b
12935
12953
  console.log(`Manifest revision: ${result.manifestRevision}`);
12936
12954
  console.log(`Owner: ${result.fromOwner} -> ${result.toOwner}`);
12937
12955
  });
12938
- ownershipCommand.command("retire-stale").description("retire stale source-manifest ownership already covered by one Fleet manifest").requiredOption("--from-workspace-root <path>", "exact stale workspace owner root").requiredOption("--to-workspace-root <path>", "registered destination Fleet root").requiredOption("--source-state-key <key>", "exact source install-manifest state key").requiredOption("--fleet <id>", "registered destination Fleet").option("--adapter <adapter>", "built-in adapter").option("-i, --installation-type <type>", "installation type (for example local or user)").option("--adapter-config <path>", "adapter JSON/JSONC file").option("--adapter-module <path>", "local programmatic adapter module").option("--allow-adapter-code", "allow loading local adapter code", false).option("-t, --target-root <path>", "runtime/project root").option("--agent <name>", "named destination Fleet agent").option("--profile <name>", "destination Fleet profile resolving to one target").option("--plan-digest <sha256>", "reviewed plan digest; required with --apply").option("--expected-source-revision <sha256>", "reviewed source manifest revision; required with --apply").option("--expected-destination-revision <sha256>", "reviewed destination manifest revision; required with --apply").option("--expected-inventory-revision <sha256>", "reviewed runtime manifest inventory revision; required with --apply").option("--apply", "apply the exact reviewed metadata-only retirement", false).option("--json", "print the complete deterministic plan as JSON", false).action(async (options) => {
12956
+ ownershipCommand.command("retire-stale").description("retire stale source-manifest ownership already covered by one Fleet manifest").requiredOption("--from-workspace-root <path>", "exact stale workspace owner root").requiredOption("--to-workspace-root <path>", "registered destination Fleet root").requiredOption("--source-state-key <key>", "exact source install-manifest state key").requiredOption("--fleet <id>", "registered destination Fleet").option("--adapter <adapter>", "built-in adapter").option("-i, --installation-type <type>", "installation type (for example local or user)").option("--adapter-config <path>", "adapter JSON/JSONC file").option("--adapter-module <path>", "local programmatic adapter module").option("--allow-adapter-code", "allow loading local adapter code", false).option("-t, --target-root <path>", "runtime/project root").option("--agent <name>", "named destination Fleet agent").option("--profile <name>", "destination Fleet profile resolving to one target").option("--plan-digest <sha256>", "reviewed plan digest; required with --apply").option("--expected-source-revision <sha256>", "reviewed source manifest revision; required with --apply").option("--expected-destination-revision <sha256>", "reviewed destination manifest revision; required with --apply").option("--expected-inventory-revision <sha256>", "reviewed runtime manifest inventory revision; required with --apply").option("--abandon-incomplete-merge-owner", "explicitly retire incomplete legacy merge metadata without changing runtime bytes", false).option("--apply", "apply the exact reviewed metadata-only retirement", false).option("--json", "print the complete deterministic plan as JSON", false).action(async (options) => {
12939
12957
  const normalizedOptions = normalizeRuntimeScopeOptions(options);
12940
12958
  const fleet = await showRegisteredFleet(options.fleet);
12941
12959
  const toWorkspaceRoot = normalizeCliPath(options.toWorkspaceRoot);
@@ -12967,6 +12985,7 @@ ownershipCommand.command("retire-stale").description("retire stale source-manife
12967
12985
  expectedSourceRevision: options.expectedSourceRevision,
12968
12986
  expectedDestinationRevision: options.expectedDestinationRevision,
12969
12987
  expectedInventoryRevision: options.expectedInventoryRevision,
12988
+ abandonIncompleteMergeOwner: options.abandonIncompleteMergeOwner,
12970
12989
  transport: transportForTarget(target)
12971
12990
  };
12972
12991
  const result = options.apply ? await applyRetireStaleOwnership(request) : await planRetireStaleOwnership(request);
@@ -12989,6 +13008,7 @@ ownershipCommand.command("retire-stale").description("retire stale source-manife
12989
13008
  ...options.adapterConfig ? ["--adapter-config", options.adapterConfig] : [],
12990
13009
  ...options.adapterModule ? ["--adapter-module", options.adapterModule] : [],
12991
13010
  ...options.allowAdapterCode ? ["--allow-adapter-code"] : [],
13011
+ ...options.abandonIncompleteMergeOwner ? ["--abandon-incomplete-merge-owner"] : [],
12992
13012
  "--plan-digest",
12993
13013
  result.planDigest,
12994
13014
  "--expected-source-revision",
@@ -18,7 +18,7 @@ import {
18
18
  removeApplyJournal,
19
19
  rollbackCompletedOperations,
20
20
  writeApplyJournal
21
- } from "./chunk-Z4N7TB6Q.js";
21
+ } from "./chunk-JIATNPDH.js";
22
22
  import "./chunk-7VPI5J5Y.js";
23
23
  export {
24
24
  abortApplyJournal,
package/openpack.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 2,
3
3
  "name": "NestDevLab/agentwheel",
4
- "version": "0.20.2",
4
+ "version": "0.20.4",
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.20.2",
3
+ "version": "0.20.4",
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.20.2"
8
+ version: "0.20.4"
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.20.2"
8
+ version: "0.20.4"
9
9
  ---
10
10
 
11
11
  # Agentwheel Discovery