hostctl 0.1.57 → 0.1.59

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
@@ -6,7 +6,7 @@ var __export = (target, all) => {
6
6
 
7
7
  // src/app.ts
8
8
  import process4 from "process";
9
- import * as fs11 from "fs";
9
+ import * as fs12 from "fs";
10
10
  import { homedir as homedir3 } from "os";
11
11
 
12
12
  // src/handlebars.ts
@@ -1831,8 +1831,12 @@ var TmpFileRegistry = class _TmpFileRegistry {
1831
1831
  constructor(rootPath) {
1832
1832
  this.rootPath = Path.new(rootPath);
1833
1833
  this.tempFilePaths = [];
1834
+ this.ensureRootPathExists();
1834
1835
  process2.on("exit", (code) => this.exitCallback());
1835
1836
  }
1837
+ ensureRootPathExists() {
1838
+ fs.mkdirSync(this.rootPath.toString(), { recursive: true });
1839
+ }
1836
1840
  randName() {
1837
1841
  return Math.random().toString(36).slice(-5) + Math.random().toString(36).slice(-5);
1838
1842
  }
@@ -1849,6 +1853,7 @@ var TmpFileRegistry = class _TmpFileRegistry {
1849
1853
  }
1850
1854
  // this file will be automatically cleaned up at program exit
1851
1855
  writeTmpFile(fileContent) {
1856
+ this.ensureRootPathExists();
1852
1857
  const path14 = this.tmpPath();
1853
1858
  fs.writeFileSync(path14.toString(), fileContent);
1854
1859
  this.registerTempFileOrDir(path14.toString());
@@ -1890,6 +1895,7 @@ var Host = class {
1890
1895
  this.user = opts.user;
1891
1896
  this.password = opts.password;
1892
1897
  this.sshKey = opts.sshKey;
1898
+ this.sshKeyPassphrase = opts.sshKeyPassphrase;
1893
1899
  this.tags = opts.tags ?? [];
1894
1900
  this.tagSet = new Set(this.tags);
1895
1901
  }
@@ -1901,6 +1907,7 @@ var Host = class {
1901
1907
  user;
1902
1908
  password;
1903
1909
  sshKey;
1910
+ sshKeyPassphrase;
1904
1911
  tags;
1905
1912
  tagSet;
1906
1913
  async decryptedPassword() {
@@ -1920,6 +1927,16 @@ var Host = class {
1920
1927
  return await secret?.plaintext();
1921
1928
  }
1922
1929
  }
1930
+ async decryptedSshKeyPassphrase() {
1931
+ if (V(this.sshKeyPassphrase).isA(SecretRef)) {
1932
+ const secretRef = this.sshKeyPassphrase;
1933
+ const secret = this.config.getSecret(secretRef.name);
1934
+ return await secret?.plaintext();
1935
+ }
1936
+ if (typeof this.sshKeyPassphrase === "string") {
1937
+ return this.sshKeyPassphrase;
1938
+ }
1939
+ }
1923
1940
  toYAML() {
1924
1941
  let passwordForYaml = this.password;
1925
1942
  if (this.password && V(this.password).isA(SecretRef)) {
@@ -1929,6 +1946,10 @@ var Host = class {
1929
1946
  if (this.sshKey && V(this.sshKey).isA(SecretRef)) {
1930
1947
  sshKeyForYaml = this.sshKey.toYAML();
1931
1948
  }
1949
+ let sshKeyPassphraseForYaml = this.sshKeyPassphrase;
1950
+ if (this.sshKeyPassphrase && V(this.sshKeyPassphrase).isA(SecretRef)) {
1951
+ sshKeyPassphraseForYaml = this.sshKeyPassphrase.toYAML();
1952
+ }
1932
1953
  return {
1933
1954
  host: this.hostname,
1934
1955
  // Always include the host field
@@ -1937,6 +1958,7 @@ var Host = class {
1937
1958
  // Only include port if not default
1938
1959
  password: passwordForYaml,
1939
1960
  "ssh-key": sshKeyForYaml,
1961
+ "ssh-key-passphrase": sshKeyPassphraseForYaml,
1940
1962
  tags: this.tags
1941
1963
  };
1942
1964
  }
@@ -2288,6 +2310,7 @@ var ConfigFile2 = class {
2288
2310
  hostObj ||= {};
2289
2311
  const password = this.parseSecretValue(hostObj.password);
2290
2312
  const sshKey = this.parseSecretValue(hostObj["ssh-key"]);
2313
+ const sshKeyPassphrase = this.parseSecretValue(hostObj["ssh-key-passphrase"]);
2291
2314
  const hostname = hostObj.host || alias;
2292
2315
  hostMap.set(
2293
2316
  alias,
@@ -2302,6 +2325,7 @@ var ConfigFile2 = class {
2302
2325
  user: hostObj.user,
2303
2326
  password,
2304
2327
  sshKey,
2328
+ sshKeyPassphrase,
2305
2329
  tags: hostObj.tags
2306
2330
  })
2307
2331
  );
@@ -2476,6 +2500,7 @@ var ProviderConfig = class _ProviderConfig {
2476
2500
  user: input.user,
2477
2501
  password: input.password,
2478
2502
  sshKey: input.sshKey,
2503
+ sshKeyPassphrase: input.sshKeyPassphrase,
2479
2504
  tags: input.tags
2480
2505
  });
2481
2506
  }
@@ -2519,6 +2544,7 @@ var FileConfigProvider = class {
2519
2544
  port: h.port,
2520
2545
  password: h.password,
2521
2546
  sshKey: h.sshKey,
2547
+ sshKeyPassphrase: h.sshKeyPassphrase,
2522
2548
  tags: h.tags
2523
2549
  }));
2524
2550
  }
@@ -2719,7 +2745,7 @@ var Verbosity = {
2719
2745
  };
2720
2746
 
2721
2747
  // src/version.ts
2722
- var version = "0.1.57";
2748
+ var version = "0.1.59";
2723
2749
 
2724
2750
  // src/commands/pkg/create.ts
2725
2751
  import { promises as fs5 } from "fs";
@@ -4150,9 +4176,13 @@ function task(runFn4, options) {
4150
4176
  options?.outputSchema
4151
4177
  );
4152
4178
  const taskFnObject = function(params) {
4153
- return function(parentInvocation) {
4154
- return parentInvocation.invokeChildTask(taskFnObject, params ?? {});
4179
+ const normalizedParams = params ?? {};
4180
+ const taskPartialFn = function(parentInvocation) {
4181
+ return parentInvocation.invokeChildTask(taskFnObject, normalizedParams);
4155
4182
  };
4183
+ taskPartialFn.taskFn = taskFnObject;
4184
+ taskPartialFn.params = normalizedParams;
4185
+ return taskPartialFn;
4156
4186
  };
4157
4187
  Object.assign(taskFnObject, { task: taskInstance });
4158
4188
  return taskFnObject;
@@ -4808,7 +4838,7 @@ var DirCreateOutputSchema = z.object({
4808
4838
  })
4809
4839
  );
4810
4840
  async function runFn(context) {
4811
- const { params, exec, run: run253 } = context;
4841
+ const { params, exec, run: run249 } = context;
4812
4842
  const sudoDefault = context.host ? !context.host.isLocal() : false;
4813
4843
  const { path: path14, mode, owner, sudo = sudoDefault } = params;
4814
4844
  if (!path14) {
@@ -4832,7 +4862,7 @@ async function runFn(context) {
4832
4862
  }
4833
4863
  }
4834
4864
  if (mode) {
4835
- const chmodResult = await run253(chmod_default({ path: path14, mode, sudo: true }));
4865
+ const chmodResult = await run249(chmod_default({ path: path14, mode, sudo: true }));
4836
4866
  if (!chmodResult?.success) {
4837
4867
  return { success: false, error: chmodResult?.error ?? "Failed to set directory mode" };
4838
4868
  }
@@ -5425,7 +5455,7 @@ async function ensureFile(context, file, sudo) {
5425
5455
  await exec(["touch", file], { sudo });
5426
5456
  }
5427
5457
  async function runFn2(context) {
5428
- const { params, exec, info, run: run253, error } = context;
5458
+ const { params, exec, info, run: run249, error } = context;
5429
5459
  const {
5430
5460
  file,
5431
5461
  state = "present",
@@ -6112,7 +6142,7 @@ async function getOsReleaseInfo(exec) {
6112
6142
  const cpeMatch = osRelease.match(/^CPE_NAME=(.*?)$/im);
6113
6143
  if (idMatch) {
6114
6144
  let id = idMatch[1].trim().replace(/"/g, "");
6115
- const idLike = idLikeMatch ? idLikeMatch[1].trim().replace(/"/g, "") : id;
6145
+ let idLike = idLikeMatch ? idLikeMatch[1].trim().replace(/"/g, "") : id;
6116
6146
  const version2 = versionIdMatch && versionIdMatch[1].trim().replace(/"/g, "") || buildIdMatch && buildIdMatch[1].trim().replace(/"/g, "") || "unknown";
6117
6147
  const nameValue = nameMatch ? nameMatch[1].trim().replace(/"/g, "") : "";
6118
6148
  const prettyName = prettyNameMatch ? prettyNameMatch[1].trim().replace(/"/g, "") : "";
@@ -6121,6 +6151,10 @@ async function getOsReleaseInfo(exec) {
6121
6151
  if (normalizedName.includes("rocky") || idLike.toLowerCase().includes("rocky")) {
6122
6152
  id = "rocky";
6123
6153
  }
6154
+ if (normalizedName.includes("xcp-ng") || id.toLowerCase() === "xenenterprise") {
6155
+ id = "xcp-ng";
6156
+ idLike = "xcp-ng";
6157
+ }
6124
6158
  return {
6125
6159
  idLike,
6126
6160
  id,
@@ -6140,6 +6174,53 @@ async function getOsReleaseInfo(exec) {
6140
6174
  };
6141
6175
  }
6142
6176
  }
6177
+ function parseKeyValueFile(contents) {
6178
+ return contents.split("\n").map((line) => line.trim()).filter(Boolean).reduce((acc, line) => {
6179
+ const match7 = line.match(/^([A-Za-z0-9_]+)=(.*)$/);
6180
+ if (!match7) {
6181
+ return acc;
6182
+ }
6183
+ const key = match7[1];
6184
+ const rawValue = match7[2];
6185
+ const value = rawValue.replace(/^"(.*)"$/, "$1");
6186
+ acc[key] = value;
6187
+ return acc;
6188
+ }, {});
6189
+ }
6190
+ async function detectSynologyInfo(exec) {
6191
+ try {
6192
+ const { stdout } = await exec(["cat", "/etc.defaults/VERSION"]);
6193
+ const values3 = parseKeyValueFile(stdout);
6194
+ const version2 = values3.productversion || values3.version || `${values3.major || ""}.${values3.minor || ""}`.trim();
6195
+ if (!version2 || version2 === ".") {
6196
+ return null;
6197
+ }
6198
+ return {
6199
+ idLike: "synology",
6200
+ id: "synology",
6201
+ version: version2
6202
+ };
6203
+ } catch {
6204
+ return null;
6205
+ }
6206
+ }
6207
+ async function detectXcpNgInfo(exec) {
6208
+ try {
6209
+ const { stdout } = await exec(["cat", "/etc/redhat-release"]);
6210
+ if (!stdout.toLowerCase().includes("xcp-ng")) {
6211
+ return null;
6212
+ }
6213
+ const versionMatch = stdout.match(/([0-9]+(?:\.[0-9]+)+)/);
6214
+ const version2 = versionMatch ? versionMatch[1] : "unknown";
6215
+ return {
6216
+ idLike: "xcp-ng",
6217
+ id: "xcp-ng",
6218
+ version: version2
6219
+ };
6220
+ } catch {
6221
+ return null;
6222
+ }
6223
+ }
6143
6224
  async function detectRockyLinux(exec) {
6144
6225
  try {
6145
6226
  const { stdout } = await exec([
@@ -6154,58 +6235,74 @@ async function detectRockyLinux(exec) {
6154
6235
  }
6155
6236
  var os_default = task(
6156
6237
  async function run26(context) {
6157
- try {
6158
- const { exec } = context;
6159
- const {
6160
- success: ostypeSuccess,
6161
- stdout: ostypeOutput,
6162
- stderr: ostypeStderr
6163
- } = await exec(["bash", "-c", "echo $OSTYPE"]);
6164
- if (!ostypeSuccess) {
6165
- throw new Error(`Failed to get OSTYPE: ${ostypeStderr}`);
6166
- }
6167
- const family = await match3(ostypeOutput.trim().toLowerCase()).with(P2.string.startsWith("solaris"), () => "solaris").with(P2.string.startsWith("darwin"), () => "darwin").with(P2.string.startsWith("linux"), () => "linux").with(P2.string.startsWith("bsd"), () => "bsd").with(P2.string.startsWith("freebsd"), () => "bsd").with(P2.string.startsWith("msys"), () => "windows").with(P2.string.startsWith("cygwin"), () => "windows").with(P2.string.startsWith("mingw"), () => "windows").otherwise(async () => {
6168
- const { stdout: unameOutput } = await exec(["uname"]);
6169
- const unameFamily = match3(unameOutput.trim().toLowerCase()).with(P2.string.startsWith("sunos"), () => "solaris").with(P2.string.startsWith("darwin"), () => "darwin").with(P2.string.startsWith("linux"), () => "linux").with(P2.string.startsWith("freebsd"), () => "bsd").with(P2.string.startsWith("openbsd"), () => "bsd").with(P2.string.startsWith("netbsd"), () => "bsd").otherwise(() => "unknown");
6170
- return unameFamily;
6171
- });
6172
- const [osIdLike, osId, osVersion] = await match3(family).with("bsd", async () => {
6173
- const { stdout: unameROutput } = await exec(["uname", "-r"]);
6174
- return [family, family, unameROutput.trim()];
6175
- }).with("darwin", async () => {
6176
- const { stdout: swVersOutput } = await exec(["sw_vers", "-productVersion"]);
6177
- return [family, family, swVersOutput.trim()];
6178
- }).with("linux", async () => {
6179
- const { idLike, id, version: version2 } = await getOsReleaseInfo(exec);
6180
- return [idLike, id, version2];
6181
- }).with("solaris", async () => {
6182
- const { stdout: unameROutput } = await exec(["uname", "-r"]);
6183
- return ["solaris", "solaris", unameROutput.trim()];
6184
- }).with("windows", () => ["windows", "windows", "unknown"]).otherwise(() => ["unknown", "unknown", "unknown"]);
6185
- let variant = osId.toLowerCase();
6186
- if (family === "linux" && !variant.includes("rocky") && (osIdLike.toLowerCase().includes("rocky") || osId.toLowerCase().includes("rhel"))) {
6187
- const isRocky = await detectRockyLinux(exec);
6188
- if (isRocky) {
6189
- variant = "rocky";
6238
+ return await context.memoize(
6239
+ "core.host.os:v1",
6240
+ async () => {
6241
+ try {
6242
+ const { exec } = context;
6243
+ const {
6244
+ success: ostypeSuccess,
6245
+ stdout: ostypeOutput,
6246
+ stderr: ostypeStderr
6247
+ } = await exec(["bash", "-c", "echo $OSTYPE"]);
6248
+ if (!ostypeSuccess) {
6249
+ throw new Error(`Failed to get OSTYPE: ${ostypeStderr}`);
6250
+ }
6251
+ const family = await match3(ostypeOutput.trim().toLowerCase()).with(P2.string.startsWith("solaris"), () => "solaris").with(P2.string.startsWith("darwin"), () => "darwin").with(P2.string.startsWith("linux"), () => "linux").with(P2.string.startsWith("bsd"), () => "bsd").with(P2.string.startsWith("freebsd"), () => "bsd").with(P2.string.startsWith("msys"), () => "windows").with(P2.string.startsWith("cygwin"), () => "windows").with(P2.string.startsWith("mingw"), () => "windows").otherwise(async () => {
6252
+ const { stdout: unameOutput } = await exec(["uname"]);
6253
+ const unameFamily = match3(unameOutput.trim().toLowerCase()).with(P2.string.startsWith("sunos"), () => "solaris").with(P2.string.startsWith("darwin"), () => "darwin").with(P2.string.startsWith("linux"), () => "linux").with(P2.string.startsWith("freebsd"), () => "bsd").with(P2.string.startsWith("openbsd"), () => "bsd").with(P2.string.startsWith("netbsd"), () => "bsd").otherwise(() => "unknown");
6254
+ return unameFamily;
6255
+ });
6256
+ const [osIdLike, osId, osVersion] = await match3(family).with("bsd", async () => {
6257
+ const { stdout: unameROutput } = await exec(["uname", "-r"]);
6258
+ return [family, family, unameROutput.trim()];
6259
+ }).with("darwin", async () => {
6260
+ const { stdout: swVersOutput } = await exec(["sw_vers", "-productVersion"]);
6261
+ return [family, family, swVersOutput.trim()];
6262
+ }).with("linux", async () => {
6263
+ let { idLike, id, version: version2 } = await getOsReleaseInfo(exec);
6264
+ if (id === "unknown") {
6265
+ const synologyInfo = await detectSynologyInfo(exec);
6266
+ if (synologyInfo) {
6267
+ return [synologyInfo.idLike, synologyInfo.id, synologyInfo.version];
6268
+ }
6269
+ const xcpNgInfo = await detectXcpNgInfo(exec);
6270
+ if (xcpNgInfo) {
6271
+ return [xcpNgInfo.idLike, xcpNgInfo.id, xcpNgInfo.version];
6272
+ }
6273
+ }
6274
+ return [idLike, id, version2];
6275
+ }).with("solaris", async () => {
6276
+ const { stdout: unameROutput } = await exec(["uname", "-r"]);
6277
+ return ["solaris", "solaris", unameROutput.trim()];
6278
+ }).with("windows", () => ["windows", "windows", "unknown"]).otherwise(() => ["unknown", "unknown", "unknown"]);
6279
+ let variant = osId.toLowerCase();
6280
+ if (family === "linux" && !variant.includes("rocky") && (osIdLike.toLowerCase().includes("rocky") || osId.toLowerCase().includes("rhel"))) {
6281
+ const isRocky = await detectRockyLinux(exec);
6282
+ if (isRocky) {
6283
+ variant = "rocky";
6284
+ }
6285
+ }
6286
+ return {
6287
+ success: true,
6288
+ family,
6289
+ os: osIdLike.toLowerCase(),
6290
+ variant,
6291
+ version: osVersion
6292
+ };
6293
+ } catch (error) {
6294
+ return {
6295
+ success: false,
6296
+ error: error.message,
6297
+ family: "unknown",
6298
+ os: "unknown",
6299
+ variant: "unknown",
6300
+ version: "unknown"
6301
+ };
6190
6302
  }
6191
- }
6192
- return {
6193
- success: true,
6194
- family,
6195
- os: osIdLike.toLowerCase(),
6196
- variant,
6197
- version: osVersion
6198
- };
6199
- } catch (error) {
6200
- return {
6201
- success: false,
6202
- error: error.message,
6203
- family: "unknown",
6204
- os: "unknown",
6205
- variant: "unknown",
6206
- version: "unknown"
6207
- };
6208
- }
6303
+ },
6304
+ { scope: "host" }
6305
+ );
6209
6306
  },
6210
6307
  {
6211
6308
  name: "os",
@@ -6256,15 +6353,29 @@ async function run27(context) {
6256
6353
  const hostnameResult = await runTask(hostname_default({}));
6257
6354
  const name = hostnameResult.hostname;
6258
6355
  const os6 = await runTask(os_default({}));
6259
- const { stdout: lsbOutput } = await exec(["lsb_release", "-a"]);
6260
- const lsb_release = lsbOutput.split("\n").filter(Boolean).reduce((acc, line) => {
6261
- const [key, ...valueParts] = line.split(":");
6262
- const value = valueParts.join(":").trim();
6263
- acc[key.trim()] = value;
6264
- return acc;
6265
- }, {});
6266
- const { stdout: lscpuOutput } = await exec(["lscpu", "-J"]);
6267
- const lscpu = JSON.parse(lscpuOutput).lscpu;
6356
+ let lsb_release = {
6357
+ "Distributor ID": "",
6358
+ Description: "",
6359
+ Release: "",
6360
+ Codename: ""
6361
+ };
6362
+ try {
6363
+ const { stdout: lsbOutput } = await exec(["lsb_release", "-a"]);
6364
+ lsb_release = lsbOutput.split("\n").filter(Boolean).reduce((acc, line) => {
6365
+ const [key, ...valueParts] = line.split(":");
6366
+ const value = valueParts.join(":").trim();
6367
+ acc[key.trim()] = value;
6368
+ return acc;
6369
+ }, {});
6370
+ } catch {
6371
+ }
6372
+ let lscpu = [];
6373
+ try {
6374
+ const { stdout: lscpuOutput } = await exec(["lscpu", "-J"]);
6375
+ const parsed = JSON.parse(lscpuOutput);
6376
+ lscpu = Array.isArray(parsed?.lscpu) ? parsed.lscpu : [];
6377
+ } catch {
6378
+ }
6268
6379
  return {
6269
6380
  host: {
6270
6381
  name,
@@ -7647,10 +7758,6 @@ var uninstall_default2 = task(run41, {
7647
7758
  // src/core/pkg/dnf/update.ts
7648
7759
  async function run42(context) {
7649
7760
  const { sudo = true, updateMetadata = true } = context.params;
7650
- const isProtectedPackageError = (output) => {
7651
- const normalized = output.toLowerCase();
7652
- return normalized.includes("protected packages") || normalized.includes("protected package") || normalized.includes("the following protected") || normalized.includes("systemd-udev");
7653
- };
7654
7761
  try {
7655
7762
  if (!updateMetadata) {
7656
7763
  return {
@@ -7661,55 +7768,25 @@ async function run42(context) {
7661
7768
  updatedPackages: []
7662
7769
  };
7663
7770
  }
7664
- const command = ["dnf", "update", "-y", "--quiet"];
7771
+ const command = ["dnf", "makecache", "--refresh", "--quiet"];
7665
7772
  const result = await context.exec(command, { sudo });
7666
- const combinedOutput = `${result.stdout}
7667
- ${result.stderr}`;
7668
7773
  if (result.exitCode === 0) {
7669
- const updatedPackages = [];
7670
- let packagesUpdated = 0;
7671
- const lines = result.stdout.split("\n");
7672
- for (const line of lines) {
7673
- if (line.includes("packages upgraded")) {
7674
- const match7 = line.match(/(\d+)\s+packages? upgraded/);
7675
- if (match7) {
7676
- packagesUpdated = parseInt(match7[1], 10);
7677
- }
7678
- } else if (line.includes("Installing") || line.includes("Upgrading")) {
7679
- const match7 = line.match(/(?:Installing|Upgrading)\s+(\S+)/);
7680
- if (match7) {
7681
- updatedPackages.push(match7[1]);
7682
- }
7683
- }
7684
- }
7685
7774
  return {
7686
7775
  success: true,
7687
7776
  packageManager: "dnf",
7688
7777
  output: result.stdout,
7689
- packagesUpdated,
7690
- updatedPackages
7691
- };
7692
- } else {
7693
- if (isProtectedPackageError(combinedOutput)) {
7694
- context.warn("DNF skipped updates because the transaction would remove protected packages.");
7695
- return {
7696
- success: true,
7697
- packageManager: "dnf",
7698
- output: combinedOutput,
7699
- packagesUpdated: 0,
7700
- updatedPackages: [],
7701
- warning: "DNF skipped updates due to protected packages; leaving system unchanged."
7702
- };
7703
- }
7704
- return {
7705
- success: false,
7706
- error: result.stderr || "Update failed",
7707
- packageManager: "dnf",
7708
- output: result.stdout,
7709
7778
  packagesUpdated: 0,
7710
7779
  updatedPackages: []
7711
7780
  };
7712
7781
  }
7782
+ return {
7783
+ success: false,
7784
+ error: result.stderr || "Update failed",
7785
+ packageManager: "dnf",
7786
+ output: result.stdout,
7787
+ packagesUpdated: 0,
7788
+ updatedPackages: []
7789
+ };
7713
7790
  } catch (error) {
7714
7791
  context.error("Error updating packages:", error);
7715
7792
  return {
@@ -7723,7 +7800,7 @@ ${result.stderr}`;
7723
7800
  }
7724
7801
  var update_default2 = task(run42, {
7725
7802
  name: "update",
7726
- description: "Update packages using dnf package manager",
7803
+ description: "Update package metadata using dnf package manager",
7727
7804
  inputSchema: DnfUpdateParamsSchema,
7728
7805
  outputSchema: DnfUpdateResultSchema
7729
7806
  });
@@ -10368,6 +10445,44 @@ async function packageManagerSpecificInstall(pkgManager, context) {
10368
10445
  return abstractInstallFallback(context, pkgManager);
10369
10446
  }
10370
10447
  }
10448
+ async function packageManagerSpecificUpdate(pkgManager, context) {
10449
+ const mapAptParams = () => ({
10450
+ ...context.params,
10451
+ packageManager: "apt",
10452
+ updateLists: true,
10453
+ upgrade: false
10454
+ });
10455
+ const mapDnfParams = () => ({
10456
+ ...context.params,
10457
+ packageManager: "dnf",
10458
+ updateMetadata: true,
10459
+ upgrade: false
10460
+ });
10461
+ const mapPacmanParams = () => ({
10462
+ ...context.params,
10463
+ packageManager: "pacman",
10464
+ updateMetadata: true,
10465
+ upgrade: false
10466
+ });
10467
+ const mapYumParams = () => ({
10468
+ ...context.params,
10469
+ packageManager: "yum",
10470
+ updateMetadata: true,
10471
+ upgrade: false
10472
+ });
10473
+ switch (pkgManager.name) {
10474
+ case "apt":
10475
+ return await context.run(update_default(mapAptParams()));
10476
+ case "dnf":
10477
+ return await context.run(update_default2(mapDnfParams()));
10478
+ case "pacman":
10479
+ return await context.run(update_default3(mapPacmanParams()));
10480
+ case "yum":
10481
+ return await context.run(update_default4(mapYumParams()));
10482
+ default:
10483
+ return await abstractUpdateFallback(context, pkgManager);
10484
+ }
10485
+ }
10371
10486
  function buildCommandArray(pkgManager, operation, packages, extraArgs) {
10372
10487
  const baseCommand = pkgManager[operation];
10373
10488
  if (!baseCommand) {
@@ -10657,8 +10772,8 @@ async function abstractUninstallFallback(context) {
10657
10772
  }
10658
10773
  }
10659
10774
  async function abstractUpdate(context) {
10660
- const { params, exec, log, warn, info } = context;
10661
- const { sudo = true, packageManager: forcedManager, extraArgs, input: userInput } = params;
10775
+ const { params, warn } = context;
10776
+ const { packageManager: forcedManager } = params;
10662
10777
  try {
10663
10778
  const pkgManager = forcedManager ? PACKAGE_MANAGERS[forcedManager] : await detectPackageManager(context);
10664
10779
  if (!pkgManager) {
@@ -10668,14 +10783,26 @@ async function abstractUpdate(context) {
10668
10783
  };
10669
10784
  }
10670
10785
  warn(`Using package manager: ${pkgManager.name}`);
10671
- if (pkgManager.name === "pacman") {
10672
- return await context.run(
10673
- update_default3({
10674
- ...context.params,
10675
- packageManager: "pacman"
10676
- })
10677
- );
10786
+ return await packageManagerSpecificUpdate(pkgManager, context);
10787
+ } catch (error) {
10788
+ return {
10789
+ success: false,
10790
+ error: error instanceof Error ? error.message : String(error)
10791
+ };
10792
+ }
10793
+ }
10794
+ async function abstractUpdateFallback(context, detectedManager) {
10795
+ const { params, exec, warn, info } = context;
10796
+ const { sudo = true, packageManager: forcedManager, extraArgs, input: userInput } = params;
10797
+ try {
10798
+ const pkgManager = detectedManager || (forcedManager ? PACKAGE_MANAGERS[forcedManager] : await detectPackageManager(context));
10799
+ if (!pkgManager) {
10800
+ return {
10801
+ success: false,
10802
+ error: "No supported package manager detected. Please specify one explicitly."
10803
+ };
10678
10804
  }
10805
+ warn(`Using fallback implementation for package manager: ${pkgManager.name}`);
10679
10806
  const mergedInput = getInteractiveInput(pkgManager.name, userInput);
10680
10807
  const commandArray = buildCommandArray(pkgManager, "updateCommand", [], extraArgs);
10681
10808
  info(`Executing: ${commandArray.join(" ")}`);
@@ -11210,7 +11337,8 @@ async function abstractClean(context) {
11210
11337
  var AbstractPkgUpdateParamsSchema = AbstractPkgParamsSchema.pick({
11211
11338
  sudo: true,
11212
11339
  packageManager: true,
11213
- extraArgs: true
11340
+ extraArgs: true,
11341
+ input: true
11214
11342
  });
11215
11343
  var AbstractPkgUpdateResultSchema = AbstractPkgResultSchema;
11216
11344
  async function run68(context) {
@@ -11591,7 +11719,6 @@ async function run75(context) {
11591
11719
  const { params, run: runTask, exec, log, info, error } = context;
11592
11720
  let { public_key, user, sudo } = params;
11593
11721
  const publicKeyTrimmed = public_key.trim();
11594
- const sudoPrefix = sudo ? ["sudo"] : [];
11595
11722
  if (!user) {
11596
11723
  const usernameResult = await runTask(get_username_default());
11597
11724
  if (usernameResult instanceof Error) {
@@ -11645,9 +11772,7 @@ async function run75(context) {
11645
11772
  );
11646
11773
  return { success: false, changed: false };
11647
11774
  }
11648
- const checkKeyCommandParts = [];
11649
- checkKeyCommandParts.push("sudo", "-u", user, "grep", "-xqF", publicKeyTrimmed, authorizedKeysFile);
11650
- const checkKeyCmdResult = await exec(checkKeyCommandParts);
11775
+ const checkKeyCmdResult = await exec(["grep", "-xqF", publicKeyTrimmed, authorizedKeysFile], { sudo });
11651
11776
  if (checkKeyCmdResult.exitCode === 0) {
11652
11777
  info(`SSH key already exists in ${authorizedKeysFile} for user ${user}.`);
11653
11778
  return { success: true, changed: false };
@@ -11657,7 +11782,7 @@ async function run75(context) {
11657
11782
  }
11658
11783
  const escapedPublicKey = publicKeyTrimmed.replace(/"/g, '\\"').replace(/\$/g, "\\$").replace(/`/g, "\\`");
11659
11784
  const command = `echo "${escapedPublicKey}" >> "${authorizedKeysFile}"`;
11660
- const addKeyResult = await exec([...sudoPrefix, "sh", "-c", command], { sudo });
11785
+ const addKeyResult = await exec(["sh", "-c", command], { sudo });
11661
11786
  if (!addKeyResult.success) {
11662
11787
  error(`Failed to append public key to ${authorizedKeysFile}: ${addKeyResult.stderr}`);
11663
11788
  return { success: false, changed: false };
@@ -11955,7 +12080,7 @@ async function bootstrapServiceAccount(context) {
11955
12080
  create_home = true,
11956
12081
  create_group = true,
11957
12082
  system = false,
11958
- skip_packages = false
12083
+ skip_packages = true
11959
12084
  } = params;
11960
12085
  const skipPackages = typeof skip_packages === "string" ? skip_packages === "true" : Boolean(skip_packages);
11961
12086
  if (!username || !password || !public_key) {
@@ -12208,7 +12333,6 @@ __export(pkg_exports, {
12208
12333
  removeCp: () => remove_cp_default,
12209
12334
  search: () => search_default5,
12210
12335
  update: () => update_default5,
12211
- updateCp: () => update_cp_default,
12212
12336
  upgrade: () => upgrade_default5,
12213
12337
  yum: () => yum_exports
12214
12338
  });
@@ -12719,94 +12843,6 @@ var remove_default = task(run89, {
12719
12843
  // src/core/pkg/remove-cp.ts
12720
12844
  var remove_cp_default = remove_default;
12721
12845
 
12722
- // src/core/pkg/update/arch.ts
12723
- async function run90(context) {
12724
- const {
12725
- params: { package: pkg, sudo = true },
12726
- exec
12727
- } = context;
12728
- const commandParts = [sudo ? "sudo" : "", "pacman", "-Syu", "--noconfirm"];
12729
- if (pkg && Array.isArray(pkg) && pkg.length) {
12730
- commandParts.push(...pkg);
12731
- }
12732
- const { success } = await exec(commandParts.filter(Boolean).join(" "), { sudo });
12733
- return { success };
12734
- }
12735
- var update = task(run90);
12736
-
12737
- // src/core/pkg/update/debian.ts
12738
- async function run91(context) {
12739
- const {
12740
- params: { package: pkg, sudo = true, fullUpgrade = false },
12741
- exec
12742
- } = context;
12743
- const prefix = sudo ? "sudo " : "";
12744
- if (!pkg || Array.isArray(pkg) && pkg.length === 0) {
12745
- const upgradeCmd = fullUpgrade ? "apt-get dist-upgrade -y" : "apt-get upgrade -y";
12746
- const { success: u1 } = await exec(`${prefix}apt-get update`, { sudo });
12747
- if (!u1) return { success: false };
12748
- const { success: success2 } = await exec(prefix + upgradeCmd, { sudo });
12749
- return { success: success2 };
12750
- }
12751
- const packages = Array.isArray(pkg) ? pkg : [pkg];
12752
- const { success } = await exec(`${prefix}apt-get install -y --only-upgrade ${packages.join(" ")}`, { sudo });
12753
- return { success };
12754
- }
12755
- var update2 = task(run91);
12756
-
12757
- // src/core/pkg/update/fedora.ts
12758
- async function run92(context) {
12759
- const {
12760
- params: { package: pkg, sudo = true },
12761
- exec
12762
- } = context;
12763
- const prefix = sudo ? "sudo " : "";
12764
- if (!pkg || Array.isArray(pkg) && pkg.length === 0) {
12765
- const { success: success2 } = await exec(`${prefix}dnf upgrade -y`, { sudo });
12766
- return { success: success2 };
12767
- }
12768
- const packages = Array.isArray(pkg) ? pkg : [pkg];
12769
- const { success } = await exec(`${prefix}dnf upgrade -y ${packages.join(" ")}`, { sudo });
12770
- return { success };
12771
- }
12772
- var update3 = task(run92);
12773
-
12774
- // src/core/pkg/update/index.ts
12775
- async function run93(context) {
12776
- const { params: taskParams, run: runTask, error } = context;
12777
- const osDetails = await runTask(os_default());
12778
- if (osDetails instanceof Error) {
12779
- error(`Failed to determine OS details: ${osDetails.message}`);
12780
- return { success: false };
12781
- }
12782
- const baseOs = String(osDetails?.os ?? "");
12783
- let result;
12784
- if (/arch/.test(baseOs)) {
12785
- result = await runTask(update(taskParams));
12786
- } else if (/debian|ubuntu/.test(baseOs)) {
12787
- result = await runTask(update2(taskParams));
12788
- } else if (baseOs === "fedora") {
12789
- result = await runTask(update3(taskParams));
12790
- } else {
12791
- error(`Unsupported OS (${baseOs}) for pkg.update`);
12792
- return { success: false };
12793
- }
12794
- if (result instanceof Error) {
12795
- error(`pkg.update failed: ${result.message}`);
12796
- return { success: false };
12797
- }
12798
- return result;
12799
- }
12800
- var update_default6 = task(run93, {
12801
- name: "update",
12802
- description: "Updates packages using the appropriate OS package manager.",
12803
- inputSchema: PkgUpdateParamsSchema,
12804
- outputSchema: PkgUpdateResultSchema
12805
- });
12806
-
12807
- // src/core/pkg/update-cp.ts
12808
- var update_cp_default = update_default6;
12809
-
12810
12846
  // src/core/pkg/search.ts
12811
12847
  var AbstractPkgSearchParamsSchema = z.object({
12812
12848
  /** Search query */
@@ -12815,13 +12851,13 @@ var AbstractPkgSearchParamsSchema = z.object({
12815
12851
  packageManager: z.string().optional()
12816
12852
  });
12817
12853
  var AbstractPkgSearchResultSchema = AbstractPkgResultSchema;
12818
- async function run94(context) {
12854
+ async function run90(context) {
12819
12855
  const result = await abstractSearch(context);
12820
12856
  return {
12821
12857
  ...result
12822
12858
  };
12823
12859
  }
12824
- var search_default5 = task(run94, {
12860
+ var search_default5 = task(run90, {
12825
12861
  description: "Search for packages using auto-detected or specified package manager",
12826
12862
  inputSchema: AbstractPkgSearchParamsSchema,
12827
12863
  outputSchema: AbstractPkgSearchResultSchema
@@ -12833,10 +12869,10 @@ var AbstractPkgListParamsSchema = z.object({
12833
12869
  packageManager: z.string().optional()
12834
12870
  });
12835
12871
  var AbstractPkgListResultSchema = AbstractPkgResultSchema;
12836
- async function run95(context) {
12872
+ async function run91(context) {
12837
12873
  return await abstractList(context);
12838
12874
  }
12839
- var list_default7 = task(run95, {
12875
+ var list_default7 = task(run91, {
12840
12876
  description: "List installed packages using auto-detected or specified package manager",
12841
12877
  inputSchema: AbstractPkgListParamsSchema,
12842
12878
  outputSchema: AbstractPkgListResultSchema
@@ -12848,10 +12884,10 @@ var AbstractPkgCleanParamsSchema = AbstractPkgParamsSchema.pick({
12848
12884
  sudo: true
12849
12885
  });
12850
12886
  var AbstractPkgCleanResultSchema = AbstractPkgResultSchema;
12851
- async function run96(context) {
12887
+ async function run92(context) {
12852
12888
  return await abstractClean(context);
12853
12889
  }
12854
- var clean_default5 = task(run96, {
12890
+ var clean_default5 = task(run92, {
12855
12891
  description: "Clean package cache using auto-detected or specified package manager",
12856
12892
  inputSchema: AbstractPkgCleanParamsSchema,
12857
12893
  outputSchema: AbstractPkgCleanResultSchema
@@ -12905,7 +12941,7 @@ var K3supInstallOutputSchema = z.object({
12905
12941
  /** The command that would be run if --print-command was used */
12906
12942
  executedCommand: z.string().optional()
12907
12943
  });
12908
- async function run97(context) {
12944
+ async function run93(context) {
12909
12945
  const { params, exec, log, error, debug } = context;
12910
12946
  const k3supCmd = ["k3sup", "install"];
12911
12947
  const addFlag = (flag, condition) => {
@@ -12963,7 +12999,7 @@ async function run97(context) {
12963
12999
  throw e;
12964
13000
  }
12965
13001
  }
12966
- var k3sup_install_default = task(run97, {
13002
+ var k3sup_install_default = task(run93, {
12967
13003
  name: "k3sup-install",
12968
13004
  description: "K3s k3sup-install.",
12969
13005
  inputSchema: K3supInstallInputSchema,
@@ -13727,7 +13763,7 @@ var AddUsersOutputSchema = z.object({
13727
13763
  error: z.string().optional()
13728
13764
  })
13729
13765
  );
13730
- async function run98(context) {
13766
+ async function run94(context) {
13731
13767
  const { params, info, warn, error, run: runTask } = context;
13732
13768
  const { users } = params;
13733
13769
  if (!users || users.length === 0) {
@@ -13760,7 +13796,7 @@ async function run98(context) {
13760
13796
  return { success: false, error: message };
13761
13797
  }
13762
13798
  }
13763
- var add_users_default = task(run98, {
13799
+ var add_users_default = task(run94, {
13764
13800
  description: "Adds one or more users to the docker group.",
13765
13801
  inputSchema: AddUsersInputSchema,
13766
13802
  outputSchema: AddUsersOutputSchema
@@ -13780,7 +13816,7 @@ var InstallComposeOutputSchema = z.object({
13780
13816
  error: z.string().optional()
13781
13817
  })
13782
13818
  );
13783
- async function run99(context) {
13819
+ async function run95(context) {
13784
13820
  const { params, info, error, run: runTask } = context;
13785
13821
  const version2 = params.version ?? "v2.24.5";
13786
13822
  const composePath = params.path ?? "/usr/local/bin/docker-compose";
@@ -13818,7 +13854,7 @@ async function run99(context) {
13818
13854
  return { success: false, error: message };
13819
13855
  }
13820
13856
  }
13821
- var install_compose_default = task(run99, {
13857
+ var install_compose_default = task(run95, {
13822
13858
  description: "Installs the Docker Compose standalone binary.",
13823
13859
  inputSchema: InstallComposeInputSchema,
13824
13860
  outputSchema: InstallComposeOutputSchema
@@ -13841,7 +13877,7 @@ var DockerInstallOutputSchema = z.object({
13841
13877
  error: z.string().optional()
13842
13878
  })
13843
13879
  );
13844
- async function run100(context) {
13880
+ async function run96(context) {
13845
13881
  const { info, run: runTask, params, error: logError2 } = context;
13846
13882
  const installComposePlugin = params.install_compose_plugin !== false;
13847
13883
  const installComposeStandalone = params.install_compose_standalone === true;
@@ -14080,7 +14116,7 @@ function sanitizeSystemctlState(value) {
14080
14116
  }
14081
14117
  return value.replace(/\u001b\][^\u001b]*\u001b\\/g, "").replace(/\u001b\[[0-9;?]*[ -/]*[@-~]/g, "").trim().toLowerCase();
14082
14118
  }
14083
- var install_default6 = task(run100, {
14119
+ var install_default6 = task(run96, {
14084
14120
  name: "install",
14085
14121
  description: "Installs and configures Docker, Docker Compose, and group membership.",
14086
14122
  inputSchema: DockerInstallInputSchema,
@@ -14229,7 +14265,7 @@ var DockerRunContainerOutputSchema = z.object({
14229
14265
  containerName: z.string().optional(),
14230
14266
  error: z.string().optional()
14231
14267
  });
14232
- async function run101(context) {
14268
+ async function run97(context) {
14233
14269
  const { params, exec, info, error: logError2 } = context;
14234
14270
  if (!params.image) {
14235
14271
  const message = "Docker image is required.";
@@ -14270,7 +14306,7 @@ async function run101(context) {
14270
14306
  containerName: params.name
14271
14307
  };
14272
14308
  }
14273
- var run_container_default = task(run101, {
14309
+ var run_container_default = task(run97, {
14274
14310
  description: "Runs a Docker container and returns its output (attached).",
14275
14311
  inputSchema: DockerRunContainerInputSchema,
14276
14312
  outputSchema: DockerRunContainerOutputSchema
@@ -14287,7 +14323,7 @@ var DockerRunDetachedOutputSchema = z.object({
14287
14323
  containerName: z.string().optional(),
14288
14324
  error: z.string().optional()
14289
14325
  });
14290
- async function run102(context) {
14326
+ async function run98(context) {
14291
14327
  const { params, exec, info, error: logError2 } = context;
14292
14328
  if (!params.image) {
14293
14329
  const message = "Docker image is required.";
@@ -14327,7 +14363,7 @@ async function run102(context) {
14327
14363
  containerName: params.name
14328
14364
  };
14329
14365
  }
14330
- var run_container_detached_default = task(run102, {
14366
+ var run_container_detached_default = task(run98, {
14331
14367
  description: "Runs a Docker container in detached mode and returns its metadata.",
14332
14368
  inputSchema: DockerRunDetachedInputSchema,
14333
14369
  outputSchema: DockerRunDetachedOutputSchema
@@ -14386,7 +14422,7 @@ var ProcessListOutputSchema = z.object({
14386
14422
  error: z.string().optional()
14387
14423
  })
14388
14424
  );
14389
- async function run103(context) {
14425
+ async function run99(context) {
14390
14426
  const { params, exec, debug, error } = context;
14391
14427
  const { user, command, limit, sort, reverse } = params;
14392
14428
  try {
@@ -14472,7 +14508,7 @@ async function run103(context) {
14472
14508
  return { success: false, error: errorMsg };
14473
14509
  }
14474
14510
  }
14475
- var list_default8 = task(run103, {
14511
+ var list_default8 = task(run99, {
14476
14512
  name: "list",
14477
14513
  description: "Lists processes on the system.",
14478
14514
  inputSchema: ProcessListInputSchema,
@@ -14518,7 +14554,7 @@ var ProcessSearchOutputSchema = z.object({
14518
14554
  error: z.string().optional()
14519
14555
  })
14520
14556
  );
14521
- async function run104(context) {
14557
+ async function run100(context) {
14522
14558
  const { params, exec, debug, error } = context;
14523
14559
  const { name, user, pid, ppid, args, state, regex = false, ignoreCase = false, limit } = params;
14524
14560
  debug(`Searching processes with params: ${JSON.stringify(params)}`);
@@ -14632,7 +14668,7 @@ function filterProcesses(processes, filters) {
14632
14668
  return true;
14633
14669
  });
14634
14670
  }
14635
- var search_default6 = task(run104, {
14671
+ var search_default6 = task(run100, {
14636
14672
  name: "search",
14637
14673
  description: "Search for processes matching specified criteria.",
14638
14674
  inputSchema: ProcessSearchInputSchema,
@@ -14660,7 +14696,7 @@ var ProcessKillOutputSchema = z.object({
14660
14696
  error: z.string().optional()
14661
14697
  })
14662
14698
  );
14663
- async function run105(context) {
14699
+ async function run101(context) {
14664
14700
  const { params, exec, debug, error } = context;
14665
14701
  const { pid, user, command, signal = "TERM", force = false, sudo = false } = params;
14666
14702
  try {
@@ -14748,7 +14784,7 @@ async function run105(context) {
14748
14784
  return { success: false, error: errorMsg };
14749
14785
  }
14750
14786
  }
14751
- var kill_default = task(run105, {
14787
+ var kill_default = task(run101, {
14752
14788
  name: "kill",
14753
14789
  description: "Kills processes matching specified criteria. Requires at least one filtering parameter (pid, user, or command) to prevent accidental killing of all processes.",
14754
14790
  inputSchema: ProcessKillInputSchema,
@@ -14769,7 +14805,7 @@ var ProcessSignalOutputSchema = z.object({
14769
14805
  error: z.string().optional()
14770
14806
  })
14771
14807
  );
14772
- async function run106(context) {
14808
+ async function run102(context) {
14773
14809
  const { params, exec, debug, error } = context;
14774
14810
  const { pid, signal = "TERM", sudo = false } = params;
14775
14811
  if (!pid || pid <= 0) {
@@ -14792,7 +14828,7 @@ async function run106(context) {
14792
14828
  return { success: false, error: errorMsg };
14793
14829
  }
14794
14830
  }
14795
- var signal_default = task(run106, {
14831
+ var signal_default = task(run102, {
14796
14832
  name: "signal",
14797
14833
  description: "Sends a signal to a process.",
14798
14834
  inputSchema: ProcessSignalInputSchema,
@@ -14828,7 +14864,7 @@ var ProcessInfoOutputSchema = z.object({
14828
14864
  error: z.string().optional()
14829
14865
  })
14830
14866
  );
14831
- async function run107(context) {
14867
+ async function run103(context) {
14832
14868
  const { params, exec, debug, error } = context;
14833
14869
  const { pid } = params;
14834
14870
  if (!pid || pid <= 0) {
@@ -14904,7 +14940,7 @@ async function run107(context) {
14904
14940
  return { success: false, error: errorMsg };
14905
14941
  }
14906
14942
  }
14907
- var info_default7 = task(run107, {
14943
+ var info_default7 = task(run103, {
14908
14944
  name: "info",
14909
14945
  description: "Gets detailed information about a specific process.",
14910
14946
  inputSchema: ProcessInfoInputSchema,
@@ -14968,7 +15004,7 @@ var ProcessTopOutputSchema = z.object({
14968
15004
  timestamp: z.string()
14969
15005
  })
14970
15006
  );
14971
- async function run108(context) {
15007
+ async function run104(context) {
14972
15008
  const { params, exec, debug, error } = context;
14973
15009
  const {
14974
15010
  limit = 10,
@@ -15130,7 +15166,7 @@ function sortProcesses(processes, sort) {
15130
15166
  }
15131
15167
  });
15132
15168
  }
15133
- var top_default = task(run108, {
15169
+ var top_default = task(run104, {
15134
15170
  name: "top",
15135
15171
  description: "Get top processes with system information.",
15136
15172
  inputSchema: ProcessTopInputSchema,
@@ -15194,7 +15230,7 @@ var ProcessStatsOutputSchema = z.object({
15194
15230
  timestamp: z.string()
15195
15231
  })
15196
15232
  );
15197
- async function run109(context) {
15233
+ async function run105(context) {
15198
15234
  const { params, exec, debug, error } = context;
15199
15235
  const { includeUsers = true, includeStates = true, includeCommands = false, commandLimit = 10 } = params;
15200
15236
  debug(`Getting process statistics with params: ${JSON.stringify(params)}`);
@@ -15372,7 +15408,7 @@ function calculateCommandStats(processes, limit) {
15372
15408
  }
15373
15409
  return Array.from(commandMap.values()).sort((a, b) => b.cpu - a.cpu).slice(0, limit);
15374
15410
  }
15375
- var stats_default = task(run109, {
15411
+ var stats_default = task(run105, {
15376
15412
  name: "stats",
15377
15413
  description: "Get system-wide process statistics.",
15378
15414
  inputSchema: ProcessStatsInputSchema,
@@ -15407,7 +15443,7 @@ var ProcessChildrenOutputSchema = z.object({
15407
15443
  error: z.string().optional()
15408
15444
  })
15409
15445
  );
15410
- async function run110(context) {
15446
+ async function run106(context) {
15411
15447
  const { params, exec, debug, error } = context;
15412
15448
  const { pid, recursive = false, maxDepth } = params;
15413
15449
  debug(`Getting children for process ${pid} with params: ${JSON.stringify(params)}`);
@@ -15492,7 +15528,7 @@ async function getDescendants(exec, parentPid, currentDepth, maxDepth) {
15492
15528
  }
15493
15529
  return allDescendants;
15494
15530
  }
15495
- var children_default = task(run110, {
15531
+ var children_default = task(run106, {
15496
15532
  name: "children",
15497
15533
  description: "Get child processes of a given PID.",
15498
15534
  inputSchema: ProcessChildrenInputSchema,
@@ -15525,7 +15561,7 @@ var RebootOutputSchema = z.object({
15525
15561
  error: z.string().optional(),
15526
15562
  status: z.string()
15527
15563
  });
15528
- async function run111(context) {
15564
+ async function run107(context) {
15529
15565
  const { params, info, warn, exec } = context;
15530
15566
  const time = params.time || "now";
15531
15567
  const sudo = params.sudo ?? true;
@@ -15558,7 +15594,7 @@ stderr: ${stderr}`
15558
15594
  };
15559
15595
  }
15560
15596
  }
15561
- var reboot_default = task(run111, {
15597
+ var reboot_default = task(run107, {
15562
15598
  description: "Reboots a system",
15563
15599
  inputSchema: RebootInputSchema,
15564
15600
  outputSchema: RebootOutputSchema
@@ -15578,7 +15614,7 @@ var ShutdownOutputSchema = z.object({
15578
15614
  error: z.string().optional(),
15579
15615
  status: z.string()
15580
15616
  });
15581
- async function run112(context) {
15617
+ async function run108(context) {
15582
15618
  const { params, info, warn, exec } = context;
15583
15619
  const time = params.time || "now";
15584
15620
  const sudo = params.sudo ?? true;
@@ -15610,7 +15646,7 @@ stderr: ${stderr}`
15610
15646
  };
15611
15647
  }
15612
15648
  }
15613
- var shutdown_default = task(run112, {
15649
+ var shutdown_default = task(run108, {
15614
15650
  description: "Shuts down a system",
15615
15651
  inputSchema: ShutdownInputSchema,
15616
15652
  outputSchema: ShutdownOutputSchema
@@ -15631,7 +15667,7 @@ var RebootIfNeededOutputSchema = z.object({
15631
15667
  error: z.string().optional()
15632
15668
  })
15633
15669
  );
15634
- async function run113(context) {
15670
+ async function run109(context) {
15635
15671
  const { params, run: runTask, exec, error, info, warn } = context;
15636
15672
  const delayInSeconds = Math.max(1, params.delay ?? 1);
15637
15673
  const message = params.message ?? "Reboot is required. Initiating reboot sequence.";
@@ -15661,7 +15697,7 @@ ${stderr}`;
15661
15697
  }
15662
15698
  return { rebooting: true, success: true };
15663
15699
  }
15664
- var reboot_if_needed_default = task(run113, {
15700
+ var reboot_if_needed_default = task(run109, {
15665
15701
  name: "reboot_if_needed",
15666
15702
  description: "Reboot if needed.",
15667
15703
  inputSchema: RebootIfNeededInputSchema,
@@ -15678,7 +15714,7 @@ var SystemUptimeOutputSchema = z.object({
15678
15714
  days: z.number().optional(),
15679
15715
  error: z.string().optional()
15680
15716
  });
15681
- async function run114(context) {
15717
+ async function run110(context) {
15682
15718
  const { params, exec, error } = context;
15683
15719
  const sudo = params.sudo ?? false;
15684
15720
  const { success, stdout, stderr } = await exec(["cat", "/proc/uptime"], { sudo });
@@ -15697,7 +15733,7 @@ async function run114(context) {
15697
15733
  days: Math.floor(uptimeSeconds / 86400)
15698
15734
  };
15699
15735
  }
15700
- var uptime_default = task(run114, {
15736
+ var uptime_default = task(run110, {
15701
15737
  name: "uptime",
15702
15738
  description: "Report system uptime.",
15703
15739
  inputSchema: SystemUptimeInputSchema,
@@ -15722,7 +15758,7 @@ var SystemDatetimeOutputSchema = z.object({
15722
15758
  error: z.string().optional()
15723
15759
  })
15724
15760
  );
15725
- async function run115(context) {
15761
+ async function run111(context) {
15726
15762
  const { params, exec } = context;
15727
15763
  const sudo = params.sudo ?? false;
15728
15764
  const isoResult = await exec(["date", "--iso-8601=seconds"], { sudo }).catch((error) => error);
@@ -15743,7 +15779,7 @@ async function run115(context) {
15743
15779
  timezone
15744
15780
  };
15745
15781
  }
15746
- var datetime_default = task(run115, {
15782
+ var datetime_default = task(run111, {
15747
15783
  name: "datetime",
15748
15784
  description: "Report system time and timezone.",
15749
15785
  inputSchema: SystemDatetimeInputSchema,
@@ -15770,7 +15806,7 @@ var SystemHardwareOutputSchema = z.object({
15770
15806
  error: z.string().optional()
15771
15807
  })
15772
15808
  );
15773
- async function run116(context) {
15809
+ async function run112(context) {
15774
15810
  const { params, exec } = context;
15775
15811
  const sudo = params.sudo ?? false;
15776
15812
  const archResult = await exec(["uname", "-m"], { sudo }).catch((error) => error);
@@ -15797,7 +15833,7 @@ async function run116(context) {
15797
15833
  memTotalKb: Number.isFinite(memTotalKb ?? NaN) ? memTotalKb : void 0
15798
15834
  };
15799
15835
  }
15800
- var hardware_default = task(run116, {
15836
+ var hardware_default = task(run112, {
15801
15837
  name: "hardware",
15802
15838
  description: "Report CPU and memory details.",
15803
15839
  inputSchema: SystemHardwareInputSchema,
@@ -15829,7 +15865,7 @@ var SystemdDisableOutputSchema = z.object({
15829
15865
  error: z.string().optional()
15830
15866
  })
15831
15867
  );
15832
- async function run117(context) {
15868
+ async function run113(context) {
15833
15869
  const { params, exec, error } = context;
15834
15870
  const { service, sudo = false } = params;
15835
15871
  if (!service) {
@@ -15852,7 +15888,7 @@ async function run117(context) {
15852
15888
  };
15853
15889
  }
15854
15890
  }
15855
- var disable_default = task(run117, {
15891
+ var disable_default = task(run113, {
15856
15892
  name: "disable",
15857
15893
  description: "Systemd disable.",
15858
15894
  inputSchema: SystemdDisableInputSchema,
@@ -15872,7 +15908,7 @@ var SystemdEnableOutputSchema = z.object({
15872
15908
  error: z.string().optional()
15873
15909
  })
15874
15910
  );
15875
- async function run118(context) {
15911
+ async function run114(context) {
15876
15912
  const { params, exec, error } = context;
15877
15913
  const { service, sudo = false } = params;
15878
15914
  if (!service) {
@@ -15895,7 +15931,7 @@ async function run118(context) {
15895
15931
  };
15896
15932
  }
15897
15933
  }
15898
- var enable_default = task(run118, {
15934
+ var enable_default = task(run114, {
15899
15935
  name: "enable",
15900
15936
  description: "Systemd enable.",
15901
15937
  inputSchema: SystemdEnableInputSchema,
@@ -15915,7 +15951,7 @@ var SystemdRestartOutputSchema = z.object({
15915
15951
  error: z.string().optional()
15916
15952
  })
15917
15953
  );
15918
- async function run119(context) {
15954
+ async function run115(context) {
15919
15955
  const { params, exec, error } = context;
15920
15956
  const { service, sudo = false } = params;
15921
15957
  if (!service) {
@@ -15942,7 +15978,7 @@ async function run119(context) {
15942
15978
  };
15943
15979
  }
15944
15980
  }
15945
- var restart_default = task(run119, {
15981
+ var restart_default = task(run115, {
15946
15982
  name: "restart",
15947
15983
  description: "Systemd restart.",
15948
15984
  inputSchema: SystemdRestartInputSchema,
@@ -15962,7 +15998,7 @@ var SystemdStartOutputSchema = z.object({
15962
15998
  error: z.string().optional()
15963
15999
  })
15964
16000
  );
15965
- async function run120(context) {
16001
+ async function run116(context) {
15966
16002
  const { params, exec, error } = context;
15967
16003
  const { service, sudo = false } = params;
15968
16004
  if (!service) {
@@ -15985,7 +16021,7 @@ async function run120(context) {
15985
16021
  };
15986
16022
  }
15987
16023
  }
15988
- var start_default = task(run120, {
16024
+ var start_default = task(run116, {
15989
16025
  name: "start",
15990
16026
  description: "Systemd start.",
15991
16027
  inputSchema: SystemdStartInputSchema,
@@ -16005,7 +16041,7 @@ var SystemdStopOutputSchema = z.object({
16005
16041
  error: z.string().optional()
16006
16042
  })
16007
16043
  );
16008
- async function run121(context) {
16044
+ async function run117(context) {
16009
16045
  const { params, exec, error } = context;
16010
16046
  const { service, sudo = false } = params;
16011
16047
  if (!service) {
@@ -16032,7 +16068,7 @@ async function run121(context) {
16032
16068
  };
16033
16069
  }
16034
16070
  }
16035
- var stop_default = task(run121, {
16071
+ var stop_default = task(run117, {
16036
16072
  name: "stop",
16037
16073
  description: "Systemd stop.",
16038
16074
  inputSchema: SystemdStopInputSchema,
@@ -16052,7 +16088,7 @@ var SystemdReloadOutputSchema = z.object({
16052
16088
  error: z.string().optional()
16053
16089
  })
16054
16090
  );
16055
- async function run122(context) {
16091
+ async function run118(context) {
16056
16092
  const { params, exec, error } = context;
16057
16093
  const { service, sudo = false } = params;
16058
16094
  if (!service) {
@@ -16073,7 +16109,7 @@ async function run122(context) {
16073
16109
  };
16074
16110
  }
16075
16111
  }
16076
- var reload_default = task(run122, {
16112
+ var reload_default = task(run118, {
16077
16113
  name: "reload",
16078
16114
  description: "Reloads a systemd service (e.g., re-reads configuration without full restart).",
16079
16115
  inputSchema: SystemdReloadInputSchema,
@@ -16095,7 +16131,7 @@ var SystemdStatusOutputSchema = z.object({
16095
16131
  error: z.string().optional()
16096
16132
  })
16097
16133
  );
16098
- async function run123(context) {
16134
+ async function run119(context) {
16099
16135
  const { params, exec, error } = context;
16100
16136
  const { service, sudo = false } = params;
16101
16137
  if (!service) {
@@ -16118,7 +16154,7 @@ async function run123(context) {
16118
16154
  };
16119
16155
  }
16120
16156
  }
16121
- var status_default = task(run123, {
16157
+ var status_default = task(run119, {
16122
16158
  name: "status",
16123
16159
  description: "Checks systemd service status.",
16124
16160
  inputSchema: SystemdStatusInputSchema,
@@ -16148,7 +16184,7 @@ var TemplateWriteOutputSchema = z.object({
16148
16184
  path: z.string()
16149
16185
  });
16150
16186
  async function runFn3(context) {
16151
- const { params, warn, error, debug, run: run253, file, exec } = context;
16187
+ const { params, warn, error, debug, run: run249, file, exec } = context;
16152
16188
  const { template, template_file, variables, to, mode, owner, group, sudo } = params;
16153
16189
  let templateContent = template;
16154
16190
  if (template && template_file) {
@@ -16203,7 +16239,7 @@ EOF`;
16203
16239
  debug(`Setting mode ${mode} for ${outputPath}`);
16204
16240
  try {
16205
16241
  const chmodParams = { path: outputPath, mode, sudo };
16206
- const chmodResult = await run253(chmod_default(chmodParams));
16242
+ const chmodResult = await run249(chmod_default(chmodParams));
16207
16243
  if (chmodResult instanceof Error) {
16208
16244
  error(`Error setting mode for ${outputPath}: ${chmodResult.message}`);
16209
16245
  overallSuccess = false;
@@ -16229,7 +16265,7 @@ EOF`;
16229
16265
  if (group) {
16230
16266
  chownTaskParams.group = group;
16231
16267
  }
16232
- const chownResult = await run253(chown_default(chownTaskParams));
16268
+ const chownResult = await run249(chown_default(chownTaskParams));
16233
16269
  if (chownResult instanceof Error) {
16234
16270
  error(`Error setting owner/group for ${outputPath}: ${chownResult.message}`);
16235
16271
  overallSuccess = false;
@@ -16289,7 +16325,7 @@ var UfwAllowOutputSchema = z.object({
16289
16325
  error: z.string().optional()
16290
16326
  })
16291
16327
  );
16292
- async function run124(context) {
16328
+ async function run120(context) {
16293
16329
  const { params, exec, info } = context;
16294
16330
  const { port, proto = "tcp", from } = params;
16295
16331
  if (!port) {
@@ -16320,7 +16356,7 @@ async function run124(context) {
16320
16356
  return { success: false, error };
16321
16357
  }
16322
16358
  }
16323
- var allow_default = task(run124, {
16359
+ var allow_default = task(run120, {
16324
16360
  description: "Allows a port through UFW firewall.",
16325
16361
  inputSchema: UfwAllowInputSchema,
16326
16362
  outputSchema: UfwAllowOutputSchema
@@ -16341,7 +16377,7 @@ var UfwDenyOutputSchema = z.object({
16341
16377
  error: z.string().optional()
16342
16378
  })
16343
16379
  );
16344
- async function run125(context) {
16380
+ async function run121(context) {
16345
16381
  const { params, exec, error, info } = context;
16346
16382
  const { port, proto = "tcp", from } = params;
16347
16383
  if (!port) {
@@ -16372,7 +16408,7 @@ async function run125(context) {
16372
16408
  };
16373
16409
  }
16374
16410
  }
16375
- var deny_default = task(run125, {
16411
+ var deny_default = task(run121, {
16376
16412
  name: "deny",
16377
16413
  description: "Ufw deny.",
16378
16414
  inputSchema: UfwDenyInputSchema,
@@ -16391,7 +16427,7 @@ var UfwDeleteOutputSchema = z.object({
16391
16427
  error: z.string().optional()
16392
16428
  })
16393
16429
  );
16394
- async function run126(context) {
16430
+ async function run122(context) {
16395
16431
  const { params, exec, error } = context;
16396
16432
  const { rule_number } = params;
16397
16433
  if (!rule_number || rule_number <= 0) {
@@ -16413,7 +16449,7 @@ async function run126(context) {
16413
16449
  };
16414
16450
  }
16415
16451
  }
16416
- var delete_default4 = task(run126, {
16452
+ var delete_default4 = task(run122, {
16417
16453
  name: "delete",
16418
16454
  description: "Ufw delete.",
16419
16455
  inputSchema: UfwDeleteInputSchema,
@@ -16426,7 +16462,7 @@ var UfwDisableOutputSchema = z.object({
16426
16462
  success: z.boolean(),
16427
16463
  error: z.string().optional()
16428
16464
  });
16429
- async function run127(context) {
16465
+ async function run123(context) {
16430
16466
  const { exec, error } = context;
16431
16467
  try {
16432
16468
  const result = await exec(["ufw", "disable"], { sudo: true });
@@ -16442,7 +16478,7 @@ async function run127(context) {
16442
16478
  return { success: false, error: errorMsg };
16443
16479
  }
16444
16480
  }
16445
- var disable_default2 = task(run127, {
16481
+ var disable_default2 = task(run123, {
16446
16482
  description: "Disables UFW firewall.",
16447
16483
  inputSchema: UfwDisableInputSchema,
16448
16484
  outputSchema: UfwDisableOutputSchema
@@ -16454,7 +16490,7 @@ var UfwEnableOutputSchema = z.object({
16454
16490
  success: z.boolean(),
16455
16491
  error: z.string().optional()
16456
16492
  });
16457
- async function run128(context) {
16493
+ async function run124(context) {
16458
16494
  const { exec, error } = context;
16459
16495
  try {
16460
16496
  const result = await exec(["ufw", "--force", "enable"], { sudo: true });
@@ -16470,7 +16506,7 @@ async function run128(context) {
16470
16506
  return { success: false, error: errorMsg };
16471
16507
  }
16472
16508
  }
16473
- var enable_default2 = task(run128, {
16509
+ var enable_default2 = task(run124, {
16474
16510
  description: "Enables UFW firewall.",
16475
16511
  inputSchema: UfwEnableInputSchema,
16476
16512
  outputSchema: UfwEnableOutputSchema
@@ -16486,7 +16522,7 @@ var UfwInstallOutputSchema = z.object({
16486
16522
  error: z.string().optional()
16487
16523
  })
16488
16524
  );
16489
- async function run129(context) {
16525
+ async function run125(context) {
16490
16526
  const { run: runTask, error } = context;
16491
16527
  try {
16492
16528
  const installResult = await runTask(install_default5({ package: "ufw", sudo: true }));
@@ -16505,7 +16541,7 @@ async function run129(context) {
16505
16541
  };
16506
16542
  }
16507
16543
  }
16508
- var install_default7 = task(run129, {
16544
+ var install_default7 = task(run125, {
16509
16545
  name: "install",
16510
16546
  description: "Ufw install.",
16511
16547
  inputSchema: UfwInstallInputSchema,
@@ -16525,7 +16561,7 @@ var UfwLoggingOutputSchema = z.object({
16525
16561
  error: z.string().optional()
16526
16562
  })
16527
16563
  );
16528
- async function run130(context) {
16564
+ async function run126(context) {
16529
16565
  const { params, exec, log } = context;
16530
16566
  const level = params.level || "on";
16531
16567
  try {
@@ -16542,7 +16578,7 @@ async function run130(context) {
16542
16578
  return { success: false, error };
16543
16579
  }
16544
16580
  }
16545
- var logging_default = task(run130, {
16581
+ var logging_default = task(run126, {
16546
16582
  description: "Configures UFW logging",
16547
16583
  inputSchema: UfwLoggingInputSchema,
16548
16584
  outputSchema: UfwLoggingOutputSchema
@@ -16558,7 +16594,7 @@ var UfwReloadOutputSchema = z.object({
16558
16594
  error: z.string().optional()
16559
16595
  })
16560
16596
  );
16561
- async function run131(context) {
16597
+ async function run127(context) {
16562
16598
  const { exec, error } = context;
16563
16599
  try {
16564
16600
  const { success } = await exec(["sudo", "ufw", "reload"], { sudo: true });
@@ -16570,7 +16606,7 @@ async function run131(context) {
16570
16606
  };
16571
16607
  }
16572
16608
  }
16573
- var reload_default2 = task(run131, {
16609
+ var reload_default2 = task(run127, {
16574
16610
  name: "reload",
16575
16611
  description: "Ufw reload.",
16576
16612
  inputSchema: UfwReloadInputSchema,
@@ -16588,7 +16624,7 @@ var UfwResetOutputSchema = z.object({
16588
16624
  error: z.string().optional()
16589
16625
  })
16590
16626
  );
16591
- async function run132(context) {
16627
+ async function run128(context) {
16592
16628
  const { exec, error, info } = context;
16593
16629
  try {
16594
16630
  const command = ["ufw", "--force", "reset"];
@@ -16609,7 +16645,7 @@ async function run132(context) {
16609
16645
  return { success: false, error: errorMsg };
16610
16646
  }
16611
16647
  }
16612
- var reset_default = task(run132, {
16648
+ var reset_default = task(run128, {
16613
16649
  name: "reset",
16614
16650
  description: "Resets UFW firewall to default state.",
16615
16651
  inputSchema: UfwResetInputSchema,
@@ -16632,7 +16668,7 @@ var UfwStatusOutputSchema = z.object({
16632
16668
  rules: z.array(UfwRuleSchema).optional(),
16633
16669
  error: z.string().optional()
16634
16670
  });
16635
- async function run133(context) {
16671
+ async function run129(context) {
16636
16672
  const { exec, error } = context;
16637
16673
  try {
16638
16674
  const result = await exec(["ufw", "status", "numbered"], { sudo: true });
@@ -16687,7 +16723,7 @@ async function run133(context) {
16687
16723
  return { success: false, error: errorMsg };
16688
16724
  }
16689
16725
  }
16690
- var status_default2 = task(run133, {
16726
+ var status_default2 = task(run129, {
16691
16727
  description: "Gets UFW firewall status with numbered rules.",
16692
16728
  inputSchema: UfwStatusInputSchema,
16693
16729
  outputSchema: UfwStatusOutputSchema
@@ -16726,7 +16762,7 @@ var AddGroupsOutputSchema = z.object({
16726
16762
  error: z.string().optional()
16727
16763
  })
16728
16764
  );
16729
- async function run134(context) {
16765
+ async function run130(context) {
16730
16766
  const { params, exec } = context;
16731
16767
  const { user, groups, sudo = true } = params;
16732
16768
  const normalizedGroups = Array.isArray(groups) ? groups : typeof groups === "string" ? groups.split(",").map((group) => group.trim()).filter(Boolean) : [];
@@ -16741,7 +16777,7 @@ async function run134(context) {
16741
16777
  error: success ? void 0 : stderr || stdout
16742
16778
  };
16743
16779
  }
16744
- var add_groups_default = task(run134, {
16780
+ var add_groups_default = task(run130, {
16745
16781
  name: "add_groups",
16746
16782
  description: "User add groups.",
16747
16783
  inputSchema: AddGroupsInputSchema,
@@ -16761,7 +16797,7 @@ var GetGidOutputSchema = z.object({
16761
16797
  gid: z.string().optional()
16762
16798
  })
16763
16799
  );
16764
- async function run135(context) {
16800
+ async function run131(context) {
16765
16801
  const { params, exec } = context;
16766
16802
  const { user } = params;
16767
16803
  const command = ["id", "-g", user].filter(Boolean).join(" ");
@@ -16771,7 +16807,7 @@ async function run135(context) {
16771
16807
  gid: gid.trim()
16772
16808
  };
16773
16809
  }
16774
- var get_gid_default = task(run135, {
16810
+ var get_gid_default = task(run131, {
16775
16811
  name: "get_gid",
16776
16812
  description: "User get gid.",
16777
16813
  inputSchema: GetGidInputSchema,
@@ -16791,7 +16827,7 @@ var GetGroupsOutputSchema = z.object({
16791
16827
  groups: z.array(z.string()).optional()
16792
16828
  })
16793
16829
  );
16794
- async function run136(context) {
16830
+ async function run132(context) {
16795
16831
  const { params, exec } = context;
16796
16832
  const { user } = params;
16797
16833
  const command = ["groups", user].filter(Boolean).join(" ");
@@ -16808,7 +16844,7 @@ async function run136(context) {
16808
16844
  groups
16809
16845
  };
16810
16846
  }
16811
- var get_groups_default = task(run136, {
16847
+ var get_groups_default = task(run132, {
16812
16848
  name: "get_groups",
16813
16849
  description: "User get groups.",
16814
16850
  inputSchema: GetGroupsInputSchema,
@@ -16828,7 +16864,7 @@ var GetUidOutputSchema = z.object({
16828
16864
  uid: z.string().optional()
16829
16865
  })
16830
16866
  );
16831
- async function run137(context) {
16867
+ async function run133(context) {
16832
16868
  const { params, exec } = context;
16833
16869
  const { user } = params;
16834
16870
  const command = ["id", "-u", user].filter(Boolean).join(" ");
@@ -16838,7 +16874,7 @@ async function run137(context) {
16838
16874
  uid: uid.trim()
16839
16875
  };
16840
16876
  }
16841
- var get_uid_default = task(run137, {
16877
+ var get_uid_default = task(run133, {
16842
16878
  name: "get_uid",
16843
16879
  description: "User get uid.",
16844
16880
  inputSchema: GetUidInputSchema,
@@ -16859,7 +16895,7 @@ var SetUserGroupsOutputSchema = z.object({
16859
16895
  error: z.string().optional()
16860
16896
  })
16861
16897
  );
16862
- async function run138(context) {
16898
+ async function run134(context) {
16863
16899
  const { params, exec } = context;
16864
16900
  const { user, groups, sudo = true } = params;
16865
16901
  const normalizedGroups = Array.isArray(groups) ? groups : typeof groups === "string" ? groups.split(",").map((group) => group.trim()).filter(Boolean) : [];
@@ -16874,7 +16910,7 @@ async function run138(context) {
16874
16910
  error: success ? void 0 : stderr || stdout
16875
16911
  };
16876
16912
  }
16877
- var set_groups_default = task(run138, {
16913
+ var set_groups_default = task(run134, {
16878
16914
  name: "set_groups",
16879
16915
  description: "User set groups.",
16880
16916
  inputSchema: SetUserGroupsInputSchema,
@@ -16895,7 +16931,7 @@ var SetUserShellOutputSchema = z.object({
16895
16931
  error: z.string().optional()
16896
16932
  })
16897
16933
  );
16898
- async function run139(context) {
16934
+ async function run135(context) {
16899
16935
  const { params, exec } = context;
16900
16936
  const { user, shell, sudo = true } = params;
16901
16937
  const command = [sudo ? "sudo" : "", "usermod", "-s", shell, user].filter(Boolean).join(" ");
@@ -16905,7 +16941,7 @@ async function run139(context) {
16905
16941
  error: success ? void 0 : stderr || stdout
16906
16942
  };
16907
16943
  }
16908
- var set_shell_default = task(run139, {
16944
+ var set_shell_default = task(run135, {
16909
16945
  name: "set_shell",
16910
16946
  description: "User set shell.",
16911
16947
  inputSchema: SetUserShellInputSchema,
@@ -16924,8 +16960,8 @@ var UserDeleteOutputSchema = z.object({
16924
16960
  success: z.boolean(),
16925
16961
  error: z.string().optional()
16926
16962
  });
16927
- async function run140(context) {
16928
- const { params, debug, exec, run: run253, error } = context;
16963
+ async function run136(context) {
16964
+ const { params, debug, exec, run: run249, error } = context;
16929
16965
  const { user, remove: remove4 = false, sudo = true } = params;
16930
16966
  if (!user) {
16931
16967
  error('Required parameter "user" is missing');
@@ -16935,7 +16971,7 @@ async function run140(context) {
16935
16971
  };
16936
16972
  }
16937
16973
  try {
16938
- const { exists: userExists } = await run253(exists_default4({ user }));
16974
+ const { exists: userExists } = await run249(exists_default4({ user }));
16939
16975
  if (!userExists) {
16940
16976
  debug(`User '${user}' does not exist, considering task successful (idempotent).`);
16941
16977
  return { success: true };
@@ -16963,7 +16999,7 @@ async function run140(context) {
16963
16999
  };
16964
17000
  }
16965
17001
  }
16966
- var delete_default5 = task(run140, {
17002
+ var delete_default5 = task(run136, {
16967
17003
  description: "Deletes a user from the system idempotently",
16968
17004
  inputSchema: UserDeleteInputSchema,
16969
17005
  outputSchema: UserDeleteOutputSchema
@@ -16993,7 +17029,7 @@ var ModifyUserOutputSchema = z.object({
16993
17029
  error: z.string().optional()
16994
17030
  })
16995
17031
  );
16996
- async function run141(context) {
17032
+ async function run137(context) {
16997
17033
  const { params, exec, run: runTask, error } = context;
16998
17034
  const {
16999
17035
  user,
@@ -17052,7 +17088,7 @@ async function run141(context) {
17052
17088
  };
17053
17089
  }
17054
17090
  }
17055
- var modify_default2 = task(run141, {
17091
+ var modify_default2 = task(run137, {
17056
17092
  name: "modify",
17057
17093
  description: "Modify an existing user account.",
17058
17094
  inputSchema: ModifyUserInputSchema,
@@ -17337,7 +17373,7 @@ var XcpngAttachVdiResultSchema = z.object({
17337
17373
  plugged: z.boolean().optional(),
17338
17374
  error: z.string().optional()
17339
17375
  });
17340
- async function run142(context) {
17376
+ async function run138(context) {
17341
17377
  const { params, error, debug } = context;
17342
17378
  const { vm_uuid, vdi_uuid, device = "0", mode = "RW", bootable: rawBootable = false } = params;
17343
17379
  if (!vm_uuid) {
@@ -17396,7 +17432,7 @@ async function run142(context) {
17396
17432
  plugged: true
17397
17433
  };
17398
17434
  }
17399
- var attach_vdi_default = task(run142, {
17435
+ var attach_vdi_default = task(run138, {
17400
17436
  inputSchema: XcpngAttachVdiParamsSchema,
17401
17437
  outputSchema: XcpngAttachVdiResultSchema,
17402
17438
  description: "Attaches an existing virtual disk image to a VM and plugs it into the guest."
@@ -17460,7 +17496,7 @@ var XcpngCreateVdiResultSchema = z.object({
17460
17496
  command: z.string().optional(),
17461
17497
  error: z.string().optional()
17462
17498
  });
17463
- async function run143(context) {
17499
+ async function run139(context) {
17464
17500
  const { params, error } = context;
17465
17501
  const { name_label, sr_uuid, size_bytes, size_mb, size_gb, description, type = "user", shareable = false } = params;
17466
17502
  if (!name_label) {
@@ -17513,7 +17549,7 @@ async function run143(context) {
17513
17549
  command: result.command
17514
17550
  };
17515
17551
  }
17516
- var create_vdi_default = task(run143, {
17552
+ var create_vdi_default = task(run139, {
17517
17553
  inputSchema: XcpngCreateVdiParamsSchema,
17518
17554
  outputSchema: XcpngCreateVdiResultSchema,
17519
17555
  description: "Creates a new virtual disk image on the specified XCP-ng storage repository."
@@ -17528,7 +17564,7 @@ var XcpngListSrParamsResultSchema = z.object({
17528
17564
  items: z.any().optional(),
17529
17565
  error: z.string().optional()
17530
17566
  });
17531
- async function run144(context) {
17567
+ async function run140(context) {
17532
17568
  const filters = normalizeFilterArgs(context.params?.filters);
17533
17569
  const result = await runXeCommand(context, "sr-param-list", filters);
17534
17570
  if (!result.success) {
@@ -17542,7 +17578,7 @@ async function run144(context) {
17542
17578
  items: parseKeyValueOutput(result.stdout)
17543
17579
  };
17544
17580
  }
17545
- var list_sr_params_default = task(run144, {
17581
+ var list_sr_params_default = task(run140, {
17546
17582
  inputSchema: XcpngListSrParamsParamsSchema,
17547
17583
  outputSchema: XcpngListSrParamsResultSchema,
17548
17584
  description: "Lists parameters for storage repositories (SRs) on an XCP-ng host."
@@ -17557,7 +17593,7 @@ var XcpngListStorageRepositoriesResultSchema = z.object({
17557
17593
  items: z.array(z.any()).optional(),
17558
17594
  error: z.string().optional()
17559
17595
  });
17560
- async function run145(context) {
17596
+ async function run141(context) {
17561
17597
  const { params } = context;
17562
17598
  const filters = normalizeFilterArgs(params?.filters);
17563
17599
  const result = await runXeCommand(context, "sr-list", filters);
@@ -17606,7 +17642,7 @@ async function run145(context) {
17606
17642
  items: enrichedItems
17607
17643
  };
17608
17644
  }
17609
- var list_storage_repositories_default = task(run145, {
17645
+ var list_storage_repositories_default = task(run141, {
17610
17646
  inputSchema: XcpngListStorageRepositoriesParamsSchema,
17611
17647
  outputSchema: XcpngListStorageRepositoriesResultSchema,
17612
17648
  description: "Lists storage repositories on an XCP-ng host."
@@ -17629,7 +17665,7 @@ var XcpngFindStorageRepositoryResultSchema = z.object({
17629
17665
  multiple: z.boolean().optional(),
17630
17666
  error: z.string().optional()
17631
17667
  });
17632
- async function run146(context) {
17668
+ async function run142(context) {
17633
17669
  const params = context.params ?? {};
17634
17670
  const {
17635
17671
  name_label: nameLabel,
@@ -17749,7 +17785,7 @@ async function runListStorageRepositories(context, params) {
17749
17785
  })
17750
17786
  );
17751
17787
  }
17752
- var find_storage_repository_default = task(run146, {
17788
+ var find_storage_repository_default = task(run142, {
17753
17789
  inputSchema: XcpngFindStorageRepositoryParamsSchema,
17754
17790
  outputSchema: XcpngFindStorageRepositoryResultSchema,
17755
17791
  description: "Finds a single storage repository on an XCP-ng host, optionally allowing multiple matches."
@@ -17782,7 +17818,7 @@ var XcpngAddDiskResultSchema = z.object({
17782
17818
  plugged: z.boolean().optional(),
17783
17819
  error: z.string().optional()
17784
17820
  });
17785
- async function run147(context) {
17821
+ async function run143(context) {
17786
17822
  const { params, error } = context;
17787
17823
  const {
17788
17824
  vm_uuid: vmUuid,
@@ -17915,7 +17951,7 @@ async function destroyVdi(context, vdiUuid, appliedCommands) {
17915
17951
  context.warn(`Failed to clean up VDI ${vdiUuid}: ${xeErrorMessage(result, "unknown error")}`);
17916
17952
  }
17917
17953
  }
17918
- var add_disk_default = task(run147, {
17954
+ var add_disk_default = task(run143, {
17919
17955
  inputSchema: XcpngAddDiskParamsSchema,
17920
17956
  outputSchema: XcpngAddDiskResultSchema,
17921
17957
  description: "Creates a VDI and attaches it to a VM on XCP-ng."
@@ -17934,7 +17970,7 @@ var XcpngAttachIsoResultSchema = z.object({
17934
17970
  plugged: z.boolean().optional(),
17935
17971
  error: z.string().optional()
17936
17972
  });
17937
- async function run148(context) {
17973
+ async function run144(context) {
17938
17974
  const { params, error, debug } = context;
17939
17975
  const { vm_uuid, iso_vdi_uuid, device, eject_before_insert = true } = params;
17940
17976
  if (!vm_uuid) {
@@ -18027,7 +18063,7 @@ async function run148(context) {
18027
18063
  plugged
18028
18064
  };
18029
18065
  }
18030
- var attach_iso_default = task(run148, {
18066
+ var attach_iso_default = task(run144, {
18031
18067
  inputSchema: XcpngAttachIsoParamsSchema,
18032
18068
  outputSchema: XcpngAttachIsoResultSchema,
18033
18069
  description: "Attaches an ISO image to a VM by invoking xe vm-cd-insert, ejecting existing media if requested."
@@ -18048,7 +18084,7 @@ var XcpngAttachNetworkInterfaceResultSchema = z.object({
18048
18084
  plugged: z.boolean().optional(),
18049
18085
  error: z.string().optional()
18050
18086
  });
18051
- async function run149(context) {
18087
+ async function run145(context) {
18052
18088
  const { params, error, debug } = context;
18053
18089
  const { vm_uuid, network_uuid, device = "0", mac_address, mtu } = params;
18054
18090
  if (!vm_uuid) {
@@ -18113,7 +18149,7 @@ async function run149(context) {
18113
18149
  plugged: true
18114
18150
  };
18115
18151
  }
18116
- var attach_network_interface_default = task(run149, {
18152
+ var attach_network_interface_default = task(run145, {
18117
18153
  inputSchema: XcpngAttachNetworkInterfaceParamsSchema,
18118
18154
  outputSchema: XcpngAttachNetworkInterfaceResultSchema,
18119
18155
  description: "Creates and plugs a virtual network interface for a VM on XCP-ng."
@@ -18128,7 +18164,7 @@ var XcpngListTemplateParamsResultSchema = z.object({
18128
18164
  items: z.any().optional(),
18129
18165
  error: z.string().optional()
18130
18166
  });
18131
- async function run150(context) {
18167
+ async function run146(context) {
18132
18168
  const filters = normalizeFilterArgs(context.params?.filters);
18133
18169
  const result = await runXeCommand(context, "template-param-list", filters);
18134
18170
  if (!result.success) {
@@ -18142,7 +18178,7 @@ async function run150(context) {
18142
18178
  items: parseKeyValueOutput(result.stdout)
18143
18179
  };
18144
18180
  }
18145
- var list_template_params_default = task(run150, {
18181
+ var list_template_params_default = task(run146, {
18146
18182
  inputSchema: XcpngListTemplateParamsParamsSchema,
18147
18183
  outputSchema: XcpngListTemplateParamsResultSchema,
18148
18184
  description: "Lists parameters for templates on an XCP-ng host."
@@ -18157,7 +18193,7 @@ var XcpngListTemplatesResultSchema = z.object({
18157
18193
  items: z.array(z.any()).optional(),
18158
18194
  error: z.string().optional()
18159
18195
  });
18160
- async function run151(context) {
18196
+ async function run147(context) {
18161
18197
  const filters = normalizeFilterArgs(context.params?.filters);
18162
18198
  const result = await runXeCommand(context, "template-list", filters);
18163
18199
  if (!result.success) {
@@ -18207,7 +18243,7 @@ async function run151(context) {
18207
18243
  items: enriched
18208
18244
  };
18209
18245
  }
18210
- var list_templates_default = task(run151, {
18246
+ var list_templates_default = task(run147, {
18211
18247
  inputSchema: XcpngListTemplatesParamsSchema,
18212
18248
  outputSchema: XcpngListTemplatesResultSchema,
18213
18249
  description: "Lists VM templates available on the XCP-ng host."
@@ -18228,7 +18264,7 @@ var XcpngFindTemplateResultSchema = z.object({
18228
18264
  multiple: z.boolean().optional(),
18229
18265
  error: z.string().optional()
18230
18266
  });
18231
- async function run152(context) {
18267
+ async function run148(context) {
18232
18268
  const params = context.params ?? {};
18233
18269
  const {
18234
18270
  name_label: nameLabel,
@@ -18326,7 +18362,7 @@ async function runListTemplates(context, params) {
18326
18362
  })
18327
18363
  );
18328
18364
  }
18329
- var find_template_default = task(run152, {
18365
+ var find_template_default = task(run148, {
18330
18366
  inputSchema: XcpngFindTemplateParamsSchema,
18331
18367
  outputSchema: XcpngFindTemplateResultSchema,
18332
18368
  description: "Finds a single template on an XCP-ng host, optionally allowing multiple matches."
@@ -18351,7 +18387,7 @@ var XcpngCloneTemplateResultSchema = z.object({
18351
18387
  alreadyExists: z.boolean().optional(),
18352
18388
  error: z.string().optional()
18353
18389
  });
18354
- async function run153(context) {
18390
+ async function run149(context) {
18355
18391
  const { params, error } = context;
18356
18392
  const {
18357
18393
  source_template_uuid: sourceTemplateUuidParam,
@@ -18471,7 +18507,7 @@ async function run153(context) {
18471
18507
  appliedCommands
18472
18508
  };
18473
18509
  }
18474
- var clone_template_default = task(run153, {
18510
+ var clone_template_default = task(run149, {
18475
18511
  inputSchema: XcpngCloneTemplateParamsSchema,
18476
18512
  outputSchema: XcpngCloneTemplateResultSchema,
18477
18513
  description: "Clones an existing XCP-ng template to a new template name."
@@ -18486,7 +18522,7 @@ var XcpngListHostsResultSchema = z.object({
18486
18522
  items: z.any().optional(),
18487
18523
  error: z.string().optional()
18488
18524
  });
18489
- async function run154(context) {
18525
+ async function run150(context) {
18490
18526
  const filters = normalizeFilterArgs(context.params?.filters);
18491
18527
  const result = await runXeCommand(context, "host-list", filters);
18492
18528
  if (!result.success) {
@@ -18500,7 +18536,7 @@ async function run154(context) {
18500
18536
  items: parseKeyValueOutput(result.stdout)
18501
18537
  };
18502
18538
  }
18503
- var list_hosts_default = task(run154, {
18539
+ var list_hosts_default = task(run150, {
18504
18540
  inputSchema: XcpngListHostsParamsSchema,
18505
18541
  outputSchema: XcpngListHostsResultSchema,
18506
18542
  description: "Lists hosts in an XCP-ng pool, returning parsed xe host-list output."
@@ -18521,7 +18557,7 @@ var XcpngFindHostResultSchema = z.object({
18521
18557
  multiple: z.boolean().optional(),
18522
18558
  error: z.string().optional()
18523
18559
  });
18524
- async function run155(context) {
18560
+ async function run151(context) {
18525
18561
  const params = context.params ?? {};
18526
18562
  const {
18527
18563
  name_label: nameLabel,
@@ -18621,7 +18657,7 @@ async function runListHosts(context, params) {
18621
18657
  })
18622
18658
  );
18623
18659
  }
18624
- var find_host_default = task(run155, {
18660
+ var find_host_default = task(run151, {
18625
18661
  inputSchema: XcpngFindHostParamsSchema,
18626
18662
  outputSchema: XcpngFindHostResultSchema,
18627
18663
  description: "Finds a single host on an XCP-ng pool, optionally allowing multiple matches."
@@ -18636,7 +18672,7 @@ var XcpngListNetworkParamsResultSchema = z.object({
18636
18672
  items: z.any().optional(),
18637
18673
  error: z.string().optional()
18638
18674
  });
18639
- async function run156(context) {
18675
+ async function run152(context) {
18640
18676
  const filters = normalizeFilterArgs(context.params?.filters);
18641
18677
  const result = await runXeCommand(context, "network-param-list", filters);
18642
18678
  if (!result.success) {
@@ -18650,7 +18686,7 @@ async function run156(context) {
18650
18686
  items: parseKeyValueOutput(result.stdout)
18651
18687
  };
18652
18688
  }
18653
- var list_network_params_default = task(run156, {
18689
+ var list_network_params_default = task(run152, {
18654
18690
  inputSchema: XcpngListNetworkParamsParamsSchema,
18655
18691
  outputSchema: XcpngListNetworkParamsResultSchema,
18656
18692
  description: "Lists parameters for networks on an XCP-ng host."
@@ -18665,7 +18701,7 @@ var XcpngListNetworksResultSchema = z.object({
18665
18701
  items: z.array(z.any()).optional(),
18666
18702
  error: z.string().optional()
18667
18703
  });
18668
- async function run157(context) {
18704
+ async function run153(context) {
18669
18705
  const { params } = context;
18670
18706
  const filters = normalizeFilterArgs(params?.filters);
18671
18707
  const result = await runXeCommand(context, "network-list", filters);
@@ -18714,7 +18750,7 @@ async function run157(context) {
18714
18750
  items: enrichedItems
18715
18751
  };
18716
18752
  }
18717
- var list_networks_default = task(run157, {
18753
+ var list_networks_default = task(run153, {
18718
18754
  inputSchema: XcpngListNetworksParamsSchema,
18719
18755
  outputSchema: XcpngListNetworksResultSchema,
18720
18756
  description: "Lists networks on an XCP-ng host."
@@ -18735,7 +18771,7 @@ var XcpngFindNetworkResultSchema = z.object({
18735
18771
  multiple: z.boolean().optional(),
18736
18772
  error: z.string().optional()
18737
18773
  });
18738
- async function run158(context) {
18774
+ async function run154(context) {
18739
18775
  const params = context.params ?? {};
18740
18776
  const {
18741
18777
  name_label: nameLabel,
@@ -18826,7 +18862,7 @@ function buildMultipleMessage4(nameLabel, uuid, count) {
18826
18862
  const detail = identifiers.length > 0 ? identifiers.join(", ") : "specified criteria";
18827
18863
  return `Multiple networks (${count}) matched ${detail}; refine filters or set allow_multiple:true.`;
18828
18864
  }
18829
- var find_network_default = task(run158, {
18865
+ var find_network_default = task(run154, {
18830
18866
  inputSchema: XcpngFindNetworkParamsSchema,
18831
18867
  outputSchema: XcpngFindNetworkResultSchema,
18832
18868
  description: "Finds a single network on an XCP-ng host, optionally allowing multiple matches."
@@ -18853,7 +18889,7 @@ var XcpngCreateBondResultSchema = z.object({
18853
18889
  appliedCommands: z.array(z.string()),
18854
18890
  error: z.string().optional()
18855
18891
  });
18856
- async function run159(context) {
18892
+ async function run155(context) {
18857
18893
  const { params, error } = context;
18858
18894
  const {
18859
18895
  host_uuid: hostUuidParam,
@@ -18975,7 +19011,7 @@ async function run159(context) {
18975
19011
  appliedCommands
18976
19012
  };
18977
19013
  }
18978
- var create_bond_default = task(run159, {
19014
+ var create_bond_default = task(run155, {
18979
19015
  inputSchema: XcpngCreateBondParamsSchema,
18980
19016
  outputSchema: XcpngCreateBondResultSchema,
18981
19017
  description: "Creates a bonded interface on a host, wrapping xe bond-create."
@@ -18990,7 +19026,7 @@ var XcpngListPbdParamsResultSchema = z.object({
18990
19026
  items: z.any().optional(),
18991
19027
  error: z.string().optional()
18992
19028
  });
18993
- async function run160(context) {
19029
+ async function run156(context) {
18994
19030
  const filters = normalizeFilterArgs(context.params?.filters);
18995
19031
  const result = await runXeCommand(context, "pbd-param-list", filters);
18996
19032
  if (!result.success) {
@@ -19004,7 +19040,7 @@ async function run160(context) {
19004
19040
  items: parseKeyValueOutput(result.stdout)
19005
19041
  };
19006
19042
  }
19007
- var list_pbd_params_default = task(run160, {
19043
+ var list_pbd_params_default = task(run156, {
19008
19044
  inputSchema: XcpngListPbdParamsParamsSchema,
19009
19045
  outputSchema: XcpngListPbdParamsResultSchema,
19010
19046
  description: "Lists parameters for PBDs on an XCP-ng host."
@@ -19019,7 +19055,7 @@ var XcpngListPbdsResultSchema = z.object({
19019
19055
  items: z.array(z.any()).optional(),
19020
19056
  error: z.string().optional()
19021
19057
  });
19022
- async function run161(context) {
19058
+ async function run157(context) {
19023
19059
  const filters = normalizeFilterArgs(context.params?.filters);
19024
19060
  const result = await runXeCommand(context, "pbd-list", filters);
19025
19061
  if (!result.success) {
@@ -19067,7 +19103,7 @@ async function run161(context) {
19067
19103
  items: enrichedItems
19068
19104
  };
19069
19105
  }
19070
- var list_pbds_default = task(run161, {
19106
+ var list_pbds_default = task(run157, {
19071
19107
  inputSchema: XcpngListPbdsParamsSchema,
19072
19108
  outputSchema: XcpngListPbdsResultSchema,
19073
19109
  description: "Lists storage bindings (PBDs) between hosts and storage repositories."
@@ -19089,7 +19125,7 @@ var XcpngFindPbdResultSchema = z.object({
19089
19125
  multiple: z.boolean().optional(),
19090
19126
  error: z.string().optional()
19091
19127
  });
19092
- async function run162(context) {
19128
+ async function run158(context) {
19093
19129
  const params = context.params ?? {};
19094
19130
  const {
19095
19131
  uuid,
@@ -19202,7 +19238,7 @@ async function runListPbds(context, params) {
19202
19238
  })
19203
19239
  );
19204
19240
  }
19205
- var find_pbd_default = task(run162, {
19241
+ var find_pbd_default = task(run158, {
19206
19242
  inputSchema: XcpngFindPbdParamsSchema,
19207
19243
  outputSchema: XcpngFindPbdResultSchema,
19208
19244
  description: "Finds a single PBD (host \u2194 SR binding), optionally allowing multiple matches."
@@ -19227,7 +19263,7 @@ var XcpngCreatePbdResultSchema = z.object({
19227
19263
  skipped: z.boolean().optional(),
19228
19264
  error: z.string().optional()
19229
19265
  });
19230
- async function run163(context) {
19266
+ async function run159(context) {
19231
19267
  const { params, error } = context;
19232
19268
  const {
19233
19269
  host_uuid: hostUuidParam,
@@ -19344,7 +19380,7 @@ async function run163(context) {
19344
19380
  appliedCommands
19345
19381
  };
19346
19382
  }
19347
- var create_pbd_default = task(run163, {
19383
+ var create_pbd_default = task(run159, {
19348
19384
  inputSchema: XcpngCreatePbdParamsSchema,
19349
19385
  outputSchema: XcpngCreatePbdResultSchema,
19350
19386
  description: "Creates a host \u2194 storage repository binding (PBD)."
@@ -19359,7 +19395,7 @@ var XcpngListVmParamsResultSchema = z.object({
19359
19395
  items: z.any().optional(),
19360
19396
  error: z.string().optional()
19361
19397
  });
19362
- async function run164(context) {
19398
+ async function run160(context) {
19363
19399
  const filters = normalizeFilterArgs(context.params?.filters);
19364
19400
  const result = await runXeCommand(context, "vm-param-list", filters);
19365
19401
  if (!result.success) {
@@ -19373,7 +19409,7 @@ async function run164(context) {
19373
19409
  items: parseKeyValueOutput(result.stdout)
19374
19410
  };
19375
19411
  }
19376
- var list_vm_params_default = task(run164, {
19412
+ var list_vm_params_default = task(run160, {
19377
19413
  inputSchema: XcpngListVmParamsParamsSchema,
19378
19414
  outputSchema: XcpngListVmParamsResultSchema,
19379
19415
  description: "Lists virtual machines (VMs) on an XCP-ng host."
@@ -19389,7 +19425,7 @@ var XcpngListVmsResultSchema = z.object({
19389
19425
  items: z.array(z.any()).optional(),
19390
19426
  error: z.string().optional()
19391
19427
  });
19392
- async function run165(context) {
19428
+ async function run161(context) {
19393
19429
  const { params } = context;
19394
19430
  const filters = normalizeFilterArgs(params?.filters);
19395
19431
  const paramsArg = buildParamsArg(params?.params);
@@ -19442,7 +19478,7 @@ async function run165(context) {
19442
19478
  items: enrichedItems
19443
19479
  };
19444
19480
  }
19445
- var list_vms_default = task(run165, {
19481
+ var list_vms_default = task(run161, {
19446
19482
  inputSchema: XcpngListVmsParamsSchema,
19447
19483
  outputSchema: XcpngListVmsResultSchema,
19448
19484
  description: "Lists VMs on an XCP-ng host and returns structured metadata."
@@ -19493,7 +19529,7 @@ var XcpngFindVmResultSchema = z.object({
19493
19529
  multiple: z.boolean().optional(),
19494
19530
  error: z.string().optional()
19495
19531
  });
19496
- async function run166(context) {
19532
+ async function run162(context) {
19497
19533
  const params = context.params ?? {};
19498
19534
  const {
19499
19535
  name_label: nameLabel,
@@ -19621,7 +19657,7 @@ async function runListVms(context, params) {
19621
19657
  })
19622
19658
  );
19623
19659
  }
19624
- var find_vm_default = task(run166, {
19660
+ var find_vm_default = task(run162, {
19625
19661
  inputSchema: XcpngFindVmParamsSchema,
19626
19662
  outputSchema: XcpngFindVmResultSchema,
19627
19663
  description: "Finds a single VM on an XCP-ng host, optionally allowing multiple matches."
@@ -19726,7 +19762,7 @@ var XcpngCreateTemplateResultSchema = z.object({
19726
19762
  powerState: z.string().optional(),
19727
19763
  waitAttempts: z.number().optional()
19728
19764
  });
19729
- async function run167(context) {
19765
+ async function run163(context) {
19730
19766
  const { params, error } = context;
19731
19767
  const {
19732
19768
  source_vm_uuid: sourceVmUuidParam,
@@ -19834,7 +19870,7 @@ async function run167(context) {
19834
19870
  waitAttempts: ensureHalted.attempts
19835
19871
  };
19836
19872
  }
19837
- var create_template_default = task(run167, {
19873
+ var create_template_default = task(run163, {
19838
19874
  inputSchema: XcpngCreateTemplateParamsSchema,
19839
19875
  outputSchema: XcpngCreateTemplateResultSchema,
19840
19876
  description: "Clones a VM and converts it into an XCP-ng template."
@@ -19861,7 +19897,7 @@ var XcpngCreateVmResultSchema = z.object({
19861
19897
  appliedCommands: z.array(z.string()),
19862
19898
  error: z.string().optional()
19863
19899
  });
19864
- async function run168(context) {
19900
+ async function run164(context) {
19865
19901
  const { params, error } = context;
19866
19902
  const {
19867
19903
  name_label,
@@ -19987,7 +20023,7 @@ async function run168(context) {
19987
20023
  appliedCommands
19988
20024
  };
19989
20025
  }
19990
- var create_vm_default = task(run168, {
20026
+ var create_vm_default = task(run164, {
19991
20027
  inputSchema: XcpngCreateVmParamsSchema,
19992
20028
  outputSchema: XcpngCreateVmResultSchema,
19993
20029
  description: "Creates a new VM on XCP-ng and optionally applies memory and CPU sizing."
@@ -20002,7 +20038,7 @@ var XcpngListVdiParamsResultSchema = z.object({
20002
20038
  items: z.any().optional(),
20003
20039
  error: z.string().optional()
20004
20040
  });
20005
- async function run169(context) {
20041
+ async function run165(context) {
20006
20042
  const filters = normalizeFilterArgs(context.params?.filters);
20007
20043
  const result = await runXeCommand(context, "vdi-param-list", filters);
20008
20044
  if (!result.success) {
@@ -20016,7 +20052,7 @@ async function run169(context) {
20016
20052
  items: parseKeyValueOutput(result.stdout)
20017
20053
  };
20018
20054
  }
20019
- var list_vdi_params_default = task(run169, {
20055
+ var list_vdi_params_default = task(run165, {
20020
20056
  inputSchema: XcpngListVdiParamsParamsSchema,
20021
20057
  outputSchema: XcpngListVdiParamsResultSchema,
20022
20058
  description: "Lists virtual disk image parameters (VDI params) on an XCP-ng host."
@@ -20031,7 +20067,7 @@ var XcpngListVdisResultSchema = z.object({
20031
20067
  items: z.array(z.any()).optional(),
20032
20068
  error: z.string().optional()
20033
20069
  });
20034
- async function run170(context) {
20070
+ async function run166(context) {
20035
20071
  const { params } = context;
20036
20072
  const filters = normalizeFilterArgs(params?.filters);
20037
20073
  const result = await runXeCommand(context, "vdi-list", filters);
@@ -20082,7 +20118,7 @@ async function run170(context) {
20082
20118
  items: enrichedItems
20083
20119
  };
20084
20120
  }
20085
- var list_vdis_default = task(run170, {
20121
+ var list_vdis_default = task(run166, {
20086
20122
  inputSchema: XcpngListVdisParamsSchema,
20087
20123
  outputSchema: XcpngListVdisResultSchema,
20088
20124
  description: "Lists VDIs on an XCP-ng host with optional filtering."
@@ -20104,7 +20140,7 @@ var XcpngFindVdiResultSchema = z.object({
20104
20140
  multiple: z.boolean().optional(),
20105
20141
  error: z.string().optional()
20106
20142
  });
20107
- async function run171(context) {
20143
+ async function run167(context) {
20108
20144
  const params = context.params ?? {};
20109
20145
  const {
20110
20146
  name_label: nameLabel,
@@ -20210,7 +20246,7 @@ function buildMultipleMessage7(nameLabel, uuid, srUuid, count) {
20210
20246
  const detail = identifiers.length > 0 ? identifiers.join(", ") : "specified criteria";
20211
20247
  return `Multiple VDIs (${count}) matched ${detail}; refine filters or set allow_multiple:true.`;
20212
20248
  }
20213
- var find_vdi_default = task(run171, {
20249
+ var find_vdi_default = task(run167, {
20214
20250
  inputSchema: XcpngFindVdiParamsSchema,
20215
20251
  outputSchema: XcpngFindVdiResultSchema,
20216
20252
  description: "Finds a single VDI on an XCP-ng host, optionally allowing multiple matches."
@@ -20225,7 +20261,7 @@ var XcpngListVbdParamsResultSchema = z.object({
20225
20261
  items: z.any().optional(),
20226
20262
  error: z.string().optional()
20227
20263
  });
20228
- async function run172(context) {
20264
+ async function run168(context) {
20229
20265
  const filters = normalizeFilterArgs(context.params?.filters);
20230
20266
  const result = await runXeCommand(context, "vbd-param-list", filters);
20231
20267
  if (!result.success) {
@@ -20239,7 +20275,7 @@ async function run172(context) {
20239
20275
  items: parseKeyValueOutput(result.stdout)
20240
20276
  };
20241
20277
  }
20242
- var list_vbd_params_default = task(run172, {
20278
+ var list_vbd_params_default = task(run168, {
20243
20279
  inputSchema: XcpngListVbdParamsParamsSchema,
20244
20280
  outputSchema: XcpngListVbdParamsResultSchema,
20245
20281
  description: "Lists virtual block devices (VBDs) on an XCP-ng host."
@@ -20254,7 +20290,7 @@ var XcpngListVbdsResultSchema = z.object({
20254
20290
  items: z.array(z.any()).optional(),
20255
20291
  error: z.string().optional()
20256
20292
  });
20257
- async function run173(context) {
20293
+ async function run169(context) {
20258
20294
  const filters = normalizeFilterArgs(context.params?.filters);
20259
20295
  const result = await runXeCommand(context, "vbd-list", filters);
20260
20296
  if (!result.success) {
@@ -20304,7 +20340,7 @@ async function run173(context) {
20304
20340
  items: enrichedItems
20305
20341
  };
20306
20342
  }
20307
- var list_vbds_default = task(run173, {
20343
+ var list_vbds_default = task(run169, {
20308
20344
  inputSchema: XcpngListVbdsParamsSchema,
20309
20345
  outputSchema: XcpngListVbdsResultSchema,
20310
20346
  description: "Lists virtual block devices (VBDs) on an XCP-ng host."
@@ -20321,7 +20357,7 @@ var XcpngListAttachedDisksResultSchema = z.object({
20321
20357
  disks: z.array(z.any()).optional(),
20322
20358
  error: z.string().optional()
20323
20359
  });
20324
- async function run174(context) {
20360
+ async function run170(context) {
20325
20361
  const { params, error } = context;
20326
20362
  const { vm_uuid: vmUuid, include_readonly: rawIncludeReadonly } = params ?? {};
20327
20363
  if (!vmUuid) {
@@ -20415,7 +20451,7 @@ async function run174(context) {
20415
20451
  disks
20416
20452
  };
20417
20453
  }
20418
- var list_attached_disks_default = task(run174, {
20454
+ var list_attached_disks_default = task(run170, {
20419
20455
  inputSchema: XcpngListAttachedDisksParamsSchema,
20420
20456
  outputSchema: XcpngListAttachedDisksResultSchema,
20421
20457
  description: "Lists VBDs attached to a VM and enriches them with VDI metadata so disks vs CD drives can be distinguished."
@@ -20442,7 +20478,7 @@ var XcpngRemoveDiskResultSchema = z.object({
20442
20478
  appliedCommands: z.array(z.string()),
20443
20479
  error: z.string().optional()
20444
20480
  });
20445
- async function run175(context) {
20481
+ async function run171(context) {
20446
20482
  const { params, error } = context;
20447
20483
  const {
20448
20484
  vbd_uuid: vbdUuidParam,
@@ -20630,7 +20666,7 @@ async function waitForVdiRemoval(context, vdiUuid, timeoutMs) {
20630
20666
  await new Promise((resolve) => setTimeout(resolve, 1e3));
20631
20667
  }
20632
20668
  }
20633
- var remove_disk_default = task(run175, {
20669
+ var remove_disk_default = task(run171, {
20634
20670
  inputSchema: XcpngRemoveDiskParamsSchema,
20635
20671
  outputSchema: XcpngRemoveDiskResultSchema,
20636
20672
  description: "Detaches a VDI from a VM and optionally destroys the backing disk on XCP-ng."
@@ -20647,7 +20683,7 @@ var XcpngSetBootOrderResultSchema = z.object({
20647
20683
  appliedCommands: z.array(z.string()),
20648
20684
  error: z.string().optional()
20649
20685
  });
20650
- async function run176(context) {
20686
+ async function run172(context) {
20651
20687
  const { params, error } = context;
20652
20688
  const { vm_uuid, boot_order, firmware } = params;
20653
20689
  if (!vm_uuid) {
@@ -20711,7 +20747,7 @@ async function run176(context) {
20711
20747
  appliedCommands
20712
20748
  };
20713
20749
  }
20714
- var set_boot_order_default = task(run176, {
20750
+ var set_boot_order_default = task(run172, {
20715
20751
  inputSchema: XcpngSetBootOrderParamsSchema,
20716
20752
  outputSchema: XcpngSetBootOrderResultSchema,
20717
20753
  description: "Configures VM boot order and optional firmware mode via xe vm-param-set."
@@ -20764,7 +20800,7 @@ var OTHER_CONFIG_KEYS_TO_REMOVE = [
20764
20800
  "cloud-init-hostname",
20765
20801
  "cloud-init-instance-id"
20766
20802
  ];
20767
- async function run177(context) {
20803
+ async function run173(context) {
20768
20804
  if (!context.host) {
20769
20805
  const message = "core.xcpng.create-template-from-vdi must run against a remote XCP-ng host.";
20770
20806
  return {
@@ -21297,7 +21333,7 @@ async function run177(context) {
21297
21333
  steps
21298
21334
  };
21299
21335
  }
21300
- var create_template_from_vdi_default = task(run177, {
21336
+ var create_template_from_vdi_default = task(run173, {
21301
21337
  inputSchema: XcpngCreateTemplateFromVdiParamsSchema,
21302
21338
  outputSchema: XcpngCreateTemplateFromVdiResultSchema,
21303
21339
  description: "Creates an XCP-ng template from an existing VDI by staging a VM and converting it."
@@ -21414,7 +21450,7 @@ var XcpngCreateNetworkResultSchema = z.object({
21414
21450
  skipped: z.boolean().optional(),
21415
21451
  error: z.string().optional()
21416
21452
  });
21417
- async function run178(context) {
21453
+ async function run174(context) {
21418
21454
  const { params, error } = context;
21419
21455
  const { name_label: nameLabel, description, bridge, mtu, tags, allow_existing: rawAllowExisting } = params ?? {};
21420
21456
  if (!nameLabel) {
@@ -21479,7 +21515,7 @@ async function run178(context) {
21479
21515
  appliedCommands
21480
21516
  };
21481
21517
  }
21482
- var create_network_default = task(run178, {
21518
+ var create_network_default = task(run174, {
21483
21519
  inputSchema: XcpngCreateNetworkParamsSchema,
21484
21520
  outputSchema: XcpngCreateNetworkResultSchema,
21485
21521
  description: "Creates a new network on an XCP-ng host (bridge, MTU, and tags optional)."
@@ -21511,7 +21547,7 @@ var XcpngFindOrCreateIsoSrResultSchema = z.object({
21511
21547
  commands: z.array(z.string()),
21512
21548
  error: z.string().optional()
21513
21549
  });
21514
- async function run179(context) {
21550
+ async function run175(context) {
21515
21551
  const { params, debug, error: logError2 } = context;
21516
21552
  const {
21517
21553
  name_label: nameLabel,
@@ -21663,7 +21699,7 @@ async function runDirCreate(context, params) {
21663
21699
  })
21664
21700
  );
21665
21701
  }
21666
- var find_or_create_iso_sr_default = task(run179, {
21702
+ var find_or_create_iso_sr_default = task(run175, {
21667
21703
  inputSchema: XcpngFindOrCreateIsoSrParamsSchema,
21668
21704
  outputSchema: XcpngFindOrCreateIsoSrResultSchema,
21669
21705
  description: "Finds an ISO storage repository by name, creating it if missing using xe sr-create."
@@ -21706,7 +21742,7 @@ var XcpngCreateConfigDriveResultSchema = z.object({
21706
21742
  steps: z.array(z.any()),
21707
21743
  error: z.string().optional()
21708
21744
  });
21709
- async function run180(context) {
21745
+ async function run176(context) {
21710
21746
  if (!context.host) {
21711
21747
  return {
21712
21748
  success: false,
@@ -22225,7 +22261,7 @@ function decodeBase64Field(field, value) {
22225
22261
  };
22226
22262
  }
22227
22263
  }
22228
- var create_config_drive_default = task(run180, {
22264
+ var create_config_drive_default = task(run176, {
22229
22265
  inputSchema: XcpngCreateConfigDriveParamsSchema,
22230
22266
  outputSchema: XcpngCreateConfigDriveResultSchema,
22231
22267
  description: "Generates a NoCloud config-drive ISO, stores it in an ISO SR, and returns the associated VDI."
@@ -22249,7 +22285,7 @@ var XcpngConvertTemplateToVmResultSchema = z.object({
22249
22285
  alreadyVm: z.boolean().optional(),
22250
22286
  error: z.string().optional()
22251
22287
  });
22252
- async function run181(context) {
22288
+ async function run177(context) {
22253
22289
  const { params, error } = context;
22254
22290
  const {
22255
22291
  template_uuid: templateUuidParam,
@@ -22348,7 +22384,7 @@ async function run181(context) {
22348
22384
  alreadyVm
22349
22385
  };
22350
22386
  }
22351
- var convert_template_to_vm_default = task(run181, {
22387
+ var convert_template_to_vm_default = task(run177, {
22352
22388
  inputSchema: XcpngConvertTemplateToVmParamsSchema,
22353
22389
  outputSchema: XcpngConvertTemplateToVmResultSchema,
22354
22390
  description: "Converts an XCP-ng template into a VM by clearing the template flag and optionally renaming it."
@@ -22369,7 +22405,7 @@ var XcpngDestroyIsoSrResultSchema = z.object({
22369
22405
  skipped: z.boolean().optional(),
22370
22406
  error: z.string().optional()
22371
22407
  });
22372
- async function run182(context) {
22408
+ async function run178(context) {
22373
22409
  const { params, error } = context;
22374
22410
  const { sr_uuid: srUuidParam, sr_name_label: srName, location, allow_missing: rawAllowMissing } = params ?? {};
22375
22411
  const allowMissing = coerceBoolean(rawAllowMissing, false);
@@ -22535,7 +22571,7 @@ async function detachSrPbds(context, srUuid, allowMissing) {
22535
22571
  }
22536
22572
  return { commands };
22537
22573
  }
22538
- var destroy_iso_sr_default = task(run182, {
22574
+ var destroy_iso_sr_default = task(run178, {
22539
22575
  inputSchema: XcpngDestroyIsoSrParamsSchema,
22540
22576
  outputSchema: XcpngDestroyIsoSrResultSchema,
22541
22577
  description: "Destroys an ISO storage repository and optionally removes its backing directory."
@@ -22554,7 +22590,7 @@ var XcpngDestroyBondResultSchema = z.object({
22554
22590
  skipped: z.boolean().optional(),
22555
22591
  error: z.string().optional()
22556
22592
  });
22557
- async function run183(context) {
22593
+ async function run179(context) {
22558
22594
  const { params, error } = context;
22559
22595
  const { bond_uuid: bondUuidParam, pif_uuid: pifUuidParam, allow_missing: rawAllowMissing } = params ?? {};
22560
22596
  const allowMissing = coerceBoolean(rawAllowMissing, false);
@@ -22591,7 +22627,7 @@ async function run183(context) {
22591
22627
  appliedCommands
22592
22628
  };
22593
22629
  }
22594
- var destroy_bond_default = task(run183, {
22630
+ var destroy_bond_default = task(run179, {
22595
22631
  inputSchema: XcpngDestroyBondParamsSchema,
22596
22632
  outputSchema: XcpngDestroyBondResultSchema,
22597
22633
  description: "Destroys a bonded interface, wrapping xe bond-destroy."
@@ -22613,7 +22649,7 @@ var XcpngCreateSrResultSchema = z.object({
22613
22649
  skipped: z.boolean().optional(),
22614
22650
  error: z.string().optional()
22615
22651
  });
22616
- async function run184(context) {
22652
+ async function run180(context) {
22617
22653
  const { params, error } = context;
22618
22654
  const {
22619
22655
  name_label: nameLabel,
@@ -22688,7 +22724,7 @@ async function run184(context) {
22688
22724
  appliedCommands
22689
22725
  };
22690
22726
  }
22691
- var create_sr_default = task(run184, {
22727
+ var create_sr_default = task(run180, {
22692
22728
  inputSchema: XcpngCreateSrParamsSchema,
22693
22729
  outputSchema: XcpngCreateSrResultSchema,
22694
22730
  description: "Creates a new storage repository (SR) with the specified device configuration."
@@ -22708,7 +22744,7 @@ var XcpngDestroySrResultSchema = z.object({
22708
22744
  skipped: z.boolean().optional(),
22709
22745
  error: z.string().optional()
22710
22746
  });
22711
- async function run185(context) {
22747
+ async function run181(context) {
22712
22748
  const { params, error } = context;
22713
22749
  const {
22714
22750
  sr_uuid: srUuidParam,
@@ -22782,7 +22818,7 @@ async function run185(context) {
22782
22818
  appliedCommands
22783
22819
  };
22784
22820
  }
22785
- var destroy_sr_default = task(run185, {
22821
+ var destroy_sr_default = task(run181, {
22786
22822
  inputSchema: XcpngDestroySrParamsSchema,
22787
22823
  outputSchema: XcpngDestroySrResultSchema,
22788
22824
  description: "Destroys a storage repository by UUID or name-label (optionally forcing)."
@@ -22801,7 +22837,7 @@ var XcpngDestroyNetworkResultSchema = z.object({
22801
22837
  skipped: z.boolean().optional(),
22802
22838
  error: z.string().optional()
22803
22839
  });
22804
- async function run186(context) {
22840
+ async function run182(context) {
22805
22841
  const { params, error } = context;
22806
22842
  const {
22807
22843
  network_uuid: networkUuidParam,
@@ -22868,7 +22904,7 @@ async function run186(context) {
22868
22904
  appliedCommands
22869
22905
  };
22870
22906
  }
22871
- var destroy_network_default = task(run186, {
22907
+ var destroy_network_default = task(run182, {
22872
22908
  inputSchema: XcpngDestroyNetworkParamsSchema,
22873
22909
  outputSchema: XcpngDestroyNetworkResultSchema,
22874
22910
  description: "Destroys an XCP-ng network by UUID or name-label."
@@ -22890,7 +22926,7 @@ var XcpngDestroyPbdResultSchema = z.object({
22890
22926
  skipped: z.boolean().optional(),
22891
22927
  error: z.string().optional()
22892
22928
  });
22893
- async function run187(context) {
22929
+ async function run183(context) {
22894
22930
  const { params, error } = context;
22895
22931
  const {
22896
22932
  pbd_uuid: pbdUuidParam,
@@ -22999,7 +23035,7 @@ async function run187(context) {
22999
23035
  appliedCommands
23000
23036
  };
23001
23037
  }
23002
- var destroy_pbd_default = task(run187, {
23038
+ var destroy_pbd_default = task(run183, {
23003
23039
  inputSchema: XcpngDestroyPbdParamsSchema,
23004
23040
  outputSchema: XcpngDestroyPbdResultSchema,
23005
23041
  description: "Destroys a host \u2194 storage repository binding (PBD)."
@@ -23015,7 +23051,7 @@ var XcpngDestroySnapshotResultSchema = z.object({
23015
23051
  command: z.string().optional(),
23016
23052
  error: z.string().optional()
23017
23053
  });
23018
- async function run188(context) {
23054
+ async function run184(context) {
23019
23055
  const { params, error } = context;
23020
23056
  const { snapshot_uuid: snapshotUuid } = params ?? {};
23021
23057
  if (!snapshotUuid) {
@@ -23038,7 +23074,7 @@ async function run188(context) {
23038
23074
  command: result.command
23039
23075
  };
23040
23076
  }
23041
- var destroy_snapshot_default = task(run188, {
23077
+ var destroy_snapshot_default = task(run184, {
23042
23078
  inputSchema: XcpngDestroySnapshotParamsSchema,
23043
23079
  outputSchema: XcpngDestroySnapshotResultSchema,
23044
23080
  description: "Destroys an XCP-ng VM snapshot."
@@ -23058,7 +23094,7 @@ var XcpngIntroduceSrResultSchema = z.object({
23058
23094
  appliedCommands: z.array(z.string()),
23059
23095
  error: z.string().optional()
23060
23096
  });
23061
- async function run189(context) {
23097
+ async function run185(context) {
23062
23098
  const { params, error } = context;
23063
23099
  const { sr_uuid: srUuid, name_label: nameLabel, type, content_type: contentType, shared } = params ?? {};
23064
23100
  if (!srUuid) {
@@ -23099,7 +23135,7 @@ async function run189(context) {
23099
23135
  appliedCommands
23100
23136
  };
23101
23137
  }
23102
- var introduce_sr_default = task(run189, {
23138
+ var introduce_sr_default = task(run185, {
23103
23139
  inputSchema: XcpngIntroduceSrParamsSchema,
23104
23140
  outputSchema: XcpngIntroduceSrResultSchema,
23105
23141
  description: "Introduces an existing storage repository into the pool."
@@ -23118,7 +23154,7 @@ var XcpngForgetSrResultSchema = z.object({
23118
23154
  skipped: z.boolean().optional(),
23119
23155
  error: z.string().optional()
23120
23156
  });
23121
- async function run190(context) {
23157
+ async function run186(context) {
23122
23158
  const { params, error } = context;
23123
23159
  const { sr_uuid: srUuidParam, sr_name_label: srNameLabel, allow_missing: rawAllowMissing } = params ?? {};
23124
23160
  const allowMissing = coerceBoolean(rawAllowMissing, false);
@@ -23181,7 +23217,7 @@ async function run190(context) {
23181
23217
  appliedCommands
23182
23218
  };
23183
23219
  }
23184
- var forget_sr_default = task(run190, {
23220
+ var forget_sr_default = task(run186, {
23185
23221
  inputSchema: XcpngForgetSrParamsSchema,
23186
23222
  outputSchema: XcpngForgetSrResultSchema,
23187
23223
  description: "Forgets an SR from the pool metadata without destroying the underlying storage."
@@ -23196,7 +23232,7 @@ var XcpngListSnapshotsResultSchema = z.object({
23196
23232
  items: z.any().optional(),
23197
23233
  error: z.string().optional()
23198
23234
  });
23199
- async function run191(context) {
23235
+ async function run187(context) {
23200
23236
  const filters = normalizeFilterArgs(context.params?.filters);
23201
23237
  const result = await runXeCommand(context, "snapshot-list", filters);
23202
23238
  if (!result.success) {
@@ -23210,7 +23246,7 @@ async function run191(context) {
23210
23246
  items: parseKeyValueOutput(result.stdout)
23211
23247
  };
23212
23248
  }
23213
- var list_snapshots_default = task(run191, {
23249
+ var list_snapshots_default = task(run187, {
23214
23250
  inputSchema: XcpngListSnapshotsParamsSchema,
23215
23251
  outputSchema: XcpngListSnapshotsResultSchema,
23216
23252
  description: "Lists VM snapshots available on the host."
@@ -23225,7 +23261,7 @@ var XcpngListMessagesResultSchema = z.object({
23225
23261
  items: z.any().optional(),
23226
23262
  error: z.string().optional()
23227
23263
  });
23228
- async function run192(context) {
23264
+ async function run188(context) {
23229
23265
  const filters = normalizeFilterArgs(context.params?.filters);
23230
23266
  const result = await runXeCommand(context, "message-list", filters);
23231
23267
  if (!result.success) {
@@ -23239,7 +23275,7 @@ async function run192(context) {
23239
23275
  items: parseKeyValueOutput(result.stdout)
23240
23276
  };
23241
23277
  }
23242
- var list_messages_default = task(run192, {
23278
+ var list_messages_default = task(run188, {
23243
23279
  inputSchema: XcpngListMessagesParamsSchema,
23244
23280
  outputSchema: XcpngListMessagesResultSchema,
23245
23281
  description: "Lists messages emitted by the XCP-ng pool."
@@ -23258,7 +23294,7 @@ var XcpngClearMessagesResultSchema = z.object({
23258
23294
  commands: z.any().optional(),
23259
23295
  error: z.string().optional()
23260
23296
  });
23261
- async function run193(context) {
23297
+ async function run189(context) {
23262
23298
  const { params, error } = context;
23263
23299
  const { uuid, uuid_prefix: uuidPrefix, all: rawAll, filters } = params ?? {};
23264
23300
  const all = coerceBoolean(rawAll, false);
@@ -23316,7 +23352,7 @@ async function run193(context) {
23316
23352
  commands
23317
23353
  };
23318
23354
  }
23319
- var clear_messages_default = task(run193, {
23355
+ var clear_messages_default = task(run189, {
23320
23356
  inputSchema: XcpngClearMessagesParamsSchema,
23321
23357
  outputSchema: XcpngClearMessagesResultSchema,
23322
23358
  description: "Clears messages (all, by UUID, or UUID prefix)."
@@ -23337,7 +23373,7 @@ var XcpngDestroyTemplateResultSchema = z.object({
23337
23373
  skipped: z.boolean().optional(),
23338
23374
  error: z.string().optional()
23339
23375
  });
23340
- async function run194(context) {
23376
+ async function run190(context) {
23341
23377
  const { params, error } = context;
23342
23378
  const {
23343
23379
  template_uuid: templateUuidParam,
@@ -23412,7 +23448,7 @@ async function run194(context) {
23412
23448
  command: commandResult.command
23413
23449
  };
23414
23450
  }
23415
- var destroy_template_default = task(run194, {
23451
+ var destroy_template_default = task(run190, {
23416
23452
  inputSchema: XcpngDestroyTemplateParamsSchema,
23417
23453
  outputSchema: XcpngDestroyTemplateResultSchema,
23418
23454
  description: "Destroys an XCP-ng template by UUID or name-label."
@@ -23432,7 +23468,7 @@ var XcpngDestroyVdiResultSchema = z.object({
23432
23468
  skipped: z.boolean().optional(),
23433
23469
  error: z.string().optional()
23434
23470
  });
23435
- async function run195(context) {
23471
+ async function run191(context) {
23436
23472
  const { params, error } = context;
23437
23473
  const {
23438
23474
  vdi_uuid: vdiUuidParam,
@@ -23497,7 +23533,7 @@ async function run195(context) {
23497
23533
  command: result.command
23498
23534
  };
23499
23535
  }
23500
- var destroy_vdi_default = task(run195, {
23536
+ var destroy_vdi_default = task(run191, {
23501
23537
  inputSchema: XcpngDestroyVdiParamsSchema,
23502
23538
  outputSchema: XcpngDestroyVdiResultSchema,
23503
23539
  description: "Destroys an XCP-ng VDI by UUID (optionally resolving by name-label)."
@@ -23522,7 +23558,7 @@ var XcpngDestroyVmResultSchema = z.object({
23522
23558
  skipped: z.boolean().optional(),
23523
23559
  error: z.string().optional()
23524
23560
  });
23525
- async function run196(context) {
23561
+ async function run192(context) {
23526
23562
  const { params, error } = context;
23527
23563
  const {
23528
23564
  vm_uuid: vmUuidParam,
@@ -23685,7 +23721,7 @@ async function run196(context) {
23685
23721
  destroyedVdiUuids
23686
23722
  };
23687
23723
  }
23688
- var destroy_vm_default = task(run196, {
23724
+ var destroy_vm_default = task(run192, {
23689
23725
  inputSchema: XcpngDestroyVmParamsSchema,
23690
23726
  outputSchema: XcpngDestroyVmResultSchema,
23691
23727
  description: "Destroys an XCP-ng VM, optionally forcing and pruning snapshots."
@@ -23714,7 +23750,7 @@ var XcpngCopyVdiResultSchema = z.object({
23714
23750
  skipped: z.boolean().optional(),
23715
23751
  error: z.string().optional()
23716
23752
  });
23717
- async function run197(context) {
23753
+ async function run193(context) {
23718
23754
  const { params, error } = context;
23719
23755
  const {
23720
23756
  source_vdi_uuid: sourceVdiUuidParam,
@@ -23859,7 +23895,7 @@ async function run197(context) {
23859
23895
  appliedCommands
23860
23896
  };
23861
23897
  }
23862
- var copy_vdi_default = task(run197, {
23898
+ var copy_vdi_default = task(run193, {
23863
23899
  inputSchema: XcpngCopyVdiParamsSchema,
23864
23900
  outputSchema: XcpngCopyVdiResultSchema,
23865
23901
  description: "Copies an XCP-ng VDI to a destination storage repository and optionally updates its metadata."
@@ -23877,7 +23913,7 @@ var XcpngDetachIsoResultSchema = z.object({
23877
23913
  alreadyEmpty: z.boolean().optional(),
23878
23914
  error: z.string().optional()
23879
23915
  });
23880
- async function run198(context) {
23916
+ async function run194(context) {
23881
23917
  const { params, error } = context;
23882
23918
  const { vm_uuid: vmUuid, allow_missing: rawAllowMissing } = params;
23883
23919
  if (!vmUuid) {
@@ -23909,7 +23945,7 @@ async function run198(context) {
23909
23945
  error: message
23910
23946
  };
23911
23947
  }
23912
- var detach_iso_default = task(run198, {
23948
+ var detach_iso_default = task(run194, {
23913
23949
  inputSchema: XcpngDetachIsoParamsSchema,
23914
23950
  outputSchema: XcpngDetachIsoResultSchema,
23915
23951
  description: "Ejects ISO media from a VM, tolerating empty drives when allow_missing:true."
@@ -23935,7 +23971,7 @@ var XcpngDetachVdiResultSchema = z.object({
23935
23971
  appliedCommands: z.array(z.string()),
23936
23972
  error: z.string().optional()
23937
23973
  });
23938
- async function run199(context) {
23974
+ async function run195(context) {
23939
23975
  const { params } = context;
23940
23976
  const {
23941
23977
  vbd_uuid,
@@ -23972,7 +24008,7 @@ async function run199(context) {
23972
24008
  error: result.error
23973
24009
  };
23974
24010
  }
23975
- var detach_vdi_default = task(run199, {
24011
+ var detach_vdi_default = task(run195, {
23976
24012
  inputSchema: XcpngDetachVdiParamsSchema,
23977
24013
  outputSchema: XcpngDetachVdiResultSchema,
23978
24014
  description: "Detaches a VDI from a VM by unplugging and optionally destroying the VBD, leaving the VDI intact by default."
@@ -23994,7 +24030,7 @@ var XcpngDetachNetworkInterfaceResultSchema = z.object({
23994
24030
  appliedCommands: z.array(z.string()),
23995
24031
  error: z.string().optional()
23996
24032
  });
23997
- async function run200(context) {
24033
+ async function run196(context) {
23998
24034
  const { params, error } = context;
23999
24035
  const {
24000
24036
  vif_uuid: vifUuidParam,
@@ -24088,7 +24124,7 @@ async function run200(context) {
24088
24124
  appliedCommands
24089
24125
  };
24090
24126
  }
24091
- var detach_network_interface_default = task(run200, {
24127
+ var detach_network_interface_default = task(run196, {
24092
24128
  inputSchema: XcpngDetachNetworkInterfaceParamsSchema,
24093
24129
  outputSchema: XcpngDetachNetworkInterfaceResultSchema,
24094
24130
  description: "Unplugs (and optionally destroys) a virtual network interface from an XCP-ng VM."
@@ -24108,7 +24144,7 @@ var XcpngEnableHostResultSchema = z.object({
24108
24144
  skipped: z.boolean().optional(),
24109
24145
  error: z.string().optional()
24110
24146
  });
24111
- async function run201(context) {
24147
+ async function run197(context) {
24112
24148
  const { params, error } = context;
24113
24149
  const {
24114
24150
  host_uuid: hostUuidParam,
@@ -24176,7 +24212,7 @@ async function run201(context) {
24176
24212
  appliedCommands
24177
24213
  };
24178
24214
  }
24179
- var enable_host_default = task(run201, {
24215
+ var enable_host_default = task(run197, {
24180
24216
  inputSchema: XcpngEnableHostParamsSchema,
24181
24217
  outputSchema: XcpngEnableHostResultSchema,
24182
24218
  description: "Enables maintenance-disabled hosts so they rejoin scheduling."
@@ -24198,7 +24234,7 @@ var XcpngDisableHostResultSchema = z.object({
24198
24234
  evacuated: z.boolean().optional(),
24199
24235
  error: z.string().optional()
24200
24236
  });
24201
- async function run202(context) {
24237
+ async function run198(context) {
24202
24238
  const { params, error } = context;
24203
24239
  const {
24204
24240
  host_uuid: hostUuidParam,
@@ -24283,7 +24319,7 @@ async function run202(context) {
24283
24319
  evacuated: evacuate
24284
24320
  };
24285
24321
  }
24286
- var disable_host_default = task(run202, {
24322
+ var disable_host_default = task(run198, {
24287
24323
  inputSchema: XcpngDisableHostParamsSchema,
24288
24324
  outputSchema: XcpngDisableHostResultSchema,
24289
24325
  description: "Disables a host (optionally evacuating resident VMs first)."
@@ -24303,7 +24339,7 @@ var XcpngPlugPbdResultSchema = z.object({
24303
24339
  skipped: z.boolean().optional(),
24304
24340
  error: z.string().optional()
24305
24341
  });
24306
- async function run203(context) {
24342
+ async function run199(context) {
24307
24343
  const { params, error } = context;
24308
24344
  const { pbd_uuid: pbdUuidParam, sr_uuid: srUuid, host_uuid: hostUuid, allow_missing: rawAllowMissing } = params ?? {};
24309
24345
  const allowMissing = coerceBoolean(rawAllowMissing, false);
@@ -24367,7 +24403,7 @@ async function run203(context) {
24367
24403
  appliedCommands
24368
24404
  };
24369
24405
  }
24370
- var plug_pbd_default = task(run203, {
24406
+ var plug_pbd_default = task(run199, {
24371
24407
  inputSchema: XcpngPlugPbdParamsSchema,
24372
24408
  outputSchema: XcpngPlugPbdResultSchema,
24373
24409
  description: "Plugs a PBD so the host reattaches the storage repository."
@@ -24387,7 +24423,7 @@ var XcpngUnplugPbdResultSchema = z.object({
24387
24423
  skipped: z.boolean().optional(),
24388
24424
  error: z.string().optional()
24389
24425
  });
24390
- async function run204(context) {
24426
+ async function run200(context) {
24391
24427
  const { params, error } = context;
24392
24428
  const { pbd_uuid: pbdUuidParam, sr_uuid: srUuid, host_uuid: hostUuid, allow_missing: rawAllowMissing } = params ?? {};
24393
24429
  const allowMissing = coerceBoolean(rawAllowMissing, false);
@@ -24451,7 +24487,7 @@ async function run204(context) {
24451
24487
  appliedCommands
24452
24488
  };
24453
24489
  }
24454
- var unplug_pbd_default = task(run204, {
24490
+ var unplug_pbd_default = task(run200, {
24455
24491
  inputSchema: XcpngUnplugPbdParamsSchema,
24456
24492
  outputSchema: XcpngUnplugPbdResultSchema,
24457
24493
  description: "Unplugs a PBD so the host detaches the storage repository."
@@ -24466,7 +24502,7 @@ var XcpngListPoolsResultSchema = z.object({
24466
24502
  items: z.any().optional(),
24467
24503
  error: z.string().optional()
24468
24504
  });
24469
- async function run205(context) {
24505
+ async function run201(context) {
24470
24506
  const filters = normalizeFilterArgs(context.params?.filters);
24471
24507
  const result = await runXeCommand(context, "pool-list", filters);
24472
24508
  if (!result.success) {
@@ -24480,7 +24516,7 @@ async function run205(context) {
24480
24516
  items: parseKeyValueOutput(result.stdout)
24481
24517
  };
24482
24518
  }
24483
- var list_pools_default = task(run205, {
24519
+ var list_pools_default = task(run201, {
24484
24520
  inputSchema: XcpngListPoolsParamsSchema,
24485
24521
  outputSchema: XcpngListPoolsResultSchema,
24486
24522
  description: "Lists pools available to the current host."
@@ -24501,7 +24537,7 @@ var XcpngFindPoolResultSchema = z.object({
24501
24537
  multiple: z.boolean().optional(),
24502
24538
  error: z.string().optional()
24503
24539
  });
24504
- async function run206(context) {
24540
+ async function run202(context) {
24505
24541
  const params = context.params ?? {};
24506
24542
  const {
24507
24543
  uuid,
@@ -24601,7 +24637,7 @@ async function runListPools(context, params) {
24601
24637
  })
24602
24638
  );
24603
24639
  }
24604
- var find_pool_default = task(run206, {
24640
+ var find_pool_default = task(run202, {
24605
24641
  inputSchema: XcpngFindPoolParamsSchema,
24606
24642
  outputSchema: XcpngFindPoolResultSchema,
24607
24643
  description: "Finds a single pool by UUID or name-label, optionally allowing multiple matches."
@@ -24620,7 +24656,7 @@ var XcpngSetPoolParamResultSchema = z.object({
24620
24656
  appliedCommands: z.array(z.string()),
24621
24657
  error: z.string().optional()
24622
24658
  });
24623
- async function run207(context) {
24659
+ async function run203(context) {
24624
24660
  const { params, error } = context;
24625
24661
  const { pool_uuid: poolUuidParam, pool_name_label: poolNameLabel, key, value } = params ?? {};
24626
24662
  if (!key) {
@@ -24681,7 +24717,7 @@ async function run207(context) {
24681
24717
  appliedCommands
24682
24718
  };
24683
24719
  }
24684
- var set_pool_param_default = task(run207, {
24720
+ var set_pool_param_default = task(run203, {
24685
24721
  inputSchema: XcpngSetPoolParamParamsSchema,
24686
24722
  outputSchema: XcpngSetPoolParamResultSchema,
24687
24723
  description: "Updates a pool parameter (wraps xe pool-param-set)."
@@ -24701,7 +24737,7 @@ var XcpngRebootHostResultSchema = z.object({
24701
24737
  skipped: z.boolean().optional(),
24702
24738
  error: z.string().optional()
24703
24739
  });
24704
- async function run208(context) {
24740
+ async function run204(context) {
24705
24741
  const { params, error } = context;
24706
24742
  const {
24707
24743
  host_uuid: hostUuidParam,
@@ -24767,7 +24803,7 @@ async function run208(context) {
24767
24803
  command: commandResult.command
24768
24804
  };
24769
24805
  }
24770
- var reboot_host_default = task(run208, {
24806
+ var reboot_host_default = task(run204, {
24771
24807
  inputSchema: XcpngRebootHostParamsSchema,
24772
24808
  outputSchema: XcpngRebootHostResultSchema,
24773
24809
  description: "Reboots an XCP-ng host (optionally forcing)."
@@ -24787,7 +24823,7 @@ var XcpngShutdownHostResultSchema = z.object({
24787
24823
  skipped: z.boolean().optional(),
24788
24824
  error: z.string().optional()
24789
24825
  });
24790
- async function run209(context) {
24826
+ async function run205(context) {
24791
24827
  const { params, error } = context;
24792
24828
  const {
24793
24829
  host_uuid: hostUuidParam,
@@ -24851,7 +24887,7 @@ async function run209(context) {
24851
24887
  command: commandResult.command
24852
24888
  };
24853
24889
  }
24854
- var shutdown_host_default = task(run209, {
24890
+ var shutdown_host_default = task(run205, {
24855
24891
  inputSchema: XcpngShutdownHostParamsSchema,
24856
24892
  outputSchema: XcpngShutdownHostResultSchema,
24857
24893
  description: "Shuts down an XCP-ng host (optionally forcing)."
@@ -24870,7 +24906,7 @@ var XcpngEvacuateHostResultSchema = z.object({
24870
24906
  skipped: z.boolean().optional(),
24871
24907
  error: z.string().optional()
24872
24908
  });
24873
- async function run210(context) {
24909
+ async function run206(context) {
24874
24910
  const { params, error } = context;
24875
24911
  const { host_uuid: hostUuidParam, host_name_label: hostNameLabel, allow_missing: rawAllowMissing } = params ?? {};
24876
24912
  const allowMissing = coerceBoolean(rawAllowMissing, false);
@@ -24923,7 +24959,7 @@ async function run210(context) {
24923
24959
  command: commandResult.command
24924
24960
  };
24925
24961
  }
24926
- var evacuate_host_default = task(run210, {
24962
+ var evacuate_host_default = task(run206, {
24927
24963
  inputSchema: XcpngEvacuateHostParamsSchema,
24928
24964
  outputSchema: XcpngEvacuateHostResultSchema,
24929
24965
  description: "Evacuates all VMs from a host."
@@ -24944,7 +24980,7 @@ var XcpngPlugPifResultSchema = z.object({
24944
24980
  skipped: z.boolean().optional(),
24945
24981
  error: z.string().optional()
24946
24982
  });
24947
- async function run211(context) {
24983
+ async function run207(context) {
24948
24984
  const { params, error } = context;
24949
24985
  const {
24950
24986
  pif_uuid: pifUuidParam,
@@ -25041,7 +25077,7 @@ async function run211(context) {
25041
25077
  appliedCommands
25042
25078
  };
25043
25079
  }
25044
- var plug_pif_default = task(run211, {
25080
+ var plug_pif_default = task(run207, {
25045
25081
  inputSchema: XcpngPlugPifParamsSchema,
25046
25082
  outputSchema: XcpngPlugPifResultSchema,
25047
25083
  description: "Plugs a physical interface (PIF) on the specified host."
@@ -25060,7 +25096,7 @@ var XcpngPifScanResultSchema = z.object({
25060
25096
  skipped: z.boolean().optional(),
25061
25097
  error: z.string().optional()
25062
25098
  });
25063
- async function run212(context) {
25099
+ async function run208(context) {
25064
25100
  const { params, error } = context;
25065
25101
  const { host_uuid: hostUuidParam, host_name_label: hostNameLabel, allow_missing: rawAllowMissing } = params ?? {};
25066
25102
  const allowMissing = coerceBoolean(rawAllowMissing, false);
@@ -25125,7 +25161,7 @@ async function run212(context) {
25125
25161
  appliedCommands
25126
25162
  };
25127
25163
  }
25128
- var pif_scan_default = task(run212, {
25164
+ var pif_scan_default = task(run208, {
25129
25165
  inputSchema: XcpngPifScanParamsSchema,
25130
25166
  outputSchema: XcpngPifScanResultSchema,
25131
25167
  description: "Rescans physical interfaces (PIFs) on a host to discover changes."
@@ -25146,7 +25182,7 @@ var XcpngUnplugPifResultSchema = z.object({
25146
25182
  skipped: z.boolean().optional(),
25147
25183
  error: z.string().optional()
25148
25184
  });
25149
- async function run213(context) {
25185
+ async function run209(context) {
25150
25186
  const { params, error } = context;
25151
25187
  const {
25152
25188
  pif_uuid: pifUuidParam,
@@ -25243,7 +25279,7 @@ async function run213(context) {
25243
25279
  appliedCommands
25244
25280
  };
25245
25281
  }
25246
- var unplug_pif_default = task(run213, {
25282
+ var unplug_pif_default = task(run209, {
25247
25283
  inputSchema: XcpngUnplugPifParamsSchema,
25248
25284
  outputSchema: XcpngUnplugPifResultSchema,
25249
25285
  description: "Unplugs a physical interface (PIF) on the specified host."
@@ -25261,7 +25297,7 @@ var XcpngSetPifParamResultSchema = z.object({
25261
25297
  command: z.string().optional(),
25262
25298
  error: z.string().optional()
25263
25299
  });
25264
- async function run214(context) {
25300
+ async function run210(context) {
25265
25301
  const { params, error } = context;
25266
25302
  const { pif_uuid: pifUuid, key, value } = params ?? {};
25267
25303
  if (!pifUuid) {
@@ -25299,7 +25335,7 @@ async function run214(context) {
25299
25335
  command: commandResult.command
25300
25336
  };
25301
25337
  }
25302
- var set_pif_param_default = task(run214, {
25338
+ var set_pif_param_default = task(run210, {
25303
25339
  inputSchema: XcpngSetPifParamParamsSchema,
25304
25340
  outputSchema: XcpngSetPifParamResultSchema,
25305
25341
  description: "Updates a PIF parameter (wraps `xe pif-param-set`)."
@@ -25316,7 +25352,7 @@ var XcpngUnplugVbdResultSchema = z.object({
25316
25352
  alreadyDetached: z.boolean().optional(),
25317
25353
  error: z.string().optional()
25318
25354
  });
25319
- async function run215(context) {
25355
+ async function run211(context) {
25320
25356
  const { params, error } = context;
25321
25357
  const { vbd_uuid: vbdUuid, allow_missing: rawAllowMissing } = params;
25322
25358
  if (!vbdUuid) {
@@ -25346,7 +25382,7 @@ async function run215(context) {
25346
25382
  error: message
25347
25383
  };
25348
25384
  }
25349
- var unplug_vbd_default = task(run215, {
25385
+ var unplug_vbd_default = task(run211, {
25350
25386
  inputSchema: XcpngUnplugVbdParamsSchema,
25351
25387
  outputSchema: XcpngUnplugVbdResultSchema,
25352
25388
  description: "Unplugs a VBD from an XCP-ng VM, tolerating already-detached devices when allow_missing:true."
@@ -25366,7 +25402,7 @@ var XcpngSuspendVmResultSchema = z.object({
25366
25402
  waitAttempts: z.number().optional(),
25367
25403
  error: z.string().optional()
25368
25404
  });
25369
- async function run216(context) {
25405
+ async function run212(context) {
25370
25406
  const { params, error } = context;
25371
25407
  const { vm_uuid: vmUuid, allow_running: rawAllowRunning } = params;
25372
25408
  if (!vmUuid) {
@@ -25427,7 +25463,7 @@ async function run216(context) {
25427
25463
  waitAttempts: waitResult.attempts
25428
25464
  };
25429
25465
  }
25430
- var suspend_vm_default = task(run216, {
25466
+ var suspend_vm_default = task(run212, {
25431
25467
  inputSchema: XcpngSuspendVmParamsSchema,
25432
25468
  outputSchema: XcpngSuspendVmResultSchema,
25433
25469
  description: "Suspends an XCP-ng VM, waiting until the VM reports the suspended power state."
@@ -25448,7 +25484,7 @@ var XcpngResumeVmResultSchema = z.object({
25448
25484
  waitAttempts: z.number().optional(),
25449
25485
  error: z.string().optional()
25450
25486
  });
25451
- async function run217(context) {
25487
+ async function run213(context) {
25452
25488
  const { params, error } = context;
25453
25489
  const { vm_uuid: vmUuid, start_paused: rawStartPaused, host_uuid: hostUuid } = params;
25454
25490
  if (!vmUuid) {
@@ -25513,7 +25549,7 @@ async function run217(context) {
25513
25549
  waitAttempts: waitResult.attempts
25514
25550
  };
25515
25551
  }
25516
- var resume_vm_default = task(run217, {
25552
+ var resume_vm_default = task(run213, {
25517
25553
  inputSchema: XcpngResumeVmParamsSchema,
25518
25554
  outputSchema: XcpngResumeVmResultSchema,
25519
25555
  description: "Resumes a suspended XCP-ng VM, optionally starting it in a paused state or on a specific host."
@@ -25528,7 +25564,7 @@ var XcpngListVifParamsResultSchema = z.object({
25528
25564
  items: z.any().optional(),
25529
25565
  error: z.string().optional()
25530
25566
  });
25531
- async function run218(context) {
25567
+ async function run214(context) {
25532
25568
  const filters = normalizeFilterArgs(context.params?.filters);
25533
25569
  const result = await runXeCommand(context, "vif-param-list", filters);
25534
25570
  if (!result.success) {
@@ -25542,7 +25578,7 @@ async function run218(context) {
25542
25578
  items: parseKeyValueOutput(result.stdout)
25543
25579
  };
25544
25580
  }
25545
- var list_vif_params_default = task(run218, {
25581
+ var list_vif_params_default = task(run214, {
25546
25582
  inputSchema: XcpngListVifParamsParamsSchema,
25547
25583
  outputSchema: XcpngListVifParamsResultSchema,
25548
25584
  description: "Lists parameters for virtual interfaces (VIFs) on an XCP-ng host."
@@ -25557,7 +25593,7 @@ var XcpngListVifsResultSchema = z.object({
25557
25593
  items: z.array(z.any()).optional(),
25558
25594
  error: z.string().optional()
25559
25595
  });
25560
- async function run219(context) {
25596
+ async function run215(context) {
25561
25597
  const filters = normalizeFilterArgs(context.params?.filters);
25562
25598
  const result = await runXeCommand(context, "vif-list", filters);
25563
25599
  if (!result.success) {
@@ -25605,7 +25641,7 @@ async function run219(context) {
25605
25641
  items: enrichedItems
25606
25642
  };
25607
25643
  }
25608
- var list_vifs_default = task(run219, {
25644
+ var list_vifs_default = task(run215, {
25609
25645
  inputSchema: XcpngListVifsParamsSchema,
25610
25646
  outputSchema: XcpngListVifsResultSchema,
25611
25647
  description: "Lists VIFs (virtual interfaces) attached to VMs."
@@ -25620,7 +25656,7 @@ var XcpngListPifParamsResultSchema = z.object({
25620
25656
  items: z.any().optional(),
25621
25657
  error: z.string().optional()
25622
25658
  });
25623
- async function run220(context) {
25659
+ async function run216(context) {
25624
25660
  const filters = normalizeFilterArgs(context.params?.filters);
25625
25661
  const result = await runXeCommand(context, "pif-param-list", filters);
25626
25662
  if (!result.success) {
@@ -25634,7 +25670,7 @@ async function run220(context) {
25634
25670
  items: parseKeyValueOutput(result.stdout)
25635
25671
  };
25636
25672
  }
25637
- var list_pif_params_default = task(run220, {
25673
+ var list_pif_params_default = task(run216, {
25638
25674
  inputSchema: XcpngListPifParamsParamsSchema,
25639
25675
  outputSchema: XcpngListPifParamsResultSchema,
25640
25676
  description: "Lists parameters for PIFs on an XCP-ng host."
@@ -25649,7 +25685,7 @@ var XcpngListPifsResultSchema = z.object({
25649
25685
  items: z.array(z.any()).optional(),
25650
25686
  error: z.string().optional()
25651
25687
  });
25652
- async function run221(context) {
25688
+ async function run217(context) {
25653
25689
  const filters = normalizeFilterArgs(context.params?.filters);
25654
25690
  const result = await runXeCommand(context, "pif-list", filters);
25655
25691
  if (!result.success) {
@@ -25697,7 +25733,7 @@ async function run221(context) {
25697
25733
  items: enrichedItems
25698
25734
  };
25699
25735
  }
25700
- var list_pifs_default = task(run221, {
25736
+ var list_pifs_default = task(run217, {
25701
25737
  inputSchema: XcpngListPifsParamsSchema,
25702
25738
  outputSchema: XcpngListPifsResultSchema,
25703
25739
  description: "Lists PIFs (physical interfaces) available on the XCP-ng host."
@@ -25717,7 +25753,7 @@ var XcpngRebootVmResultSchema = z.object({
25717
25753
  powerState: z.string().optional(),
25718
25754
  waitAttempts: z.number().optional()
25719
25755
  });
25720
- async function run222(context) {
25756
+ async function run218(context) {
25721
25757
  const { params, error } = context;
25722
25758
  const { vm_uuid: vmUuidParam, vm_name_label: vmNameLabel, force: rawForce } = params ?? {};
25723
25759
  const force = coerceBoolean(rawForce, false);
@@ -25778,7 +25814,7 @@ async function run222(context) {
25778
25814
  waitAttempts: waitResult.attempts
25779
25815
  };
25780
25816
  }
25781
- var reboot_vm_default = task(run222, {
25817
+ var reboot_vm_default = task(run218, {
25782
25818
  inputSchema: XcpngRebootVmParamsSchema,
25783
25819
  outputSchema: XcpngRebootVmResultSchema,
25784
25820
  description: "Reboots an XCP-ng VM using `xe vm-reboot`."
@@ -25797,7 +25833,7 @@ var XcpngSetNetworkParamResultSchema = z.object({
25797
25833
  appliedCommands: z.array(z.string()),
25798
25834
  error: z.string().optional()
25799
25835
  });
25800
- async function run223(context) {
25836
+ async function run219(context) {
25801
25837
  const { params, error } = context;
25802
25838
  const { network_uuid: networkUuidParam, network_name_label: networkNameLabel, key, value } = params ?? {};
25803
25839
  if (!key) {
@@ -25858,7 +25894,7 @@ async function run223(context) {
25858
25894
  appliedCommands
25859
25895
  };
25860
25896
  }
25861
- var set_network_param_default = task(run223, {
25897
+ var set_network_param_default = task(run219, {
25862
25898
  inputSchema: XcpngSetNetworkParamParamsSchema,
25863
25899
  outputSchema: XcpngSetNetworkParamResultSchema,
25864
25900
  description: "Updates a network parameter (wraps xe network-param-set)."
@@ -25882,7 +25918,7 @@ var XcpngResizeVdiResultSchema = z.object({
25882
25918
  newSizeBytes: z.number().optional(),
25883
25919
  error: z.string().optional()
25884
25920
  });
25885
- async function run224(context) {
25921
+ async function run220(context) {
25886
25922
  const { params, error } = context;
25887
25923
  const {
25888
25924
  vdi_uuid: vdiUuidParam,
@@ -25956,7 +25992,7 @@ async function run224(context) {
25956
25992
  newSizeBytes: sizeBytes
25957
25993
  };
25958
25994
  }
25959
- var resize_vdi_default = task(run224, {
25995
+ var resize_vdi_default = task(run220, {
25960
25996
  inputSchema: XcpngResizeVdiParamsSchema,
25961
25997
  outputSchema: XcpngResizeVdiResultSchema,
25962
25998
  description: "Resizes an existing VDI on XCP-ng using `xe vdi-resize`/`vdi-resize-online`."
@@ -25988,7 +26024,7 @@ var XcpngSetVmResourcesResultSchema = z.object({
25988
26024
  powerState: z.string().optional(),
25989
26025
  waitAttempts: z.number().optional()
25990
26026
  });
25991
- async function run225(context) {
26027
+ async function run221(context) {
25992
26028
  const { params, error } = context;
25993
26029
  const {
25994
26030
  vm_uuid: vmUuidParam,
@@ -26236,14 +26272,14 @@ async function run225(context) {
26236
26272
  cpuUpdates.push({ field, value });
26237
26273
  }
26238
26274
  }
26239
- for (const update4 of cpuUpdates) {
26275
+ for (const update of cpuUpdates) {
26240
26276
  const result = await runXeCommand(context, "vm-param-set", {
26241
26277
  uuid: vmUuid,
26242
- [update4.field]: update4.value
26278
+ [update.field]: update.value
26243
26279
  });
26244
26280
  appliedCommands.push(result.command);
26245
26281
  if (!result.success) {
26246
- const message = xeErrorMessage(result, `xe vm-param-set (${update4.field}) failed`);
26282
+ const message = xeErrorMessage(result, `xe vm-param-set (${update.field}) failed`);
26247
26283
  error(message);
26248
26284
  return {
26249
26285
  success: false,
@@ -26291,7 +26327,7 @@ function ensurePositiveMib(value, fieldName) {
26291
26327
  bytes: mibToBytes2(value)
26292
26328
  };
26293
26329
  }
26294
- var set_vm_resources_default = task(run225, {
26330
+ var set_vm_resources_default = task(run221, {
26295
26331
  inputSchema: XcpngSetVmResourcesParamsSchema,
26296
26332
  outputSchema: XcpngSetVmResourcesResultSchema,
26297
26333
  description: "Updates VM memory and vCPU settings on an XCP-ng host."
@@ -26316,7 +26352,7 @@ var XcpngResizeVmCpusResultSchema = z.object({
26316
26352
  powerState: z.string().optional(),
26317
26353
  waitAttempts: z.number().optional()
26318
26354
  });
26319
- async function run226(context) {
26355
+ async function run222(context) {
26320
26356
  const { params, error } = context;
26321
26357
  const {
26322
26358
  vm_uuid: vmUuid,
@@ -26365,7 +26401,7 @@ async function run226(context) {
26365
26401
  waitAttempts: result.waitAttempts
26366
26402
  };
26367
26403
  }
26368
- var resize_vm_cpus_default = task(run226, {
26404
+ var resize_vm_cpus_default = task(run222, {
26369
26405
  inputSchema: XcpngResizeVmCpusParamsSchema,
26370
26406
  outputSchema: XcpngResizeVmCpusResultSchema,
26371
26407
  description: "Resizes an XCP-ng VM\u2019s vCPU configuration."
@@ -26386,7 +26422,7 @@ var XcpngResizeVmMemoryResultSchema = z.object({
26386
26422
  powerState: z.string().optional(),
26387
26423
  waitAttempts: z.number().optional()
26388
26424
  });
26389
- async function run227(context) {
26425
+ async function run223(context) {
26390
26426
  const { params, error } = context;
26391
26427
  const { vm_uuid: vmUuid, vm_name_label: vmNameLabel, memory_mib: memoryMib } = params ?? {};
26392
26428
  if (!memoryMib || !Number.isFinite(memoryMib) || memoryMib <= 0) {
@@ -26425,7 +26461,7 @@ async function run227(context) {
26425
26461
  waitAttempts: result.waitAttempts
26426
26462
  };
26427
26463
  }
26428
- var resize_vm_memory_default = task(run227, {
26464
+ var resize_vm_memory_default = task(run223, {
26429
26465
  inputSchema: XcpngResizeVmMemoryParamsSchema,
26430
26466
  outputSchema: XcpngResizeVmMemoryResultSchema,
26431
26467
  description: "Resizes an XCP-ng VM\u2019s memory allocation (static/dynamic bounds)."
@@ -26444,7 +26480,7 @@ var XcpngRevertSnapshotResultSchema = z.object({
26444
26480
  powerState: z.string().optional(),
26445
26481
  waitAttempts: z.number().optional()
26446
26482
  });
26447
- async function run228(context) {
26483
+ async function run224(context) {
26448
26484
  const { params, error } = context;
26449
26485
  const { snapshot_uuid: snapshotUuid } = params ?? {};
26450
26486
  if (!snapshotUuid) {
@@ -26533,7 +26569,7 @@ async function run228(context) {
26533
26569
  waitAttempts
26534
26570
  };
26535
26571
  }
26536
- var revert_snapshot_default = task(run228, {
26572
+ var revert_snapshot_default = task(run224, {
26537
26573
  inputSchema: XcpngRevertSnapshotParamsSchema,
26538
26574
  outputSchema: XcpngRevertSnapshotResultSchema,
26539
26575
  description: "Reverts an XCP-ng VM to a specified snapshot."
@@ -26551,7 +26587,7 @@ var XcpngSetSnapshotParamResultSchema = z.object({
26551
26587
  command: z.string().optional(),
26552
26588
  error: z.string().optional()
26553
26589
  });
26554
- async function run229(context) {
26590
+ async function run225(context) {
26555
26591
  const { params, error } = context;
26556
26592
  const { snapshot_uuid: snapshotUuid, key, value } = params ?? {};
26557
26593
  if (!snapshotUuid) {
@@ -26589,7 +26625,7 @@ async function run229(context) {
26589
26625
  command: commandResult.command
26590
26626
  };
26591
26627
  }
26592
- var set_snapshot_param_default = task(run229, {
26628
+ var set_snapshot_param_default = task(run225, {
26593
26629
  inputSchema: XcpngSetSnapshotParamParamsSchema,
26594
26630
  outputSchema: XcpngSetSnapshotParamResultSchema,
26595
26631
  description: "Updates a snapshot parameter (wraps xe snapshot-param-set)."
@@ -26608,7 +26644,7 @@ var XcpngSetSrParamResultSchema = z.object({
26608
26644
  appliedCommands: z.array(z.string()),
26609
26645
  error: z.string().optional()
26610
26646
  });
26611
- async function run230(context) {
26647
+ async function run226(context) {
26612
26648
  const { params, error } = context;
26613
26649
  const { sr_uuid: srUuidParam, sr_name_label: srNameLabel, key, value } = params ?? {};
26614
26650
  if (!key) {
@@ -26669,7 +26705,7 @@ async function run230(context) {
26669
26705
  appliedCommands
26670
26706
  };
26671
26707
  }
26672
- var set_sr_param_default = task(run230, {
26708
+ var set_sr_param_default = task(run226, {
26673
26709
  inputSchema: XcpngSetSrParamParamsSchema,
26674
26710
  outputSchema: XcpngSetSrParamResultSchema,
26675
26711
  description: "Updates a storage repository parameter (wraps xe sr-param-set)."
@@ -26690,7 +26726,7 @@ var XcpngStartVmResultSchema = z.object({
26690
26726
  finalPowerState: z.string().optional(),
26691
26727
  waitAttempts: z.number().optional()
26692
26728
  });
26693
- async function run231(context) {
26729
+ async function run227(context) {
26694
26730
  const { params, error } = context;
26695
26731
  const { vm_uuid, start_paused: rawStartPaused, force: rawForce } = params;
26696
26732
  const startPaused = coerceBoolean(rawStartPaused, false);
@@ -26757,7 +26793,7 @@ async function run231(context) {
26757
26793
  waitAttempts: waitResult.attempts
26758
26794
  };
26759
26795
  }
26760
- var start_vm_default = task(run231, {
26796
+ var start_vm_default = task(run227, {
26761
26797
  inputSchema: XcpngStartVmParamsSchema,
26762
26798
  outputSchema: XcpngStartVmResultSchema,
26763
26799
  description: "Starts an XCP-ng virtual machine with optional paused or forced modes."
@@ -26778,7 +26814,7 @@ var XcpngStopVmResultSchema = z.object({
26778
26814
  finalPowerState: z.string().optional(),
26779
26815
  waitAttempts: z.number().optional()
26780
26816
  });
26781
- async function run232(context) {
26817
+ async function run228(context) {
26782
26818
  const { params, error } = context;
26783
26819
  const { vm_uuid, force: rawForce, timeout_seconds: rawTimeout } = params;
26784
26820
  const force = coerceBoolean(rawForce, false);
@@ -26853,7 +26889,7 @@ async function run232(context) {
26853
26889
  waitAttempts: waitResult.attempts
26854
26890
  };
26855
26891
  }
26856
- var stop_vm_default = task(run232, {
26892
+ var stop_vm_default = task(run228, {
26857
26893
  inputSchema: XcpngStopVmParamsSchema,
26858
26894
  outputSchema: XcpngStopVmResultSchema,
26859
26895
  description: "Stops an XCP-ng virtual machine gracefully or forcefully."
@@ -26882,7 +26918,7 @@ var XcpngImportIsoResultSchema = z.object({
26882
26918
  commands: z.array(z.string()),
26883
26919
  error: z.string().optional()
26884
26920
  });
26885
- async function run233(context) {
26921
+ async function run229(context) {
26886
26922
  if (!context.host) {
26887
26923
  return {
26888
26924
  success: false,
@@ -27088,7 +27124,7 @@ async function findIsoVdi2(context, srUuid, isoFileName) {
27088
27124
  }
27089
27125
  return { vdi };
27090
27126
  }
27091
- var import_iso_default = task(run233, {
27127
+ var import_iso_default = task(run229, {
27092
27128
  inputSchema: XcpngImportIsoParamsSchema,
27093
27129
  outputSchema: XcpngImportIsoResultSchema,
27094
27130
  description: "Ensures an ISO file is represented as a VDI in an ISO SR by rescanning and importing when necessary."
@@ -27117,7 +27153,7 @@ var XcpngUploadIsoHostResultSchema = z.object({
27117
27153
  remotePath: z.string().optional(),
27118
27154
  error: z.string().optional()
27119
27155
  });
27120
- async function run234(context) {
27156
+ async function run230(context) {
27121
27157
  if (context.host) {
27122
27158
  return {
27123
27159
  success: false,
@@ -27172,10 +27208,10 @@ async function run234(context) {
27172
27208
  const uploads = await context.ssh(
27173
27209
  [],
27174
27210
  async (remoteContext) => {
27175
- const { run: run253 } = remoteContext;
27211
+ const { run: run249 } = remoteContext;
27176
27212
  const remotePath = pathPosix3.join(resolvedLocation, remoteFileName);
27177
27213
  try {
27178
- const srResult = await run253(
27214
+ const srResult = await run249(
27179
27215
  find_or_create_iso_sr_default({
27180
27216
  name_label: isoSrName,
27181
27217
  location: resolvedLocation,
@@ -27192,7 +27228,7 @@ async function run234(context) {
27192
27228
  error: srResult.error ?? "Failed to ensure ISO SR exists."
27193
27229
  };
27194
27230
  }
27195
- const fileExistsResult = await run253(exists_default2({ path: remotePath }));
27231
+ const fileExistsResult = await run249(exists_default2({ path: remotePath }));
27196
27232
  if (fileExistsResult.exists) {
27197
27233
  return {
27198
27234
  success: true,
@@ -27259,7 +27295,7 @@ function resolveChunkSizeBytes(chunkSizeMb) {
27259
27295
  const bounded = Math.min(Math.max(safeSize, MIN_CHUNK_SIZE_MB), MAX_CHUNK_SIZE_MB);
27260
27296
  return bounded * 1024 * 1024;
27261
27297
  }
27262
- var upload_iso_default = task(run234, {
27298
+ var upload_iso_default = task(run230, {
27263
27299
  inputSchema: XcpngUploadIsoParamsSchema,
27264
27300
  outputSchema: XcpngUploadIsoHostResultSchema,
27265
27301
  description: "Uploads a local ISO to the remote XCP-ng hypervisor, ensuring the target ISO SR exists beforehand."
@@ -27296,7 +27332,7 @@ function parseMapValue(raw) {
27296
27332
  return acc;
27297
27333
  }, {});
27298
27334
  }
27299
- async function run235(context) {
27335
+ async function run231(context) {
27300
27336
  const { params, error } = context;
27301
27337
  const {
27302
27338
  vm_uuid: vmUuidParam,
@@ -27434,7 +27470,7 @@ async function run235(context) {
27434
27470
  }
27435
27471
  return result;
27436
27472
  }
27437
- var get_vm_info_default = task(run235, {
27473
+ var get_vm_info_default = task(run231, {
27438
27474
  inputSchema: XcpngGetVmInfoParamsSchema,
27439
27475
  outputSchema: XcpngGetVmInfoResultSchema,
27440
27476
  description: "Returns structured VM details (platform, boot configuration, memory/CPU sizing, and optional VBD/VIF inventory)."
@@ -27458,7 +27494,7 @@ var XcpngExportVdiResultSchema = z.object({
27458
27494
  skipped: z.boolean().optional(),
27459
27495
  error: z.string().optional()
27460
27496
  });
27461
- async function run236(context) {
27497
+ async function run232(context) {
27462
27498
  const { params, error } = context;
27463
27499
  const {
27464
27500
  vdi_uuid: vdiUuidParam,
@@ -27538,7 +27574,7 @@ async function run236(context) {
27538
27574
  appliedCommands
27539
27575
  };
27540
27576
  }
27541
- var export_vdi_default = task(run236, {
27577
+ var export_vdi_default = task(run232, {
27542
27578
  inputSchema: XcpngExportVdiParamsSchema,
27543
27579
  outputSchema: XcpngExportVdiResultSchema,
27544
27580
  description: "Exports a VDI to the hypervisor filesystem via xe vdi-export."
@@ -27592,7 +27628,7 @@ var XcpngProvisionVmFromIsoResultSchema = z.object({
27592
27628
  steps: z.array(z.any()),
27593
27629
  error: z.string().optional()
27594
27630
  });
27595
- async function run237(context) {
27631
+ async function run233(context) {
27596
27632
  if (!context.host) {
27597
27633
  return {
27598
27634
  success: false,
@@ -27919,7 +27955,7 @@ async function run237(context) {
27919
27955
  steps
27920
27956
  };
27921
27957
  }
27922
- var provision_vm_from_iso_default = task(run237, {
27958
+ var provision_vm_from_iso_default = task(run233, {
27923
27959
  inputSchema: XcpngProvisionVmFromIsoParamsSchema,
27924
27960
  outputSchema: XcpngProvisionVmFromIsoResultSchema,
27925
27961
  description: "Creates a VM from a template, attaches storage, network, and ISO media, and optionally boots it for installation."
@@ -28949,7 +28985,7 @@ function resolveMemoryMib(input) {
28949
28985
  }
28950
28986
  return { value: Math.floor(value) };
28951
28987
  }
28952
- async function run238(context) {
28988
+ async function run234(context) {
28953
28989
  if (!context.host) {
28954
28990
  return runLocal(context);
28955
28991
  }
@@ -29162,7 +29198,7 @@ function buildLocalFailure(step, message) {
29162
29198
  error: message
29163
29199
  };
29164
29200
  }
29165
- var provision_vm_default = task(run238, {
29201
+ var provision_vm_default = task(run234, {
29166
29202
  inputSchema: XcpngProvisionVmParamsSchema,
29167
29203
  outputSchema: XcpngProvisionVmResultSchema,
29168
29204
  description: "Provisions a VM from an XCP-ng template by cloning its root disk, configuring cloud-init metadata, and attaching network resources."
@@ -29228,7 +29264,7 @@ var XcpngSnapshotVmResultSchema = z.object({
29228
29264
  command: z.string().optional(),
29229
29265
  error: z.string().optional()
29230
29266
  });
29231
- async function run239(context) {
29267
+ async function run235(context) {
29232
29268
  const { params, error } = context;
29233
29269
  const {
29234
29270
  vm_uuid: vmUuidParam,
@@ -29298,7 +29334,7 @@ async function run239(context) {
29298
29334
  command: snapshotResult.command
29299
29335
  };
29300
29336
  }
29301
- var snapshot_vm_default = task(run239, {
29337
+ var snapshot_vm_default = task(run235, {
29302
29338
  inputSchema: XcpngSnapshotVmParamsSchema,
29303
29339
  outputSchema: XcpngSnapshotVmResultSchema,
29304
29340
  description: "Creates a snapshot of an XCP-ng VM (optionally with quiesce)."
@@ -29325,7 +29361,7 @@ var XcpngImportVdiResultSchema = z.object({
29325
29361
  appliedCommands: z.array(z.string()),
29326
29362
  error: z.string().optional()
29327
29363
  });
29328
- async function run240(context) {
29364
+ async function run236(context) {
29329
29365
  const { params, error } = context;
29330
29366
  const {
29331
29367
  sr_uuid: srUuidParam,
@@ -29447,7 +29483,7 @@ async function run240(context) {
29447
29483
  appliedCommands
29448
29484
  };
29449
29485
  }
29450
- var import_vdi_default = task(run240, {
29486
+ var import_vdi_default = task(run236, {
29451
29487
  inputSchema: XcpngImportVdiParamsSchema,
29452
29488
  outputSchema: XcpngImportVdiResultSchema,
29453
29489
  description: "Imports a VDI file into a storage repository via xe vdi-import."
@@ -29549,7 +29585,7 @@ var XcpngVmMigrateResultSchema = z.object({
29549
29585
  skipped: z.boolean().optional(),
29550
29586
  error: z.string().optional()
29551
29587
  });
29552
- async function run241(context) {
29588
+ async function run237(context) {
29553
29589
  const { params, error } = context;
29554
29590
  const {
29555
29591
  vm_uuid: vmUuidParam,
@@ -29673,7 +29709,7 @@ async function run241(context) {
29673
29709
  appliedCommands
29674
29710
  };
29675
29711
  }
29676
- var vm_migrate_default = task(run241, {
29712
+ var vm_migrate_default = task(run237, {
29677
29713
  inputSchema: XcpngVmMigrateParamsSchema,
29678
29714
  outputSchema: XcpngVmMigrateResultSchema,
29679
29715
  description: "Migrates a VM to another host (and optionally storage repository) via xe vm-migrate."
@@ -29698,7 +29734,7 @@ var XcpngVmExportResultSchema = z.object({
29698
29734
  skipped: z.boolean().optional(),
29699
29735
  error: z.string().optional()
29700
29736
  });
29701
- async function run242(context) {
29737
+ async function run238(context) {
29702
29738
  const { params, error } = context;
29703
29739
  const {
29704
29740
  vm_uuid: vmUuidParam,
@@ -29787,7 +29823,7 @@ async function run242(context) {
29787
29823
  appliedCommands
29788
29824
  };
29789
29825
  }
29790
- var vm_export_default = task(run242, {
29826
+ var vm_export_default = task(run238, {
29791
29827
  inputSchema: XcpngVmExportParamsSchema,
29792
29828
  outputSchema: XcpngVmExportResultSchema,
29793
29829
  description: "Exports a VM to an XVA file via xe vm-export."
@@ -29809,7 +29845,7 @@ var XcpngVmImportResultSchema = z.object({
29809
29845
  appliedCommands: z.array(z.string()),
29810
29846
  error: z.string().optional()
29811
29847
  });
29812
- async function run243(context) {
29848
+ async function run239(context) {
29813
29849
  const { params, error } = context;
29814
29850
  const {
29815
29851
  filename,
@@ -29878,7 +29914,7 @@ async function run243(context) {
29878
29914
  appliedCommands
29879
29915
  };
29880
29916
  }
29881
- var vm_import_default = task(run243, {
29917
+ var vm_import_default = task(run239, {
29882
29918
  inputSchema: XcpngVmImportParamsSchema,
29883
29919
  outputSchema: XcpngVmImportResultSchema,
29884
29920
  description: "Imports a VM image from an XVA file via xe vm-import."
@@ -29905,7 +29941,7 @@ var XcpngVmCopyResultSchema = z.object({
29905
29941
  skipped: z.boolean().optional(),
29906
29942
  error: z.string().optional()
29907
29943
  });
29908
- async function run244(context) {
29944
+ async function run240(context) {
29909
29945
  const { params, error } = context;
29910
29946
  const {
29911
29947
  vm_uuid: vmUuidParam,
@@ -30032,7 +30068,7 @@ async function run244(context) {
30032
30068
  appliedCommands
30033
30069
  };
30034
30070
  }
30035
- var vm_copy_default = task(run244, {
30071
+ var vm_copy_default = task(run240, {
30036
30072
  inputSchema: XcpngVmCopyParamsSchema,
30037
30073
  outputSchema: XcpngVmCopyResultSchema,
30038
30074
  description: "Creates a full copy of a VM, optionally targeting a different SR."
@@ -30052,7 +30088,7 @@ var XcpngDetachCdMediaResultSchema = z.object({
30052
30088
  error: z.string().optional(),
30053
30089
  skipped: z.boolean().optional()
30054
30090
  });
30055
- async function run245(context) {
30091
+ async function run241(context) {
30056
30092
  if (!context.host) {
30057
30093
  return {
30058
30094
  success: false,
@@ -30189,7 +30225,7 @@ function filterCdDisks(disks) {
30189
30225
  }
30190
30226
  return results;
30191
30227
  }
30192
- var detach_cd_media_default = task(run245, {
30228
+ var detach_cd_media_default = task(run241, {
30193
30229
  inputSchema: XcpngDetachCdMediaParamsSchema,
30194
30230
  outputSchema: XcpngDetachCdMediaResultSchema,
30195
30231
  description: "Detaches CD/DVD virtual media from a VM by unplugging and destroying associated VBDs."
@@ -30212,7 +30248,7 @@ var XcpngCleanupConfigDriveResultSchema = z.object({
30212
30248
  error: z.string().optional(),
30213
30249
  skipped: z.boolean().optional()
30214
30250
  });
30215
- async function run246(context) {
30251
+ async function run242(context) {
30216
30252
  if (!context.host) {
30217
30253
  return {
30218
30254
  success: false,
@@ -30412,7 +30448,7 @@ async function run246(context) {
30412
30448
  steps
30413
30449
  };
30414
30450
  }
30415
- var cleanup_config_drive_default = task(run246, {
30451
+ var cleanup_config_drive_default = task(run242, {
30416
30452
  inputSchema: XcpngCleanupConfigDriveParamsSchema,
30417
30453
  outputSchema: XcpngCleanupConfigDriveResultSchema,
30418
30454
  description: "Detaches an attached config-drive ISO from a VM and removes the associated VDI once the guest is halted."
@@ -30551,7 +30587,7 @@ var YumAddRepositoryResultSchema = z.object({
30551
30587
  error: z.string().optional()
30552
30588
  })
30553
30589
  );
30554
- async function run247(context) {
30590
+ async function run243(context) {
30555
30591
  const { params, exec, info, error } = context;
30556
30592
  const { content, name, sudo = true } = params;
30557
30593
  if (!content) {
@@ -30583,7 +30619,7 @@ EOF`;
30583
30619
  return { success: false, error: errorMsg };
30584
30620
  }
30585
30621
  }
30586
- var add_repository_default2 = task(run247, {
30622
+ var add_repository_default2 = task(run243, {
30587
30623
  description: "Adds a YUM repository.",
30588
30624
  inputSchema: YumAddRepositoryParamsSchema,
30589
30625
  outputSchema: YumAddRepositoryResultSchema
@@ -30609,7 +30645,7 @@ var DownloadOutputSchema = z.object({
30609
30645
  path: z.string().optional(),
30610
30646
  error: z.string().optional()
30611
30647
  });
30612
- async function run248(context) {
30648
+ async function run244(context) {
30613
30649
  const { params, info, error, exec } = context;
30614
30650
  const { url, dest, mode, sudo = false } = params;
30615
30651
  if (!url || !dest) {
@@ -30654,7 +30690,7 @@ async function run248(context) {
30654
30690
  return { success: false, error: errorMsg };
30655
30691
  }
30656
30692
  }
30657
- var download_default = task(run248, {
30693
+ var download_default = task(run244, {
30658
30694
  description: "Downloads a file from a URL using curl or wget.",
30659
30695
  inputSchema: DownloadInputSchema,
30660
30696
  outputSchema: DownloadOutputSchema
@@ -30685,7 +30721,7 @@ var InterfacesOutputSchema = z.object({
30685
30721
  error: z.string()
30686
30722
  })
30687
30723
  );
30688
- async function run249(context) {
30724
+ async function run245(context) {
30689
30725
  const { params, info, error, exec } = context;
30690
30726
  const { sudo = false } = params;
30691
30727
  try {
@@ -30777,7 +30813,7 @@ async function run249(context) {
30777
30813
  return { success: false, error: errorMsg };
30778
30814
  }
30779
30815
  }
30780
- var interfaces_default = task(run249, {
30816
+ var interfaces_default = task(run245, {
30781
30817
  name: "interfaces",
30782
30818
  description: "Lists network interfaces with their properties.",
30783
30819
  inputSchema: InterfacesInputSchema,
@@ -30803,7 +30839,7 @@ var NftablesApplyOutputSchema = z.object({
30803
30839
  error: z.string().optional()
30804
30840
  })
30805
30841
  );
30806
- async function run250(context) {
30842
+ async function run246(context) {
30807
30843
  const { params, exec, info } = context;
30808
30844
  const { config } = params;
30809
30845
  if (!config) {
@@ -30827,7 +30863,7 @@ async function run250(context) {
30827
30863
  return { success: false, error };
30828
30864
  }
30829
30865
  }
30830
- var apply_default = task(run250, {
30866
+ var apply_default = task(run246, {
30831
30867
  description: "Applies an nftables configuration.",
30832
30868
  inputSchema: NftablesApplyInputSchema,
30833
30869
  outputSchema: NftablesApplyOutputSchema
@@ -30850,7 +30886,7 @@ var FirewalldDisableResultSchema = z.object({
30850
30886
  success: z.boolean(),
30851
30887
  error: z.string().optional()
30852
30888
  });
30853
- async function run251(context) {
30889
+ async function run247(context) {
30854
30890
  const { run: runTask, debug, error, info } = context;
30855
30891
  const statusResult = await runTask(status_default({ service: "firewalld", sudo: true }));
30856
30892
  if (!statusResult.success && (statusResult.error?.includes("Could not find") || statusResult.error?.includes("not-found"))) {
@@ -30874,7 +30910,7 @@ async function run251(context) {
30874
30910
  info("firewalld service disabled successfully.");
30875
30911
  return { success: true };
30876
30912
  }
30877
- var disable_default3 = task(run251, {
30913
+ var disable_default3 = task(run247, {
30878
30914
  description: "Disables and stops the firewalld service.",
30879
30915
  inputSchema: FirewalldDisableInputSchema,
30880
30916
  outputSchema: FirewalldDisableResultSchema
@@ -32169,6 +32205,7 @@ import Handlebars3 from "handlebars";
32169
32205
  // src/remote-runtime.ts
32170
32206
  import Handlebars2 from "handlebars";
32171
32207
  import "path";
32208
+ import * as fs10 from "fs";
32172
32209
 
32173
32210
  // src/ssh-session.ts
32174
32211
  import { signalsByName } from "human-signals";
@@ -32316,6 +32353,15 @@ import "chalk";
32316
32353
  import "util";
32317
32354
  import "typescript-string-operations";
32318
32355
  import { match as match4, P as P3 } from "ts-pattern";
32356
+ function normalizePrivateKey(value) {
32357
+ if (!value.includes("\n") && value.includes("\\n")) {
32358
+ return value.replace(/\\n/g, "\n");
32359
+ }
32360
+ return value;
32361
+ }
32362
+ function looksLikePrivateKey(value) {
32363
+ return /-----BEGIN [A-Z0-9 ]+PRIVATE KEY-----/.test(value);
32364
+ }
32319
32365
  function normalizeWriteMode(mode) {
32320
32366
  if (mode === void 0) {
32321
32367
  return void 0;
@@ -32555,9 +32601,28 @@ var RemoteRuntime = class {
32555
32601
  // Assuming defaultSshUser on App
32556
32602
  port: this.host.port,
32557
32603
  // node-ssh parses port from host string if present
32558
- privateKey: await this.host.plaintextSshKeyPath(),
32559
32604
  password: await this.host.decryptedPassword()
32560
32605
  };
32606
+ const sshKeyPassphrase = await this.host.decryptedSshKeyPassphrase();
32607
+ if (sshKeyPassphrase) {
32608
+ sshConnectOpts.passphrase = sshKeyPassphrase;
32609
+ }
32610
+ const decryptedKey = await this.host.decryptedSshKey();
32611
+ if (decryptedKey) {
32612
+ const normalizedKey = normalizePrivateKey(decryptedKey).trim();
32613
+ if (looksLikePrivateKey(normalizedKey)) {
32614
+ sshConnectOpts.privateKey = normalizedKey;
32615
+ } else if (fs10.existsSync(normalizedKey)) {
32616
+ sshConnectOpts.privateKeyPath = normalizedKey;
32617
+ } else {
32618
+ sshConnectOpts.privateKey = normalizedKey;
32619
+ }
32620
+ } else {
32621
+ const keyPath = await this.host.plaintextSshKeyPath();
32622
+ if (keyPath) {
32623
+ sshConnectOpts.privateKeyPath = keyPath;
32624
+ }
32625
+ }
32561
32626
  try {
32562
32627
  if (!this.sshSession.isConnected()) {
32563
32628
  await this.sshSession.connect(sshConnectOpts);
@@ -32648,7 +32713,7 @@ var RemoteRuntime = class {
32648
32713
  };
32649
32714
 
32650
32715
  // src/local-runtime.ts
32651
- import * as fs10 from "fs";
32716
+ import * as fs11 from "fs";
32652
32717
  import chalk4 from "chalk";
32653
32718
  function normalizeMode(mode) {
32654
32719
  if (mode === void 0) {
@@ -32671,7 +32736,7 @@ var LocalInvocation = class _LocalInvocation extends Invocation {
32671
32736
  )(params);
32672
32737
  this.config = this.runtime.app.config;
32673
32738
  this.file = {
32674
- read: async (path14) => fs10.promises.readFile(path14, "utf-8"),
32739
+ read: async (path14) => fs11.promises.readFile(path14, "utf-8"),
32675
32740
  write: async (path14, content, options) => {
32676
32741
  const mode = normalizeMode(options?.mode);
32677
32742
  const writeOptions = {
@@ -32680,20 +32745,20 @@ var LocalInvocation = class _LocalInvocation extends Invocation {
32680
32745
  if (mode !== void 0) {
32681
32746
  writeOptions.mode = mode;
32682
32747
  }
32683
- await fs10.promises.writeFile(path14, content, writeOptions);
32748
+ await fs11.promises.writeFile(path14, content, writeOptions);
32684
32749
  },
32685
32750
  exists: async (path14) => {
32686
32751
  try {
32687
- await fs10.promises.access(path14);
32752
+ await fs11.promises.access(path14);
32688
32753
  return true;
32689
32754
  } catch {
32690
32755
  return false;
32691
32756
  }
32692
32757
  },
32693
32758
  mkdir: async (path14, options) => {
32694
- await fs10.promises.mkdir(path14, options);
32759
+ await fs11.promises.mkdir(path14, options);
32695
32760
  },
32696
- rm: async (path14, options) => fs10.promises.rm(path14, options)
32761
+ rm: async (path14, options) => fs11.promises.rm(path14, options)
32697
32762
  };
32698
32763
  }
32699
32764
  config;
@@ -32932,6 +32997,9 @@ import AdmZip from "adm-zip";
32932
32997
 
32933
32998
  // src/hash.ts
32934
32999
  import { createHash } from "crypto";
33000
+ function sha256(str) {
33001
+ return createHash("sha256").update(str).digest("hex");
33002
+ }
32935
33003
 
32936
33004
  // src/param-map.ts
32937
33005
  import { match as match5 } from "ts-pattern";
@@ -33040,7 +33108,7 @@ function serializeError(value) {
33040
33108
  }
33041
33109
  return { error: String(value) };
33042
33110
  }
33043
- async function run252(context) {
33111
+ async function run248(context) {
33044
33112
  const { params, ssh } = context;
33045
33113
  const { taskFn, params: taskParams } = params;
33046
33114
  const remoteResults = await ssh([], async (remoteContext) => {
@@ -33069,13 +33137,170 @@ async function run252(context) {
33069
33137
  });
33070
33138
  return Object.fromEntries(normalizedEntries);
33071
33139
  }
33072
- var runAllRemote_default = task(run252, {
33140
+ var runAllRemote_default = task(run248, {
33073
33141
  description: "run a task on all selected hosts",
33074
33142
  inputSchema: RunParamsSchema,
33075
33143
  outputSchema: RunResultSchema
33076
33144
  });
33077
33145
 
33146
+ // src/task-cache.ts
33147
+ var DEFAULT_CACHE_MODE = "use";
33148
+ var LOCAL_HOST_SCOPE_KEY = "host:local";
33149
+ function normalizeValue(value) {
33150
+ if (value === void 0) {
33151
+ return void 0;
33152
+ }
33153
+ if (value === null) {
33154
+ return null;
33155
+ }
33156
+ if (typeof value === "bigint") {
33157
+ return value.toString();
33158
+ }
33159
+ if (value instanceof Date) {
33160
+ return value.toISOString();
33161
+ }
33162
+ if (Array.isArray(value)) {
33163
+ return value.map((item) => {
33164
+ const normalized = normalizeValue(item);
33165
+ return normalized === void 0 ? null : normalized;
33166
+ });
33167
+ }
33168
+ if (typeof value === "object") {
33169
+ const obj = value;
33170
+ const sortedKeys = Object.keys(obj).sort();
33171
+ const result = {};
33172
+ for (const key of sortedKeys) {
33173
+ const normalized = normalizeValue(obj[key]);
33174
+ if (normalized !== void 0) {
33175
+ result[key] = normalized;
33176
+ }
33177
+ }
33178
+ return result;
33179
+ }
33180
+ return value;
33181
+ }
33182
+ function stableJson(value) {
33183
+ const normalized = normalizeValue(value);
33184
+ return JSON.stringify(normalized ?? null);
33185
+ }
33186
+ function normalizeCacheConfig(cache) {
33187
+ if (!cache) {
33188
+ return { enabled: false, mode: DEFAULT_CACHE_MODE };
33189
+ }
33190
+ if (cache === true) {
33191
+ return { enabled: true, mode: DEFAULT_CACHE_MODE };
33192
+ }
33193
+ if (typeof cache === "string") {
33194
+ return { enabled: true, scope: cache, mode: DEFAULT_CACHE_MODE };
33195
+ }
33196
+ return {
33197
+ enabled: true,
33198
+ scope: cache.scope,
33199
+ key: cache.key,
33200
+ ttlMs: cache.ttlMs,
33201
+ mode: cache.mode ?? DEFAULT_CACHE_MODE
33202
+ };
33203
+ }
33204
+ function buildTaskCacheKey(taskIdentity, params) {
33205
+ const taskName = taskIdentity?.task?.name;
33206
+ const modulePath = taskIdentity?.task?.taskModuleAbsolutePath;
33207
+ const identity2 = taskName ?? (modulePath ? Path.new(modulePath).absolute().toString() : "unknown-task");
33208
+ const paramsHash = sha256(stableJson(params ?? {}));
33209
+ return `${identity2}:${paramsHash}`;
33210
+ }
33211
+ function buildHostScopeKey(host, configRef) {
33212
+ if (!host) {
33213
+ return LOCAL_HOST_SCOPE_KEY;
33214
+ }
33215
+ const identity2 = {
33216
+ alias: host.alias ?? "",
33217
+ hostname: host.hostname ?? "",
33218
+ user: host.user ?? "",
33219
+ port: host.port ?? 22,
33220
+ config: configRef ?? ""
33221
+ };
33222
+ return `host:${sha256(stableJson(identity2))}`;
33223
+ }
33224
+ function buildInvocationScopeKey(rootInvocationId) {
33225
+ return `invocation:${rootInvocationId}`;
33226
+ }
33227
+ var TaskCacheStore = class {
33228
+ entries = /* @__PURE__ */ new Map();
33229
+ runId;
33230
+ constructor(runId) {
33231
+ this.runId = runId ?? crypto.randomUUID();
33232
+ }
33233
+ globalScopeKey() {
33234
+ return `global:${this.runId}`;
33235
+ }
33236
+ get(scopeKey, cacheKey2) {
33237
+ const scope = this.entries.get(scopeKey);
33238
+ if (!scope) {
33239
+ return void 0;
33240
+ }
33241
+ const entry = scope.get(cacheKey2);
33242
+ if (!entry) {
33243
+ return void 0;
33244
+ }
33245
+ if (entry.expiresAt > 0 && Date.now() > entry.expiresAt) {
33246
+ scope.delete(cacheKey2);
33247
+ if (scope.size === 0) {
33248
+ this.entries.delete(scopeKey);
33249
+ }
33250
+ return void 0;
33251
+ }
33252
+ return entry;
33253
+ }
33254
+ set(scopeKey, cacheKey2, value, ttlMs) {
33255
+ const scope = this.entries.get(scopeKey) ?? /* @__PURE__ */ new Map();
33256
+ const expiresAt = ttlMs && ttlMs > 0 ? Date.now() + ttlMs : 0;
33257
+ const entry = { value, expiresAt };
33258
+ scope.set(cacheKey2, entry);
33259
+ this.entries.set(scopeKey, scope);
33260
+ return entry;
33261
+ }
33262
+ delete(scopeKey, cacheKey2) {
33263
+ const scope = this.entries.get(scopeKey);
33264
+ if (!scope) {
33265
+ return;
33266
+ }
33267
+ scope.delete(cacheKey2);
33268
+ if (scope.size === 0) {
33269
+ this.entries.delete(scopeKey);
33270
+ }
33271
+ }
33272
+ async resolve(scopeKey, cacheKey2, compute, options = {}) {
33273
+ const mode = options.mode ?? DEFAULT_CACHE_MODE;
33274
+ if (mode === "bypass") {
33275
+ return await compute();
33276
+ }
33277
+ if (mode === "use") {
33278
+ const cached = this.get(scopeKey, cacheKey2);
33279
+ if (cached) {
33280
+ return await cached.value;
33281
+ }
33282
+ }
33283
+ const promise = Promise.resolve().then(compute);
33284
+ this.set(scopeKey, cacheKey2, promise, options.ttlMs);
33285
+ try {
33286
+ return await promise;
33287
+ } catch (error) {
33288
+ this.delete(scopeKey, cacheKey2);
33289
+ throw error;
33290
+ }
33291
+ }
33292
+ };
33293
+
33078
33294
  // src/app.ts
33295
+ function normalizePrivateKey2(value) {
33296
+ if (!value.includes("\n") && value.includes("\\n")) {
33297
+ return value.replace(/\\n/g, "\n");
33298
+ }
33299
+ return value;
33300
+ }
33301
+ function looksLikePrivateKey2(value) {
33302
+ return /-----BEGIN [A-Z0-9 ]+PRIVATE KEY-----/.test(value);
33303
+ }
33079
33304
  var TaskTree = class {
33080
33305
  // private taskEventBus: Emittery<{ newTask: NewTaskEvent; taskComplete: TaskCompleteEvent }>;
33081
33306
  listr;
@@ -33171,6 +33396,7 @@ var App6 = class _App {
33171
33396
  outputStyle;
33172
33397
  _tmpDir;
33173
33398
  tmpFileRegistry;
33399
+ taskCache;
33174
33400
  taskTree;
33175
33401
  verbosity = Verbosity.ERROR;
33176
33402
  passwordProvider;
@@ -33180,6 +33406,7 @@ var App6 = class _App {
33180
33406
  this.taskTree = new TaskTree();
33181
33407
  this.outputStyle = "plain";
33182
33408
  this.tmpFileRegistry = new TmpFileRegistry(this.hostctlTmpDir());
33409
+ this.taskCache = new TaskCacheStore();
33183
33410
  this.configRef = void 0;
33184
33411
  this.hostSelector = void 0;
33185
33412
  process4.on("exit", (code) => this.appExitCallback());
@@ -33194,8 +33421,8 @@ var App6 = class _App {
33194
33421
  }
33195
33422
  get tmpDir() {
33196
33423
  if (!this._tmpDir) {
33197
- if (!fs11.existsSync(this.hostctlDir().toString())) {
33198
- fs11.mkdirSync(this.hostctlDir().toString(), { recursive: true });
33424
+ if (!fs12.existsSync(this.hostctlDir().toString())) {
33425
+ fs12.mkdirSync(this.hostctlDir().toString(), { recursive: true });
33199
33426
  }
33200
33427
  this._tmpDir = this.createNamedTmpDir(version);
33201
33428
  }
@@ -33209,10 +33436,11 @@ var App6 = class _App {
33209
33436
  this.configProvider = provider;
33210
33437
  if (provider instanceof FileConfigProvider) {
33211
33438
  this.configRef = provider.path;
33439
+ this._config = await provider.getConfigFile();
33212
33440
  } else {
33213
33441
  this.configRef = "provider";
33442
+ this._config = await ProviderConfig.load(provider);
33214
33443
  }
33215
- this._config = await ProviderConfig.load(provider);
33216
33444
  }
33217
33445
  isValidUrl(url) {
33218
33446
  try {
@@ -33416,9 +33644,28 @@ ${cmdRes.stderr.trim()}`));
33416
33644
  host: host.hostname,
33417
33645
  port: host.port,
33418
33646
  username: host.user,
33419
- password: hostPassword,
33420
- privateKeyPath: await host.plaintextSshKeyPath()
33647
+ password: hostPassword
33421
33648
  };
33649
+ const sshKeyPassphrase = await host.decryptedSshKeyPassphrase();
33650
+ if (sshKeyPassphrase) {
33651
+ sshConnection.passphrase = sshKeyPassphrase;
33652
+ }
33653
+ const decryptedKey = await host.decryptedSshKey();
33654
+ if (decryptedKey) {
33655
+ const normalizedKey = normalizePrivateKey2(decryptedKey).trim();
33656
+ if (looksLikePrivateKey2(normalizedKey)) {
33657
+ sshConnection.privateKey = normalizedKey;
33658
+ } else if (fs12.existsSync(normalizedKey)) {
33659
+ sshConnection.privateKeyPath = normalizedKey;
33660
+ } else {
33661
+ sshConnection.privateKey = normalizedKey;
33662
+ }
33663
+ } else {
33664
+ const keyPath = await host.plaintextSshKeyPath();
33665
+ if (keyPath) {
33666
+ sshConnection.privateKeyPath = keyPath;
33667
+ }
33668
+ }
33422
33669
  const interactionHandler = InteractionHandler.with(withSudo(hostPassword));
33423
33670
  const session = new SSHSession();
33424
33671
  await session.connect(sshConnection);
@@ -33495,6 +33742,27 @@ ${cmdRes.stderr.trim()}`));
33495
33742
  }
33496
33743
  taskContextForRunFn(invocation, params, hostForContext) {
33497
33744
  const effectiveHost = hostForContext || invocation.host;
33745
+ const rootInvocationId = (() => {
33746
+ let current = invocation;
33747
+ while (current.parent) {
33748
+ current = current.parent;
33749
+ }
33750
+ return current.id;
33751
+ })();
33752
+ const defaultScope = () => effectiveHost ? "host" : "global";
33753
+ const scopeKeyFor = (scope) => {
33754
+ switch (scope) {
33755
+ case "global":
33756
+ return this.taskCache.globalScopeKey();
33757
+ case "host":
33758
+ return buildHostScopeKey(effectiveHost, this.configRef);
33759
+ case "invocation":
33760
+ return buildInvocationScopeKey(rootInvocationId);
33761
+ }
33762
+ };
33763
+ const isTaskFn = (candidate) => {
33764
+ return typeof candidate === "function" && !!candidate.task;
33765
+ };
33498
33766
  return {
33499
33767
  // Properties from TaskContext
33500
33768
  params,
@@ -33524,8 +33792,58 @@ ${cmdRes.stderr.trim()}`));
33524
33792
  ssh: async (tags, remoteTaskFn) => {
33525
33793
  return await invocation.ssh(tags, remoteTaskFn);
33526
33794
  },
33527
- run: async (taskPartialFn) => {
33528
- return await invocation.run(taskPartialFn);
33795
+ run: async (...args) => {
33796
+ const [firstArg, secondArg, thirdArg] = args;
33797
+ let taskPartialFn;
33798
+ let taskIdentity;
33799
+ let paramsForKey;
33800
+ let options;
33801
+ if (isTaskFn(firstArg)) {
33802
+ taskIdentity = firstArg;
33803
+ paramsForKey = secondArg ?? {};
33804
+ options = thirdArg;
33805
+ taskPartialFn = taskIdentity(paramsForKey);
33806
+ } else {
33807
+ taskPartialFn = firstArg;
33808
+ options = secondArg;
33809
+ const meta = taskPartialFn;
33810
+ taskIdentity = meta.taskFn;
33811
+ paramsForKey = meta.params;
33812
+ }
33813
+ const cacheDecision = normalizeCacheConfig(options?.cache);
33814
+ if (!cacheDecision.enabled || cacheDecision.mode === "bypass") {
33815
+ return await invocation.run(taskPartialFn);
33816
+ }
33817
+ const scope = cacheDecision.scope ?? defaultScope();
33818
+ const cacheKey2 = cacheDecision.key ?? buildTaskCacheKey(taskIdentity, paramsForKey ?? {});
33819
+ const scopeKey = scopeKeyFor(scope);
33820
+ return await this.taskCache.resolve(scopeKey, cacheKey2, () => invocation.run(taskPartialFn), {
33821
+ ttlMs: cacheDecision.ttlMs,
33822
+ mode: cacheDecision.mode
33823
+ });
33824
+ },
33825
+ memoize: async (key, valueOrFactory, options) => {
33826
+ const cacheDecision = normalizeCacheConfig({
33827
+ scope: options?.scope,
33828
+ ttlMs: options?.ttlMs,
33829
+ mode: options?.mode,
33830
+ key
33831
+ });
33832
+ const scope = cacheDecision.scope ?? defaultScope();
33833
+ const scopeKey = scopeKeyFor(scope);
33834
+ const compute = async () => {
33835
+ if (typeof valueOrFactory === "function") {
33836
+ return await valueOrFactory();
33837
+ }
33838
+ return await valueOrFactory;
33839
+ };
33840
+ if (cacheDecision.mode === "bypass") {
33841
+ return await compute();
33842
+ }
33843
+ return await this.taskCache.resolve(scopeKey, key, compute, {
33844
+ ttlMs: cacheDecision.ttlMs,
33845
+ mode: cacheDecision.mode
33846
+ });
33529
33847
  },
33530
33848
  getPassword: async () => {
33531
33849
  return await invocation.getPassword();
@@ -33757,7 +34075,7 @@ ${cmdRes.stderr.trim()}`));
33757
34075
  await configFile.decryptAllIfPossible();
33758
34076
  const successfullyUsedIdentityPaths = configFile.loadPrivateKeys().filter((identity2) => {
33759
34077
  try {
33760
- return fs11.existsSync(identity2.identityFilePath);
34078
+ return fs12.existsSync(identity2.identityFilePath);
33761
34079
  } catch (e) {
33762
34080
  return false;
33763
34081
  }