@agentforge/tools 0.15.4 → 0.15.6

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
@@ -3080,6 +3080,21 @@ async function generateEmbedding(text, model) {
3080
3080
  async function generateBatchEmbeddings(texts, model) {
3081
3081
  return embeddingManager.generateBatchEmbeddings(texts, model);
3082
3082
  }
3083
+ function normalizeRecord(record) {
3084
+ const originalKeyByString = /* @__PURE__ */ new Map();
3085
+ const normalizedKeys = [];
3086
+ for (const key of record.keys) {
3087
+ const keyString = String(key);
3088
+ if (!originalKeyByString.has(keyString)) {
3089
+ originalKeyByString.set(keyString, key);
3090
+ normalizedKeys.push(keyString);
3091
+ }
3092
+ }
3093
+ return {
3094
+ keys: normalizedKeys,
3095
+ get: (key) => record.get(originalKeyByString.get(key) ?? key)
3096
+ };
3097
+ }
3083
3098
  function formatInteger(value) {
3084
3099
  if (value.inSafeRange()) {
3085
3100
  return value.toNumber();
@@ -3143,7 +3158,8 @@ function formatPath(path12) {
3143
3158
  };
3144
3159
  }
3145
3160
  function formatResults(records) {
3146
- return records.map((record) => {
3161
+ return records.map((rawRecord) => {
3162
+ const record = normalizeRecord(rawRecord);
3147
3163
  const formatted = {};
3148
3164
  for (const key of record.keys) {
3149
3165
  formatted[key] = formatValue(record.get(key));