toolbase 0.5.0__tar.gz → 0.6.0__tar.gz
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.
- {toolbase-0.5.0 → toolbase-0.6.0}/PKG-INFO +31 -2
- {toolbase-0.5.0 → toolbase-0.6.0}/README.md +30 -1
- {toolbase-0.5.0 → toolbase-0.6.0}/pyproject.toml +1 -1
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/__init__.py +4 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/_toolkit_host.py +5 -1
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/cli.py +149 -23
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/connect/orchestral.py +25 -4
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/envs/config.py +16 -1
- toolbase-0.6.0/toolbase/naming.py +88 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/serve/config.py +13 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/serve/orchestrator.py +253 -19
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/setup/declarative.py +14 -7
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/setup/storage.py +16 -6
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase.egg-info/SOURCES.txt +1 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/CHANGELOG.md +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/LICENSE +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/MANIFEST.in +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/setup.cfg +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/_setup_host.py +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/astro.py +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/auth.py +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/config.py +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/connect/__init__.py +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/connect/base.py +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/connect/claude_code.py +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/connect/codex.py +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/envs/__init__.py +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/envs/bundle_deps.py +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/envs/cache.py +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/envs/discovery.py +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/envs/manifest.py +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/envs/paths.py +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/envs/schema.py +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/hep.py +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/ingest.py +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/logging/__init__.py +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/logging/logger.py +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/neutrino.py +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/quantum.py +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/serve/__init__.py +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/serve/bundles.py +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/serve/profile_scaffold.py +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/serve/profiles.py +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/serve/proxy_tool.py +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/setup/__init__.py +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/setup/_rpc.py +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/setup/context.py +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/setup/downloads.py +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/setup/prompts.py +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/setup/runner.py +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/setup/schema.py +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/setup/validate_cache.py +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/skills.py +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/templates/Dockerfile.template +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/templates/README.md.template +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/templates/__init__.py.template +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/templates/mcp/__init__.py.template +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/templates/mcp/server_stdio.py.template +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/templates/requirements.txt.template +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/templates/setup.py.template +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/templates/skills/example_skill.md +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/templates/tool_example.py +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/templates/toolkit.yaml.template +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/toolkit.py +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/validation.py +0 -0
- {toolbase-0.5.0 → toolbase-0.6.0}/toolbase/versioning.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: toolbase
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.0
|
|
4
4
|
Summary: The community registry and CLI for AI agent toolkits - discover, share, and serve tools to AI agents over MCP
|
|
5
5
|
Author-email: Alex Roman <toolbase.dev@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -117,6 +117,35 @@ lists what's available. Power users can keep several named profiles
|
|
|
117
117
|
`tb connect claude-code --profile paper`) and switch between them; most
|
|
118
118
|
users only ever touch the default profile.
|
|
119
119
|
|
|
120
|
+
Tools are served namespaced as `<toolkit>__<tool>` by default, so two active
|
|
121
|
+
toolkits that both define, say, an `add` tool stay distinct (`calculator__add`
|
|
122
|
+
vs `matrix__add`). When names do overlap, `tb serve`, `tb list -v`, and
|
|
123
|
+
`tb install` flag it so it's never a surprise. Prefer bare names? `tb serve
|
|
124
|
+
--bare` (or `default.bare: true` in `serve.yaml`) advertises the plain `<tool>`;
|
|
125
|
+
a name shared by two toolkits stays qualified (both remain callable) with a
|
|
126
|
+
warning, and the rest are served bare.
|
|
127
|
+
|
|
128
|
+
## Share a project without sharing your machine
|
|
129
|
+
|
|
130
|
+
Toolkits that need configuration (an API key, a path to an external
|
|
131
|
+
binary) read it from three layers, later winning key-by-key:
|
|
132
|
+
|
|
133
|
+
| Layer | File | For |
|
|
134
|
+
|---|---|---|
|
|
135
|
+
| user | `~/.toolbase/config/<kit>.yaml` | your defaults and secrets, every project |
|
|
136
|
+
| project | `<repo>/.toolbase/config/<kit>.yaml` | committed, shared with the team |
|
|
137
|
+
| local | `<repo>/.toolbase/config/<kit>.local.yaml` | this project on *this* machine; gitignored |
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
tb config set calculator precision 10 # committed
|
|
141
|
+
tb config set calculator solver_path /opt/bin --local # yours alone
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Toolkit versions split the same way: `manifest.yaml` is committed so a
|
|
145
|
+
collaborator who clones the project and runs `tb install` gets the same
|
|
146
|
+
toolkits at the same versions, while `manifest.local.yaml` holds machine-local
|
|
147
|
+
pins like editable installs.
|
|
148
|
+
|
|
120
149
|
---
|
|
121
150
|
|
|
122
151
|
## Authoring a toolkit
|
|
@@ -163,7 +192,7 @@ Full reference with all flags: <https://toolbase-ai.com/docs/reference/commands>
|
|
|
163
192
|
| `tb disconnect HARNESS` | Remove toolbase from a harness |
|
|
164
193
|
| `tb logs` | Tail the serve log, live |
|
|
165
194
|
| `tb profile …` | Manage named profiles: `list \| show \| create \| edit \| delete \| set-default \| path \| tools` |
|
|
166
|
-
| `tb config …` | Manage per-toolkit config: `show \| init \| set \| unset \| edit \| path \| validate` |
|
|
195
|
+
| `tb config …` | Manage per-toolkit config: `show \| init \| set \| unset \| edit \| path \| validate` (`--user` / `--project` / `--local` pick the layer) |
|
|
167
196
|
| `tb setup TOOLKIT` | Run a toolkit's `setup.py` (`--reset`, `--check`) |
|
|
168
197
|
| `tb project init` | Create `.toolbase/` here |
|
|
169
198
|
| `tb init NAME` | Scaffold a toolkit from template |
|
|
@@ -76,6 +76,35 @@ lists what's available. Power users can keep several named profiles
|
|
|
76
76
|
`tb connect claude-code --profile paper`) and switch between them; most
|
|
77
77
|
users only ever touch the default profile.
|
|
78
78
|
|
|
79
|
+
Tools are served namespaced as `<toolkit>__<tool>` by default, so two active
|
|
80
|
+
toolkits that both define, say, an `add` tool stay distinct (`calculator__add`
|
|
81
|
+
vs `matrix__add`). When names do overlap, `tb serve`, `tb list -v`, and
|
|
82
|
+
`tb install` flag it so it's never a surprise. Prefer bare names? `tb serve
|
|
83
|
+
--bare` (or `default.bare: true` in `serve.yaml`) advertises the plain `<tool>`;
|
|
84
|
+
a name shared by two toolkits stays qualified (both remain callable) with a
|
|
85
|
+
warning, and the rest are served bare.
|
|
86
|
+
|
|
87
|
+
## Share a project without sharing your machine
|
|
88
|
+
|
|
89
|
+
Toolkits that need configuration (an API key, a path to an external
|
|
90
|
+
binary) read it from three layers, later winning key-by-key:
|
|
91
|
+
|
|
92
|
+
| Layer | File | For |
|
|
93
|
+
|---|---|---|
|
|
94
|
+
| user | `~/.toolbase/config/<kit>.yaml` | your defaults and secrets, every project |
|
|
95
|
+
| project | `<repo>/.toolbase/config/<kit>.yaml` | committed, shared with the team |
|
|
96
|
+
| local | `<repo>/.toolbase/config/<kit>.local.yaml` | this project on *this* machine; gitignored |
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
tb config set calculator precision 10 # committed
|
|
100
|
+
tb config set calculator solver_path /opt/bin --local # yours alone
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Toolkit versions split the same way: `manifest.yaml` is committed so a
|
|
104
|
+
collaborator who clones the project and runs `tb install` gets the same
|
|
105
|
+
toolkits at the same versions, while `manifest.local.yaml` holds machine-local
|
|
106
|
+
pins like editable installs.
|
|
107
|
+
|
|
79
108
|
---
|
|
80
109
|
|
|
81
110
|
## Authoring a toolkit
|
|
@@ -122,7 +151,7 @@ Full reference with all flags: <https://toolbase-ai.com/docs/reference/commands>
|
|
|
122
151
|
| `tb disconnect HARNESS` | Remove toolbase from a harness |
|
|
123
152
|
| `tb logs` | Tail the serve log, live |
|
|
124
153
|
| `tb profile …` | Manage named profiles: `list \| show \| create \| edit \| delete \| set-default \| path \| tools` |
|
|
125
|
-
| `tb config …` | Manage per-toolkit config: `show \| init \| set \| unset \| edit \| path \| validate` |
|
|
154
|
+
| `tb config …` | Manage per-toolkit config: `show \| init \| set \| unset \| edit \| path \| validate` (`--user` / `--project` / `--local` pick the layer) |
|
|
126
155
|
| `tb setup TOOLKIT` | Run a toolkit's `setup.py` (`--reset`, `--check`) |
|
|
127
156
|
| `tb project init` | Create `.toolbase/` here |
|
|
128
157
|
| `tb init NAME` | Scaffold a toolkit from template |
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "toolbase"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.6.0"
|
|
8
8
|
description = "The community registry and CLI for AI agent toolkits - discover, share, and serve tools to AI agents over MCP"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.12"
|
|
@@ -22,6 +22,10 @@ except PackageNotFoundError:
|
|
|
22
22
|
|
|
23
23
|
__author__ = "Alex Roman"
|
|
24
24
|
|
|
25
|
+
# The canonical tool-naming rule, public so external integrators (e.g.
|
|
26
|
+
# toolbench's `python:` bridge) reproduce served names without re-deriving them.
|
|
27
|
+
from .naming import mcp_tool_name, namespaced_tool_name, strip_tool_suffix
|
|
28
|
+
|
|
25
29
|
# Placeholder imports for future toolkit categories
|
|
26
30
|
# from .astro import aster
|
|
27
31
|
# from .hep import heptapod
|
|
@@ -363,11 +363,15 @@ def _import_explicit_tools(
|
|
|
363
363
|
# ``inspiresearch``) was a single-blob lowercase that lost
|
|
364
364
|
# word boundaries — hard for the agent to parse and not
|
|
365
365
|
# something the author could override per-tool.
|
|
366
|
+
# Resolve the wire name via the one canonical rule (toolbase.naming),
|
|
367
|
+
# keeping the host's precedence: toolkit.yaml display_name >
|
|
368
|
+
# @define_tool display_name (already on the instance) > stripped class.
|
|
369
|
+
from .naming import mcp_tool_name
|
|
366
370
|
yaml_display = entry.get("display_name") if isinstance(entry, dict) else None
|
|
367
371
|
if isinstance(yaml_display, str) and yaml_display:
|
|
368
372
|
instance._mcp_display_name = yaml_display
|
|
369
373
|
elif not getattr(instance, "_mcp_display_name", None):
|
|
370
|
-
instance._mcp_display_name = attr_name
|
|
374
|
+
instance._mcp_display_name = mcp_tool_name(attr_name)
|
|
371
375
|
tools.append(instance)
|
|
372
376
|
except Exception as exc:
|
|
373
377
|
_emit_tool_skip(
|
|
@@ -1825,10 +1825,18 @@ def _layer_option(f):
|
|
|
1825
1825
|
"--user", "layer_user", is_flag=True, default=False,
|
|
1826
1826
|
help="Target the user layer explicitly.",
|
|
1827
1827
|
)(f)
|
|
1828
|
+
f = click.option(
|
|
1829
|
+
"--local", "layer_local", is_flag=True, default=False,
|
|
1830
|
+
help=(
|
|
1831
|
+
"Target the project-LOCAL layer: config/<toolkit>.local.yaml, "
|
|
1832
|
+
"project-scoped but gitignored — machine truth like absolute "
|
|
1833
|
+
"tool paths. Wins over the committed project layer."
|
|
1834
|
+
),
|
|
1835
|
+
)(f)
|
|
1828
1836
|
f = click.option(
|
|
1829
1837
|
"--layer", "layer_explicit",
|
|
1830
|
-
type=click.Choice(["user", "project"]), default=None,
|
|
1831
|
-
help="Target a specific config layer (alternative to --user/--project).",
|
|
1838
|
+
type=click.Choice(["user", "project", "local"]), default=None,
|
|
1839
|
+
help="Target a specific config layer (alternative to --user/--project/--local).",
|
|
1832
1840
|
)(f)
|
|
1833
1841
|
return f
|
|
1834
1842
|
|
|
@@ -1838,6 +1846,7 @@ def _resolve_config_layer(
|
|
|
1838
1846
|
layer_explicit: Optional[str],
|
|
1839
1847
|
layer_user: bool,
|
|
1840
1848
|
layer_project: bool,
|
|
1849
|
+
layer_local: bool = False,
|
|
1841
1850
|
default_context: str = "auto",
|
|
1842
1851
|
) -> Tuple[str, Optional[Path]]:
|
|
1843
1852
|
"""Resolve the per-command effective layer.
|
|
@@ -1860,9 +1869,11 @@ def _resolve_config_layer(
|
|
|
1860
1869
|
explicit.append("user")
|
|
1861
1870
|
if layer_project:
|
|
1862
1871
|
explicit.append("project")
|
|
1872
|
+
if layer_local:
|
|
1873
|
+
explicit.append("local")
|
|
1863
1874
|
if len(explicit) > 1:
|
|
1864
1875
|
raise click.UsageError(
|
|
1865
|
-
"--layer / --user / --project are mutually exclusive."
|
|
1876
|
+
"--layer / --user / --project / --local are mutually exclusive."
|
|
1866
1877
|
)
|
|
1867
1878
|
|
|
1868
1879
|
if explicit:
|
|
@@ -1873,16 +1884,17 @@ def _resolve_config_layer(
|
|
|
1873
1884
|
# the user layer.
|
|
1874
1885
|
return "project", _cwd_project_root()
|
|
1875
1886
|
|
|
1876
|
-
# Explicit layer specified.
|
|
1877
|
-
|
|
1878
|
-
|
|
1887
|
+
# Explicit layer specified. "local" is project-scoped too — same
|
|
1888
|
+
# root discovery, different (gitignored) file.
|
|
1889
|
+
if layer in ("project", "local"):
|
|
1890
|
+
return layer, _cwd_project_root()
|
|
1879
1891
|
return "user", None
|
|
1880
1892
|
|
|
1881
1893
|
|
|
1882
1894
|
@config.command(name="path")
|
|
1883
1895
|
@click.argument("toolkit_name")
|
|
1884
1896
|
@_layer_option
|
|
1885
|
-
def config_path_cmd(toolkit_name, layer_explicit, layer_user, layer_project):
|
|
1897
|
+
def config_path_cmd(toolkit_name, layer_explicit, layer_user, layer_project, layer_local):
|
|
1886
1898
|
"""Print the absolute path to a toolkit's config file.
|
|
1887
1899
|
|
|
1888
1900
|
Defaults to the active layer for the current context (project layer
|
|
@@ -1894,6 +1906,7 @@ def config_path_cmd(toolkit_name, layer_explicit, layer_user, layer_project):
|
|
|
1894
1906
|
layer, project_root = _resolve_config_layer(
|
|
1895
1907
|
layer_explicit=layer_explicit,
|
|
1896
1908
|
layer_user=layer_user, layer_project=layer_project,
|
|
1909
|
+
layer_local=layer_local,
|
|
1897
1910
|
)
|
|
1898
1911
|
print(_cfg_path(toolkit_name, layer=layer, project_root=project_root))
|
|
1899
1912
|
|
|
@@ -1901,7 +1914,7 @@ def config_path_cmd(toolkit_name, layer_explicit, layer_user, layer_project):
|
|
|
1901
1914
|
@config.command(name="show")
|
|
1902
1915
|
@click.argument("toolkit_name")
|
|
1903
1916
|
@_layer_option
|
|
1904
|
-
def config_show(toolkit_name, layer_explicit, layer_user, layer_project):
|
|
1917
|
+
def config_show(toolkit_name, layer_explicit, layer_user, layer_project, layer_local):
|
|
1905
1918
|
"""Show a toolkit's effective configuration.
|
|
1906
1919
|
|
|
1907
1920
|
Default (no flags): merged view of user + project layers, with each
|
|
@@ -2073,7 +2086,7 @@ def config_show(toolkit_name, layer_explicit, layer_user, layer_project):
|
|
|
2073
2086
|
@config.command(name="edit")
|
|
2074
2087
|
@click.argument("toolkit_name")
|
|
2075
2088
|
@_layer_option
|
|
2076
|
-
def config_edit(toolkit_name, layer_explicit, layer_user, layer_project):
|
|
2089
|
+
def config_edit(toolkit_name, layer_explicit, layer_user, layer_project, layer_local):
|
|
2077
2090
|
"""Open the toolkit's config file in $EDITOR.
|
|
2078
2091
|
|
|
2079
2092
|
Defaults to the project layer in a project context, the user layer
|
|
@@ -2096,6 +2109,7 @@ def config_edit(toolkit_name, layer_explicit, layer_user, layer_project):
|
|
|
2096
2109
|
layer, project_root = _resolve_config_layer(
|
|
2097
2110
|
layer_explicit=layer_explicit,
|
|
2098
2111
|
layer_user=layer_user, layer_project=layer_project,
|
|
2112
|
+
layer_local=layer_local,
|
|
2099
2113
|
)
|
|
2100
2114
|
cfg_file = _cfg_path(
|
|
2101
2115
|
toolkit_name, layer=layer, project_root=project_root,
|
|
@@ -2165,7 +2179,7 @@ def config_edit(toolkit_name, layer_explicit, layer_user, layer_project):
|
|
|
2165
2179
|
@_layer_option
|
|
2166
2180
|
def config_set(
|
|
2167
2181
|
toolkit_name, key, value,
|
|
2168
|
-
layer_explicit, layer_user, layer_project,
|
|
2182
|
+
layer_explicit, layer_user, layer_project, layer_local,
|
|
2169
2183
|
):
|
|
2170
2184
|
"""Set one config field on a toolkit (preserves other fields/comments).
|
|
2171
2185
|
|
|
@@ -2207,11 +2221,16 @@ def config_set(
|
|
|
2207
2221
|
layer, project_root = _resolve_config_layer(
|
|
2208
2222
|
layer_explicit=layer_explicit,
|
|
2209
2223
|
layer_user=layer_user, layer_project=layer_project,
|
|
2224
|
+
layer_local=layer_local,
|
|
2210
2225
|
)
|
|
2211
|
-
set_config_value(
|
|
2226
|
+
cfg_written = set_config_value(
|
|
2212
2227
|
toolkit_name, key, parsed,
|
|
2213
2228
|
layer=layer, project_root=project_root,
|
|
2214
2229
|
)
|
|
2230
|
+
if layer == "local":
|
|
2231
|
+
# config/ sits one level below .toolbase/ — keep the local
|
|
2232
|
+
# layer out of git the same way editable pins are.
|
|
2233
|
+
_ensure_toolbase_gitignore(cfg_written.parent.parent)
|
|
2215
2234
|
cfg_file = _cfg_path(
|
|
2216
2235
|
toolkit_name, layer=layer, project_root=project_root,
|
|
2217
2236
|
)
|
|
@@ -2227,7 +2246,7 @@ def config_set(
|
|
|
2227
2246
|
@_layer_option
|
|
2228
2247
|
def config_unset(
|
|
2229
2248
|
toolkit_name, key,
|
|
2230
|
-
layer_explicit, layer_user, layer_project,
|
|
2249
|
+
layer_explicit, layer_user, layer_project, layer_local,
|
|
2231
2250
|
):
|
|
2232
2251
|
"""Remove one config field from a toolkit's config file.
|
|
2233
2252
|
|
|
@@ -2239,6 +2258,7 @@ def config_unset(
|
|
|
2239
2258
|
layer, project_root = _resolve_config_layer(
|
|
2240
2259
|
layer_explicit=layer_explicit,
|
|
2241
2260
|
layer_user=layer_user, layer_project=layer_project,
|
|
2261
|
+
layer_local=layer_local,
|
|
2242
2262
|
)
|
|
2243
2263
|
removed = unset_config_value(
|
|
2244
2264
|
toolkit_name, key, layer=layer, project_root=project_root,
|
|
@@ -2329,7 +2349,7 @@ def _render_config_scaffold(toolkit_name: str, schema, source_path: Path) -> str
|
|
|
2329
2349
|
help="Overwrite an existing config file.",
|
|
2330
2350
|
)
|
|
2331
2351
|
def config_init(
|
|
2332
|
-
toolkit_name, layer_explicit, layer_user, layer_project, force,
|
|
2352
|
+
toolkit_name, layer_explicit, layer_user, layer_project, layer_local, force,
|
|
2333
2353
|
):
|
|
2334
2354
|
"""Scaffold a commented YAML config file from the toolkit's ``config:`` schema.
|
|
2335
2355
|
|
|
@@ -2359,6 +2379,7 @@ def config_init(
|
|
|
2359
2379
|
layer, project_root = _resolve_config_layer(
|
|
2360
2380
|
layer_explicit=layer_explicit,
|
|
2361
2381
|
layer_user=layer_user, layer_project=layer_project,
|
|
2382
|
+
layer_local=layer_local,
|
|
2362
2383
|
)
|
|
2363
2384
|
out_path = _cfg_path(
|
|
2364
2385
|
toolkit_name, layer=layer, project_root=project_root,
|
|
@@ -3480,6 +3501,17 @@ def _pin_after_install(
|
|
|
3480
3501
|
)
|
|
3481
3502
|
|
|
3482
3503
|
|
|
3504
|
+
def _ensure_toolbase_gitignore(tb_dir: Path) -> None:
|
|
3505
|
+
"""Drop the canonical .toolbase/.gitignore if none exists.
|
|
3506
|
+
|
|
3507
|
+
Covers both machine-local layers (pins and config). Created only
|
|
3508
|
+
when absent — an existing file is the user's to manage.
|
|
3509
|
+
"""
|
|
3510
|
+
gitignore = tb_dir / ".gitignore"
|
|
3511
|
+
if not gitignore.exists():
|
|
3512
|
+
gitignore.write_text("manifest.local.yaml\nconfig/*.local.yaml\n")
|
|
3513
|
+
|
|
3514
|
+
|
|
3483
3515
|
def _pin_editable_local(name: str, *, local_scope: bool) -> None:
|
|
3484
3516
|
"""Pin (name, "editable") into the machine-local manifest layer.
|
|
3485
3517
|
|
|
@@ -3508,9 +3540,7 @@ def _pin_editable_local(name: str, *, local_scope: bool) -> None:
|
|
|
3508
3540
|
project_root = _default_project_root()
|
|
3509
3541
|
local_path = _local_manifest_path(_project_manifest_path(project_root))
|
|
3510
3542
|
_add_pin(local_path, name, "editable")
|
|
3511
|
-
|
|
3512
|
-
if not gitignore.exists():
|
|
3513
|
-
gitignore.write_text("manifest.local.yaml\n")
|
|
3543
|
+
_ensure_toolbase_gitignore(local_path.parent)
|
|
3514
3544
|
console.print(
|
|
3515
3545
|
f"[dim]Pinned editable in {local_path.name} "
|
|
3516
3546
|
f"(machine-local, gitignored).[/dim]"
|
|
@@ -3872,6 +3902,7 @@ def _install_from_path(
|
|
|
3872
3902
|
f"\n[bold green]✓ Successfully installed {name} "
|
|
3873
3903
|
f"{'(editable)' if editable else 'v' + version}[/bold green]\n"
|
|
3874
3904
|
)
|
|
3905
|
+
_warn_install_name_collisions(name)
|
|
3875
3906
|
if editable:
|
|
3876
3907
|
console.print(f"Source: [cyan]{source_path}[/cyan] (live link)")
|
|
3877
3908
|
console.print(
|
|
@@ -4936,6 +4967,7 @@ def install(ctx, name, version, global_scope, local_scope, editable, no_skills,
|
|
|
4936
4967
|
|
|
4937
4968
|
# Step 9: Success message
|
|
4938
4969
|
console.print(f"\n[bold green]✓ Successfully installed {name} v{version}[/bold green]\n")
|
|
4970
|
+
_warn_install_name_collisions(name)
|
|
4939
4971
|
|
|
4940
4972
|
if activate_after:
|
|
4941
4973
|
_post_install_activate(
|
|
@@ -5192,6 +5224,10 @@ def list_cmd(as_json, verbose):
|
|
|
5192
5224
|
# Resolve the active profile to mark which toolkits are active (served).
|
|
5193
5225
|
# Best-effort: no active profile => everything inactive, no error.
|
|
5194
5226
|
resolved_profile, active_set = _list_resolve_active()
|
|
5227
|
+
# Tool names shared by >1 active toolkit — annotated per row under -v so
|
|
5228
|
+
# overlap (harmless while namespaced, a clash if ever served bare) is
|
|
5229
|
+
# visible. Only meaningful with an active multi-toolkit profile.
|
|
5230
|
+
_name_collisions = _active_name_collisions(active_set) if verbose else {}
|
|
5195
5231
|
active_profile = resolved_profile.name if resolved_profile is not None else None
|
|
5196
5232
|
|
|
5197
5233
|
if as_json:
|
|
@@ -5305,7 +5341,7 @@ def list_cmd(as_json, verbose):
|
|
|
5305
5341
|
".toolbase/manifest.local.yaml to serve your checkout[/yellow]"
|
|
5306
5342
|
)
|
|
5307
5343
|
if verbose:
|
|
5308
|
-
_list_print_tools_verbose(name, resolved_profile)
|
|
5344
|
+
_list_print_tools_verbose(name, resolved_profile, _name_collisions)
|
|
5309
5345
|
|
|
5310
5346
|
if any_pin_applied and manifest_path is not None:
|
|
5311
5347
|
# Render the manifest path relative to cwd when possible — keeps
|
|
@@ -5343,7 +5379,68 @@ def _list_resolve_active():
|
|
|
5343
5379
|
return resolved, active
|
|
5344
5380
|
|
|
5345
5381
|
|
|
5346
|
-
def
|
|
5382
|
+
def _toolkit_declared_tool_names(name: str) -> set:
|
|
5383
|
+
"""Bare tool names a toolkit declares in its ``toolkit.yaml`` (empty for
|
|
5384
|
+
implicit-form toolkits that don't enumerate tools there)."""
|
|
5385
|
+
from .serve.orchestrator import (
|
|
5386
|
+
discover_toolkits, _resolve_bundle_availability,
|
|
5387
|
+
)
|
|
5388
|
+
disc = next(
|
|
5389
|
+
(d for d in discover_toolkits()
|
|
5390
|
+
if d.name == name and d.skip_reason is None),
|
|
5391
|
+
None,
|
|
5392
|
+
)
|
|
5393
|
+
if disc is None:
|
|
5394
|
+
return set()
|
|
5395
|
+
_availability, name_to_bundles = _resolve_bundle_availability(disc)
|
|
5396
|
+
return set(name_to_bundles or {})
|
|
5397
|
+
|
|
5398
|
+
|
|
5399
|
+
def _active_name_collisions(active_toolkit_names) -> dict:
|
|
5400
|
+
"""``{bare_name: [toolkits]}`` for tool names declared by more than one of
|
|
5401
|
+
the given (active) toolkits — the ``tb list -v`` / ``tb install`` view of
|
|
5402
|
+
:func:`toolbase.naming.find_name_collisions`."""
|
|
5403
|
+
from .naming import find_name_collisions
|
|
5404
|
+
return find_name_collisions(
|
|
5405
|
+
{tk: _toolkit_declared_tool_names(tk) for tk in active_toolkit_names}
|
|
5406
|
+
)
|
|
5407
|
+
|
|
5408
|
+
|
|
5409
|
+
def _warn_install_name_collisions(new_toolkit: str) -> None:
|
|
5410
|
+
"""After an install, warn if the toolkit shares any bare tool name with an
|
|
5411
|
+
already-active toolkit (a clash only if ever served un-namespaced; harmless
|
|
5412
|
+
under the default ``<toolkit>__<tool>`` form). Best-effort — never raises,
|
|
5413
|
+
never blocks the install."""
|
|
5414
|
+
try:
|
|
5415
|
+
_resolved, active = _list_resolve_active()
|
|
5416
|
+
others = {tk for tk in active if tk != new_toolkit}
|
|
5417
|
+
new_tools = _toolkit_declared_tool_names(new_toolkit)
|
|
5418
|
+
if not others or not new_tools:
|
|
5419
|
+
return
|
|
5420
|
+
overlaps = {}
|
|
5421
|
+
for tk in others:
|
|
5422
|
+
shared = sorted(new_tools & _toolkit_declared_tool_names(tk))
|
|
5423
|
+
if shared:
|
|
5424
|
+
overlaps[tk] = shared
|
|
5425
|
+
if not overlaps:
|
|
5426
|
+
return
|
|
5427
|
+
console.print(
|
|
5428
|
+
f"\n[yellow]⚠ {new_toolkit} shares tool name(s) with active "
|
|
5429
|
+
"toolkit(s):[/yellow]"
|
|
5430
|
+
)
|
|
5431
|
+
for tk, shared in sorted(overlaps.items()):
|
|
5432
|
+
console.print(f" [dim]{', '.join(shared)} — also in {tk}[/dim]")
|
|
5433
|
+
console.print(
|
|
5434
|
+
" [dim]Served distinctly as <toolkit>__<tool>, so this is only a "
|
|
5435
|
+
"clash if tools are served un-namespaced. To pre-empt it: set a "
|
|
5436
|
+
"toolkit.yaml display_name:, tb deactivate one, or keep the "
|
|
5437
|
+
"namespaced default.[/dim]"
|
|
5438
|
+
)
|
|
5439
|
+
except Exception:
|
|
5440
|
+
pass # a heads-up must never break install
|
|
5441
|
+
|
|
5442
|
+
|
|
5443
|
+
def _list_print_tools_verbose(name, resolved_profile, collisions=None) -> None:
|
|
5347
5444
|
"""Print a toolkit's declared tools with served/hidden status.
|
|
5348
5445
|
|
|
5349
5446
|
Tool list comes from the toolkit.yaml declaration (explicit form);
|
|
@@ -5433,7 +5530,11 @@ def _list_print_tools_verbose(name, resolved_profile) -> None:
|
|
|
5433
5530
|
f" [yellow](needs config: "
|
|
5434
5531
|
f"{'; '.join(missing_per_bundle)})[/yellow]"
|
|
5435
5532
|
)
|
|
5436
|
-
|
|
5533
|
+
clash = ""
|
|
5534
|
+
others = [tk for tk in (collisions or {}).get(tool, []) if tk != name]
|
|
5535
|
+
if others:
|
|
5536
|
+
clash = f" [yellow](also in: {', '.join(others)})[/yellow]"
|
|
5537
|
+
console.print(f" {mk} {tool}{btag}{gate}{clash}")
|
|
5437
5538
|
|
|
5438
5539
|
if install_gated:
|
|
5439
5540
|
if len(install_gated) >= _VERBOSE_INSTALL_GATED_COLLAPSE_THRESHOLD:
|
|
@@ -6005,8 +6106,17 @@ def toolbase_config_dir() -> Path:
|
|
|
6005
6106
|
'--no-tui', is_flag=True, default=True,
|
|
6006
6107
|
help='Run without TUI. Currently the only supported mode.',
|
|
6007
6108
|
)
|
|
6109
|
+
@click.option(
|
|
6110
|
+
'--bare/--qualified', 'bare_flag', default=None,
|
|
6111
|
+
help=(
|
|
6112
|
+
'Advertise tools un-namespaced (<tool>) instead of the default '
|
|
6113
|
+
'qualified <toolkit>__<tool>. Overrides serve.yaml default.bare for '
|
|
6114
|
+
'this invocation. A name shared by two toolkits stays qualified (both '
|
|
6115
|
+
'callable) with a warning; the rest are served bare.'
|
|
6116
|
+
),
|
|
6117
|
+
)
|
|
6008
6118
|
@click.pass_context
|
|
6009
|
-
def serve(ctx, profile_name, dry_run, call_timeout, no_tui):
|
|
6119
|
+
def serve(ctx, profile_name, dry_run, call_timeout, no_tui, bare_flag):
|
|
6010
6120
|
"""
|
|
6011
6121
|
Start the MCP server for the active profile's tools.
|
|
6012
6122
|
|
|
@@ -6063,8 +6173,18 @@ def serve(ctx, profile_name, dry_run, call_timeout, no_tui):
|
|
|
6063
6173
|
console.print(f"[red]Error in serve config:[/red] {e}")
|
|
6064
6174
|
sys.exit(1)
|
|
6065
6175
|
|
|
6176
|
+
# Bare naming: explicit --bare/--qualified wins; else serve.yaml default.bare.
|
|
6177
|
+
if bare_flag is not None:
|
|
6178
|
+
bare = bare_flag
|
|
6179
|
+
else:
|
|
6180
|
+
from .serve.profiles import load_merged_serve_config
|
|
6181
|
+
try:
|
|
6182
|
+
bare = load_merged_serve_config(project_root).default.bare
|
|
6183
|
+
except ServeConfigError:
|
|
6184
|
+
bare = False
|
|
6185
|
+
|
|
6066
6186
|
if dry_run:
|
|
6067
|
-
_print_resolution(profile)
|
|
6187
|
+
_print_resolution(profile, bare=bare)
|
|
6068
6188
|
return
|
|
6069
6189
|
|
|
6070
6190
|
# The MCP stdio protocol owns this process's stdin/stdout, so we do NOT
|
|
@@ -6072,11 +6192,12 @@ def serve(ctx, profile_name, dry_run, call_timeout, no_tui):
|
|
|
6072
6192
|
# orchestrator builds its own stderr-bound Console.
|
|
6073
6193
|
from .serve.orchestrator import DEFAULT_CALL_TIMEOUT_S, serve as _serve_entry
|
|
6074
6194
|
timeout_s = call_timeout if call_timeout is not None else DEFAULT_CALL_TIMEOUT_S
|
|
6075
|
-
rc = _serve_entry(no_tui=True, profile=profile, call_timeout_s=timeout_s
|
|
6195
|
+
rc = _serve_entry(no_tui=True, profile=profile, call_timeout_s=timeout_s,
|
|
6196
|
+
bare=bare)
|
|
6076
6197
|
sys.exit(rc)
|
|
6077
6198
|
|
|
6078
6199
|
|
|
6079
|
-
def _print_resolution(profile) -> None:
|
|
6200
|
+
def _print_resolution(profile, bare: bool = False) -> None:
|
|
6080
6201
|
"""Render --dry-run output: the active profile and what it selects.
|
|
6081
6202
|
|
|
6082
6203
|
Shows the profile name + provenance, each selected toolkit and its
|
|
@@ -6089,6 +6210,11 @@ def _print_resolution(profile) -> None:
|
|
|
6089
6210
|
f"\n[bold]Active profile:[/bold] [cyan]{profile.name}[/cyan] "
|
|
6090
6211
|
f"[dim]({profile.source})[/dim]"
|
|
6091
6212
|
)
|
|
6213
|
+
console.print(
|
|
6214
|
+
f"[bold]Naming:[/bold] "
|
|
6215
|
+
+ ("[yellow]bare <tool>[/yellow] (un-namespaced)" if bare
|
|
6216
|
+
else "qualified [cyan]<toolkit>__<tool>[/cyan]")
|
|
6217
|
+
)
|
|
6092
6218
|
if not profile.toolkits:
|
|
6093
6219
|
console.print(" [dim](profile selects no toolkits)[/dim]")
|
|
6094
6220
|
for tk, sel in profile.toolkits.items():
|
|
@@ -36,7 +36,7 @@ from __future__ import annotations
|
|
|
36
36
|
import contextlib
|
|
37
37
|
import io
|
|
38
38
|
from pathlib import Path
|
|
39
|
-
from typing import Any, Dict, Iterator, List, Optional
|
|
39
|
+
from typing import Any, Dict, Iterator, List, Optional, Union
|
|
40
40
|
|
|
41
41
|
from ..serve.orchestrator import DEFAULT_CALL_TIMEOUT_S, Orchestrator
|
|
42
42
|
|
|
@@ -64,18 +64,21 @@ def is_orchestral_available() -> bool:
|
|
|
64
64
|
return importlib.util.find_spec("orchestral") is not None
|
|
65
65
|
|
|
66
66
|
|
|
67
|
-
def _resolve(project_root
|
|
67
|
+
def _resolve(project_root, profile: Optional[str]):
|
|
68
68
|
"""Resolve the active profile, auto-discovering the project root.
|
|
69
69
|
|
|
70
70
|
Mirrors ``tb serve``: if ``project_root`` is None we walk up from the
|
|
71
71
|
cwd for a project; absent one, resolution falls through to the user
|
|
72
|
-
layer.
|
|
72
|
+
layer. ``project_root`` may be a ``str`` or ``Path``; a ``str`` is
|
|
73
|
+
coerced (downstream path handling requires ``Path``).
|
|
73
74
|
"""
|
|
74
75
|
from ..envs import find_project_root
|
|
75
76
|
from ..serve.profiles import resolve_profile
|
|
76
77
|
|
|
77
78
|
if project_root is None:
|
|
78
79
|
project_root = find_project_root()
|
|
80
|
+
elif not isinstance(project_root, Path):
|
|
81
|
+
project_root = Path(project_root)
|
|
79
82
|
return resolve_profile(project_root, cli_profile=profile)
|
|
80
83
|
|
|
81
84
|
|
|
@@ -90,10 +93,12 @@ def _null_console():
|
|
|
90
93
|
def toolbase_tools(
|
|
91
94
|
*,
|
|
92
95
|
profile: Optional[str] = None,
|
|
93
|
-
project_root: Optional[Path] = None,
|
|
96
|
+
project_root: Optional[Union[str, Path]] = None,
|
|
94
97
|
call_timeout_s: float = DEFAULT_CALL_TIMEOUT_S,
|
|
95
98
|
quiet: bool = False,
|
|
96
99
|
config_overrides: Optional[Dict[str, Any]] = None,
|
|
100
|
+
report: Optional[List[Dict[str, Any]]] = None,
|
|
101
|
+
bare: bool = False,
|
|
97
102
|
) -> Iterator[List[Any]]:
|
|
98
103
|
"""Spin up toolbase's served tools and yield them as orchestral BaseTools.
|
|
99
104
|
|
|
@@ -119,6 +124,14 @@ def toolbase_tools(
|
|
|
119
124
|
agent calls read/write the same tree the agent's other
|
|
120
125
|
tools see. Keys a toolkit doesn't declare as StateFields
|
|
121
126
|
are ignored by the host.
|
|
127
|
+
report: optional list; when provided, it is extended with one
|
|
128
|
+
``{toolkit, advertised, served, hidden}`` dict per served toolkit
|
|
129
|
+
so the caller can detect and surface dropped tools even under
|
|
130
|
+
``quiet=True`` (where the console diagnostics are suppressed).
|
|
131
|
+
bare: advertise tools un-namespaced (``<tool>``) instead of the default
|
|
132
|
+
qualified ``<toolkit>__<tool>``. A name shared by two toolkits
|
|
133
|
+
falls back to its qualified form (both stay callable) with a
|
|
134
|
+
warning; the rest are served bare.
|
|
122
135
|
|
|
123
136
|
Yields:
|
|
124
137
|
A list of orchestral ``BaseTool`` instances (namespaced
|
|
@@ -146,9 +159,17 @@ def toolbase_tools(
|
|
|
146
159
|
# Passed conditionally so test doubles (and any subclass) with the
|
|
147
160
|
# pre-override Orchestrator signature keep working unchanged.
|
|
148
161
|
orch_kwargs["config_overrides"] = config_overrides
|
|
162
|
+
if bare:
|
|
163
|
+
# Conditional for the same back-compat reason (default False == the
|
|
164
|
+
# long-standing namespaced behavior, so old signatures are untouched).
|
|
165
|
+
orch_kwargs["bare"] = bare
|
|
149
166
|
orch = Orchestrator(**orch_kwargs)
|
|
150
167
|
try:
|
|
151
168
|
tools = orch.start()
|
|
169
|
+
if report is not None:
|
|
170
|
+
# Let the caller see how many tools each toolkit dropped (profile /
|
|
171
|
+
# bundle / config gating) — invisible otherwise when quiet=True.
|
|
172
|
+
report.extend(orch.tool_report)
|
|
152
173
|
yield tools
|
|
153
174
|
finally:
|
|
154
175
|
orch.shutdown()
|
|
@@ -58,6 +58,19 @@ def load_project_config_layer(
|
|
|
58
58
|
return _read_layer(path, "project_config")
|
|
59
59
|
|
|
60
60
|
|
|
61
|
+
def load_project_local_config_layer(
|
|
62
|
+
toolkit: str,
|
|
63
|
+
project_root: Path,
|
|
64
|
+
) -> Dict[str, Any]:
|
|
65
|
+
# The project-local layer: config/<toolkit>.local.yaml next to the
|
|
66
|
+
# committed project file. Project-scoped machine state (absolute
|
|
67
|
+
# tool paths and the like), gitignored, highest precedence.
|
|
68
|
+
# Returns {} if absent.
|
|
69
|
+
path = project_config_path(project_root, toolkit)
|
|
70
|
+
path = path.with_name(f"{toolkit}.local.yaml")
|
|
71
|
+
return _read_layer(path, "project_config")
|
|
72
|
+
|
|
73
|
+
|
|
61
74
|
def resolve_toolkit_config(
|
|
62
75
|
toolkit: str,
|
|
63
76
|
project_root: Path,
|
|
@@ -99,10 +112,12 @@ def resolve_toolkit_config(
|
|
|
99
112
|
"""
|
|
100
113
|
user_data = load_user_config_layer(toolkit, user_base=user_base)
|
|
101
114
|
project_data = load_project_config_layer(toolkit, project_root)
|
|
115
|
+
local_data = load_project_local_config_layer(toolkit, project_root)
|
|
102
116
|
|
|
103
117
|
merged: Dict[str, Any] = {}
|
|
104
118
|
merged.update(user_data)
|
|
105
|
-
merged.update(project_data) # project wins key-by-key
|
|
119
|
+
merged.update(project_data) # project wins over user key-by-key
|
|
120
|
+
merged.update(local_data) # project-local (machine state) wins overall
|
|
106
121
|
return merged
|
|
107
122
|
|
|
108
123
|
|