klaude-code 1.2.18__py3-none-any.whl → 1.2.20__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.
Files changed (74) hide show
  1. klaude_code/cli/main.py +42 -22
  2. klaude_code/cli/runtime.py +46 -2
  3. klaude_code/{version.py → cli/self_update.py} +110 -2
  4. klaude_code/command/__init__.py +1 -3
  5. klaude_code/command/clear_cmd.py +5 -4
  6. klaude_code/command/command_abc.py +5 -40
  7. klaude_code/command/debug_cmd.py +2 -2
  8. klaude_code/command/diff_cmd.py +2 -1
  9. klaude_code/command/export_cmd.py +14 -49
  10. klaude_code/command/export_online_cmd.py +10 -4
  11. klaude_code/command/help_cmd.py +2 -1
  12. klaude_code/command/model_cmd.py +7 -5
  13. klaude_code/command/prompt-jj-workspace.md +18 -0
  14. klaude_code/command/prompt_command.py +16 -9
  15. klaude_code/command/refresh_cmd.py +3 -2
  16. klaude_code/command/registry.py +98 -28
  17. klaude_code/command/release_notes_cmd.py +2 -1
  18. klaude_code/command/status_cmd.py +2 -1
  19. klaude_code/command/terminal_setup_cmd.py +2 -1
  20. klaude_code/command/thinking_cmd.py +6 -4
  21. klaude_code/core/executor.py +187 -180
  22. klaude_code/core/manager/sub_agent_manager.py +3 -0
  23. klaude_code/core/prompt.py +4 -1
  24. klaude_code/core/prompts/prompt-sub-agent-explore.md +14 -2
  25. klaude_code/core/prompts/prompt-sub-agent-web.md +3 -3
  26. klaude_code/core/reminders.py +70 -26
  27. klaude_code/core/task.py +13 -12
  28. klaude_code/core/tool/__init__.py +2 -0
  29. klaude_code/core/tool/file/apply_patch_tool.py +3 -1
  30. klaude_code/core/tool/file/edit_tool.py +7 -5
  31. klaude_code/core/tool/file/multi_edit_tool.py +7 -5
  32. klaude_code/core/tool/file/read_tool.md +1 -1
  33. klaude_code/core/tool/file/read_tool.py +8 -4
  34. klaude_code/core/tool/file/write_tool.py +8 -6
  35. klaude_code/core/tool/memory/skill_loader.py +12 -10
  36. klaude_code/core/tool/shell/bash_tool.py +89 -17
  37. klaude_code/core/tool/sub_agent_tool.py +5 -1
  38. klaude_code/core/tool/tool_abc.py +18 -0
  39. klaude_code/core/tool/tool_context.py +6 -6
  40. klaude_code/core/tool/tool_registry.py +1 -1
  41. klaude_code/core/tool/tool_runner.py +7 -7
  42. klaude_code/core/tool/web/web_fetch_tool.py +77 -22
  43. klaude_code/core/tool/web/web_search_tool.py +5 -1
  44. klaude_code/llm/anthropic/client.py +25 -9
  45. klaude_code/llm/openai_compatible/client.py +5 -2
  46. klaude_code/llm/openrouter/client.py +7 -3
  47. klaude_code/llm/responses/client.py +6 -1
  48. klaude_code/protocol/model.py +8 -1
  49. klaude_code/protocol/op.py +47 -0
  50. klaude_code/protocol/op_handler.py +25 -1
  51. klaude_code/protocol/sub_agent/web.py +1 -1
  52. klaude_code/session/codec.py +71 -0
  53. klaude_code/session/export.py +21 -11
  54. klaude_code/session/session.py +186 -322
  55. klaude_code/session/store.py +215 -0
  56. klaude_code/session/templates/export_session.html +48 -47
  57. klaude_code/ui/modes/repl/completers.py +211 -71
  58. klaude_code/ui/modes/repl/event_handler.py +7 -23
  59. klaude_code/ui/modes/repl/input_prompt_toolkit.py +5 -7
  60. klaude_code/ui/modes/repl/renderer.py +2 -2
  61. klaude_code/ui/renderers/common.py +54 -0
  62. klaude_code/ui/renderers/developer.py +2 -3
  63. klaude_code/ui/renderers/errors.py +1 -1
  64. klaude_code/ui/renderers/metadata.py +10 -1
  65. klaude_code/ui/renderers/tools.py +3 -4
  66. klaude_code/ui/rich/__init__.py +10 -1
  67. klaude_code/ui/rich/cjk_wrap.py +228 -0
  68. klaude_code/ui/rich/status.py +0 -1
  69. klaude_code/ui/utils/common.py +0 -18
  70. {klaude_code-1.2.18.dist-info → klaude_code-1.2.20.dist-info}/METADATA +18 -2
  71. {klaude_code-1.2.18.dist-info → klaude_code-1.2.20.dist-info}/RECORD +73 -70
  72. klaude_code/ui/utils/debouncer.py +0 -42
  73. {klaude_code-1.2.18.dist-info → klaude_code-1.2.20.dist-info}/WHEEL +0 -0
  74. {klaude_code-1.2.18.dist-info → klaude_code-1.2.20.dist-info}/entry_points.txt +0 -0
@@ -63,7 +63,7 @@ def get_default_export_path(session: Session) -> Path:
63
63
  """Get default export path for a session."""
64
64
  from klaude_code.session.session import Session as SessionClass
65
65
 
66
- exports_dir = SessionClass._exports_dir() # pyright: ignore[reportPrivateUsage]
66
+ exports_dir = SessionClass.exports_dir()
67
67
  timestamp = datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
68
68
  first_msg = get_first_user_message(session.conversation_history)
69
69
  sanitized_msg = _sanitize_filename(first_msg)
@@ -267,20 +267,30 @@ def _render_assistant_message(index: int, content: str, timestamp: datetime) ->
267
267
  )
268
268
 
269
269
 
270
- def _try_render_todo_args(arguments: str) -> str | None:
270
+ def _try_render_todo_args(arguments: str, tool_name: str) -> str | None:
271
271
  try:
272
272
  parsed = json.loads(arguments)
273
- if not isinstance(parsed, dict) or "todos" not in parsed or not isinstance(parsed["todos"], list):
273
+ if not isinstance(parsed, dict):
274
274
  return None
275
275
 
276
- todos = cast(list[dict[str, str]], parsed["todos"])
277
- if not todos:
276
+ # Support both TodoWrite (todos/content) and update_plan (plan/step)
277
+ parsed_dict = cast(dict[str, Any], parsed)
278
+ if tool_name == "TodoWrite":
279
+ items = parsed_dict.get("todos")
280
+ content_key = "content"
281
+ elif tool_name == "update_plan":
282
+ items = parsed_dict.get("plan")
283
+ content_key = "step"
284
+ else:
285
+ return None
286
+
287
+ if not isinstance(items, list) or not items:
278
288
  return None
279
289
 
280
290
  items_html: list[str] = []
281
- for todo in todos:
282
- content = _escape_html(todo.get("content", ""))
283
- status = todo.get("status", "pending")
291
+ for item in cast(list[dict[str, str]], items):
292
+ content = _escape_html(item.get(content_key, ""))
293
+ status = item.get("status", "pending")
284
294
  status_class = f"status-{status}"
285
295
 
286
296
  items_html.append(
@@ -447,8 +457,8 @@ def _format_tool_call(tool_call: model.ToolCallItem, result: model.ToolResultIte
447
457
  is_todo_list = False
448
458
  ts_str = _format_msg_timestamp(tool_call.created_at)
449
459
 
450
- if tool_call.name == "TodoWrite":
451
- args_html = _try_render_todo_args(tool_call.arguments)
460
+ if tool_call.name in ("TodoWrite", "update_plan"):
461
+ args_html = _try_render_todo_args(tool_call.arguments, tool_call.name)
452
462
  if args_html:
453
463
  is_todo_list = True
454
464
 
@@ -506,7 +516,7 @@ def _format_tool_call(tool_call: model.ToolCallItem, result: model.ToolResultIte
506
516
  diff_text = _get_diff_text(result.ui_extra)
507
517
  mermaid_html = _get_mermaid_link_html(result.ui_extra, tool_call)
508
518
 
509
- should_hide_text = tool_call.name == "TodoWrite" and result.status != "error"
519
+ should_hide_text = tool_call.name in ("TodoWrite", "update_plan") and result.status != "error"
510
520
 
511
521
  if tool_call.name == "Edit" and not diff_text and result.status != "error":
512
522
  try: