toolbase 0.16.0__tar.gz → 0.18.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.
Files changed (77) hide show
  1. {toolbase-0.16.0 → toolbase-0.18.0}/CHANGELOG.md +55 -0
  2. {toolbase-0.16.0 → toolbase-0.18.0}/PKG-INFO +1 -1
  3. {toolbase-0.16.0 → toolbase-0.18.0}/pyproject.toml +1 -1
  4. toolbase-0.18.0/toolbase/_sanitize.py +69 -0
  5. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/_toolkit_host.py +11 -0
  6. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/cli.py +500 -16
  7. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/envs/config.py +4 -1
  8. toolbase-0.18.0/toolbase/envs/container.py +569 -0
  9. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/logging/logger.py +4 -33
  10. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/serve/config.py +16 -2
  11. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/serve/orchestrator.py +274 -10
  12. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/setup/declarative.py +29 -1
  13. toolbase-0.18.0/toolbase/trace/__init__.py +66 -0
  14. toolbase-0.18.0/toolbase/trace/capture.py +63 -0
  15. toolbase-0.18.0/toolbase/trace/core.py +556 -0
  16. toolbase-0.18.0/toolbase/trace/mcp_hooks.py +133 -0
  17. toolbase-0.18.0/toolbase/trace/session.py +75 -0
  18. toolbase-0.18.0/toolbase/trace/summary.py +160 -0
  19. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/validation.py +36 -0
  20. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase.egg-info/SOURCES.txt +9 -1
  21. {toolbase-0.16.0 → toolbase-0.18.0}/LICENSE +0 -0
  22. {toolbase-0.16.0 → toolbase-0.18.0}/MANIFEST.in +0 -0
  23. {toolbase-0.16.0 → toolbase-0.18.0}/README.md +0 -0
  24. {toolbase-0.16.0 → toolbase-0.18.0}/setup.cfg +0 -0
  25. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/__init__.py +0 -0
  26. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/_setup_host.py +0 -0
  27. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/astro.py +0 -0
  28. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/auth.py +0 -0
  29. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/config.py +0 -0
  30. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/connect/__init__.py +0 -0
  31. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/connect/antigravity.py +0 -0
  32. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/connect/base.py +0 -0
  33. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/connect/claude_code.py +0 -0
  34. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/connect/codex.py +0 -0
  35. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/connect/opencode.py +0 -0
  36. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/connect/orchestral.py +0 -0
  37. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/envs/__init__.py +0 -0
  38. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/envs/bundle_deps.py +0 -0
  39. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/envs/cache.py +0 -0
  40. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/envs/discovery.py +0 -0
  41. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/envs/manifest.py +0 -0
  42. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/envs/paths.py +0 -0
  43. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/envs/resolve.py +0 -0
  44. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/envs/schema.py +0 -0
  45. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/hep.py +0 -0
  46. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/ingest.py +0 -0
  47. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/logging/__init__.py +0 -0
  48. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/naming.py +0 -0
  49. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/neutrino.py +0 -0
  50. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/quantum.py +0 -0
  51. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/serve/__init__.py +0 -0
  52. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/serve/bundles.py +0 -0
  53. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/serve/loadout_scaffold.py +0 -0
  54. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/serve/loadouts.py +0 -0
  55. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/serve/proxy_tool.py +0 -0
  56. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/setup/__init__.py +0 -0
  57. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/setup/_rpc.py +0 -0
  58. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/setup/context.py +0 -0
  59. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/setup/downloads.py +0 -0
  60. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/setup/prompts.py +0 -0
  61. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/setup/runner.py +0 -0
  62. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/setup/schema.py +0 -0
  63. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/setup/storage.py +0 -0
  64. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/setup/validate_cache.py +0 -0
  65. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/skills.py +0 -0
  66. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/templates/Dockerfile.template +0 -0
  67. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/templates/README.md.template +0 -0
  68. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/templates/__init__.py.template +0 -0
  69. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/templates/mcp/__init__.py.template +0 -0
  70. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/templates/mcp/server_stdio.py.template +0 -0
  71. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/templates/requirements.txt.template +0 -0
  72. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/templates/setup.py.template +0 -0
  73. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/templates/skills/example_skill.md +0 -0
  74. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/templates/tool_example.py +0 -0
  75. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/templates/toolkit.yaml.template +0 -0
  76. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/toolkit.py +0 -0
  77. {toolbase-0.16.0 → toolbase-0.18.0}/toolbase/versioning.py +0 -0
@@ -6,6 +6,61 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/), and this
6
6
 
7
7
  ---
8
8
 
9
+ ## [Unreleased]
10
+
11
+ ---
12
+
13
+ ## [0.18.0] — 2026-12-01
14
+
15
+ ### Added
16
+
17
+ - **Container environments.** A toolkit can offer an image to run in:
18
+
19
+ ```yaml
20
+ environment:
21
+ container:
22
+ image: ghcr.io/owner/mytoolkit-env:1.0.0
23
+ # type: container # install in the image by default
24
+ ```
25
+
26
+ With only the `container:` block the image is an option — `tb install` builds a venv as before and `tb install --container` installs into the image — so one toolkit serves users with their own installs and users without. `type: container` makes the image the only way the toolkit installs.
27
+
28
+ `tb install` pulls it, checks it can host a toolkit (Python 3.12+ with `orchestral-ai` and `mcp`), and pins what it pulled — the repository digest under Docker/Podman, a `.sif` in the cache slot under Apptainer. `tb serve` runs the unchanged toolkit host inside it over the same stdio wire, so loadouts, bundles, namespacing and restarts work as for a venv toolkit.
29
+
30
+ Runtime-agnostic: `podman`, `docker`, `apptainer` or `singularity`, the first on PATH or `TOOLBASE_CONTAINER_RUNTIME`. The same image serves a laptop and an HPC cluster.
31
+
32
+ Host paths are mounted at the same absolute path inside (project, toolkit, logs, path-typed config values that exist on the host, and `TOOLBASE_CONTAINER_BINDS`), so a path a tool returns is valid for the agent outside. Only toolbase's own variables cross into the container. Docker runs as the caller's uid with a persistent per-toolkit `HOME` under `~/.toolbase/container-home/`; Podman uses `--userns=keep-id`; Apptainer runs as the caller.
33
+
34
+ `tb status` reports a container toolkit whose runtime or `.sif` is missing. `tb clean` never removes one for that reason — on a cluster a missing runtime is usually an unloaded module.
35
+
36
+ Only the explicit forms select a container; a bare `Dockerfile` or `docker_required` keeps its install-time refusal.
37
+
38
+ - **An image can configure its toolkit.** An image that ships `/etc/toolbase/config.yaml` (a flat mapping of the toolkit's `config:` keys to values valid inside it) has it read at install. It is the lowest config layer, under the user, project and private layers: install doesn't prompt for those keys, `path` values from the image skip the host existence check, bundles they satisfy are served, and `tb config show` marks them `# from image`.
39
+
40
+ - **`tb install --image REF`** installs a different image than the toolkit offers — a locally built variant, say — pulled, checked, pinned and read for config the same way. It implies `--container`.
41
+
42
+ - **`tb exec TOOLKIT -- CMD` and `tb shell TOOLKIT`** run a command or an interactive shell in a toolkit's environment: a container toolkit's image with the same mounts, `HOME` and environment its tools get, or a venv/conda toolkit's interpreter first on PATH. The process is replaced, so the terminal, signals and exit status are the command's.
43
+
44
+ - **`TOOLBASE_CONTAINER_RUNTIME=inside`** for an image that carries toolbase itself (and a harness) as well as a toolkit's environment. Nothing is pulled, mounted or wrapped: the image's interpreter runs the toolkit host directly, `/etc/toolbase/config.yaml` is read in place, and the image's environment reaches the host unstripped. Inside such an image `tb install --container` puts any toolkit in it, whether or not the toolkit declares an image; `TOOLBASE_CONTAINER_IMAGE` names the image for the install record. Never chosen automatically.
45
+
46
+ ### Fixed
47
+
48
+ - A toolkit served in a wrapped container (podman, docker, apptainer) now receives the provenance trace switch (`TOOLBASE_TRACE_HOST`). The container sees only the variables named on its command line, and the switch was set in the spawn environment alone.
49
+
50
+ ---
51
+
52
+ ## [0.17.0] — 2026-11-16
53
+
54
+ ### Added
55
+
56
+ - **Provenance trace, phase 1: an optional record of every tool call.** Off by default; with it off nothing changes. Turned on per project with `tb trace on` (`trace: true` in `.toolbase/serve.yaml`, read when `serve` starts), per session with `TOOLBASE_TRACE=1` (and `TOOLBASE_TRACE_DIR`), per hand-started server with `toolbase serve --trace [DIR]`, or in-process with `Orchestrator(..., trace=Trace(dir, agent=...))`.
57
+
58
+ Each session writes `<project>/.toolbase/traces/<session>/`: `agents.jsonl` (`agent_started` / `agent_ended`, with parent, model, engine and harness) and `calls.jsonl`, one `toolbase-call/1` record per call with the agent, toolkit and the version actually served, tool, sanitised arguments, outcome, a result digest, and the files named in the arguments and result with size, mtime and sha256. Records are appended and flushed one per line, safe across threads and processes, so a killed run keeps everything up to the kill. Each traced result ends with a `[toolbase call <id>]` line the agent can cite. A trace failure is logged and never affects the call.
59
+
60
+ Toolkits can see the call they are serving (`toolbase.trace.current()`, sent in the MCP request `_meta`) and record work done later on its behalf with `parent` set (`toolbase.trace.child_call`, `record_call`), for jobs that run a tool in a worker. `tb trace status`, `tb trace list` and `tb trace show <session>` inspect it, and `tb trace export` hands a trace to the separate `tooltrace` package, which writes a shareable record with an offline viewer. See `docs/TRACE.md`.
61
+
62
+ ---
63
+
9
64
  ## [0.16.0] — 2026-09-15
10
65
 
11
66
  ### Added
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: toolbase
3
- Version: 0.16.0
3
+ Version: 0.18.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
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "toolbase"
7
- version = "0.16.0"
7
+ version = "0.18.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"
@@ -0,0 +1,69 @@
1
+ """The tool-argument secret sanitiser, shared by the call log and the trace.
2
+
3
+ Stdlib only, with no import-time side effects: the trace imports it inside
4
+ toolkit host processes, where ``toolbase.config`` (which creates
5
+ ``~/.toolbase`` on import) should not run.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ from typing import Any, Dict, Optional
11
+
12
+ # Argument names that might hold a secret. Matched as substrings of the
13
+ # lower-cased key.
14
+ SECRET_KEYS = frozenset({
15
+ 'password', 'passwd', 'pwd',
16
+ 'token', 'api_key', 'apikey', 'key',
17
+ 'secret', 'auth', 'credential'
18
+ })
19
+
20
+ REDACTED = "***REDACTED***"
21
+
22
+
23
+ def is_secret_key(key: str) -> bool:
24
+ key_lower = str(key).lower()
25
+ return any(secret in key_lower for secret in SECRET_KEYS)
26
+
27
+
28
+ def sanitize_args(
29
+ args: Dict[str, Any],
30
+ *,
31
+ max_items: Optional[int] = 10,
32
+ max_str: Optional[int] = None,
33
+ ) -> Dict[str, Any]:
34
+ """Return a copy of ``args`` with secret-looking keys redacted.
35
+
36
+ The defaults reproduce the call log's historical behaviour exactly:
37
+ lists longer than ``max_items`` collapse to a ``<list of N items>``
38
+ placeholder, nested dicts recurse, other types show only their type.
39
+
40
+ The trace passes ``max_items=None`` (keep whole lists, recursing into
41
+ them so a secret inside a list of dicts is still redacted) and a
42
+ ``max_str`` cap, so a record stays small when an argument carries a
43
+ file's contents.
44
+ """
45
+ sanitized: Dict[str, Any] = {}
46
+ for key, value in args.items():
47
+ if is_secret_key(key):
48
+ sanitized[key] = REDACTED
49
+ else:
50
+ sanitized[key] = _value(value, max_items, max_str)
51
+ return sanitized
52
+
53
+
54
+ def _value(value: Any, max_items: Optional[int], max_str: Optional[int]) -> Any:
55
+ if isinstance(value, str):
56
+ if max_str is not None and len(value) > max_str:
57
+ return value[:max_str] + f"...[truncated {len(value) - max_str} chars]"
58
+ return value
59
+ if isinstance(value, (int, float, bool, type(None))):
60
+ return value
61
+ if isinstance(value, (list, tuple)):
62
+ if max_items is not None:
63
+ if len(value) > max_items:
64
+ return f"<{type(value).__name__} of {len(value)} items>"
65
+ return value
66
+ return [_value(v, max_items, max_str) for v in value]
67
+ if isinstance(value, dict):
68
+ return sanitize_args(value, max_items=max_items, max_str=max_str)
69
+ return f"<{type(value).__name__}>"
@@ -631,6 +631,17 @@ def main(argv: list[str] | None = None) -> int:
631
631
  )
632
632
  return 6
633
633
 
634
+ # Provenance trace on: let tools see the call being served through
635
+ # ``toolbase.trace.current()`` (the orchestrator sends it in each
636
+ # request's ``_meta``). Stdlib-only module; any failure leaves the
637
+ # plain server in place.
638
+ if os.environ.get("TOOLBASE_TRACE_HOST") == "1":
639
+ try:
640
+ from toolbase.trace.mcp_hooks import host_server_class
641
+ MCPServer = host_server_class(MCPServer)
642
+ except Exception as e:
643
+ sys.stderr.write(f"[toolbase-host] WARN: trace hook unavailable: {e}\n")
644
+
634
645
  server = MCPServer(
635
646
  tools=tool_instances,
636
647
  name=f"toolbase-{args.name}",