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.
- kash/actions/core/chat.py +1 -0
- kash/actions/core/markdownify_html.py +4 -5
- kash/actions/core/minify_html.py +4 -5
- kash/actions/core/readability.py +1 -4
- kash/actions/core/render_as_html.py +10 -7
- kash/actions/core/save_sidematter_meta.py +47 -0
- kash/actions/core/show_webpage.py +2 -0
- kash/actions/core/zip_sidematter.py +47 -0
- kash/commands/base/basic_file_commands.py +7 -4
- kash/commands/base/diff_commands.py +6 -4
- kash/commands/base/files_command.py +31 -30
- kash/commands/base/general_commands.py +3 -2
- kash/commands/base/logs_commands.py +6 -4
- kash/commands/base/reformat_command.py +3 -2
- kash/commands/base/search_command.py +4 -3
- kash/commands/base/show_command.py +9 -7
- kash/commands/help/assistant_commands.py +6 -4
- kash/commands/help/help_commands.py +7 -4
- kash/commands/workspace/selection_commands.py +18 -16
- kash/commands/workspace/workspace_commands.py +39 -26
- kash/config/logger.py +1 -1
- kash/config/setup.py +2 -27
- kash/config/text_styles.py +1 -1
- kash/docs/markdown/topics/a1_what_is_kash.md +26 -18
- kash/docs/markdown/topics/a2_installation.md +3 -2
- kash/exec/action_decorators.py +7 -5
- kash/exec/action_exec.py +104 -53
- kash/exec/fetch_url_items.py +40 -11
- kash/exec/llm_transforms.py +14 -5
- kash/exec/preconditions.py +2 -2
- kash/exec/resolve_args.py +4 -1
- kash/exec/runtime_settings.py +3 -0
- kash/file_storage/file_store.py +108 -114
- kash/file_storage/item_file_format.py +91 -26
- kash/file_storage/item_id_index.py +128 -0
- kash/help/help_types.py +1 -1
- kash/llm_utils/llms.py +6 -1
- kash/local_server/local_server_commands.py +2 -1
- kash/mcp/mcp_server_commands.py +3 -2
- kash/mcp/mcp_server_routes.py +42 -12
- kash/model/actions_model.py +44 -32
- kash/model/compound_actions_model.py +4 -3
- kash/model/exec_model.py +33 -3
- kash/model/items_model.py +150 -60
- kash/model/params_model.py +4 -4
- kash/shell/output/shell_output.py +1 -2
- kash/utils/api_utils/gather_limited.py +2 -0
- kash/utils/api_utils/multitask_gather.py +74 -0
- kash/utils/common/s3_utils.py +108 -0
- kash/utils/common/url.py +16 -4
- kash/utils/file_formats/chat_format.py +7 -4
- kash/utils/file_utils/file_ext.py +1 -0
- kash/utils/file_utils/file_formats.py +4 -2
- kash/utils/file_utils/file_formats_model.py +12 -0
- kash/utils/text_handling/doc_normalization.py +1 -1
- kash/utils/text_handling/markdown_footnotes.py +224 -0
- kash/utils/text_handling/markdown_utils.py +532 -41
- kash/utils/text_handling/markdownify_utils.py +2 -1
- kash/web_content/web_fetch.py +2 -1
- kash/web_gen/templates/components/tooltip_scripts.js.jinja +186 -1
- kash/web_gen/templates/components/youtube_popover_scripts.js.jinja +223 -0
- kash/web_gen/templates/components/youtube_popover_styles.css.jinja +150 -0
- kash/web_gen/templates/content_styles.css.jinja +53 -1
- kash/web_gen/templates/youtube_webpage.html.jinja +47 -0
- kash/web_gen/webpage_render.py +103 -0
- kash/workspaces/workspaces.py +0 -5
- kash/xonsh_custom/custom_shell.py +4 -3
- {kash_shell-0.3.28.dist-info → kash_shell-0.3.33.dist-info}/METADATA +35 -26
- {kash_shell-0.3.28.dist-info → kash_shell-0.3.33.dist-info}/RECORD +72 -64
- kash/llm_utils/llm_features.py +0 -72
- kash/web_gen/simple_webpage.py +0 -55
- {kash_shell-0.3.28.dist-info → kash_shell-0.3.33.dist-info}/WHEEL +0 -0
- {kash_shell-0.3.28.dist-info → kash_shell-0.3.33.dist-info}/entry_points.txt +0 -0
- {kash_shell-0.3.28.dist-info → kash_shell-0.3.33.dist-info}/licenses/LICENSE +0 -0
kash/llm_utils/llm_features.py
DELETED
|
@@ -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
|
-
]
|
kash/web_gen/simple_webpage.py
DELETED
|
@@ -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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|