kash-shell 0.3.28__py3-none-any.whl → 0.3.33__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. kash/actions/core/chat.py +1 -0
  2. kash/actions/core/markdownify_html.py +4 -5
  3. kash/actions/core/minify_html.py +4 -5
  4. kash/actions/core/readability.py +1 -4
  5. kash/actions/core/render_as_html.py +10 -7
  6. kash/actions/core/save_sidematter_meta.py +47 -0
  7. kash/actions/core/show_webpage.py +2 -0
  8. kash/actions/core/zip_sidematter.py +47 -0
  9. kash/commands/base/basic_file_commands.py +7 -4
  10. kash/commands/base/diff_commands.py +6 -4
  11. kash/commands/base/files_command.py +31 -30
  12. kash/commands/base/general_commands.py +3 -2
  13. kash/commands/base/logs_commands.py +6 -4
  14. kash/commands/base/reformat_command.py +3 -2
  15. kash/commands/base/search_command.py +4 -3
  16. kash/commands/base/show_command.py +9 -7
  17. kash/commands/help/assistant_commands.py +6 -4
  18. kash/commands/help/help_commands.py +7 -4
  19. kash/commands/workspace/selection_commands.py +18 -16
  20. kash/commands/workspace/workspace_commands.py +39 -26
  21. kash/config/logger.py +1 -1
  22. kash/config/setup.py +2 -27
  23. kash/config/text_styles.py +1 -1
  24. kash/docs/markdown/topics/a1_what_is_kash.md +26 -18
  25. kash/docs/markdown/topics/a2_installation.md +3 -2
  26. kash/exec/action_decorators.py +7 -5
  27. kash/exec/action_exec.py +104 -53
  28. kash/exec/fetch_url_items.py +40 -11
  29. kash/exec/llm_transforms.py +14 -5
  30. kash/exec/preconditions.py +2 -2
  31. kash/exec/resolve_args.py +4 -1
  32. kash/exec/runtime_settings.py +3 -0
  33. kash/file_storage/file_store.py +108 -114
  34. kash/file_storage/item_file_format.py +91 -26
  35. kash/file_storage/item_id_index.py +128 -0
  36. kash/help/help_types.py +1 -1
  37. kash/llm_utils/llms.py +6 -1
  38. kash/local_server/local_server_commands.py +2 -1
  39. kash/mcp/mcp_server_commands.py +3 -2
  40. kash/mcp/mcp_server_routes.py +42 -12
  41. kash/model/actions_model.py +44 -32
  42. kash/model/compound_actions_model.py +4 -3
  43. kash/model/exec_model.py +33 -3
  44. kash/model/items_model.py +150 -60
  45. kash/model/params_model.py +4 -4
  46. kash/shell/output/shell_output.py +1 -2
  47. kash/utils/api_utils/gather_limited.py +2 -0
  48. kash/utils/api_utils/multitask_gather.py +74 -0
  49. kash/utils/common/s3_utils.py +108 -0
  50. kash/utils/common/url.py +16 -4
  51. kash/utils/file_formats/chat_format.py +7 -4
  52. kash/utils/file_utils/file_ext.py +1 -0
  53. kash/utils/file_utils/file_formats.py +4 -2
  54. kash/utils/file_utils/file_formats_model.py +12 -0
  55. kash/utils/text_handling/doc_normalization.py +1 -1
  56. kash/utils/text_handling/markdown_footnotes.py +224 -0
  57. kash/utils/text_handling/markdown_utils.py +532 -41
  58. kash/utils/text_handling/markdownify_utils.py +2 -1
  59. kash/web_content/web_fetch.py +2 -1
  60. kash/web_gen/templates/components/tooltip_scripts.js.jinja +186 -1
  61. kash/web_gen/templates/components/youtube_popover_scripts.js.jinja +223 -0
  62. kash/web_gen/templates/components/youtube_popover_styles.css.jinja +150 -0
  63. kash/web_gen/templates/content_styles.css.jinja +53 -1
  64. kash/web_gen/templates/youtube_webpage.html.jinja +47 -0
  65. kash/web_gen/webpage_render.py +103 -0
  66. kash/workspaces/workspaces.py +0 -5
  67. kash/xonsh_custom/custom_shell.py +4 -3
  68. {kash_shell-0.3.28.dist-info → kash_shell-0.3.33.dist-info}/METADATA +35 -26
  69. {kash_shell-0.3.28.dist-info → kash_shell-0.3.33.dist-info}/RECORD +72 -64
  70. kash/llm_utils/llm_features.py +0 -72
  71. kash/web_gen/simple_webpage.py +0 -55
  72. {kash_shell-0.3.28.dist-info → kash_shell-0.3.33.dist-info}/WHEEL +0 -0
  73. {kash_shell-0.3.28.dist-info → kash_shell-0.3.33.dist-info}/entry_points.txt +0 -0
  74. {kash_shell-0.3.28.dist-info → kash_shell-0.3.33.dist-info}/licenses/LICENSE +0 -0
@@ -1,72 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from dataclasses import dataclass
4
- from typing import Literal, TypeAlias
5
-
6
- from prettyfmt import custom_key_sort
7
-
8
- from kash.llm_utils.llm_names import LLMName
9
- from kash.llm_utils.llms import LLM
10
-
11
- Speed: TypeAlias = Literal["fast", "medium", "slow"]
12
-
13
- ContextSize: TypeAlias = Literal["small", "medium", "large"]
14
-
15
- ModelSize: TypeAlias = Literal["small", "medium", "large"]
16
-
17
-
18
- @dataclass(frozen=True)
19
- class LLMFeatures:
20
- speed: Speed | None = None
21
- context_size: ContextSize | None = None
22
- model_size: ModelSize | None = None
23
- structured_output: bool | None = None
24
- thinking: bool = False
25
-
26
- def satisfies(self, features: LLMFeatures) -> bool:
27
- return all(
28
- getattr(self, attr) == getattr(features, attr)
29
- for attr in features.__dataclass_fields__
30
- if getattr(self, attr) is not None
31
- )
32
-
33
-
34
- def pick_llm(desired_features: LLMFeatures) -> LLMName:
35
- """
36
- Pick the preferred model that satisfies the desired features.
37
- """
38
- satisfied_models: list[LLMName] = [
39
- llm for llm, features in FEATURES.items() if features.satisfies(desired_features)
40
- ]
41
- satisfied_models.sort(key=custom_key_sort(preferred_llms))
42
- if not satisfied_models:
43
- raise ValueError(f"No model found for features: {desired_features}")
44
- return satisfied_models[0]
45
-
46
-
47
- FEATURES = {
48
- LLM.o3_mini: LLMFeatures(
49
- speed="fast",
50
- context_size="small",
51
- model_size="small",
52
- structured_output=True,
53
- thinking=True,
54
- ),
55
- # FIXME
56
- }
57
-
58
- preferred_llms: list[LLMName] = [
59
- LLM.o4_mini,
60
- LLM.o3,
61
- LLM.o3_mini,
62
- LLM.o1_mini,
63
- LLM.o1,
64
- LLM.gpt_4o_mini,
65
- LLM.gpt_4o,
66
- LLM.gpt_4,
67
- LLM.claude_4_sonnet,
68
- LLM.claude_4_opus,
69
- LLM.claude_3_7_sonnet,
70
- LLM.claude_3_5_haiku,
71
- LLM.gemini_2_5_pro,
72
- ]
@@ -1,55 +0,0 @@
1
- from kash.model.items_model import Item
2
- from kash.utils.file_utils.file_formats_model import Format
3
- from kash.web_gen.template_render import render_web_template
4
-
5
-
6
- def simple_webpage_render(
7
- item: Item,
8
- page_template: str = "simple_webpage.html.jinja",
9
- add_title_h1: bool = True,
10
- show_theme_toggle: bool = False,
11
- ) -> str:
12
- """
13
- Generate a simple web page from a single item.
14
- If `add_title_h1` is True, the title will be inserted as an h1 heading above the body.
15
- """
16
- return render_web_template(
17
- template_filename=page_template,
18
- data={
19
- "title": item.pick_title(),
20
- "add_title_h1": add_title_h1,
21
- "content_html": item.body_as_html(),
22
- "thumbnail_url": item.thumbnail_url,
23
- "enable_themes": show_theme_toggle,
24
- "show_theme_toggle": show_theme_toggle,
25
- },
26
- )
27
-
28
-
29
- ## Tests
30
-
31
-
32
- def test_render():
33
- import os
34
-
35
- from kash.model.items_model import ItemType
36
-
37
- # Create a test item
38
- item = Item(
39
- type=ItemType.doc,
40
- format=Format.html,
41
- title="A Simple Web Page",
42
- body="<p>This is a simple web page with <b>HTML content</b>.</p>",
43
- )
44
-
45
- # Generate HTML
46
- html = simple_webpage_render(item)
47
-
48
- os.makedirs("tmp", exist_ok=True)
49
- with open("tmp/simple_webpage.html", "w") as f:
50
- f.write(html)
51
- print("Rendered simple webpage to tmp/simple_webpage.html")
52
-
53
- # Basic validation
54
- assert item.title and item.title in html
55
- assert "<b>HTML content</b>" in html