agentwheel 0.20.18 → 0.20.20

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/README.md CHANGED
@@ -132,6 +132,12 @@ Apply the same command with the reviewed values added as `--expected-hash <sha25
132
132
  journal, rechecks the old owner and the live artifact hash, then atomically updates only the install
133
133
  manifest. Run one target at a time; named SSH agents use the same contract through `--agent`.
134
134
 
135
+ Use `--from-unknown-owner` instead of `--from-workspace-root` for an entry recorded as
136
+ `workspace:unknown`. A plain file or directory whose runtime no longer matches the recorded hash is
137
+ refused unless `--carry-drift` is passed: the dry-run prints the runtime hash, the apply also needs
138
+ `--expected-runtime-hash <sha256>`, and the manifest keeps the recorded hash so the next install
139
+ still reports the drift. Merge and managed-block entries never carry drift.
140
+
135
141
  For a one-time MCP rename, keep the legacy artifact in a dedicated cutover workspace rather than
136
142
  the canonical desired-state profile. Set the legacy manifest `stateKey` on its named agent, then
137
143
  preview one runtime at a time:
@@ -638,6 +644,11 @@ project's curated selection for a remote runtime.
638
644
  }
639
645
  ```
640
646
 
647
+ Configured packages can opt into adapter runtimes with `"runtimes": ["claude"]`. Profile and
648
+ named-agent plans match the declared target adapter; plain workspace commands match each package's
649
+ configured adapter. Agents sharing an adapter receive the same package roots. Upgrade every member
650
+ to a version supporting this field before using it in shared configuration.
651
+
641
652
  The import is data-only: Agentwheel resolves the package first, then reads only
642
653
  `exports.selections` from that resolved source's `.agentwheel/config.json`. It never imports the
643
654
  source project's agents, profiles, SSH fields, adapter modules, trust policy, or other workspace
@@ -5,9 +5,9 @@ import {
5
5
  commitManifestMetadataJournal,
6
6
  recoverPendingApply,
7
7
  uninstall
8
- } from "./chunk-A44XYLUT.js";
9
- import "./chunk-FP26KSBM.js";
10
- import "./chunk-GE7F76AC.js";
8
+ } from "./chunk-45WVSUJA.js";
9
+ import "./chunk-FGFPAZ4J.js";
10
+ import "./chunk-BNIF3FUR.js";
11
11
  export {
12
12
  applyCombinedInstallPlan,
13
13
  applyInstallPlan,
@@ -24,11 +24,11 @@ import {
24
24
  rollbackCompletedOperations,
25
25
  sourceLockPath,
26
26
  writeApplyJournal
27
- } from "./chunk-FP26KSBM.js";
27
+ } from "./chunk-FGFPAZ4J.js";
28
28
  import {
29
29
  pathExists,
30
30
  writeJsonAtomic
31
- } from "./chunk-GE7F76AC.js";
31
+ } from "./chunk-BNIF3FUR.js";
32
32
 
33
33
  // src/install/apply.ts
34
34
  import { execFile } from "child_process";
@@ -24,6 +24,14 @@ async function pathExists(path) {
24
24
  return false;
25
25
  }
26
26
  }
27
+ async function removeOnFailure(path, run) {
28
+ try {
29
+ return await run();
30
+ } catch (error) {
31
+ await rm(path, { recursive: true, force: true });
32
+ throw error;
33
+ }
34
+ }
27
35
  async function hashPath(path) {
28
36
  const stats = await stat(path);
29
37
  if (stats.isFile()) {
@@ -129,6 +137,7 @@ function isAlreadyExists(error) {
129
137
 
130
138
  export {
131
139
  pathExists,
140
+ removeOnFailure,
132
141
  hashPath,
133
142
  listFiles,
134
143
  isIgnoredGeneratedEntry,
@@ -4,7 +4,7 @@ import {
4
4
  hashPath,
5
5
  pathExists,
6
6
  writeJsonAtomic
7
- } from "./chunk-GE7F76AC.js";
7
+ } from "./chunk-BNIF3FUR.js";
8
8
 
9
9
  // src/install/transaction.ts
10
10
  import { createHash as createHash6 } from "crypto";
@@ -1525,6 +1525,188 @@ function readMutationPathDeclarations(operationIdInput) {
1525
1525
  return [...paths].sort((a, b) => a.localeCompare(b));
1526
1526
  }
1527
1527
 
1528
+ // src/adapters/claude.ts
1529
+ var claudeAdapter = {
1530
+ name: "claude",
1531
+ displayName: "Claude Code",
1532
+ targets: {
1533
+ instructions: {
1534
+ local: { enabled: true, dest: "CLAUDE.md", mode: "managed-block" },
1535
+ user: { enabled: true, root: "home", dest: ".claude/CLAUDE.md", mode: "managed-block" }
1536
+ },
1537
+ rules: {
1538
+ local: { enabled: true, dest: ".claude/rules", formats: ["markdown-rule", "claude-markdown-rule"] },
1539
+ user: { enabled: true, root: "home", dest: ".claude/rules", formats: ["markdown-rule", "claude-markdown-rule"] }
1540
+ },
1541
+ skills: {
1542
+ local: { enabled: true, dest: ".claude/skills" },
1543
+ user: { enabled: true, root: "home", dest: ".claude/skills" }
1544
+ },
1545
+ commands: {
1546
+ local: { enabled: true, dest: ".claude/commands" },
1547
+ user: { enabled: true, root: "home", dest: ".claude/commands" }
1548
+ },
1549
+ subagents: {
1550
+ local: { enabled: true, dest: ".claude/agents" },
1551
+ user: { enabled: true, root: "home", dest: ".claude/agents" }
1552
+ },
1553
+ plugins: {
1554
+ local: { enabled: true, dest: ".agentwheel/plugins/claude", semantic: "claude-plugin" },
1555
+ user: { enabled: true, root: "home", dest: ".agentwheel/plugins/claude", semantic: "claude-plugin" }
1556
+ },
1557
+ mcp: {
1558
+ local: { enabled: true, dest: ".mcp.json", merge: "json-deep" }
1559
+ },
1560
+ hooks: {
1561
+ local: { enabled: true, dest: ".claude/settings.json", merge: "json-deep" },
1562
+ user: { enabled: true, root: "home", dest: ".claude/settings.json", merge: "json-deep" }
1563
+ },
1564
+ settings: {
1565
+ local: { enabled: true, dest: ".claude/settings.json", merge: "json-deep" },
1566
+ user: { enabled: true, root: "home", dest: ".claude/settings.json", merge: "json-deep" }
1567
+ }
1568
+ }
1569
+ };
1570
+
1571
+ // src/adapters/copilot.ts
1572
+ var copilotAdapter = {
1573
+ name: "copilot",
1574
+ displayName: "GitHub Copilot CLI",
1575
+ targets: {
1576
+ instructions: {
1577
+ local: { enabled: true, dest: ".github/copilot-instructions.md", mode: "managed-block" },
1578
+ user: { enabled: true, root: "home", dest: ".copilot/copilot-instructions.md", mode: "managed-block" }
1579
+ },
1580
+ rules: {
1581
+ local: { enabled: true, dest: ".github/instructions", formats: ["markdown-rule", "copilot-instruction-rule"], semantic: "copilot-instruction" },
1582
+ user: { enabled: true, root: "home", dest: ".copilot/instructions", formats: ["markdown-rule", "copilot-instruction-rule"], semantic: "copilot-instruction" }
1583
+ },
1584
+ commands: {
1585
+ local: { enabled: true, dest: ".github/prompts", semantic: "copilot-prompt" }
1586
+ },
1587
+ skills: {
1588
+ local: { enabled: true, dest: ".github/skills" },
1589
+ user: { enabled: true, root: "home", dest: ".copilot/skills" }
1590
+ },
1591
+ plugins: {
1592
+ user: { enabled: true, root: "home", dest: ".agentwheel/plugins/copilot", semantic: "copilot-plugin" }
1593
+ },
1594
+ subagents: {
1595
+ local: { enabled: true, dest: ".github/agents", semantic: "copilot-agent" },
1596
+ user: { enabled: true, root: "home", dest: ".copilot/agents", semantic: "copilot-agent" }
1597
+ },
1598
+ mcp: {
1599
+ local: { enabled: true, dest: ".github/mcp.json", merge: "json-deep" },
1600
+ user: { enabled: true, root: "home", dest: ".copilot/mcp-config.json", merge: "json-deep" }
1601
+ },
1602
+ hooks: {
1603
+ local: { enabled: true, dest: ".github/hooks" },
1604
+ user: { enabled: true, root: "home", dest: ".copilot/hooks" }
1605
+ },
1606
+ settings: {
1607
+ local: { enabled: true, dest: ".github/settings.json", merge: "json-deep" },
1608
+ user: { enabled: true, root: "home", dest: ".copilot/settings.json", merge: "json-deep" }
1609
+ }
1610
+ }
1611
+ };
1612
+
1613
+ // src/adapters/codex.ts
1614
+ var codexAdapter = {
1615
+ name: "codex",
1616
+ displayName: "Codex CLI",
1617
+ targets: {
1618
+ instructions: {
1619
+ local: { enabled: true, dest: "AGENTS.md", mode: "managed-block" },
1620
+ user: { enabled: true, root: "home", dest: ".codex/AGENTS.md", mode: "managed-block" }
1621
+ },
1622
+ skills: {
1623
+ local: { enabled: true, dest: ".agents/skills" },
1624
+ user: { enabled: true, root: "home", dest: ".agents/skills" }
1625
+ },
1626
+ plugins: {
1627
+ local: { enabled: true, dest: ".agentwheel/plugins/codex", semantic: "codex-plugin" },
1628
+ user: { enabled: true, root: "home", dest: ".agentwheel/plugins/codex", semantic: "codex-plugin" }
1629
+ },
1630
+ subagents: {
1631
+ local: { enabled: true, dest: ".codex/agents", semantic: "codex-subagent" },
1632
+ user: { enabled: true, root: "home", dest: ".codex/agents", semantic: "codex-subagent" }
1633
+ },
1634
+ mcp: {
1635
+ local: { enabled: true, dest: ".codex/config.toml", merge: "codex-toml-mcp" },
1636
+ user: { enabled: true, root: "home", dest: ".codex/config.toml", merge: "codex-toml-mcp" }
1637
+ },
1638
+ hooks: {
1639
+ local: { enabled: true, dest: ".codex/hooks.json", merge: "json-deep" },
1640
+ user: { enabled: true, root: "home", dest: ".codex/hooks.json", merge: "json-deep" }
1641
+ }
1642
+ }
1643
+ };
1644
+
1645
+ // src/adapters/hermes.ts
1646
+ var hermesAdapter = {
1647
+ name: "hermes",
1648
+ displayName: "Hermes",
1649
+ targets: {
1650
+ instructions: {
1651
+ local: { enabled: true, dest: "AGENTS.md", mode: "managed-block" },
1652
+ // Hermes documents SOUL.md as the user-level instruction surface.
1653
+ user: { enabled: true, root: "home", dest: ".hermes/SOUL.md", mode: "managed-block" }
1654
+ },
1655
+ skills: {
1656
+ user: { enabled: true, root: "home", dest: ".hermes/skills" }
1657
+ },
1658
+ mcp: {
1659
+ user: { enabled: true, root: "home", dest: ".hermes/config.yaml", merge: "yaml-deep" }
1660
+ },
1661
+ settings: {
1662
+ user: { enabled: true, root: "home", dest: ".hermes/config.yaml", merge: "yaml-deep" }
1663
+ },
1664
+ plugins: {
1665
+ user: { enabled: true, root: "home", dest: ".agentwheel/plugins/hermes", semantic: "hermes-plugin" }
1666
+ }
1667
+ }
1668
+ };
1669
+
1670
+ // src/adapters/openclaw.ts
1671
+ var openClawAdapter = {
1672
+ name: "openclaw",
1673
+ displayName: "OpenClaw",
1674
+ targets: {
1675
+ instructions: {
1676
+ user: { enabled: true, root: "home", dest: ".openclaw/workspace/AGENTS.md", mode: "managed-block" }
1677
+ },
1678
+ skills: {
1679
+ local: { enabled: true, dest: "skills" },
1680
+ user: { enabled: true, root: "home", dest: ".openclaw/skills" }
1681
+ },
1682
+ subagents: {
1683
+ user: { enabled: true, root: "home", dest: ".openclaw/workspace-subagents", semantic: "openclaw-subagent" }
1684
+ },
1685
+ mcp: {
1686
+ user: { enabled: true, root: "home", dest: ".openclaw/openclaw.json", merge: "openclaw-json-deep" }
1687
+ },
1688
+ settings: {
1689
+ user: { enabled: true, root: "home", dest: ".openclaw/openclaw.json", merge: "openclaw-json-deep" }
1690
+ },
1691
+ plugins: {
1692
+ local: { enabled: true, dest: ".openclaw/plugins", formats: ["openclaw-plugin", "openclaw-clawhub-plugin"], semantic: "openclaw-plugin" }
1693
+ }
1694
+ }
1695
+ };
1696
+
1697
+ // src/adapters/index.ts
1698
+ var adapters = [openClawAdapter, claudeAdapter, codexAdapter, hermesAdapter, copilotAdapter];
1699
+ function getAdapter(name) {
1700
+ const adapter = adapters.find((candidate) => candidate.name === name);
1701
+ if (!adapter) {
1702
+ throw new Error(`Unknown adapter: ${name}`);
1703
+ }
1704
+ return adapter;
1705
+ }
1706
+ function listAdapters() {
1707
+ return [...adapters];
1708
+ }
1709
+
1528
1710
  // src/model/workspace.ts
1529
1711
  var artifactSelectorListSchema = z7.array(z7.string().min(1));
1530
1712
  var CURRENT_WORKSPACE_SCHEMA_VERSION = 4;
@@ -1562,6 +1744,9 @@ var workspacePackageBaseSchema = z7.object({
1562
1744
  source: z7.string().min(1),
1563
1745
  driver: z7.enum(["local", "git", "skillkit", "vercel-skills", "mcp-registry", "clawhub"]).default("local"),
1564
1746
  adapter: z7.string().min(1).default("openclaw"),
1747
+ runtimes: z7.array(z7.string().min(1)).min(1).refine((runtimes) => new Set(runtimes).size === runtimes.length, {
1748
+ message: "Package runtimes must be unique."
1749
+ }).transform((runtimes) => [...runtimes].sort()).optional(),
1565
1750
  adapterConfig: z7.string().min(1).optional(),
1566
1751
  adapterModule: z7.string().min(1).optional(),
1567
1752
  adapterCodeHash: z7.string().min(16).optional(),
@@ -1726,7 +1911,25 @@ var workspaceConfigSchema = z7.discriminatedUnion("schemaVersion", [
1726
1911
  workspaceConfigV2Schema,
1727
1912
  workspaceConfigV3Schema,
1728
1913
  workspaceConfigV4Schema
1729
- ]);
1914
+ ]).superRefine((config, ctx) => {
1915
+ const known = /* @__PURE__ */ new Set([
1916
+ ...listAdapters().map((adapter) => adapter.name),
1917
+ ...Object.values(config.agents).map((agent) => agent.adapter),
1918
+ ...Object.values(config.profiles).flatMap((profile) => "runtimes" in profile && profile.runtimes ? profile.runtimes.map((runtime) => runtime.agent ? config.agents[runtime.agent]?.adapter ?? runtime.adapter : runtime.adapter) : [])
1919
+ ]);
1920
+ for (const [index, pkg] of config.packages.entries()) {
1921
+ for (const [runtimeIndex, runtime] of (pkg.runtimes ?? []).entries()) {
1922
+ if (!known.has(runtime)) ctx.addIssue({
1923
+ code: "custom",
1924
+ path: ["packages", index, "runtimes", runtimeIndex],
1925
+ message: `Unknown package runtime adapter '${runtime}'. Use a built-in adapter or an adapter declared by an agent/profile runtime.`
1926
+ });
1927
+ }
1928
+ }
1929
+ });
1930
+ function packagesForTarget(packages, target, targetForPackage) {
1931
+ return packages.filter((pkg) => !pkg.runtimes || pkg.runtimes.includes((targetForPackage?.(pkg) ?? target).adapter));
1932
+ }
1730
1933
  function supportsFleetConfig(config) {
1731
1934
  return config.schemaVersion === 3 || config.schemaVersion === 4;
1732
1935
  }
@@ -2865,8 +3068,8 @@ async function recoverMutationRuntime(operationId, options = {}) {
2865
3068
  }
2866
3069
  mutation = GovernedMutation.activateExisting(receipt, baseline, lock);
2867
3070
  const [{ recoverPendingApply }, { readLinkedLocalApplyJournal: readLinkedLocalApplyJournal2, removeApplyJournal: removeApplyJournal2, localPathExists: localPathExists2 }] = await Promise.all([
2868
- import("./apply-ZGCJLZMZ.js"),
2869
- import("./transaction-4KBNHDQX.js")
3071
+ import("./apply-Z5GVCPA4.js"),
3072
+ import("./transaction-NLAIJ2ZZ.js")
2870
3073
  ]);
2871
3074
  let missingReservation = false;
2872
3075
  for (const entry of pending) {
@@ -3361,6 +3564,7 @@ export {
3361
3564
  installRootForArtifacts,
3362
3565
  installRootForAdapterInstallationType,
3363
3566
  loadAdapterConfig,
3567
+ getAdapter,
3364
3568
  readMutationReceipt,
3365
3569
  listMutationReceipts,
3366
3570
  declareMutationPath,
@@ -3380,6 +3584,7 @@ export {
3380
3584
  fleetIdSchema,
3381
3585
  registeredFleetSchema,
3382
3586
  workspaceConfigSchema,
3587
+ packagesForTarget,
3383
3588
  supportsFleetConfig,
3384
3589
  workspaceConfigPath,
3385
3590
  readWorkspaceConfig,
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  pathExists
4
- } from "./chunk-GE7F76AC.js";
4
+ } from "./chunk-BNIF3FUR.js";
5
5
 
6
6
  // src/source/identify.ts
7
7
  import { homedir } from "os";
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  inferSourceDriverName,
4
4
  isExplicitSource
5
- } from "./chunk-U2GRG4UI.js";
6
- import "./chunk-GE7F76AC.js";
5
+ } from "./chunk-QABA4WUP.js";
6
+ import "./chunk-BNIF3FUR.js";
7
7
  export {
8
8
  inferSourceDriverName,
9
9
  isExplicitSource