onetool-mcp 1.0.0b1__py3-none-any.whl → 1.0.0rc2__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.
- onetool/cli.py +63 -4
- onetool_mcp-1.0.0rc2.dist-info/METADATA +266 -0
- onetool_mcp-1.0.0rc2.dist-info/RECORD +129 -0
- {onetool_mcp-1.0.0b1.dist-info → onetool_mcp-1.0.0rc2.dist-info}/licenses/LICENSE.txt +1 -1
- {onetool_mcp-1.0.0b1.dist-info → onetool_mcp-1.0.0rc2.dist-info}/licenses/NOTICE.txt +54 -64
- ot/__main__.py +6 -6
- ot/config/__init__.py +48 -46
- ot/config/global_templates/__init__.py +2 -2
- ot/config/{defaults → global_templates}/diagram-templates/api-flow.mmd +33 -33
- ot/config/{defaults → global_templates}/diagram-templates/c4-context.puml +30 -30
- ot/config/{defaults → global_templates}/diagram-templates/class-diagram.mmd +87 -87
- ot/config/{defaults → global_templates}/diagram-templates/feature-mindmap.mmd +70 -70
- ot/config/{defaults → global_templates}/diagram-templates/microservices.d2 +81 -81
- ot/config/{defaults → global_templates}/diagram-templates/project-gantt.mmd +37 -37
- ot/config/{defaults → global_templates}/diagram-templates/state-machine.mmd +42 -42
- ot/config/global_templates/diagram.yaml +167 -0
- ot/config/global_templates/onetool.yaml +3 -1
- ot/config/{defaults → global_templates}/prompts.yaml +102 -97
- ot/config/global_templates/security.yaml +31 -0
- ot/config/global_templates/servers.yaml +93 -12
- ot/config/global_templates/snippets.yaml +5 -26
- ot/config/{defaults → global_templates}/tool_templates/__init__.py +7 -7
- ot/config/loader.py +221 -105
- ot/config/mcp.py +5 -1
- ot/config/secrets.py +192 -190
- ot/decorators.py +116 -116
- ot/executor/__init__.py +35 -35
- ot/executor/base.py +16 -16
- ot/executor/fence_processor.py +83 -83
- ot/executor/linter.py +142 -142
- ot/executor/pep723.py +288 -288
- ot/executor/runner.py +20 -6
- ot/executor/simple.py +163 -163
- ot/executor/validator.py +603 -164
- ot/http_client.py +145 -145
- ot/logging/__init__.py +37 -37
- ot/logging/entry.py +213 -213
- ot/logging/format.py +191 -188
- ot/logging/span.py +349 -349
- ot/meta.py +236 -14
- ot/paths.py +32 -49
- ot/prompts.py +218 -218
- ot/proxy/manager.py +14 -2
- ot/registry/__init__.py +189 -189
- ot/registry/parser.py +269 -269
- ot/server.py +330 -315
- ot/shortcuts/__init__.py +15 -15
- ot/shortcuts/aliases.py +87 -87
- ot/shortcuts/snippets.py +258 -258
- ot/stats/__init__.py +35 -35
- ot/stats/html.py +2 -2
- ot/stats/reader.py +354 -354
- ot/stats/timing.py +57 -57
- ot/support.py +63 -63
- ot/tools.py +1 -1
- ot/utils/batch.py +161 -161
- ot/utils/cache.py +120 -120
- ot/utils/exceptions.py +23 -23
- ot/utils/factory.py +178 -179
- ot/utils/format.py +65 -65
- ot/utils/http.py +202 -202
- ot/utils/platform.py +45 -45
- ot/utils/truncate.py +69 -69
- ot_tools/__init__.py +4 -4
- ot_tools/_convert/__init__.py +12 -12
- ot_tools/_convert/pdf.py +254 -254
- ot_tools/diagram.yaml +167 -167
- ot_tools/scaffold.py +2 -2
- ot_tools/transform.py +124 -19
- ot_tools/web_fetch.py +94 -43
- onetool_mcp-1.0.0b1.dist-info/METADATA +0 -163
- onetool_mcp-1.0.0b1.dist-info/RECORD +0 -132
- ot/config/defaults/bench.yaml +0 -4
- ot/config/defaults/onetool.yaml +0 -25
- ot/config/defaults/servers.yaml +0 -7
- ot/config/defaults/snippets.yaml +0 -4
- ot_tools/firecrawl.py +0 -732
- {onetool_mcp-1.0.0b1.dist-info → onetool_mcp-1.0.0rc2.dist-info}/WHEEL +0 -0
- {onetool_mcp-1.0.0b1.dist-info → onetool_mcp-1.0.0rc2.dist-info}/entry_points.txt +0 -0
- /ot/config/{defaults → global_templates}/tool_templates/extension.py +0 -0
- /ot/config/{defaults → global_templates}/tool_templates/isolated.py +0 -0
ot/utils/truncate.py
CHANGED
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
"""Text truncation and error formatting utilities."""
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
import subprocess
|
|
6
|
-
from typing import Any
|
|
7
|
-
|
|
8
|
-
__all__ = ["format_error", "run_command", "truncate"]
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def truncate(text: str, max_length: int = 4000, indicator: str = "...") -> str:
|
|
12
|
-
"""Truncate text to a maximum length with an indicator.
|
|
13
|
-
|
|
14
|
-
Args:
|
|
15
|
-
text: Text to truncate
|
|
16
|
-
max_length: Maximum length including indicator
|
|
17
|
-
indicator: String to append when truncated (default: "...")
|
|
18
|
-
|
|
19
|
-
Returns:
|
|
20
|
-
Truncated text with indicator, or original if within limit
|
|
21
|
-
"""
|
|
22
|
-
if len(text) <= max_length:
|
|
23
|
-
return text
|
|
24
|
-
return text[: max_length - len(indicator)] + indicator
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
def format_error(message: str, details: dict[str, Any] | None = None) -> str:
|
|
28
|
-
"""Format an error message consistently.
|
|
29
|
-
|
|
30
|
-
Args:
|
|
31
|
-
message: Main error message
|
|
32
|
-
details: Optional additional details
|
|
33
|
-
|
|
34
|
-
Returns:
|
|
35
|
-
Formatted error string
|
|
36
|
-
"""
|
|
37
|
-
if details:
|
|
38
|
-
detail_str = ", ".join(f"{k}={v}" for k, v in details.items())
|
|
39
|
-
return f"Error: {message} ({detail_str})"
|
|
40
|
-
return f"Error: {message}"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
def run_command(
|
|
44
|
-
args: list[str],
|
|
45
|
-
*,
|
|
46
|
-
timeout: float = 30.0,
|
|
47
|
-
cwd: str | None = None,
|
|
48
|
-
) -> tuple[int, str, str]:
|
|
49
|
-
"""Run a subprocess command with timeout.
|
|
50
|
-
|
|
51
|
-
Args:
|
|
52
|
-
args: Command and arguments
|
|
53
|
-
timeout: Timeout in seconds (default: 30)
|
|
54
|
-
cwd: Working directory
|
|
55
|
-
|
|
56
|
-
Returns:
|
|
57
|
-
Tuple of (return_code, stdout, stderr)
|
|
58
|
-
|
|
59
|
-
Raises:
|
|
60
|
-
subprocess.TimeoutExpired: If command times out
|
|
61
|
-
"""
|
|
62
|
-
result = subprocess.run(
|
|
63
|
-
args,
|
|
64
|
-
timeout=timeout,
|
|
65
|
-
cwd=cwd,
|
|
66
|
-
capture_output=True,
|
|
67
|
-
text=True,
|
|
68
|
-
)
|
|
69
|
-
return result.returncode, result.stdout, result.stderr
|
|
1
|
+
"""Text truncation and error formatting utilities."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import subprocess
|
|
6
|
+
from typing import Any
|
|
7
|
+
|
|
8
|
+
__all__ = ["format_error", "run_command", "truncate"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def truncate(text: str, max_length: int = 4000, indicator: str = "...") -> str:
|
|
12
|
+
"""Truncate text to a maximum length with an indicator.
|
|
13
|
+
|
|
14
|
+
Args:
|
|
15
|
+
text: Text to truncate
|
|
16
|
+
max_length: Maximum length including indicator
|
|
17
|
+
indicator: String to append when truncated (default: "...")
|
|
18
|
+
|
|
19
|
+
Returns:
|
|
20
|
+
Truncated text with indicator, or original if within limit
|
|
21
|
+
"""
|
|
22
|
+
if len(text) <= max_length:
|
|
23
|
+
return text
|
|
24
|
+
return text[: max_length - len(indicator)] + indicator
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def format_error(message: str, details: dict[str, Any] | None = None) -> str:
|
|
28
|
+
"""Format an error message consistently.
|
|
29
|
+
|
|
30
|
+
Args:
|
|
31
|
+
message: Main error message
|
|
32
|
+
details: Optional additional details
|
|
33
|
+
|
|
34
|
+
Returns:
|
|
35
|
+
Formatted error string
|
|
36
|
+
"""
|
|
37
|
+
if details:
|
|
38
|
+
detail_str = ", ".join(f"{k}={v}" for k, v in details.items())
|
|
39
|
+
return f"Error: {message} ({detail_str})"
|
|
40
|
+
return f"Error: {message}"
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def run_command(
|
|
44
|
+
args: list[str],
|
|
45
|
+
*,
|
|
46
|
+
timeout: float = 30.0,
|
|
47
|
+
cwd: str | None = None,
|
|
48
|
+
) -> tuple[int, str, str]:
|
|
49
|
+
"""Run a subprocess command with timeout.
|
|
50
|
+
|
|
51
|
+
Args:
|
|
52
|
+
args: Command and arguments
|
|
53
|
+
timeout: Timeout in seconds (default: 30)
|
|
54
|
+
cwd: Working directory
|
|
55
|
+
|
|
56
|
+
Returns:
|
|
57
|
+
Tuple of (return_code, stdout, stderr)
|
|
58
|
+
|
|
59
|
+
Raises:
|
|
60
|
+
subprocess.TimeoutExpired: If command times out
|
|
61
|
+
"""
|
|
62
|
+
result = subprocess.run(
|
|
63
|
+
args,
|
|
64
|
+
timeout=timeout,
|
|
65
|
+
cwd=cwd,
|
|
66
|
+
capture_output=True,
|
|
67
|
+
text=True,
|
|
68
|
+
)
|
|
69
|
+
return result.returncode, result.stdout, result.stderr
|
ot_tools/__init__.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""OneTool built-in tools.
|
|
2
|
-
|
|
3
|
-
Tools are auto-discovered from Python files in this directory.
|
|
4
|
-
"""
|
|
1
|
+
"""OneTool built-in tools.
|
|
2
|
+
|
|
3
|
+
Tools are auto-discovered from Python files in this directory.
|
|
4
|
+
"""
|
ot_tools/_convert/__init__.py
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
"""Document conversion utilities for OneTool.
|
|
2
|
-
|
|
3
|
-
Provides PDF, Word, PowerPoint, and Excel to Markdown conversion
|
|
4
|
-
with LLM-optimised output including YAML frontmatter and TOC.
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
|
-
from ot_tools._convert.excel import convert_excel
|
|
8
|
-
from ot_tools._convert.pdf import convert_pdf
|
|
9
|
-
from ot_tools._convert.powerpoint import convert_powerpoint
|
|
10
|
-
from ot_tools._convert.word import convert_word
|
|
11
|
-
|
|
12
|
-
__all__ = ["convert_excel", "convert_pdf", "convert_powerpoint", "convert_word"]
|
|
1
|
+
"""Document conversion utilities for OneTool.
|
|
2
|
+
|
|
3
|
+
Provides PDF, Word, PowerPoint, and Excel to Markdown conversion
|
|
4
|
+
with LLM-optimised output including YAML frontmatter and TOC.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from ot_tools._convert.excel import convert_excel
|
|
8
|
+
from ot_tools._convert.pdf import convert_pdf
|
|
9
|
+
from ot_tools._convert.powerpoint import convert_powerpoint
|
|
10
|
+
from ot_tools._convert.word import convert_word
|
|
11
|
+
|
|
12
|
+
__all__ = ["convert_excel", "convert_pdf", "convert_powerpoint", "convert_word"]
|