composto-ai 0.8.3 → 0.8.4

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.js CHANGED
@@ -1194,6 +1194,13 @@ async function astWalkIR(code, filePath) {
1194
1194
  return merged.join("\n");
1195
1195
  }
1196
1196
 
1197
+ // src/benchmark/tokenizer.ts
1198
+ function estimateTokens(text) {
1199
+ if (!text) return 0;
1200
+ const tokens = text.split(/[\s]+|(?<=[{}()[\];,.:=<>!&|?+\-*/^~@#$%\\])|(?=[{}()[\];,.:=<>!&|?+\-*/^~@#$%\\])/).filter(Boolean);
1201
+ return tokens.length;
1202
+ }
1203
+
1197
1204
  // src/ir/layers.ts
1198
1205
  function generateL0(code, filePath) {
1199
1206
  const structure = extractStructure(code);
@@ -1211,7 +1218,8 @@ ${declarations.join("\n")}`;
1211
1218
  }
1212
1219
  async function generateL1(code, filePath, health) {
1213
1220
  const ir = await astWalkIR(code, filePath) ?? fingerprintFile(code, 0.75);
1214
- const result = ir.length < code.length ? ir : code;
1221
+ const irIsWin = ir.trim().length > 0 && estimateTokens(ir) < estimateTokens(code);
1222
+ const result = irIsWin ? ir : code;
1215
1223
  if (health) {
1216
1224
  return annotateIR(result, health);
1217
1225
  }
@@ -1497,13 +1505,6 @@ var CLIAdapter = class {
1497
1505
  }
1498
1506
  };
1499
1507
 
1500
- // src/benchmark/tokenizer.ts
1501
- function estimateTokens(text) {
1502
- if (!text) return 0;
1503
- const tokens = text.split(/[\s]+|(?<=[{}()[\];,.:=<>!&|?+\-*/^~@#$%\\])|(?=[{}()[\];,.:=<>!&|?+\-*/^~@#$%\\])/).filter(Boolean);
1504
- return tokens.length;
1505
- }
1506
-
1507
1508
  // src/benchmark/runner.ts
1508
1509
  async function benchmarkFile(code, filePath) {
1509
1510
  const rawTokens = estimateTokens(code);
@@ -1002,6 +1002,13 @@ async function astWalkIR(code, filePath) {
1002
1002
  return merged.join("\n");
1003
1003
  }
1004
1004
 
1005
+ // src/benchmark/tokenizer.ts
1006
+ function estimateTokens(text) {
1007
+ if (!text) return 0;
1008
+ const tokens = text.split(/[\s]+|(?<=[{}()[\];,.:=<>!&|?+\-*/^~@#$%\\])|(?=[{}()[\];,.:=<>!&|?+\-*/^~@#$%\\])/).filter(Boolean);
1009
+ return tokens.length;
1010
+ }
1011
+
1005
1012
  // src/ir/layers.ts
1006
1013
  function generateL0(code, filePath) {
1007
1014
  const structure = extractStructure(code);
@@ -1019,7 +1026,8 @@ ${declarations.join("\n")}`;
1019
1026
  }
1020
1027
  async function generateL1(code, filePath, health) {
1021
1028
  const ir = await astWalkIR(code, filePath) ?? fingerprintFile(code, 0.75);
1022
- const result = ir.length < code.length ? ir : code;
1029
+ const irIsWin = ir.trim().length > 0 && estimateTokens(ir) < estimateTokens(code);
1030
+ const result = irIsWin ? ir : code;
1023
1031
  if (health) {
1024
1032
  return annotateIR(result, health);
1025
1033
  }
@@ -1262,13 +1270,6 @@ function loadConfig(projectPath) {
1262
1270
  return parseConfig(content);
1263
1271
  }
1264
1272
 
1265
- // src/benchmark/tokenizer.ts
1266
- function estimateTokens(text) {
1267
- if (!text) return 0;
1268
- const tokens = text.split(/[\s]+|(?<=[{}()[\];,.:=<>!&|?+\-*/^~@#$%\\])|(?=[{}()[\];,.:=<>!&|?+\-*/^~@#$%\\])/).filter(Boolean);
1269
- return tokens.length;
1270
- }
1271
-
1272
1273
  // src/benchmark/runner.ts
1273
1274
  async function benchmarkFile(code, filePath) {
1274
1275
  const rawTokens = estimateTokens(code);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "composto-ai",
3
- "version": "0.8.3",
3
+ "version": "0.8.4",
4
4
  "description": "Proactive AI team companion — less tokens, more insight",
5
5
  "type": "module",
6
6
  "bin": {