klaude-code 2.7.0__py3-none-any.whl → 2.8.1__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.
- klaude_code/auth/AGENTS.md +325 -0
- klaude_code/auth/__init__.py +17 -1
- klaude_code/auth/antigravity/__init__.py +20 -0
- klaude_code/auth/antigravity/exceptions.py +17 -0
- klaude_code/auth/antigravity/oauth.py +320 -0
- klaude_code/auth/antigravity/pkce.py +25 -0
- klaude_code/auth/antigravity/token_manager.py +45 -0
- klaude_code/auth/base.py +4 -0
- klaude_code/auth/claude/oauth.py +29 -9
- klaude_code/auth/codex/exceptions.py +4 -0
- klaude_code/cli/auth_cmd.py +53 -3
- klaude_code/cli/cost_cmd.py +83 -160
- klaude_code/cli/list_model.py +50 -0
- klaude_code/cli/main.py +2 -2
- klaude_code/config/assets/builtin_config.yaml +108 -0
- klaude_code/config/builtin_config.py +5 -11
- klaude_code/config/config.py +24 -10
- klaude_code/const.py +2 -1
- klaude_code/core/agent.py +5 -1
- klaude_code/core/agent_profile.py +29 -33
- klaude_code/core/compaction/AGENTS.md +112 -0
- klaude_code/core/compaction/__init__.py +11 -0
- klaude_code/core/compaction/compaction.py +705 -0
- klaude_code/core/compaction/overflow.py +30 -0
- klaude_code/core/compaction/prompts.py +97 -0
- klaude_code/core/executor.py +121 -2
- klaude_code/core/manager/llm_clients.py +5 -0
- klaude_code/core/manager/llm_clients_builder.py +14 -2
- klaude_code/core/prompts/prompt-antigravity.md +80 -0
- klaude_code/core/prompts/prompt-codex-gpt-5-2.md +335 -0
- klaude_code/core/reminders.py +7 -2
- klaude_code/core/task.py +126 -0
- klaude_code/core/tool/file/edit_tool.py +1 -2
- klaude_code/core/tool/todo/todo_write_tool.py +1 -1
- klaude_code/core/turn.py +3 -1
- klaude_code/llm/antigravity/__init__.py +3 -0
- klaude_code/llm/antigravity/client.py +558 -0
- klaude_code/llm/antigravity/input.py +261 -0
- klaude_code/llm/registry.py +1 -0
- klaude_code/protocol/commands.py +1 -0
- klaude_code/protocol/events.py +18 -0
- klaude_code/protocol/llm_param.py +1 -0
- klaude_code/protocol/message.py +23 -1
- klaude_code/protocol/op.py +29 -1
- klaude_code/protocol/op_handler.py +10 -0
- klaude_code/session/export.py +308 -299
- klaude_code/session/session.py +36 -0
- klaude_code/session/templates/export_session.html +430 -134
- klaude_code/skill/assets/create-plan/SKILL.md +6 -6
- klaude_code/tui/command/__init__.py +6 -0
- klaude_code/tui/command/compact_cmd.py +32 -0
- klaude_code/tui/command/continue_cmd.py +34 -0
- klaude_code/tui/command/fork_session_cmd.py +110 -14
- klaude_code/tui/command/model_picker.py +5 -1
- klaude_code/tui/command/thinking_cmd.py +1 -1
- klaude_code/tui/commands.py +6 -0
- klaude_code/tui/components/rich/markdown.py +119 -12
- klaude_code/tui/components/rich/theme.py +10 -2
- klaude_code/tui/components/tools.py +39 -25
- klaude_code/tui/components/user_input.py +1 -1
- klaude_code/tui/input/__init__.py +5 -2
- klaude_code/tui/input/drag_drop.py +6 -57
- klaude_code/tui/input/key_bindings.py +10 -0
- klaude_code/tui/input/prompt_toolkit.py +19 -6
- klaude_code/tui/machine.py +25 -0
- klaude_code/tui/renderer.py +68 -4
- klaude_code/tui/runner.py +18 -2
- klaude_code/tui/terminal/image.py +72 -10
- klaude_code/tui/terminal/selector.py +31 -7
- {klaude_code-2.7.0.dist-info → klaude_code-2.8.1.dist-info}/METADATA +1 -1
- {klaude_code-2.7.0.dist-info → klaude_code-2.8.1.dist-info}/RECORD +73 -56
- klaude_code/core/prompts/prompt-codex-gpt-5-1-codex-max.md +0 -117
- {klaude_code-2.7.0.dist-info → klaude_code-2.8.1.dist-info}/WHEEL +0 -0
- {klaude_code-2.7.0.dist-info → klaude_code-2.8.1.dist-info}/entry_points.txt +0 -0
klaude_code/session/session.py
CHANGED
|
@@ -228,6 +228,30 @@ class Session(BaseModel):
|
|
|
228
228
|
)
|
|
229
229
|
self._store.append_and_flush(session_id=self.id, items=items, meta=meta)
|
|
230
230
|
|
|
231
|
+
def get_llm_history(self) -> list[message.HistoryEvent]:
|
|
232
|
+
"""Return the LLM-facing history view with compaction summary injected."""
|
|
233
|
+
history = self.conversation_history
|
|
234
|
+
last_compaction: message.CompactionEntry | None = None
|
|
235
|
+
for item in reversed(history):
|
|
236
|
+
if isinstance(item, message.CompactionEntry):
|
|
237
|
+
last_compaction = item
|
|
238
|
+
break
|
|
239
|
+
if last_compaction is None:
|
|
240
|
+
return [it for it in history if not isinstance(it, message.CompactionEntry)]
|
|
241
|
+
|
|
242
|
+
summary_message = message.UserMessage(parts=[message.TextPart(text=last_compaction.summary)])
|
|
243
|
+
kept = [it for it in history[last_compaction.first_kept_index :] if not isinstance(it, message.CompactionEntry)]
|
|
244
|
+
|
|
245
|
+
# Guard against old/bad persisted compaction boundaries that start with tool results.
|
|
246
|
+
# Tool results must not appear without their corresponding assistant tool call.
|
|
247
|
+
if kept and isinstance(kept[0], message.ToolResultMessage):
|
|
248
|
+
first_non_tool = 0
|
|
249
|
+
while first_non_tool < len(kept) and isinstance(kept[first_non_tool], message.ToolResultMessage):
|
|
250
|
+
first_non_tool += 1
|
|
251
|
+
kept = kept[first_non_tool:]
|
|
252
|
+
|
|
253
|
+
return [summary_message, *kept]
|
|
254
|
+
|
|
231
255
|
def fork(self, *, new_id: str | None = None, until_index: int | None = None) -> Session:
|
|
232
256
|
"""Create a new session as a fork of the current session.
|
|
233
257
|
|
|
@@ -399,6 +423,18 @@ class Session(BaseModel):
|
|
|
399
423
|
yield events.DeveloperMessageEvent(session_id=self.id, item=dm)
|
|
400
424
|
case message.StreamErrorItem() as se:
|
|
401
425
|
yield events.ErrorEvent(error_message=se.error, can_retry=False, session_id=self.id)
|
|
426
|
+
case message.CompactionEntry() as ce:
|
|
427
|
+
yield events.CompactionStartEvent(session_id=self.id, reason="threshold")
|
|
428
|
+
yield events.CompactionEndEvent(
|
|
429
|
+
session_id=self.id,
|
|
430
|
+
reason="threshold",
|
|
431
|
+
aborted=False,
|
|
432
|
+
will_retry=False,
|
|
433
|
+
tokens_before=ce.tokens_before,
|
|
434
|
+
kept_from_index=ce.first_kept_index,
|
|
435
|
+
summary=ce.summary,
|
|
436
|
+
kept_items_brief=ce.kept_items_brief,
|
|
437
|
+
)
|
|
402
438
|
case message.SystemMessage():
|
|
403
439
|
pass
|
|
404
440
|
prev_item = it
|