nullabot 1.0.2__py3-none-any.whl → 1.0.3__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.
@@ -342,18 +342,35 @@ IMPORTANT:
342
342
  # Parse JSON response to extract tokens
343
343
  try:
344
344
  data = json.loads(output)
345
- result_text = data.get("result", output)
346
345
 
347
- # Extract token usage from response
348
- input_tokens = data.get("input_tokens", 0)
349
- output_tokens = data.get("output_tokens", 0)
346
+ # Get result text - try multiple fields
347
+ result_text = data.get("result") or data.get("content") or ""
350
348
 
351
- # Also check nested usage object
349
+ # If no result text but we have the raw output, use a summary
350
+ if not result_text and data.get("subtype") == "error_max_turns":
351
+ result_text = "Reached max turns limit. Work saved."
352
+ elif not result_text:
353
+ result_text = output # Fallback to raw output
354
+
355
+ # Extract token usage from nested usage object
352
356
  usage = data.get("usage", {})
353
- if not input_tokens:
354
- input_tokens = usage.get("input_tokens", 0)
355
- if not output_tokens:
356
- output_tokens = usage.get("output_tokens", 0)
357
+
358
+ # Input includes regular + cache tokens
359
+ input_tokens = (
360
+ usage.get("input_tokens", 0) +
361
+ usage.get("cache_read_input_tokens", 0) +
362
+ usage.get("cache_creation_input_tokens", 0)
363
+ )
364
+ output_tokens = usage.get("output_tokens", 0)
365
+
366
+ # Also check modelUsage for more detailed breakdown
367
+ model_usage = data.get("modelUsage", {})
368
+ if model_usage and not input_tokens:
369
+ for model, mu in model_usage.items():
370
+ input_tokens += mu.get("inputTokens", 0)
371
+ input_tokens += mu.get("cacheReadInputTokens", 0)
372
+ input_tokens += mu.get("cacheCreationInputTokens", 0)
373
+ output_tokens += mu.get("outputTokens", 0)
357
374
 
358
375
  return result_text, True, input_tokens, output_tokens
359
376
  except json.JSONDecodeError:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nullabot
3
- Version: 1.0.2
3
+ Version: 1.0.3
4
4
  Summary: 24/7 AI agents that think, design, and code - controlled via Telegram
5
5
  Project-URL: Homepage, https://github.com/ebokoo/nullabot
6
6
  Project-URL: Repository, https://github.com/ebokoo/nullabot
@@ -1,7 +1,7 @@
1
1
  nullabot/__init__.py,sha256=96923LhB3uU4TE33GdjyG8M2fRRcqeWvRWlqxt48OV4,58
2
2
  nullabot/cli.py,sha256=zattwGYh4feT_sRjCxSOoG6WSToxc_F1Zp00T_zrAIU,25800
3
3
  nullabot/agents/__init__.py,sha256=6mE-zjqFa99WfnE-khjDpCSKzaNlukKVP7tB5Q4o7Vk,133
4
- nullabot/agents/claude_agent.py,sha256=B-P43PhZ_3wfUYpfsCNci3oEpm3s065FEWTDkneWoG8,32587
4
+ nullabot/agents/claude_agent.py,sha256=gCxu3jUAgJ2ZKyIkSXGRas9K8Oy-9h1ZxaCnWNefKY0,33507
5
5
  nullabot/bot/__init__.py,sha256=9axCMJfCE09CxMGsxtx81QZcBEXfz6wruHbYEtQQAeY,102
6
6
  nullabot/bot/telegram.py,sha256=ttBv693dpkt327iCjdpvJEcEsAroaHZ1e8QWQZ--SJk,69104
7
7
  nullabot/core/__init__.py,sha256=Yn9zEFXF_2-aXiiU_iftYuaXWrX1qC7ZaEd6i3sarIE,314
@@ -12,8 +12,8 @@ nullabot/core/rate_limiter.py,sha256=41CF4cX_n5_PFc6Uk1vp6m4MERxXl25p1wyw2FVdgsM
12
12
  nullabot/core/reliability.py,sha256=nfMN29dCQqM_T_MSLe0z9Tk0N5CWYFtmNXVe9Lqmiyw,13985
13
13
  nullabot/core/sandbox.py,sha256=fWgjhWglGzXsJ10qxiKwJEkQQv6tLVa-DsshO7qcQvQ,4562
14
14
  nullabot/core/state.py,sha256=yeFF4r3h0nRd5LENiXE7SSqfWPuljGy7X0FgE_GuI5o,6307
15
- nullabot-1.0.2.dist-info/METADATA,sha256=i_73BKTIn0-YsgJF-kOxmEQjSM8pnB6KaQ56XmXe0Fw,3360
16
- nullabot-1.0.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
17
- nullabot-1.0.2.dist-info/entry_points.txt,sha256=lHaTGUU4ku7Q6ZRZnlpp5LrHRyLxhaRB9HzXzsJwYY8,47
18
- nullabot-1.0.2.dist-info/licenses/LICENSE,sha256=IppsK7DD3SKtJlMoquzr1-bGKs88x85956yPxCn8H-U,1063
19
- nullabot-1.0.2.dist-info/RECORD,,
15
+ nullabot-1.0.3.dist-info/METADATA,sha256=gfHS2303WEzHe8GeFJHZsIFmvrDYFGTF6dZ96R1mLC8,3360
16
+ nullabot-1.0.3.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
17
+ nullabot-1.0.3.dist-info/entry_points.txt,sha256=lHaTGUU4ku7Q6ZRZnlpp5LrHRyLxhaRB9HzXzsJwYY8,47
18
+ nullabot-1.0.3.dist-info/licenses/LICENSE,sha256=IppsK7DD3SKtJlMoquzr1-bGKs88x85956yPxCn8H-U,1063
19
+ nullabot-1.0.3.dist-info/RECORD,,