agentinit 1.11.0 → 1.11.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [1.11.1](https://github.com/agentinit/agentinit/compare/v1.11.0...v1.11.1) (2026-03-31)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * pin contextcalc to avoid npm peer warning ([ef33526](https://github.com/agentinit/agentinit/commit/ef33526c2b1afa0e130e6b63cd4bdcce40f7e6e0))
7
+
1
8
  # [1.11.0](https://github.com/agentinit/agentinit/compare/v1.10.0...v1.11.0) (2026-03-29)
2
9
 
3
10
 
package/dist/cli.js CHANGED
@@ -12248,9 +12248,13 @@ async function isBinaryFile(filePath) {
12248
12248
  }
12249
12249
 
12250
12250
  class Tokenizer {
12251
- tiktokenWrapper;
12251
+ encoding;
12252
12252
  constructor() {
12253
- this.tiktokenWrapper = getTiktoken();
12253
+ try {
12254
+ this.encoding = get_encoding(ENCODING_NAME);
12255
+ } catch (error) {
12256
+ throw new Error(`Failed to initialize tokenizer with encoding '${ENCODING_NAME}': ${error instanceof Error ? error.message : "Unknown error"}`);
12257
+ }
12254
12258
  }
12255
12259
  async countTokens(filePath) {
12256
12260
  try {
@@ -12271,14 +12275,12 @@ class Tokenizer {
12271
12275
  }
12272
12276
  }
12273
12277
  countTokensFromText(text) {
12274
- if (!this.tiktokenWrapper.isInitialized) {
12275
- throw new Error("Tiktoken is not properly initialized. Cannot provide accurate token counts.");
12276
- }
12277
12278
  try {
12278
- const tokens = this.tiktokenWrapper.encoding.encode(text);
12279
+ const tokens = this.encoding.encode(text);
12279
12280
  return tokens.length;
12280
12281
  } catch (error) {
12281
- throw new Error(`Failed to encode text for token counting: ${error instanceof Error ? error.message : "Unknown error"}`);
12282
+ console.warn(`Warning: Failed to encode text, returning character-based estimate:`, error instanceof Error ? error.message : "Unknown error");
12283
+ return Math.ceil(text.length / 4);
12282
12284
  }
12283
12285
  }
12284
12286
  countLines(text) {
@@ -12290,6 +12292,11 @@ class Tokenizer {
12290
12292
  `) ? lines - 1 : lines;
12291
12293
  }
12292
12294
  dispose() {
12295
+ try {
12296
+ this.encoding.free();
12297
+ } catch (error) {
12298
+ console.warn("Warning: Failed to free tokenizer encoding:", error instanceof Error ? error.message : "Unknown error");
12299
+ }
12293
12300
  }
12294
12301
  formatTokenCount(count) {
12295
12302
  const thresholds = [
@@ -12304,57 +12311,11 @@ class Tokenizer {
12304
12311
  return count.toString();
12305
12312
  }
12306
12313
  }
12307
- var estimateBinaryTokens, initializeTiktoken, getTiktoken, getTokenizer, inputToString, countTokens, CODE_EXTENSIONS, DOCS_EXTENSIONS, ENCODING_NAME, tiktokenInstance, tokenizerInstance;
12314
+ var estimateBinaryTokens, getTokenizer, inputToString, countTokens, CODE_EXTENSIONS, DOCS_EXTENSIONS, ENCODING_NAME, tokenizerInstance;
12308
12315
  var init_lib = __esm(() => {
12309
12316
  estimateBinaryTokens = function(sizeInBytes) {
12310
12317
  return Math.ceil(sizeInBytes / 4);
12311
12318
  };
12312
- initializeTiktoken = function() {
12313
- if (tiktokenInstance) {
12314
- return tiktokenInstance;
12315
- }
12316
- try {
12317
- const encoding = get_encoding(ENCODING_NAME);
12318
- try {
12319
- encoding.encode("test");
12320
- } catch (validationError) {
12321
- throw new Error(`Tiktoken encoding validation failed: ${validationError instanceof Error ? validationError.message : "Unknown validation error"}`);
12322
- }
12323
- tiktokenInstance = {
12324
- encoding,
12325
- isInitialized: true
12326
- };
12327
- return tiktokenInstance;
12328
- } catch (error) {
12329
- const errorInstance = error instanceof Error ? error : new Error(String(error));
12330
- if (errorInstance.message.includes("tiktoken_bg.wasm")) {
12331
- const enhancedError = new Error(`Failed to load tiktoken WebAssembly module: ${errorInstance.message}
12332
-
12333
- ` + `This usually happens when using contextcalc as a dependency. Try:
12334
- 1. Ensure tiktoken is installed: npm install tiktoken
12335
- 2. If using in a bundled environment, ensure WASM files are copied
12336
- 3. Check that the tiktoken_bg.wasm file is accessible in your project
12337
-
12338
- For more help, see: https://github.com/agentinit/contextcalc/issues`);
12339
- enhancedError.cause = errorInstance;
12340
- tiktokenInstance = {
12341
- encoding: {},
12342
- isInitialized: false,
12343
- error: enhancedError
12344
- };
12345
- } else {
12346
- tiktokenInstance = {
12347
- encoding: {},
12348
- isInitialized: false,
12349
- error: new Error(`Failed to initialize tokenizer with encoding '${ENCODING_NAME}': ${errorInstance.message}`)
12350
- };
12351
- }
12352
- return tiktokenInstance;
12353
- }
12354
- };
12355
- getTiktoken = function() {
12356
- return initializeTiktoken();
12357
- };
12358
12319
  getTokenizer = function() {
12359
12320
  if (!tokenizerInstance) {
12360
12321
  tokenizerInstance = new Tokenizer;
@@ -12498,7 +12459,6 @@ For more help, see: https://github.com/agentinit/contextcalc/issues`);
12498
12459
  ".wiki"
12499
12460
  ]);
12500
12461
  ENCODING_NAME = "o200k_base";
12501
- tiktokenInstance = null;
12502
12462
  tokenizerInstance = null;
12503
12463
  });
12504
12464
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentinit",
3
- "version": "1.11.0",
3
+ "version": "1.11.1",
4
4
  "description": "CLI tool and library for managing AI coding agents and verifying MCP servers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -69,7 +69,7 @@
69
69
  "@inquirer/prompts": "^8.3.2",
70
70
  "@modelcontextprotocol/sdk": "^1.18.0",
71
71
  "commander": "^12.1.0",
72
- "contextcalc": "^1.3.5",
72
+ "contextcalc": "~1.3.6",
73
73
  "gray-matter": "^4.0.3",
74
74
  "js-yaml": "^4.1.0",
75
75
  "kleur": "^4.1.5",