@pentatonic-ai/ai-agent-sdk 0.7.2 → 0.7.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pentatonic-ai/ai-agent-sdk",
3
- "version": "0.7.2",
3
+ "version": "0.7.3",
4
4
  "description": "TES SDK — LLM observability and lifecycle tracking via Pentatonic Thing Event System. Track token usage, tool calls, and conversations. Manage things through event-sourced lifecycle stages with AI enrichment and vector search.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -607,10 +607,21 @@ async def search(req: SearchRequest):
607
607
  if m:
608
608
  attached_meta = m
609
609
  break
610
+ # Some layers surface arena/kind/layer_type as top-level
611
+ # fields on the raw item rather than nested under metadata.
612
+ # Pull them through into the formatted metadata so the
613
+ # post-filter can see them even on cache miss (e.g., after
614
+ # a compat container restart wipes _META_CACHE).
615
+ raw_top_level = {
616
+ k: item[k]
617
+ for k in ("arena", "kind", "layer_type", "doc_type", "source_file")
618
+ if item.get(k)
619
+ }
620
+ merged_meta = {**raw_top_level, **(attached_meta or item.get("metadata") or {})}
610
621
  out_results.append({
611
622
  "id": key,
612
623
  "content": item.get("text") or item.get("content") or item.get("snippet") or "",
613
- "metadata": attached_meta or item.get("metadata") or {},
624
+ "metadata": merged_meta,
614
625
  "similarity": float(rrf_scores[key]),
615
626
  "layer_id": f"ml_{CLIENT_ID}_episodic",
616
627
  "client_id": CLIENT_ID,
@@ -692,10 +703,18 @@ async def search(req: SearchRequest):
692
703
  if not chosen_id:
693
704
  chosen_id = (item.get("id") or item.get("doc_id")
694
705
  or item.get("path") or item.get("source_file") or "")
706
+ # Pull arena/kind/layer_type from raw item top-level if present
707
+ # (L6 returns these as top-level columns; cache may be empty).
708
+ raw_top_level = {
709
+ k: item[k]
710
+ for k in ("arena", "kind", "layer_type", "doc_type", "source_file")
711
+ if item.get(k)
712
+ }
713
+ merged_meta = {**raw_top_level, **(attached_meta or item.get("metadata") or {})}
695
714
  out_results.append({
696
715
  "id": chosen_id,
697
716
  "content": item.get("text") or item.get("content") or item.get("snippet") or "",
698
- "metadata": attached_meta or item.get("metadata") or {},
717
+ "metadata": merged_meta,
699
718
  "similarity": float(item.get("score") or item.get("similarity") or 0.0),
700
719
  "layer_id": f"ml_{CLIENT_ID}_episodic",
701
720
  "client_id": CLIENT_ID,