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/shortcuts/__init__.py
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
"""Shortcuts system for OneTool.
|
|
2
|
-
|
|
3
|
-
Provides aliases and snippets for simplified tool invocation:
|
|
4
|
-
- Aliases: Short names mapping to full function names (e.g., ws -> brave.web_search)
|
|
5
|
-
- Snippets: Jinja2 templates with variable substitution ($wsq q1=AI q2=ML p=Compare)
|
|
6
|
-
"""
|
|
7
|
-
|
|
8
|
-
from ot.shortcuts.aliases import resolve_alias
|
|
9
|
-
from ot.shortcuts.snippets import expand_snippet, parse_snippet
|
|
10
|
-
|
|
11
|
-
__all__ = [
|
|
12
|
-
"expand_snippet",
|
|
13
|
-
"parse_snippet",
|
|
14
|
-
"resolve_alias",
|
|
15
|
-
]
|
|
1
|
+
"""Shortcuts system for OneTool.
|
|
2
|
+
|
|
3
|
+
Provides aliases and snippets for simplified tool invocation:
|
|
4
|
+
- Aliases: Short names mapping to full function names (e.g., ws -> brave.web_search)
|
|
5
|
+
- Snippets: Jinja2 templates with variable substitution ($wsq q1=AI q2=ML p=Compare)
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from ot.shortcuts.aliases import resolve_alias
|
|
9
|
+
from ot.shortcuts.snippets import expand_snippet, parse_snippet
|
|
10
|
+
|
|
11
|
+
__all__ = [
|
|
12
|
+
"expand_snippet",
|
|
13
|
+
"parse_snippet",
|
|
14
|
+
"resolve_alias",
|
|
15
|
+
]
|
ot/shortcuts/aliases.py
CHANGED
|
@@ -1,87 +1,87 @@
|
|
|
1
|
-
"""Alias resolution for OneTool shortcuts.
|
|
2
|
-
|
|
3
|
-
Resolves short alias names to their full namespaced function names.
|
|
4
|
-
E.g., ws(query="test") -> brave.web_search(query="test")
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
|
-
from __future__ import annotations
|
|
8
|
-
|
|
9
|
-
import re
|
|
10
|
-
from typing import TYPE_CHECKING
|
|
11
|
-
|
|
12
|
-
if TYPE_CHECKING:
|
|
13
|
-
from ot.config import OneToolConfig
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
def resolve_alias(code: str, config: OneToolConfig) -> str:
|
|
17
|
-
"""Resolve aliases in code to their full function names.
|
|
18
|
-
|
|
19
|
-
Replaces alias function calls with their target:
|
|
20
|
-
- ws(query="test") -> brave.web_search(query="test")
|
|
21
|
-
- c7(query="react") -> context7.search(query="react")
|
|
22
|
-
|
|
23
|
-
Args:
|
|
24
|
-
code: Python code potentially containing alias calls
|
|
25
|
-
config: Configuration with alias mappings
|
|
26
|
-
|
|
27
|
-
Returns:
|
|
28
|
-
Code with aliases resolved to full names
|
|
29
|
-
"""
|
|
30
|
-
if not config.alias:
|
|
31
|
-
return code
|
|
32
|
-
|
|
33
|
-
result = code
|
|
34
|
-
|
|
35
|
-
# Sort aliases by length (longest first) to avoid partial matches
|
|
36
|
-
# e.g., "wsb" should be matched before "ws"
|
|
37
|
-
sorted_aliases = sorted(config.alias.keys(), key=len, reverse=True)
|
|
38
|
-
|
|
39
|
-
for alias_name in sorted_aliases:
|
|
40
|
-
target = config.alias[alias_name]
|
|
41
|
-
|
|
42
|
-
# Match alias followed by ( but not preceded by . or alphanumeric
|
|
43
|
-
# This prevents matching "foo.ws(" or "aws("
|
|
44
|
-
pattern = rf"(?<![.\w]){re.escape(alias_name)}\("
|
|
45
|
-
|
|
46
|
-
if re.search(pattern, result):
|
|
47
|
-
result = re.sub(pattern, f"{target}(", result)
|
|
48
|
-
|
|
49
|
-
return result
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
def validate_aliases(config: OneToolConfig) -> list[str]:
|
|
53
|
-
"""Validate alias configuration for circular references.
|
|
54
|
-
|
|
55
|
-
Args:
|
|
56
|
-
config: Configuration with alias mappings
|
|
57
|
-
|
|
58
|
-
Returns:
|
|
59
|
-
List of validation errors (empty if valid)
|
|
60
|
-
"""
|
|
61
|
-
errors: list[str] = []
|
|
62
|
-
|
|
63
|
-
# Check for circular aliases
|
|
64
|
-
for alias_name, target in config.alias.items():
|
|
65
|
-
# Extract just the function name from target (before any dot)
|
|
66
|
-
target_base = target.split(".")[0] if "." in target else target
|
|
67
|
-
|
|
68
|
-
# Check if target points to another alias
|
|
69
|
-
if target_base in config.alias:
|
|
70
|
-
# Follow the chain to detect cycles
|
|
71
|
-
visited = {alias_name}
|
|
72
|
-
current = target_base
|
|
73
|
-
|
|
74
|
-
while current in config.alias:
|
|
75
|
-
if current in visited:
|
|
76
|
-
errors.append(
|
|
77
|
-
f"Circular alias detected: '{alias_name}' -> '{target}' "
|
|
78
|
-
f"creates a cycle through '{current}'"
|
|
79
|
-
)
|
|
80
|
-
break
|
|
81
|
-
visited.add(current)
|
|
82
|
-
next_target = config.alias[current]
|
|
83
|
-
current = (
|
|
84
|
-
next_target.split(".")[0] if "." in next_target else next_target
|
|
85
|
-
)
|
|
86
|
-
|
|
87
|
-
return errors
|
|
1
|
+
"""Alias resolution for OneTool shortcuts.
|
|
2
|
+
|
|
3
|
+
Resolves short alias names to their full namespaced function names.
|
|
4
|
+
E.g., ws(query="test") -> brave.web_search(query="test")
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import re
|
|
10
|
+
from typing import TYPE_CHECKING
|
|
11
|
+
|
|
12
|
+
if TYPE_CHECKING:
|
|
13
|
+
from ot.config import OneToolConfig
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def resolve_alias(code: str, config: OneToolConfig) -> str:
|
|
17
|
+
"""Resolve aliases in code to their full function names.
|
|
18
|
+
|
|
19
|
+
Replaces alias function calls with their target:
|
|
20
|
+
- ws(query="test") -> brave.web_search(query="test")
|
|
21
|
+
- c7(query="react") -> context7.search(query="react")
|
|
22
|
+
|
|
23
|
+
Args:
|
|
24
|
+
code: Python code potentially containing alias calls
|
|
25
|
+
config: Configuration with alias mappings
|
|
26
|
+
|
|
27
|
+
Returns:
|
|
28
|
+
Code with aliases resolved to full names
|
|
29
|
+
"""
|
|
30
|
+
if not config.alias:
|
|
31
|
+
return code
|
|
32
|
+
|
|
33
|
+
result = code
|
|
34
|
+
|
|
35
|
+
# Sort aliases by length (longest first) to avoid partial matches
|
|
36
|
+
# e.g., "wsb" should be matched before "ws"
|
|
37
|
+
sorted_aliases = sorted(config.alias.keys(), key=len, reverse=True)
|
|
38
|
+
|
|
39
|
+
for alias_name in sorted_aliases:
|
|
40
|
+
target = config.alias[alias_name]
|
|
41
|
+
|
|
42
|
+
# Match alias followed by ( but not preceded by . or alphanumeric
|
|
43
|
+
# This prevents matching "foo.ws(" or "aws("
|
|
44
|
+
pattern = rf"(?<![.\w]){re.escape(alias_name)}\("
|
|
45
|
+
|
|
46
|
+
if re.search(pattern, result):
|
|
47
|
+
result = re.sub(pattern, f"{target}(", result)
|
|
48
|
+
|
|
49
|
+
return result
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def validate_aliases(config: OneToolConfig) -> list[str]:
|
|
53
|
+
"""Validate alias configuration for circular references.
|
|
54
|
+
|
|
55
|
+
Args:
|
|
56
|
+
config: Configuration with alias mappings
|
|
57
|
+
|
|
58
|
+
Returns:
|
|
59
|
+
List of validation errors (empty if valid)
|
|
60
|
+
"""
|
|
61
|
+
errors: list[str] = []
|
|
62
|
+
|
|
63
|
+
# Check for circular aliases
|
|
64
|
+
for alias_name, target in config.alias.items():
|
|
65
|
+
# Extract just the function name from target (before any dot)
|
|
66
|
+
target_base = target.split(".")[0] if "." in target else target
|
|
67
|
+
|
|
68
|
+
# Check if target points to another alias
|
|
69
|
+
if target_base in config.alias:
|
|
70
|
+
# Follow the chain to detect cycles
|
|
71
|
+
visited = {alias_name}
|
|
72
|
+
current = target_base
|
|
73
|
+
|
|
74
|
+
while current in config.alias:
|
|
75
|
+
if current in visited:
|
|
76
|
+
errors.append(
|
|
77
|
+
f"Circular alias detected: '{alias_name}' -> '{target}' "
|
|
78
|
+
f"creates a cycle through '{current}'"
|
|
79
|
+
)
|
|
80
|
+
break
|
|
81
|
+
visited.add(current)
|
|
82
|
+
next_target = config.alias[current]
|
|
83
|
+
current = (
|
|
84
|
+
next_target.split(".")[0] if "." in next_target else next_target
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
return errors
|