@agentskit/cli 0.13.44 → 0.13.46

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/bin.cjs CHANGED
@@ -10,6 +10,7 @@ var path = require('path');
10
10
  var ink$1 = 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.46"};
44
45
  async function loadJsonConfig(path6) {
45
46
  try {
46
47
  const raw = await promises.readFile(path6, "utf8");
@@ -250,7 +251,7 @@ function resolveChatProvider(options) {
250
251
  var ROOT = path.join(os.homedir(), ".agentskit", "sessions");
251
252
  var META_SUFFIX = ".meta.json";
252
253
  function cwdHash(cwd = process.cwd()) {
253
- return crypto.createHash("sha256").update(cwd).digest("hex").slice(0, 12);
254
+ return hash.sha256Hex(cwd).slice(0, 12);
254
255
  }
255
256
  function dirFor(cwd = process.cwd()) {
256
257
  return path.join(ROOT, cwdHash(cwd));
@@ -5520,11 +5521,8 @@ function resolveAuthHeader(base, config, env = {}) {
5520
5521
  }
5521
5522
  return {};
5522
5523
  }
5523
- function sha256Hex(content) {
5524
- return crypto.createHash("sha256").update(content, "utf8").digest("hex");
5525
- }
5526
5524
  function verifyChecksums(files) {
5527
- const bad = files.filter((f) => sha256Hex(f.content) !== f.sha256).map((f) => f.path);
5525
+ const bad = files.filter((f) => hash.sha256Hex(f.content) !== f.sha256).map((f) => f.path);
5528
5526
  if (bad.length > 0) {
5529
5527
  throw new IntegrityError(`checksum mismatch \u2014 install aborted for ${bad.length} file(s): ${bad.join(", ")}`);
5530
5528
  }
@@ -5711,8 +5709,6 @@ function validateInstall(input2) {
5711
5709
  }
5712
5710
  return { ok: !issues.some((i) => i.severity === "error"), port, issues };
5713
5711
  }
5714
-
5715
- // src/components/marker.ts
5716
5712
  function assertUniquePaths(files) {
5717
5713
  const seen = /* @__PURE__ */ new Set();
5718
5714
  for (const f of files) {
@@ -5728,14 +5724,14 @@ function sameKey(entry, id, installPath) {
5728
5724
  function upsertInstalled(config, entry) {
5729
5725
  const current = config.installed ?? [];
5730
5726
  const idx = current.findIndex((e) => sameKey(e, entry.id, entry.installPath));
5731
- const installed = idx === -1 ? [...current, entry] : current.map((e, i) => i === idx ? entry : e);
5732
- return { ...config, installed };
5727
+ if (idx === -1) return { ...config, installed: [...current, entry] };
5728
+ return { ...config, installed: current.map((e, i) => i === idx ? entry : e) };
5733
5729
  }
5734
5730
  function buildInstalledComponent(args) {
5735
5731
  assertUniquePaths(args.files);
5736
5732
  const files = {};
5737
5733
  for (const f of args.files) {
5738
- files[f.path] = { sha: sha256Hex(f.content), installedAt: args.now };
5734
+ files[f.path] = { sha: hash.sha256Hex(f.content), installedAt: args.now };
5739
5735
  }
5740
5736
  return {
5741
5737
  id: args.id,
@@ -5747,22 +5743,11 @@ function buildInstalledComponent(args) {
5747
5743
  files
5748
5744
  };
5749
5745
  }
5750
- function canonicalize(value) {
5751
- if (Array.isArray(value)) return value.map(canonicalize);
5752
- if (value !== null && typeof value === "object") {
5753
- const sorted = {};
5754
- for (const key of Object.keys(value).sort()) {
5755
- sorted[key] = canonicalize(value[key]);
5756
- }
5757
- return sorted;
5758
- }
5759
- return value;
5760
- }
5761
5746
  function canonicalJson(value) {
5762
- return JSON.stringify(canonicalize(value));
5747
+ return JSON.stringify(JSON.parse(hash.canonicalJson(value)));
5763
5748
  }
5764
5749
  function hashEntry(entry) {
5765
- return sha256Hex(canonicalJson(entry));
5750
+ return hash.sha256Hex(canonicalJson(entry));
5766
5751
  }
5767
5752
  function appendAudit(prevEntries, entry) {
5768
5753
  const prev = prevEntries.length > 0 ? prevEntries[prevEntries.length - 1] : void 0;