@aident-ai/cli 0.2.4-staging.ci.34807529340.1 → 0.3.0

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.
Files changed (3) hide show
  1. package/dist/cli.mjs +35 -72
  2. package/dist/dsh.mjs +45 -2965
  3. package/package.json +2 -2
package/dist/cli.mjs CHANGED
@@ -7387,9 +7387,25 @@ async function installAgentSkillBundle(descriptorValue, options = {}, injected =
7387
7387
  const descriptor = AgentSkillBundleInstallDescriptorSchema.parse(descriptorValue);
7388
7388
  const home = options.home ?? homedir2();
7389
7389
  const env = options.env ?? process.env;
7390
- return withInstallLock(descriptor.name, home, async () => {
7391
- const { releaseDirectory } = await prepareRelease(descriptor, home, injected.fetch ?? fetch);
7392
- const targets = await reconcileTargets(descriptor.name, releaseDirectory, dirname3(releaseDirectory), home, env);
7390
+ const stateRoot = join3(home, ".aident", "skills", "internal", descriptor.name);
7391
+ const releasesRoot = join3(stateRoot, "releases");
7392
+ const releaseDirectory = join3(releasesRoot, descriptor.artifactSha256);
7393
+ await mkdir3(stateRoot, { recursive: true, mode: 448 });
7394
+ const lock = await tryAcquireDirectoryLock(join3(stateRoot, "install.lock"));
7395
+ if (!lock)
7396
+ throw new Error(`Another ${descriptor.name} installation is already running`);
7397
+ try {
7398
+ if (!await pathExists(releaseDirectory)) {
7399
+ const archive = await downloadArchive(descriptor, injected.fetch ?? fetch);
7400
+ await materializeRelease(archive, descriptor, releasesRoot, releaseDirectory);
7401
+ } else {
7402
+ const existingRelease = await lstat2(releaseDirectory);
7403
+ if (!existingRelease.isDirectory()) {
7404
+ throw new Error(`Existing agent Skill release is not a directory: ${releaseDirectory}`);
7405
+ }
7406
+ await assertInstalledSkillIdentity(releaseDirectory, descriptor.name);
7407
+ }
7408
+ const targets = await reconcileTargets(descriptor.name, releaseDirectory, releasesRoot, home, env);
7393
7409
  return {
7394
7410
  name: descriptor.name,
7395
7411
  version: descriptor.version,
@@ -7398,37 +7414,6 @@ async function installAgentSkillBundle(descriptorValue, options = {}, injected =
7398
7414
  success: targets.every((target) => target.status !== "conflict" /* Conflict */ && target.status !== "failed" /* Failed */),
7399
7415
  targets
7400
7416
  };
7401
- });
7402
- }
7403
- async function prepareAgentSkillBundleRelease(descriptorValue, options = {}, injected = {}) {
7404
- const descriptor = AgentSkillBundleInstallDescriptorSchema.parse(descriptorValue);
7405
- const home = options.home ?? homedir2();
7406
- return withInstallLock(descriptor.name, home, () => prepareRelease(descriptor, home, injected.fetch ?? fetch));
7407
- }
7408
- async function prepareRelease(descriptor, home, fetchImpl) {
7409
- const stateRoot = join3(home, ".aident", "skills", "internal", descriptor.name);
7410
- const releasesRoot = join3(stateRoot, "releases");
7411
- const releaseDirectory = join3(releasesRoot, descriptor.artifactSha256);
7412
- if (!await pathExists(releaseDirectory)) {
7413
- const archive = await downloadArchive(descriptor, fetchImpl);
7414
- await materializeRelease(archive, descriptor, releasesRoot, releaseDirectory);
7415
- } else {
7416
- const existingRelease = await lstat2(releaseDirectory);
7417
- if (!existingRelease.isDirectory()) {
7418
- throw new Error(`Existing agent Skill release is not a directory: ${releaseDirectory}`);
7419
- }
7420
- await assertInstalledSkillIdentity(releaseDirectory, descriptor.name);
7421
- }
7422
- return { descriptor, releaseDirectory };
7423
- }
7424
- async function withInstallLock(name, home, run) {
7425
- const stateRoot = join3(home, ".aident", "skills", "internal", name);
7426
- await mkdir3(stateRoot, { recursive: true, mode: 448 });
7427
- const lock = await tryAcquireDirectoryLock(join3(stateRoot, "install.lock"));
7428
- if (!lock)
7429
- throw new Error(`Another ${name} installation is already running`);
7430
- try {
7431
- return await run();
7432
7417
  } finally {
7433
7418
  await lock.release();
7434
7419
  }
@@ -8182,7 +8167,7 @@ function getConfigFile() {
8182
8167
  function getConfigFileForHome(home) {
8183
8168
  return join4(getAidentDir(home), "config.json");
8184
8169
  }
8185
- var DEFAULT_BASE_URL = "https://staging.loadout.aident.ai"?.trim() || "https://loadout.aident.ai";
8170
+ var DEFAULT_BASE_URL = "https://loadout.aident.ai"?.trim() || "https://loadout.aident.ai";
8186
8171
  var CONFIG_KEYS = ["baseUrl", "packages"];
8187
8172
  async function readConfig(configFile = getConfigFile()) {
8188
8173
  try {
@@ -8475,7 +8460,7 @@ function serializeLoadoutSkillPackage(skillPackage) {
8475
8460
  }
8476
8461
 
8477
8462
  // src/version.ts
8478
- var VERSION = "0.2.4-staging.ci.34807529340.1";
8463
+ var VERSION = "0.3.0";
8479
8464
  var DESKTOP_VERSION = process.env.AIDENT_DESKTOP_VERSION?.trim() || undefined;
8480
8465
  var DESKTOP_CHANNEL = parseDesktopChannel(process.env.AIDENT_DESKTOP_CHANNEL);
8481
8466
  function parseDesktopChannel(value) {
@@ -9368,7 +9353,7 @@ var LoadoutFavoriteSkillsUpdateSchema = objectType({
9368
9353
  syncRequired: booleanType()
9369
9354
  }).strict();
9370
9355
  function getLoadoutFavoriteSkillsStateToken(skills) {
9371
- const state = skills.map(({ name, artifactVersionId, deliveryRevision }) => ({ name, artifactVersionId, deliveryRevision })).sort((left, right) => left.name.localeCompare(right.name));
9356
+ const state = skills.map(({ name, artifactVersionId }) => ({ name, artifactVersionId })).sort((left, right) => left.name.localeCompare(right.name));
9372
9357
  return createHash3("sha256").update(JSON.stringify(state)).digest("hex");
9373
9358
  }
9374
9359
 
@@ -10105,7 +10090,7 @@ function isExpired(creds) {
10105
10090
 
10106
10091
  // src/loadoutFavoriteSkills.ts
10107
10092
  import { createHash as createHash5 } from "node:crypto";
10108
- import { cp, lstat as lstat5, mkdir as mkdir8, readFile as readFile8, readlink, rename as rename4, rm as rm3, symlink as symlink3, writeFile as writeFile6 } from "node:fs/promises";
10093
+ import { lstat as lstat5, mkdir as mkdir8, readFile as readFile8, readlink, rename as rename4, rm as rm3, symlink as symlink3, writeFile as writeFile6 } from "node:fs/promises";
10109
10094
  import { homedir as homedir5 } from "node:os";
10110
10095
  import path from "node:path";
10111
10096
 
@@ -10184,8 +10169,6 @@ function assertPackage(pkg) {
10184
10169
  }
10185
10170
  if (packageBytes > LOADOUT_SKILL_MAX_PACKAGE_BYTES)
10186
10171
  throw new Error(`Package is too large: ${pkg.name}`);
10187
- if (pkg.bundle)
10188
- AgentSkillBundleInstallDescriptorSchema.parse(pkg.bundle);
10189
10172
  }
10190
10173
  function quoteYaml(value) {
10191
10174
  return JSON.stringify(value);
@@ -10228,7 +10211,7 @@ async function readManifest(home, env) {
10228
10211
  throw new Error("Unsupported manifest");
10229
10212
  const harnessRoots = new Set(getHarnessHosts(home, env).map(({ root }) => path.join(root, "skills")));
10230
10213
  for (const skill of value.skills) {
10231
- if (!LOADOUT_SKILL_NAME_PATTERN.test(skill.name) || !isCanonicalUuid(skill.artifactVersionId) || skill.displayName !== undefined && typeof skill.displayName !== "string" || skill.summary !== undefined && typeof skill.summary !== "string" || skill.deliveryRevision !== undefined && !/^[a-f0-9]{64}$/.test(skill.deliveryRevision) || !/^loadout-[a-z0-9-]+-[0-9a-f]{8}$/.test(skill.commandName) || skill.installPath !== path.join(getCanonicalRoot(home, env), skill.commandName) || skill.linkPaths.some((linkPath) => !harnessRoots.has(path.dirname(linkPath)) || path.basename(linkPath) !== skill.commandName)) {
10214
+ if (!LOADOUT_SKILL_NAME_PATTERN.test(skill.name) || !isCanonicalUuid(skill.artifactVersionId) || skill.displayName !== undefined && typeof skill.displayName !== "string" || skill.summary !== undefined && typeof skill.summary !== "string" || !/^loadout-[a-z0-9-]+-[0-9a-f]{8}$/.test(skill.commandName) || skill.installPath !== path.join(getCanonicalRoot(home, env), skill.commandName) || skill.linkPaths.some((linkPath) => !harnessRoots.has(path.dirname(linkPath)) || path.basename(linkPath) !== skill.commandName)) {
10232
10215
  throw new Error("Invalid favorite Skills ownership manifest");
10233
10216
  }
10234
10217
  }
@@ -10262,11 +10245,7 @@ async function removeOwnedSkill(skill) {
10262
10245
  if (await pathExists3(skill.installPath))
10263
10246
  await rm3(skill.installPath, { recursive: true });
10264
10247
  }
10265
- async function writeBundlePackage(directory, pkg, releaseDirectory) {
10266
- await cp(releaseDirectory, directory, { recursive: true });
10267
- await writeFile6(path.join(directory, LOADOUT_SKILL_ENTRYPOINT), entrypointContent(pkg, await readFile8(path.join(releaseDirectory, LOADOUT_SKILL_ENTRYPOINT), "utf8")));
10268
- }
10269
- async function reconcileLoadoutFavoriteSkills(payload, home = getHome(), env = process.env, injected = {}) {
10248
+ async function reconcileLoadoutFavoriteSkills(payload, home = getHome(), env = process.env) {
10270
10249
  const manifest = await readManifest(home, env);
10271
10250
  const previousByName = new Map(manifest.skills.map((skill) => [skill.name, skill]));
10272
10251
  const desiredNames = new Set(payload.packages.map((pkg) => pkg.name));
@@ -10281,12 +10260,6 @@ async function reconcileLoadoutFavoriteSkills(payload, home = getHome(), env = p
10281
10260
  if (payload.unavailable.some((name) => desiredNames.has(name))) {
10282
10261
  throw new Error("A favorite Skill cannot be both available and unavailable");
10283
10262
  }
10284
- const preparedBundles = new Map;
10285
- for (const pkg of payload.packages) {
10286
- if (!pkg.bundle)
10287
- continue;
10288
- preparedBundles.set(pkg.name, await (injected.prepareBundleRelease ?? prepareAgentSkillBundleRelease)(pkg.bundle, { home, env }));
10289
- }
10290
10263
  const nextSkills = [];
10291
10264
  const result = {
10292
10265
  installed: [],
@@ -10328,26 +10301,21 @@ async function reconcileLoadoutFavoriteSkills(payload, home = getHome(), env = p
10328
10301
  continue;
10329
10302
  }
10330
10303
  const allLinksExist = (await Promise.all(linkPaths.map(pathExists3))).every(Boolean);
10331
- if (previous?.artifactVersionId === pkg.artifactVersionId && previous.displayName === pkg.displayName && previous.summary === pkg.summary && previous.deliveryRevision === pkg.bundle?.artifactSha256 && previous.installPath === installPath && previous.linkPaths.length === linkPaths.length && previous.linkPaths.every((linkPath) => linkPaths.includes(linkPath)) && await pathExists3(installPath) && allLinksExist) {
10304
+ if (previous?.artifactVersionId === pkg.artifactVersionId && previous.displayName === pkg.displayName && previous.summary === pkg.summary && previous.installPath === installPath && previous.linkPaths.length === linkPaths.length && previous.linkPaths.every((linkPath) => linkPaths.includes(linkPath)) && await pathExists3(installPath) && allLinksExist) {
10332
10305
  result.unchanged.push(pkg.name);
10333
10306
  nextSkills.push(previous);
10334
10307
  continue;
10335
10308
  }
10336
- const preparedBundle = preparedBundles.get(pkg.name);
10337
10309
  const temporaryPath = `${installPath}.${process.pid}.tmp`;
10338
10310
  const backupPath = `${installPath}.${process.pid}.backup`;
10339
10311
  await mkdir8(getCanonicalRoot(home, env), { recursive: true });
10340
10312
  await rm3(temporaryPath, { recursive: true, force: true });
10341
10313
  await rm3(backupPath, { recursive: true, force: true });
10342
- if (preparedBundle) {
10343
- await writeBundlePackage(temporaryPath, pkg, preparedBundle.releaseDirectory);
10344
- } else {
10345
- await mkdir8(temporaryPath, { recursive: true });
10346
- for (const file of pkg.files) {
10347
- const destination = path.join(temporaryPath, ...file.path.split("/"));
10348
- await mkdir8(path.dirname(destination), { recursive: true });
10349
- await writeFile6(destination, file.path === LOADOUT_SKILL_ENTRYPOINT ? entrypointContent(pkg, file.content) : file.content);
10350
- }
10314
+ await mkdir8(temporaryPath, { recursive: true });
10315
+ for (const file of pkg.files) {
10316
+ const destination = path.join(temporaryPath, ...file.path.split("/"));
10317
+ await mkdir8(path.dirname(destination), { recursive: true });
10318
+ await writeFile6(destination, file.path === LOADOUT_SKILL_ENTRYPOINT ? entrypointContent(pkg, file.content) : file.content);
10351
10319
  }
10352
10320
  const createdLinkPaths = [];
10353
10321
  let backedUp = false;
@@ -10382,8 +10350,7 @@ async function reconcileLoadoutFavoriteSkills(payload, home = getHome(), env = p
10382
10350
  summary: pkg.summary,
10383
10351
  commandName: nextCommandName,
10384
10352
  installPath,
10385
- linkPaths,
10386
- ...pkg.bundle ? { deliveryRevision: pkg.bundle.artifactSha256 } : {}
10353
+ linkPaths
10387
10354
  });
10388
10355
  (previous ? result.updated : result.installed).push(pkg.name);
10389
10356
  }
@@ -18716,7 +18683,7 @@ async function stageOnboardingSkill(home, artifact) {
18716
18683
 
18717
18684
  // src/onboarding/transaction.ts
18718
18685
  import { randomUUID as randomUUID8 } from "node:crypto";
18719
- import { cp as cp2, lstat as lstat11, mkdir as mkdir12, readdir as readdir6, readFile as readFile17, rename as rename8, rm as rm7, symlink as symlink5 } from "node:fs/promises";
18686
+ import { cp, lstat as lstat11, mkdir as mkdir12, readdir as readdir6, readFile as readFile17, rename as rename8, rm as rm7, symlink as symlink5 } from "node:fs/promises";
18720
18687
  import { dirname as dirname11, join as join16, relative as relative5 } from "node:path";
18721
18688
  async function applyOnboardingPlan(plan, options) {
18722
18689
  if (options.confirmationDigest !== plan.confirmationDigest)
@@ -18884,7 +18851,7 @@ async function applyChange(change, desiredContent, options) {
18884
18851
  if (change.action === "copy" /* Copy */) {
18885
18852
  const temporary = `${change.target}.${randomUUID8()}.tmp`;
18886
18853
  await mkdir12(dirname11(temporary), { recursive: true, mode: 448 });
18887
- await cp2(options.skillSourceDirectory, temporary, { recursive: true, errorOnExist: true });
18854
+ await cp(options.skillSourceDirectory, temporary, { recursive: true, errorOnExist: true });
18888
18855
  await rename8(temporary, change.target);
18889
18856
  return;
18890
18857
  }
@@ -19035,7 +19002,7 @@ class OnboardingService {
19035
19002
  }
19036
19003
  }
19037
19004
 
19038
- // ../web/shared/loadout/LoadoutOnboardingTelemetryContract.ts
19005
+ // ../web/shared/loadout/LoadoutOnboardingTelemetry.ts
19039
19006
  var LoadoutOnboardingPath;
19040
19007
  ((LoadoutOnboardingPath) => {
19041
19008
  LoadoutOnboardingPath["Unselected"] = "unselected";
@@ -19052,8 +19019,6 @@ var LoadoutOnboardingTelemetryStage;
19052
19019
  LoadoutOnboardingTelemetryStage["LoginCompleted"] = "login_completed";
19053
19020
  LoadoutOnboardingTelemetryStage["MethodSelected"] = "method_selected";
19054
19021
  LoadoutOnboardingTelemetryStage["NativeDownloadStarted"] = "native_download_started";
19055
- LoadoutOnboardingTelemetryStage["PackageInstallStarted"] = "package_install_started";
19056
- LoadoutOnboardingTelemetryStage["PackageInstallCompleted"] = "package_install_completed";
19057
19022
  LoadoutOnboardingTelemetryStage["DesktopStarted"] = "desktop_started";
19058
19023
  LoadoutOnboardingTelemetryStage["InstallationCompleted"] = "installation_completed";
19059
19024
  LoadoutOnboardingTelemetryStage["OnboardingStarted"] = "onboarding_started";
@@ -19090,8 +19055,6 @@ var LoadoutOnboardingLaunchSource;
19090
19055
  LoadoutOnboardingLaunchSource["Desktop"] = "desktop";
19091
19056
  LoadoutOnboardingLaunchSource["Web"] = "web";
19092
19057
  })(LoadoutOnboardingLaunchSource ||= {});
19093
-
19094
- // ../web/shared/loadout/LoadoutOnboardingTelemetry.ts
19095
19058
  var LoadoutOnboardingClientFamily;
19096
19059
  ((LoadoutOnboardingClientFamily) => {
19097
19060
  LoadoutOnboardingClientFamily["Aident"] = "aident";