@hanhnd/agent-kit 1.0.30 → 1.0.31

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.
@@ -3229,8 +3229,8 @@ var require_utils = __commonJS({
3229
3229
  }
3230
3230
  return ind;
3231
3231
  }
3232
- function removeDotSegments(path11) {
3233
- let input = path11;
3232
+ function removeDotSegments(path10) {
3233
+ let input = path10;
3234
3234
  const output = [];
3235
3235
  let nextSlash = -1;
3236
3236
  let len = 0;
@@ -3429,8 +3429,8 @@ var require_schemes = __commonJS({
3429
3429
  wsComponent.secure = void 0;
3430
3430
  }
3431
3431
  if (wsComponent.resourceName) {
3432
- const [path11, query] = wsComponent.resourceName.split("?");
3433
- wsComponent.path = path11 && path11 !== "/" ? path11 : void 0;
3432
+ const [path10, query] = wsComponent.resourceName.split("?");
3433
+ wsComponent.path = path10 && path10 !== "/" ? path10 : void 0;
3434
3434
  wsComponent.query = query;
3435
3435
  wsComponent.resourceName = void 0;
3436
3436
  }
@@ -22171,8 +22171,8 @@ function getErrorMap() {
22171
22171
 
22172
22172
  // ../node_modules/zod/v3/helpers/parseUtil.js
22173
22173
  var makeIssue = (params) => {
22174
- const { data, path: path11, errorMaps, issueData } = params;
22175
- const fullPath = [...path11, ...issueData.path || []];
22174
+ const { data, path: path10, errorMaps, issueData } = params;
22175
+ const fullPath = [...path10, ...issueData.path || []];
22176
22176
  const fullIssue = {
22177
22177
  ...issueData,
22178
22178
  path: fullPath
@@ -22288,11 +22288,11 @@ var errorUtil;
22288
22288
 
22289
22289
  // ../node_modules/zod/v3/types.js
22290
22290
  var ParseInputLazyPath = class {
22291
- constructor(parent, value, path11, key) {
22291
+ constructor(parent, value, path10, key) {
22292
22292
  this._cachedPath = [];
22293
22293
  this.parent = parent;
22294
22294
  this.data = value;
22295
- this._path = path11;
22295
+ this._path = path10;
22296
22296
  this._key = key;
22297
22297
  }
22298
22298
  get path() {
@@ -25930,10 +25930,10 @@ function assignProp(target, prop, value) {
25930
25930
  configurable: true
25931
25931
  });
25932
25932
  }
25933
- function getElementAtPath(obj, path11) {
25934
- if (!path11)
25933
+ function getElementAtPath(obj, path10) {
25934
+ if (!path10)
25935
25935
  return obj;
25936
- return path11.reduce((acc, key) => acc?.[key], obj);
25936
+ return path10.reduce((acc, key) => acc?.[key], obj);
25937
25937
  }
25938
25938
  function promiseAllObject(promisesObj) {
25939
25939
  const keys = Object.keys(promisesObj);
@@ -26253,11 +26253,11 @@ function aborted(x, startIndex = 0) {
26253
26253
  }
26254
26254
  return false;
26255
26255
  }
26256
- function prefixIssues(path11, issues) {
26256
+ function prefixIssues(path10, issues) {
26257
26257
  return issues.map((iss) => {
26258
26258
  var _a;
26259
26259
  (_a = iss).path ?? (_a.path = []);
26260
- iss.path.unshift(path11);
26260
+ iss.path.unshift(path10);
26261
26261
  return iss;
26262
26262
  });
26263
26263
  }
@@ -35948,7 +35948,7 @@ var FORBIDDEN_FILES = [
35948
35948
  ".netrc",
35949
35949
  ".gitconfig",
35950
35950
  "credentials"
35951
- // ~/.claude/credentials file
35951
+ // ~/.agent-kit/credentials file
35952
35952
  ];
35953
35953
  var FORBIDDEN_PATTERNS = [
35954
35954
  /^\.env$/i,
@@ -36296,9 +36296,16 @@ import { writeFileSync as writeFileSync3 } from "fs";
36296
36296
 
36297
36297
  // src/utils/credentials.ts
36298
36298
  import * as fs4 from "fs";
36299
+
36300
+ // src/utils/paths.ts
36299
36301
  import * as os from "os";
36300
36302
  import * as path6 from "path";
36301
- var CREDENTIALS_FILE = path6.join(os.homedir(), ".claude", "credentials");
36303
+ var AGENT_KIT_HOME = path6.join(os.homedir(), ".agent-kit");
36304
+ var CREDENTIALS_FILE = path6.join(AGENT_KIT_HOME, "credentials");
36305
+ var MODEL_CACHE_DIR = path6.join(AGENT_KIT_HOME, "cache", "models");
36306
+ var FASTEMBED_CACHE_DIR = path6.join(MODEL_CACHE_DIR, "fastembed");
36307
+
36308
+ // src/utils/credentials.ts
36302
36309
  var cachedCredentials = null;
36303
36310
  function parseIni(content) {
36304
36311
  const result = {};
@@ -36672,12 +36679,9 @@ ${ticket.fields.labels?.join(", ") || "None"}`;
36672
36679
  }
36673
36680
 
36674
36681
  // src/tools/memory.ts
36675
- import * as path10 from "path";
36682
+ import * as path9 from "path";
36676
36683
 
36677
36684
  // src/memory/embedder.ts
36678
- import * as os2 from "os";
36679
- import * as path7 from "path";
36680
- var DEFAULT_CACHE_DIR = path7.join(os2.homedir(), ".cache", "fastembed");
36681
36685
  var EmbedderError = class extends Error {
36682
36686
  constructor(message, cause) {
36683
36687
  super(message);
@@ -36723,7 +36727,7 @@ var Embedder = class {
36723
36727
  "Xenova/all-MiniLM-L6-v2": EmbeddingModel.AllMiniLML6V2
36724
36728
  };
36725
36729
  const model = modelMap[this.modelName] ?? EmbeddingModel.BGESmallENV15;
36726
- const embedder = await FlagEmbedding.init({ model, cacheDir: DEFAULT_CACHE_DIR, showDownloadProgress: false });
36730
+ const embedder = await FlagEmbedding.init({ model, cacheDir: FASTEMBED_CACHE_DIR, showDownloadProgress: false });
36727
36731
  this.pipeline = async (texts) => {
36728
36732
  const result = [];
36729
36733
  for await (const batch of embedder.embed(texts, texts.length)) {
@@ -36741,7 +36745,7 @@ var Embedder = class {
36741
36745
 
36742
36746
  // src/memory/indexer.ts
36743
36747
  import * as fs5 from "fs";
36744
- import * as path8 from "path";
36748
+ import * as path7 from "path";
36745
36749
 
36746
36750
  // src/memory/chunker.ts
36747
36751
  import { createHash } from "crypto";
@@ -36907,7 +36911,7 @@ var MemoryIndexer = class {
36907
36911
  return this.indexFileRelativeTo(absolutePath, this.config.wikiDir);
36908
36912
  }
36909
36913
  async indexFileRelativeTo(absolutePath, sourceRoot) {
36910
- const source = path8.relative(sourceRoot, absolutePath);
36914
+ const source = path7.relative(sourceRoot, absolutePath);
36911
36915
  const existingHashes = this.store.hashesBySource(source);
36912
36916
  let text;
36913
36917
  try {
@@ -36956,7 +36960,7 @@ var MemoryIndexer = class {
36956
36960
  return;
36957
36961
  }
36958
36962
  for (const entry of entries) {
36959
- const entryPath = path8.join(dirPath, entry.name);
36963
+ const entryPath = path7.join(dirPath, entry.name);
36960
36964
  if (entry.isDirectory()) {
36961
36965
  walk(entryPath);
36962
36966
  continue;
@@ -36968,7 +36972,7 @@ var MemoryIndexer = class {
36968
36972
  };
36969
36973
  walk(rootDir);
36970
36974
  const currentSources = new Set(
36971
- files.map((file) => path8.relative(relativeBase, file))
36975
+ files.map((file) => path7.relative(relativeBase, file))
36972
36976
  );
36973
36977
  for (const stale of this.store.indexedSources()) {
36974
36978
  if (!currentSources.has(stale)) {
@@ -37036,7 +37040,7 @@ var MemoryIndexer = class {
37036
37040
  const retriever = r.hasDense && r.hasBm25 ? "both" : r.hasDense ? "dense" : "bm25";
37037
37041
  let contentSource = "file";
37038
37042
  try {
37039
- chunk.content = fs5.readFileSync(path8.join(this.config.wikiDir, chunk.source), "utf8");
37043
+ chunk.content = fs5.readFileSync(path7.join(this.config.wikiDir, chunk.source), "utf8");
37040
37044
  } catch {
37041
37045
  contentSource = "fallback";
37042
37046
  }
@@ -37046,8 +37050,8 @@ var MemoryIndexer = class {
37046
37050
  }
37047
37051
  async save(content) {
37048
37052
  const datePart = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
37049
- const rawDir = path8.join(this.config.wikiDir, "raw");
37050
- const savePath = path8.join(rawDir, `conv_save_${datePart}.md`);
37053
+ const rawDir = path7.join(this.config.wikiDir, "raw");
37054
+ const savePath = path7.join(rawDir, `conv_save_${datePart}.md`);
37051
37055
  const lockPath = `${savePath}.lock`;
37052
37056
  fs5.mkdirSync(rawDir, { recursive: true });
37053
37057
  const acquired = await acquireLock(lockPath);
@@ -37065,7 +37069,7 @@ ${content}
37065
37069
  }
37066
37070
  async startupIndex() {
37067
37071
  try {
37068
- await this.indexDirectory(path8.join(this.config.wikiDir, "compiled"), {
37072
+ await this.indexDirectory(path7.join(this.config.wikiDir, "compiled"), {
37069
37073
  relativeBase: this.config.wikiDir,
37070
37074
  excludeFiles: ["index.md", "log.md"]
37071
37075
  });
@@ -37084,7 +37088,7 @@ ${content}
37084
37088
  var import_stopword = __toESM(require_stopword_cjs(), 1);
37085
37089
  import Database from "better-sqlite3";
37086
37090
  import * as fs6 from "fs";
37087
- import * as path9 from "path";
37091
+ import * as path8 from "path";
37088
37092
  var StoreError = class extends Error {
37089
37093
  constructor(message, cause) {
37090
37094
  super(message);
@@ -37095,7 +37099,7 @@ var StoreError = class extends Error {
37095
37099
  var MemoryStore = class {
37096
37100
  constructor(dbPath, config2) {
37097
37101
  this.config = config2;
37098
- fs6.mkdirSync(path9.dirname(dbPath), { recursive: true });
37102
+ fs6.mkdirSync(path8.dirname(dbPath), { recursive: true });
37099
37103
  this.db = this.openDatabase(dbPath);
37100
37104
  }
37101
37105
  db;
@@ -37381,7 +37385,7 @@ ${content}`;
37381
37385
  function registerMemoryTools(server2, settings2, workspaceRoot2) {
37382
37386
  if (settings2.memory?.enabled !== true) return null;
37383
37387
  const config2 = resolveMemoryConfig(settings2, workspaceRoot2);
37384
- const store = new MemoryStore(path10.join(config2.wikiDir, "index.db"), config2);
37388
+ const store = new MemoryStore(path9.join(config2.wikiDir, "index.db"), config2);
37385
37389
  const embedder = new Embedder(config2.embeddingModel);
37386
37390
  const indexer = new MemoryIndexer(store, embedder, config2);
37387
37391
  registerMemoryToolHandlers(server2, indexer, store, config2);
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ import * as assert from 'node:assert/strict';
2
+ import * as os from 'node:os';
3
+ import * as path from 'node:path';
4
+ import { describe, test } from 'node:test';
5
+ import { DEFAULT_MODEL_CACHE_DIR, FASTEMBED_CACHE_DIR } from '../embedder.js';
6
+ import { AGENT_KIT_HOME, CREDENTIALS_FILE } from '../../utils/paths.js';
7
+ describe('Embedder cache paths', () => {
8
+ test('uses global Agent Kit home for user-level files', () => {
9
+ assert.equal(AGENT_KIT_HOME, path.join(os.homedir(), '.agent-kit'));
10
+ assert.equal(CREDENTIALS_FILE, path.join(AGENT_KIT_HOME, 'credentials'));
11
+ assert.equal(DEFAULT_MODEL_CACHE_DIR, path.join(AGENT_KIT_HOME, 'cache', 'models'));
12
+ assert.equal(FASTEMBED_CACHE_DIR, path.join(DEFAULT_MODEL_CACHE_DIR, 'fastembed'));
13
+ });
14
+ });
@@ -1,3 +1,4 @@
1
+ export { FASTEMBED_CACHE_DIR, MODEL_CACHE_DIR as DEFAULT_MODEL_CACHE_DIR } from '../utils/paths.js';
1
2
  export declare class EmbedderError extends Error {
2
3
  constructor(message: string, cause?: unknown);
3
4
  }
@@ -1,6 +1,5 @@
1
- import * as os from 'os';
2
- import * as path from 'path';
3
- const DEFAULT_CACHE_DIR = path.join(os.homedir(), '.cache', 'fastembed');
1
+ import { FASTEMBED_CACHE_DIR } from '../utils/paths.js';
2
+ export { FASTEMBED_CACHE_DIR, MODEL_CACHE_DIR as DEFAULT_MODEL_CACHE_DIR } from '../utils/paths.js';
4
3
  export class EmbedderError extends Error {
5
4
  constructor(message, cause) {
6
5
  super(message);
@@ -50,7 +49,7 @@ export class Embedder {
50
49
  'Xenova/all-MiniLM-L6-v2': EmbeddingModel.AllMiniLML6V2,
51
50
  };
52
51
  const model = modelMap[this.modelName] ?? EmbeddingModel.BGESmallENV15;
53
- const embedder = await FlagEmbedding.init({ model: model, cacheDir: DEFAULT_CACHE_DIR, showDownloadProgress: false });
52
+ const embedder = await FlagEmbedding.init({ model: model, cacheDir: FASTEMBED_CACHE_DIR, showDownloadProgress: false });
54
53
  this.pipeline = async (texts) => {
55
54
  const result = [];
56
55
  for await (const batch of embedder.embed(texts, texts.length)) {
@@ -89,7 +89,7 @@ export const FORBIDDEN_FILES = [
89
89
  '.yarnrc',
90
90
  '.netrc',
91
91
  '.gitconfig',
92
- 'credentials', // ~/.claude/credentials file
92
+ 'credentials', // ~/.agent-kit/credentials file
93
93
  ];
94
94
  /**
95
95
  * Regex patterns (case-insensitive) matched against path.basename.
@@ -1,9 +1,9 @@
1
1
  /**
2
- * Credential loader — reads ~/.claude/credentials (INI format, like ~/.aws/credentials)
2
+ * Credential loader — reads ~/.agent-kit/credentials (INI format, like ~/.aws/credentials)
3
3
  *
4
4
  * Resolution order per key:
5
5
  * 1. process.env.KEY (explicit override / CI)
6
- * 2. ~/.claude/credentials [profile] section
6
+ * 2. ~/.agent-kit/credentials [profile] section
7
7
  * 3. undefined
8
8
  *
9
9
  * File format:
@@ -15,6 +15,6 @@
15
15
  */
16
16
  /**
17
17
  * Resolve a credential key using the priority chain:
18
- * process.env.KEY → ~/.claude/credentials [profile] → undefined
18
+ * process.env.KEY → ~/.agent-kit/credentials [profile] → undefined
19
19
  */
20
20
  export declare function getCredential(key: string): string | undefined;
@@ -1,9 +1,9 @@
1
1
  /**
2
- * Credential loader — reads ~/.claude/credentials (INI format, like ~/.aws/credentials)
2
+ * Credential loader — reads ~/.agent-kit/credentials (INI format, like ~/.aws/credentials)
3
3
  *
4
4
  * Resolution order per key:
5
5
  * 1. process.env.KEY (explicit override / CI)
6
- * 2. ~/.claude/credentials [profile] section
6
+ * 2. ~/.agent-kit/credentials [profile] section
7
7
  * 3. undefined
8
8
  *
9
9
  * File format:
@@ -14,9 +14,7 @@
14
14
  * Active profile: KIT_PROFILE env var (defaults to "default")
15
15
  */
16
16
  import * as fs from 'fs';
17
- import * as os from 'os';
18
- import * as path from 'path';
19
- const CREDENTIALS_FILE = path.join(os.homedir(), '.claude', 'credentials');
17
+ import { CREDENTIALS_FILE } from './paths.js';
20
18
  let cachedCredentials = null;
21
19
  /**
22
20
  * Parse a simple INI file into a map of profiles.
@@ -47,7 +45,7 @@ function parseIni(content) {
47
45
  return result;
48
46
  }
49
47
  /**
50
- * Load credentials from ~/.claude/credentials for the active profile.
48
+ * Load credentials from ~/.agent-kit/credentials for the active profile.
51
49
  * Result is cached for the lifetime of the MCP server process.
52
50
  */
53
51
  function loadCredentials() {
@@ -79,7 +77,7 @@ function loadCredentials() {
79
77
  }
80
78
  /**
81
79
  * Resolve a credential key using the priority chain:
82
- * process.env.KEY → ~/.claude/credentials [profile] → undefined
80
+ * process.env.KEY → ~/.agent-kit/credentials [profile] → undefined
83
81
  */
84
82
  export function getCredential(key) {
85
83
  if (process.env[key]) {
@@ -0,0 +1,4 @@
1
+ export declare const AGENT_KIT_HOME: string;
2
+ export declare const CREDENTIALS_FILE: string;
3
+ export declare const MODEL_CACHE_DIR: string;
4
+ export declare const FASTEMBED_CACHE_DIR: string;
@@ -0,0 +1,6 @@
1
+ import * as os from 'os';
2
+ import * as path from 'path';
3
+ export const AGENT_KIT_HOME = path.join(os.homedir(), '.agent-kit');
4
+ export const CREDENTIALS_FILE = path.join(AGENT_KIT_HOME, 'credentials');
5
+ export const MODEL_CACHE_DIR = path.join(AGENT_KIT_HOME, 'cache', 'models');
6
+ export const FASTEMBED_CACHE_DIR = path.join(MODEL_CACHE_DIR, 'fastembed');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanhnd/agent-kit",
3
- "version": "1.0.30",
3
+ "version": "1.0.31",
4
4
  "description": "Agent Kit MCP server for software development agent workflows",
5
5
  "type": "module",
6
6
  "main": "dist/kit-server.js",