dasein-core 0.2.13__py3-none-any.whl → 0.2.14__py3-none-any.whl

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.
dasein/api.py CHANGED
@@ -1759,14 +1759,24 @@ Follow these rules when planning your actions."""
1759
1759
  # 1. Search in agent
1760
1760
  agent_llm = self._find_llm_recursively(self._agent, max_depth=5)
1761
1761
  if agent_llm:
1762
- all_llms.append(('agent', agent_llm))
1762
+ # CRITICAL: If this is a DaseinLLMWrapper, we need to patch the INNER LLM for pipecleaner!
1763
+ # But we skip patching the wrapper itself to avoid double callbacks
1764
+ if isinstance(agent_llm, DaseinLLMWrapper) and hasattr(agent_llm, '_llm'):
1765
+ print(f"[DASEIN][WRAPPER] Found DaseinLLMWrapper, patching inner LLM: {type(agent_llm._llm).__name__}")
1766
+ all_llms.append(('agent_inner', agent_llm._llm))
1767
+ else:
1768
+ all_llms.append(('agent', agent_llm))
1763
1769
 
1764
1770
  # 2. Search in tools (where Summary LLM lives!)
1765
1771
  if hasattr(self._agent, 'tools'):
1766
1772
  for i, tool in enumerate(self._agent.tools or []):
1767
1773
  tool_llm = self._find_llm_recursively(tool, max_depth=3, path=f"tools[{i}]")
1768
1774
  if tool_llm:
1769
- all_llms.append((f'tool_{i}_{getattr(tool, "name", "unknown")}', tool_llm))
1775
+ # Skip if it's a DaseinLLMWrapper (already handles callbacks)
1776
+ if isinstance(tool_llm, DaseinLLMWrapper):
1777
+ print(f"[DASEIN][WRAPPER] Found DaseinLLMWrapper in tool - skipping")
1778
+ else:
1779
+ all_llms.append((f'tool_{i}_{getattr(tool, "name", "unknown")}', tool_llm))
1770
1780
 
1771
1781
  print(f"[DASEIN][WRAPPER] Found {len(all_llms)} LLM(s)")
1772
1782
  for location, llm in all_llms:
@@ -2050,43 +2060,10 @@ Follow these rules when planning your actions."""
2050
2060
  traceback.print_exc()
2051
2061
 
2052
2062
  try:
2053
- # CRITICAL FIX: Ensure callbacks propagate to _generate/_agenerate
2054
- # AgentExecutor doesn't pass run_manager to these internal methods
2055
- # So we need to manually inject the callback handler
2056
- if meth_name in ['_generate', '_agenerate'] and callback_handler:
2057
- if 'run_manager' not in kwargs and hasattr(callback_handler, 'on_llm_start'):
2058
- # Manually trigger on_llm_start since no run_manager
2059
- import uuid
2060
- run_id = uuid.uuid4()
2061
- # Extract messages for on_llm_start
2062
- messages = args[0] if args else []
2063
- prompts = []
2064
- for msg in (messages if isinstance(messages, list) else [messages]):
2065
- if hasattr(msg, 'content'):
2066
- prompts.append(str(msg.content))
2067
- else:
2068
- prompts.append(str(msg))
2069
-
2070
- # Call on_llm_start
2071
- callback_handler.on_llm_start(
2072
- serialized={'name': type(self_llm).__name__},
2073
- prompts=prompts,
2074
- run_id=run_id
2075
- )
2076
-
2077
- # Store run_id for on_llm_end
2078
- if not hasattr(self_llm, '_dasein_pending_run_ids'):
2079
- self_llm._dasein_pending_run_ids = []
2080
- self_llm._dasein_pending_run_ids.append(run_id)
2081
-
2063
+ # NOTE: Manual callback injection DISABLED - DaseinLLMWrapper handles callbacks
2064
+ # The patched methods ONLY do pipecleaner deduplication, not callbacks
2082
2065
  result = await orig_method(self_llm, *args, **kwargs)
2083
2066
 
2084
- # Call on_llm_end if we called on_llm_start
2085
- if meth_name in ['_generate', '_agenerate'] and callback_handler:
2086
- if hasattr(self_llm, '_dasein_pending_run_ids') and self_llm._dasein_pending_run_ids:
2087
- run_id = self_llm._dasein_pending_run_ids.pop(0)
2088
- callback_handler.on_llm_end(result, run_id=run_id)
2089
-
2090
2067
  # 🚨 MICROTURN ENFORCEMENT - DISABLED
2091
2068
  # Microturn can interfere with tool execution, so it's disabled
2092
2069
  # TODO: Re-enable with proper gating if needed for specific use cases
@@ -2315,43 +2292,10 @@ Follow these rules when planning your actions."""
2315
2292
  traceback.print_exc()
2316
2293
 
2317
2294
  try:
2318
- # CRITICAL FIX: Ensure callbacks propagate to _generate/_agenerate
2319
- # AgentExecutor doesn't pass run_manager to these internal methods
2320
- # So we need to manually inject the callback handler
2321
- if meth_name in ['_generate', '_agenerate'] and callback_handler:
2322
- if 'run_manager' not in kwargs and hasattr(callback_handler, 'on_llm_start'):
2323
- # Manually trigger on_llm_start since no run_manager
2324
- import uuid
2325
- run_id = uuid.uuid4()
2326
- # Extract messages for on_llm_start
2327
- messages = args[0] if args else []
2328
- prompts = []
2329
- for msg in (messages if isinstance(messages, list) else [messages]):
2330
- if hasattr(msg, 'content'):
2331
- prompts.append(str(msg.content))
2332
- else:
2333
- prompts.append(str(msg))
2334
-
2335
- # Call on_llm_start
2336
- callback_handler.on_llm_start(
2337
- serialized={'name': type(self_llm).__name__},
2338
- prompts=prompts,
2339
- run_id=run_id
2340
- )
2341
-
2342
- # Store run_id for on_llm_end
2343
- if not hasattr(self_llm, '_dasein_pending_run_ids'):
2344
- self_llm._dasein_pending_run_ids = []
2345
- self_llm._dasein_pending_run_ids.append(run_id)
2346
-
2295
+ # NOTE: Manual callback injection DISABLED - DaseinLLMWrapper handles callbacks
2296
+ # The patched methods ONLY do pipecleaner deduplication, not callbacks
2347
2297
  result = orig_method(self_llm, *args, **kwargs)
2348
2298
 
2349
- # Call on_llm_end if we called on_llm_start
2350
- if meth_name in ['_generate', '_agenerate'] and callback_handler:
2351
- if hasattr(self_llm, '_dasein_pending_run_ids') and self_llm._dasein_pending_run_ids:
2352
- run_id = self_llm._dasein_pending_run_ids.pop(0)
2353
- callback_handler.on_llm_end(result, run_id=run_id)
2354
-
2355
2299
  # 🚨 MICROTURN ENFORCEMENT - DISABLED (can interfere with tool execution)
2356
2300
  # TODO: Re-enable with proper gating if needed
2357
2301
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dasein-core
3
- Version: 0.2.13
3
+ Version: 0.2.14
4
4
  Summary: Universal memory for agentic AI. Attach a brain to any LangChain/LangGraph agent in a single line.
5
5
  Author-email: Dasein Team <support@dasein.ai>
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  dasein/__init__.py,sha256=RY0lhaaWB6yJ_5YMRmaHDvQ0eFbc0BGbYNe5OVyxzYE,2316
2
2
  dasein/advice_format.py,sha256=5-h4J24L_B2Y9dlmyDuIYtmPCWOGAYoinBEXqpcNg2s,5386
3
- dasein/api.py,sha256=qJVnKdeuCGsaDuwcPP6kiaEJKbO15DsPoMHtuNvSvuM,257060
3
+ dasein/api.py,sha256=8WYkFUnMqkzOL3NDvowH_WD6A5fd27H39akujnKO99c,252752
4
4
  dasein/capture.py,sha256=D4DvknI2wbmVup5WqvNcgw-zW5riEstYG81Rl98uz6o,110942
5
5
  dasein/config.py,sha256=lXO8JG4RXbodn3gT5yEnuB0VRwWdrRVwhX3Rm06IZmU,1957
6
6
  dasein/events.py,sha256=mG-lnOvQoZUhXbrPSjrG4RME6ywUcbSZ04PscoJ15GI,12896
@@ -45,7 +45,7 @@ dasein/services/post_run_client.py,sha256=UjK3eqf7oWGSuWkKe0vQmeMS0yUUOhYFD4-SZ7
45
45
  dasein/services/pre_run_client.py,sha256=tXmz_PQaSfq0xwypiWUAqNkXOmREZ6EwXLC4OM89J-A,4317
46
46
  dasein/services/service_adapter.py,sha256=YHk41lR3PXh8WTmxOzzwKf6hwPYGqIdApI92vQKlkAY,7350
47
47
  dasein/services/service_config.py,sha256=8_4tpV4mZvfaOc5_yyHbOyL4rYsPHzkLTEY1rtYgLs8,1629
48
- dasein_core-0.2.13.dist-info/licenses/LICENSE,sha256=7FHjIFEKl_3hSc3tGUVEWmufC_3oi8rh_2zVuL7jMKs,1091
48
+ dasein_core-0.2.14.dist-info/licenses/LICENSE,sha256=7FHjIFEKl_3hSc3tGUVEWmufC_3oi8rh_2zVuL7jMKs,1091
49
49
  dasein/models/en_core_web_sm/en_core_web_sm-3.7.1.dist-info/LICENSE,sha256=OTPBdpebaLxtC8yQLH1sEw8dEn9Hbxe6XNuo2Zz9ABI,1056
50
50
  dasein/models/en_core_web_sm/en_core_web_sm-3.7.1.dist-info/LICENSES_SOURCES,sha256=INnfrNIVESJR8VNB7dGkex-Yvzk6IS8Q8ZT_3H7pipA,2347
51
51
  dasein/models/en_core_web_sm/en_core_web_sm-3.7.1.dist-info/METADATA,sha256=-vGqRxa_M2RwKtLjBhc4JlBQdJ3k7CwOnseT_ReYcic,2958
@@ -53,7 +53,7 @@ dasein/models/en_core_web_sm/en_core_web_sm-3.7.1.dist-info/RECORD,sha256=dDb6U7
53
53
  dasein/models/en_core_web_sm/en_core_web_sm-3.7.1.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
54
54
  dasein/models/en_core_web_sm/en_core_web_sm-3.7.1.dist-info/entry_points.txt,sha256=OkWs-KxPJtDdpvIFCVXzDC9ECtejhPxv7pP3Tgk2cNg,47
55
55
  dasein/models/en_core_web_sm/en_core_web_sm-3.7.1.dist-info/top_level.txt,sha256=56OIuRbEuhr12HsM9XpCMnTtHRMgNC5Hje4Xeo8wF2c,15
56
- dasein_core-0.2.13.dist-info/METADATA,sha256=dnUU3veXoiKLGCw4QWJ7Zjc3aKgiXS6ZYPbnizjrERQ,10297
57
- dasein_core-0.2.13.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
58
- dasein_core-0.2.13.dist-info/top_level.txt,sha256=6yYY9kltjvvPsg9K6KyMKRtzEr5qM7sHXN7VzmrDtp0,7
59
- dasein_core-0.2.13.dist-info/RECORD,,
56
+ dasein_core-0.2.14.dist-info/METADATA,sha256=Wor24FjmtzERNq7zLbq-b9oP4EVqlKPASshkGCgAO0c,10297
57
+ dasein_core-0.2.14.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
58
+ dasein_core-0.2.14.dist-info/top_level.txt,sha256=6yYY9kltjvvPsg9K6KyMKRtzEr5qM7sHXN7VzmrDtp0,7
59
+ dasein_core-0.2.14.dist-info/RECORD,,