@easysociable/cli 0.1.27 → 0.1.28

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.
@@ -20573,11 +20573,20 @@ function withAuthoringStudioUrl(draft, studioBaseUrl) {
20573
20573
  };
20574
20574
  }
20575
20575
  function parseDataEnvelope(payload, dataSchema) {
20576
- const envelope = external_exports.object({
20577
- ok: external_exports.boolean().optional(),
20578
- data: dataSchema
20579
- }).strict().parse(payload);
20580
- return envelope.data;
20576
+ const schema = external_exports.object({ ok: external_exports.boolean().optional(), data: dataSchema });
20577
+ const at = (root, path) => path.reduce((node2, key) => node2?.[key], root);
20578
+ let value = payload;
20579
+ for (let pass = 0; ; pass += 1) {
20580
+ const result = schema.safeParse(value);
20581
+ if (result.success) return result.data.data;
20582
+ const fixable = pass < 8 && result.error.issues.every((issue2) => issue2.code === "unrecognized_keys" || issue2.code === "invalid_type" && issue2.path.length > 0 && at(value, issue2.path) === null);
20583
+ if (!fixable) throw result.error;
20584
+ if (pass === 0) value = structuredClone(payload);
20585
+ for (const issue2 of result.error.issues) {
20586
+ if (issue2.code === "unrecognized_keys") for (const key of issue2.keys) delete at(value, issue2.path)[key];
20587
+ else delete at(value, issue2.path.slice(0, -1))[issue2.path.at(-1)];
20588
+ }
20589
+ }
20581
20590
  }
20582
20591
  function parseTemplateSummaryList(payload) {
20583
20592
  assertNoPrivateTemplateFields(payload);
@@ -22178,7 +22187,7 @@ var init_client = __esm({
22178
22187
  suggestedAction: "Run `easysociable auth login` (browser approval) or set EASYSOCIABLE_ALLOW_ENV_CREDENTIALS=true for local tests"
22179
22188
  });
22180
22189
  }
22181
- const maxRetries = this.options.maxRetries ?? 2;
22190
+ const maxRetries = this.options.maxRetries ?? 3;
22182
22191
  const baseDelay = this.options.retryBaseDelayMs ?? 250;
22183
22192
  let attempt = 0;
22184
22193
  while (true) {
@@ -22190,7 +22199,15 @@ var init_client = __esm({
22190
22199
  const idempotency = extras?.idempotencyKey ?? this.options.idempotencyKey;
22191
22200
  if (idempotency)
22192
22201
  headers["idempotency-key"] = idempotency;
22193
- const response = await this.options.transport.request({ method, path, headers, body });
22202
+ let response;
22203
+ try {
22204
+ response = await this.options.transport.request({ method, path, headers, body });
22205
+ } catch (error62) {
22206
+ if (attempt >= maxRetries || method !== "GET" && !idempotency) throw error62;
22207
+ attempt += 1;
22208
+ await sleep(baseDelay * 2 ** (attempt - 1));
22209
+ continue;
22210
+ }
22194
22211
  try {
22195
22212
  assertNoPrivateTemplateFields(response.json);
22196
22213
  } catch {
@@ -35608,8 +35625,16 @@ async function applyInstallation(options) {
35608
35625
  }
35609
35626
  await installHostConfig({ host: host.host, dataDir: "", configPath: host.configPath });
35610
35627
  await mkdir(host.skillsPath, { recursive: true, mode: 448 });
35611
- for (const skill of resolveInstallSkillIds(options))
35612
- await cp(join4(String(plan.source), skill), join4(host.skillsPath, skill), { recursive: true, force: false, errorOnExist: false });
35628
+ for (const skill of resolveInstallSkillIds(options)) {
35629
+ const target = join4(host.skillsPath, skill);
35630
+ if (existsSync4(target)) {
35631
+ const backupPath = join4(String(plan.home), ".easysociable", "backups", backupSuffix, host.host, skill);
35632
+ await cp(target, backupPath, { recursive: true });
35633
+ backups.push(backupPath);
35634
+ await rm(target, { recursive: true, force: true });
35635
+ }
35636
+ await cp(join4(String(plan.source), skill), target, { recursive: true });
35637
+ }
35613
35638
  }
35614
35639
  if (options.json !== true) {
35615
35640
  process.stdout.write(`Installed skills your Agent will use: