klaude-code 1.2.22__py3-none-any.whl → 1.2.24__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 (56) hide show
  1. klaude_code/command/prompt-jj-describe.md +32 -0
  2. klaude_code/command/status_cmd.py +1 -1
  3. klaude_code/{const/__init__.py → const.py} +11 -2
  4. klaude_code/core/executor.py +1 -1
  5. klaude_code/core/manager/sub_agent_manager.py +1 -1
  6. klaude_code/core/reminders.py +51 -0
  7. klaude_code/core/task.py +37 -18
  8. klaude_code/core/tool/__init__.py +1 -4
  9. klaude_code/core/tool/file/read_tool.py +23 -1
  10. klaude_code/core/tool/file/write_tool.py +7 -3
  11. klaude_code/core/tool/skill/__init__.py +0 -0
  12. klaude_code/core/tool/{memory → skill}/skill_tool.py +16 -39
  13. klaude_code/llm/openai_compatible/client.py +29 -102
  14. klaude_code/llm/openai_compatible/stream.py +272 -0
  15. klaude_code/llm/openrouter/client.py +29 -109
  16. klaude_code/llm/openrouter/{reasoning_handler.py → reasoning.py} +24 -2
  17. klaude_code/protocol/model.py +15 -2
  18. klaude_code/session/export.py +1 -1
  19. klaude_code/session/store.py +4 -2
  20. klaude_code/skill/__init__.py +27 -0
  21. klaude_code/skill/assets/deslop/SKILL.md +17 -0
  22. klaude_code/skill/assets/dev-docs/SKILL.md +108 -0
  23. klaude_code/skill/assets/handoff/SKILL.md +39 -0
  24. klaude_code/skill/assets/jj-workspace/SKILL.md +20 -0
  25. klaude_code/skill/assets/skill-creator/SKILL.md +139 -0
  26. klaude_code/{core/tool/memory/skill_loader.py → skill/loader.py} +60 -24
  27. klaude_code/skill/manager.py +70 -0
  28. klaude_code/skill/system_skills.py +192 -0
  29. klaude_code/ui/core/stage_manager.py +0 -3
  30. klaude_code/ui/modes/repl/completers.py +103 -3
  31. klaude_code/ui/modes/repl/event_handler.py +101 -49
  32. klaude_code/ui/modes/repl/input_prompt_toolkit.py +55 -6
  33. klaude_code/ui/modes/repl/renderer.py +24 -17
  34. klaude_code/ui/renderers/assistant.py +7 -2
  35. klaude_code/ui/renderers/developer.py +12 -0
  36. klaude_code/ui/renderers/diffs.py +1 -1
  37. klaude_code/ui/renderers/metadata.py +6 -8
  38. klaude_code/ui/renderers/sub_agent.py +28 -5
  39. klaude_code/ui/renderers/thinking.py +16 -10
  40. klaude_code/ui/renderers/tools.py +83 -34
  41. klaude_code/ui/renderers/user_input.py +32 -2
  42. klaude_code/ui/rich/markdown.py +40 -20
  43. klaude_code/ui/rich/status.py +15 -19
  44. klaude_code/ui/rich/theme.py +70 -17
  45. {klaude_code-1.2.22.dist-info → klaude_code-1.2.24.dist-info}/METADATA +18 -13
  46. {klaude_code-1.2.22.dist-info → klaude_code-1.2.24.dist-info}/RECORD +49 -45
  47. klaude_code/command/prompt-deslop.md +0 -14
  48. klaude_code/command/prompt-dev-docs-update.md +0 -56
  49. klaude_code/command/prompt-dev-docs.md +0 -46
  50. klaude_code/command/prompt-handoff.md +0 -33
  51. klaude_code/command/prompt-jj-workspace.md +0 -18
  52. klaude_code/core/tool/memory/__init__.py +0 -5
  53. klaude_code/llm/openai_compatible/stream_processor.py +0 -83
  54. /klaude_code/core/tool/{memory → skill}/skill_tool.md +0 -0
  55. {klaude_code-1.2.22.dist-info → klaude_code-1.2.24.dist-info}/WHEEL +0 -0
  56. {klaude_code-1.2.22.dist-info → klaude_code-1.2.24.dist-info}/entry_points.txt +0 -0
@@ -1,83 +0,0 @@
1
- """Shared stream processing utilities for OpenAI-compatible clients.
2
-
3
- This module provides a reusable stream state manager that handles the common
4
- logic for accumulating and flushing reasoning, assistant content, and tool calls
5
- across different LLM providers (OpenAI-compatible, OpenRouter).
6
- """
7
-
8
- from collections.abc import Callable
9
- from typing import Literal
10
-
11
- from klaude_code.llm.openai_compatible.tool_call_accumulator import BasicToolCallAccumulator, ToolCallAccumulatorABC
12
- from klaude_code.protocol import model
13
-
14
- StreamStage = Literal["waiting", "reasoning", "assistant", "tool"]
15
-
16
-
17
- class StreamStateManager:
18
- """Manages streaming state and provides flush operations for accumulated content.
19
-
20
- This class encapsulates the common state management logic used by both
21
- OpenAI-compatible and OpenRouter clients, reducing code duplication.
22
- """
23
-
24
- def __init__(
25
- self,
26
- param_model: str,
27
- response_id: str | None = None,
28
- reasoning_flusher: Callable[[], list[model.ConversationItem]] | None = None,
29
- ):
30
- self.param_model = param_model
31
- self.response_id = response_id
32
- self.stage: StreamStage = "waiting"
33
- self.accumulated_reasoning: list[str] = []
34
- self.accumulated_content: list[str] = []
35
- self.accumulated_tool_calls: ToolCallAccumulatorABC = BasicToolCallAccumulator()
36
- self.emitted_tool_start_indices: set[int] = set()
37
- self._reasoning_flusher = reasoning_flusher
38
-
39
- def set_response_id(self, response_id: str) -> None:
40
- """Set the response ID once received from the stream."""
41
- self.response_id = response_id
42
- self.accumulated_tool_calls.response_id = response_id # pyright: ignore[reportAttributeAccessIssue]
43
-
44
- def flush_reasoning(self) -> list[model.ConversationItem]:
45
- """Flush accumulated reasoning content and return items."""
46
- if self._reasoning_flusher is not None:
47
- return self._reasoning_flusher()
48
- if not self.accumulated_reasoning:
49
- return []
50
- item = model.ReasoningTextItem(
51
- content="".join(self.accumulated_reasoning),
52
- response_id=self.response_id,
53
- model=self.param_model,
54
- )
55
- self.accumulated_reasoning = []
56
- return [item]
57
-
58
- def flush_assistant(self) -> list[model.ConversationItem]:
59
- """Flush accumulated assistant content and return items."""
60
- if not self.accumulated_content:
61
- return []
62
- item = model.AssistantMessageItem(
63
- content="".join(self.accumulated_content),
64
- response_id=self.response_id,
65
- )
66
- self.accumulated_content = []
67
- return [item]
68
-
69
- def flush_tool_calls(self) -> list[model.ToolCallItem]:
70
- """Flush accumulated tool calls and return items."""
71
- items: list[model.ToolCallItem] = self.accumulated_tool_calls.get()
72
- if items:
73
- self.accumulated_tool_calls.chunks_by_step = [] # pyright: ignore[reportAttributeAccessIssue]
74
- return items
75
-
76
- def flush_all(self) -> list[model.ConversationItem]:
77
- """Flush all accumulated content in order: reasoning, assistant, tool calls."""
78
- items: list[model.ConversationItem] = []
79
- items.extend(self.flush_reasoning())
80
- items.extend(self.flush_assistant())
81
- if self.stage == "tool":
82
- items.extend(self.flush_tool_calls())
83
- return items
File without changes