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.
Files changed (81) hide show
  1. onetool/cli.py +63 -4
  2. onetool_mcp-1.0.0rc2.dist-info/METADATA +266 -0
  3. onetool_mcp-1.0.0rc2.dist-info/RECORD +129 -0
  4. {onetool_mcp-1.0.0b1.dist-info → onetool_mcp-1.0.0rc2.dist-info}/licenses/LICENSE.txt +1 -1
  5. {onetool_mcp-1.0.0b1.dist-info → onetool_mcp-1.0.0rc2.dist-info}/licenses/NOTICE.txt +54 -64
  6. ot/__main__.py +6 -6
  7. ot/config/__init__.py +48 -46
  8. ot/config/global_templates/__init__.py +2 -2
  9. ot/config/{defaults → global_templates}/diagram-templates/api-flow.mmd +33 -33
  10. ot/config/{defaults → global_templates}/diagram-templates/c4-context.puml +30 -30
  11. ot/config/{defaults → global_templates}/diagram-templates/class-diagram.mmd +87 -87
  12. ot/config/{defaults → global_templates}/diagram-templates/feature-mindmap.mmd +70 -70
  13. ot/config/{defaults → global_templates}/diagram-templates/microservices.d2 +81 -81
  14. ot/config/{defaults → global_templates}/diagram-templates/project-gantt.mmd +37 -37
  15. ot/config/{defaults → global_templates}/diagram-templates/state-machine.mmd +42 -42
  16. ot/config/global_templates/diagram.yaml +167 -0
  17. ot/config/global_templates/onetool.yaml +3 -1
  18. ot/config/{defaults → global_templates}/prompts.yaml +102 -97
  19. ot/config/global_templates/security.yaml +31 -0
  20. ot/config/global_templates/servers.yaml +93 -12
  21. ot/config/global_templates/snippets.yaml +5 -26
  22. ot/config/{defaults → global_templates}/tool_templates/__init__.py +7 -7
  23. ot/config/loader.py +221 -105
  24. ot/config/mcp.py +5 -1
  25. ot/config/secrets.py +192 -190
  26. ot/decorators.py +116 -116
  27. ot/executor/__init__.py +35 -35
  28. ot/executor/base.py +16 -16
  29. ot/executor/fence_processor.py +83 -83
  30. ot/executor/linter.py +142 -142
  31. ot/executor/pep723.py +288 -288
  32. ot/executor/runner.py +20 -6
  33. ot/executor/simple.py +163 -163
  34. ot/executor/validator.py +603 -164
  35. ot/http_client.py +145 -145
  36. ot/logging/__init__.py +37 -37
  37. ot/logging/entry.py +213 -213
  38. ot/logging/format.py +191 -188
  39. ot/logging/span.py +349 -349
  40. ot/meta.py +236 -14
  41. ot/paths.py +32 -49
  42. ot/prompts.py +218 -218
  43. ot/proxy/manager.py +14 -2
  44. ot/registry/__init__.py +189 -189
  45. ot/registry/parser.py +269 -269
  46. ot/server.py +330 -315
  47. ot/shortcuts/__init__.py +15 -15
  48. ot/shortcuts/aliases.py +87 -87
  49. ot/shortcuts/snippets.py +258 -258
  50. ot/stats/__init__.py +35 -35
  51. ot/stats/html.py +2 -2
  52. ot/stats/reader.py +354 -354
  53. ot/stats/timing.py +57 -57
  54. ot/support.py +63 -63
  55. ot/tools.py +1 -1
  56. ot/utils/batch.py +161 -161
  57. ot/utils/cache.py +120 -120
  58. ot/utils/exceptions.py +23 -23
  59. ot/utils/factory.py +178 -179
  60. ot/utils/format.py +65 -65
  61. ot/utils/http.py +202 -202
  62. ot/utils/platform.py +45 -45
  63. ot/utils/truncate.py +69 -69
  64. ot_tools/__init__.py +4 -4
  65. ot_tools/_convert/__init__.py +12 -12
  66. ot_tools/_convert/pdf.py +254 -254
  67. ot_tools/diagram.yaml +167 -167
  68. ot_tools/scaffold.py +2 -2
  69. ot_tools/transform.py +124 -19
  70. ot_tools/web_fetch.py +94 -43
  71. onetool_mcp-1.0.0b1.dist-info/METADATA +0 -163
  72. onetool_mcp-1.0.0b1.dist-info/RECORD +0 -132
  73. ot/config/defaults/bench.yaml +0 -4
  74. ot/config/defaults/onetool.yaml +0 -25
  75. ot/config/defaults/servers.yaml +0 -7
  76. ot/config/defaults/snippets.yaml +0 -4
  77. ot_tools/firecrawl.py +0 -732
  78. {onetool_mcp-1.0.0b1.dist-info → onetool_mcp-1.0.0rc2.dist-info}/WHEEL +0 -0
  79. {onetool_mcp-1.0.0b1.dist-info → onetool_mcp-1.0.0rc2.dist-info}/entry_points.txt +0 -0
  80. /ot/config/{defaults → global_templates}/tool_templates/extension.py +0 -0
  81. /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