agentwheel 0.19.6 → 0.19.8

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
@@ -4132,7 +4132,8 @@ async function createPlanFromOperations(desiredOps, adapter, targetRoot, manifes
4132
4132
  const semanticPlugin = entry.semanticPlugin;
4133
4133
  const destPath = semanticPlugin ? targetRoot : join17(targetRoot, entry.path);
4134
4134
  if (!semanticPlugin && !await transport.pathExists(destPath)) continue;
4135
- const currentHash = semanticPlugin ? entry.hash : await currentEntryHash(entry, destPath, transport);
4135
+ const inferredMode = semanticPlugin ? void 0 : await inferExactLegacyManagedInstructionMode(entry, destPath, transport);
4136
+ const currentHash = semanticPlugin ? entry.hash : await currentEntryHash(entry, destPath, transport, inferredMode);
4136
4137
  if (workspaceOwner && !entryOwnedByWorkspace(entry, workspaceOwner)) {
4137
4138
  operations.push(keepForeignManifestEntryOperation(entry, targetRoot, workspaceOwner, void 0, currentHash));
4138
4139
  continue;
@@ -4154,7 +4155,7 @@ async function createPlanFromOperations(desiredOps, adapter, targetRoot, manifes
4154
4155
  semanticPlugin,
4155
4156
  execute: entry.executed,
4156
4157
  mergeStrategy: entry.mergeStrategy,
4157
- mode: entry.mode,
4158
+ mode: entry.mode ?? inferredMode,
4158
4159
  composedFrom: entry.composedFrom,
4159
4160
  ...operationMetadataFromEntry(entry),
4160
4161
  ...options.forceDrift ? { action: "remove", reason: "force removing drifted stale managed destination", overrideDrift: true } : {}
@@ -4176,7 +4177,7 @@ async function createPlanFromOperations(desiredOps, adapter, targetRoot, manifes
4176
4177
  semanticPlugin,
4177
4178
  execute: entry.executed,
4178
4179
  mergeStrategy: entry.mergeStrategy,
4179
- mode: entry.mode,
4180
+ mode: entry.mode ?? inferredMode,
4180
4181
  composedFrom: entry.composedFrom,
4181
4182
  ...operationMetadataFromEntry(entry)
4182
4183
  });
@@ -4361,12 +4362,19 @@ async function planManagedBlockOperation(op, manifestByPath, transport, options,
4361
4362
  reason: reasonWithComposedDiff("managed instruction source changed", op.composedFrom, existing.composedFrom)
4362
4363
  }];
4363
4364
  }
4364
- async function currentEntryHash(entry, destPath, transport) {
4365
- if (entry.mode !== managedInstructionBlockMode) return transport.hashPath(destPath);
4365
+ async function currentEntryHash(entry, destPath, transport, mode = entry.mode) {
4366
+ if (mode !== managedInstructionBlockMode) return transport.hashPath(destPath);
4366
4367
  const selector = managedInstructionSelector("logicalSelector" in entry ? entry.logicalSelector : void 0, entry.artifactType, entry.artifactName);
4367
4368
  const state = await readManagedInstructionBlockState(destPath, selector, transport);
4368
4369
  return state.hash;
4369
4370
  }
4371
+ async function inferExactLegacyManagedInstructionMode(entry, destPath, transport) {
4372
+ if (entry.mode || entry.artifactType !== "instructions") return void 0;
4373
+ const selector = managedInstructionSelector("logicalSelector" in entry ? entry.logicalSelector : void 0, entry.artifactType, entry.artifactName);
4374
+ const state = await readManagedInstructionBlockState(destPath, selector, transport);
4375
+ if (!state.hasBlock || state.drifted || state.hash !== entry.hash) return void 0;
4376
+ return managedInstructionBlockMode;
4377
+ }
4370
4378
  async function canStrictlyAdoptLegacyEntry(entry, op, targetRoot, transport) {
4371
4379
  if (entry.artifactType !== op.artifactType || entry.artifactName !== op.artifactName) return false;
4372
4380
  if (!op.desiredHash || entry.sourceHash !== op.desiredHash) return false;
@@ -7361,6 +7369,7 @@ async function expandFile(file, packageRoot, appendEntries, artifactPaths, optio
7361
7369
  const expanded = await expandContent(raw, packageRoot, [owner], artifactPaths, options);
7362
7370
  let content = expanded.content;
7363
7371
  const composedFrom = [...expanded.composedFrom];
7372
+ const appliedCompositionRules = /* @__PURE__ */ new Set();
7364
7373
  for (const external of appendEntries) {
7365
7374
  const { entry } = external;
7366
7375
  const included = await expandInclude(entry.include, external.packageRoot, external.artifactPaths, {
@@ -7371,6 +7380,12 @@ async function expandFile(file, packageRoot, appendEntries, artifactPaths, optio
7371
7380
  chain: [owner]
7372
7381
  });
7373
7382
  if (!included) continue;
7383
+ if (external.deduplicate) {
7384
+ const markerMode = entry.markers === false ? "plain" : "markers";
7385
+ const identity = `${markerMode}\0${composedLineageKey(included.composedFrom)}`;
7386
+ if (appliedCompositionRules.has(identity)) continue;
7387
+ appliedCompositionRules.add(identity);
7388
+ }
7374
7389
  content = `${content.trimEnd()}
7375
7390
 
7376
7391
  ${included.rendered}
@@ -7583,6 +7598,9 @@ function uniqueComposedFrom(entries) {
7583
7598
  const byKey = new Map(entries.map((entry) => [`${entry.selector}\0${entry.hash}`, entry]));
7584
7599
  return [...byKey.values()].sort((a, b) => `${a.selector}:${a.hash}`.localeCompare(`${b.selector}:${b.hash}`));
7585
7600
  }
7601
+ function composedLineageKey(entries) {
7602
+ return entries.map((entry) => `${entry.selector}\0${entry.hash}`).sort((a, b) => a.localeCompare(b)).join("");
7603
+ }
7586
7604
  function artifactKey(artifact) {
7587
7605
  return `${artifact.type}:${artifact.name}:${artifact.channel ?? "managed"}`;
7588
7606
  }
@@ -10062,14 +10080,16 @@ function matchingCompositionEntries(artifact, targetNodeId, runtime, rules) {
10062
10080
  if (rule.runtimes?.length && (!runtime || !rule.runtimes.includes(runtime))) continue;
10063
10081
  if (!globMatches(rule.target, selector) && !globMatches(rule.target, qualifiedSelector)) continue;
10064
10082
  if (rule.exclude?.some((pattern) => globMatches(pattern, selector) || globMatches(pattern, qualifiedSelector))) continue;
10065
- const key = `${candidate.ownerNodeId}\0${rule.include}`;
10083
+ const markerMode = rule.markers === false ? "plain" : "markers";
10084
+ const key = `${candidate.ownerNodeId}\0${rule.include}\0${markerMode}`;
10066
10085
  if (seen.has(key)) continue;
10067
10086
  seen.add(key);
10068
10087
  entries.push({
10069
10088
  entry: { include: rule.include, markers: rule.markers },
10070
10089
  packageRoot: candidate.packageRoot,
10071
10090
  artifactPaths: candidate.artifactPaths,
10072
- nodeId: candidate.ownerNodeId
10091
+ nodeId: candidate.ownerNodeId,
10092
+ deduplicate: true
10073
10093
  });
10074
10094
  }
10075
10095
  return entries;
package/openpack.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 2,
3
3
  "name": "NestDevLab/agentwheel",
4
- "version": "0.19.6",
4
+ "version": "0.19.8",
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.19.6",
3
+ "version": "0.19.8",
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.19.6"
8
+ version: "0.19.8"
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.19.6"
8
+ version: "0.19.8"
9
9
  ---
10
10
 
11
11
  # Agentwheel Discovery