@agentskit/cli 0.13.44 → 0.13.45

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.cjs CHANGED
@@ -10,6 +10,7 @@ var path = require('path');
10
10
  var ink = require('@agentskit/ink');
11
11
  var adapters = require('@agentskit/adapters');
12
12
  var crypto = require('crypto');
13
+ var hash = require('@agentskit/core/hash');
13
14
  var fs = require('fs');
14
15
  var tools = require('@agentskit/tools');
15
16
  var skills = require('@agentskit/skills');
@@ -40,7 +41,7 @@ var chokidar__default = /*#__PURE__*/_interopDefault(chokidar);
40
41
 
41
42
  // package.json
42
43
  var package_default = {
43
- version: "0.13.44"};
44
+ version: "0.13.45"};
44
45
  async function loadJsonConfig(path6) {
45
46
  try {
46
47
  const raw = await promises.readFile(path6, "utf8");
@@ -251,7 +252,7 @@ function resolveChatProvider(options) {
251
252
  var ROOT = path.join(os.homedir(), ".agentskit", "sessions");
252
253
  var META_SUFFIX = ".meta.json";
253
254
  function cwdHash(cwd = process.cwd()) {
254
- return crypto.createHash("sha256").update(cwd).digest("hex").slice(0, 12);
255
+ return hash.sha256Hex(cwd).slice(0, 12);
255
256
  }
256
257
  function dirFor(cwd = process.cwd()) {
257
258
  return path.join(ROOT, cwdHash(cwd));
@@ -5528,11 +5529,8 @@ function resolveAuthHeader(base, config, env = {}) {
5528
5529
  }
5529
5530
  return {};
5530
5531
  }
5531
- function sha256Hex(content) {
5532
- return crypto.createHash("sha256").update(content, "utf8").digest("hex");
5533
- }
5534
5532
  function verifyChecksums(files) {
5535
- const bad = files.filter((f) => sha256Hex(f.content) !== f.sha256).map((f) => f.path);
5533
+ const bad = files.filter((f) => hash.sha256Hex(f.content) !== f.sha256).map((f) => f.path);
5536
5534
  if (bad.length > 0) {
5537
5535
  throw new IntegrityError(`checksum mismatch \u2014 install aborted for ${bad.length} file(s): ${bad.join(", ")}`);
5538
5536
  }
@@ -5719,8 +5717,6 @@ function validateInstall(input2) {
5719
5717
  }
5720
5718
  return { ok: !issues.some((i) => i.severity === "error"), port, issues };
5721
5719
  }
5722
-
5723
- // src/components/marker.ts
5724
5720
  function assertUniquePaths(files) {
5725
5721
  const seen = /* @__PURE__ */ new Set();
5726
5722
  for (const f of files) {
@@ -5736,14 +5732,14 @@ function sameKey(entry, id, installPath) {
5736
5732
  function upsertInstalled(config, entry) {
5737
5733
  const current = config.installed ?? [];
5738
5734
  const idx = current.findIndex((e) => sameKey(e, entry.id, entry.installPath));
5739
- const installed = idx === -1 ? [...current, entry] : current.map((e, i) => i === idx ? entry : e);
5740
- return { ...config, installed };
5735
+ if (idx === -1) return { ...config, installed: [...current, entry] };
5736
+ return { ...config, installed: current.map((e, i) => i === idx ? entry : e) };
5741
5737
  }
5742
5738
  function buildInstalledComponent(args) {
5743
5739
  assertUniquePaths(args.files);
5744
5740
  const files = {};
5745
5741
  for (const f of args.files) {
5746
- files[f.path] = { sha: sha256Hex(f.content), installedAt: args.now };
5742
+ files[f.path] = { sha: hash.sha256Hex(f.content), installedAt: args.now };
5747
5743
  }
5748
5744
  return {
5749
5745
  id: args.id,
@@ -5755,22 +5751,11 @@ function buildInstalledComponent(args) {
5755
5751
  files
5756
5752
  };
5757
5753
  }
5758
- function canonicalize(value) {
5759
- if (Array.isArray(value)) return value.map(canonicalize);
5760
- if (value !== null && typeof value === "object") {
5761
- const sorted = {};
5762
- for (const key of Object.keys(value).sort()) {
5763
- sorted[key] = canonicalize(value[key]);
5764
- }
5765
- return sorted;
5766
- }
5767
- return value;
5768
- }
5769
5754
  function canonicalJson(value) {
5770
- return JSON.stringify(canonicalize(value));
5755
+ return JSON.stringify(JSON.parse(hash.canonicalJson(value)));
5771
5756
  }
5772
5757
  function hashEntry(entry) {
5773
- return sha256Hex(canonicalJson(entry));
5758
+ return hash.sha256Hex(canonicalJson(entry));
5774
5759
  }
5775
5760
  function appendAudit(prevEntries, entry) {
5776
5761
  const prev = prevEntries.length > 0 ? prevEntries[prevEntries.length - 1] : void 0;