@allansantos-dev/smart-tool 0.9.15 → 0.9.16
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.
- package/CHANGELOG.md +16 -0
- package/README.md +7 -3
- package/client_hooks.py +45 -11
- package/package.json +1 -1
- package/setup_ui.py +985 -728
- package/version.py +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.9.16 - beta
|
|
4
|
+
|
|
5
|
+
- New setup screen. It opens on an **Overview** that checks everything Smart Tool needs on this machine (model
|
|
6
|
+
gateway, each agent's connection and hook, block patterns waiting, the service, web search, the setup audit) and
|
|
7
|
+
lists what needs you first, each with a button that takes you to the fix. A side menu replaces the long scroll:
|
|
8
|
+
Connect (Agents, Models, Web search), Behavior (Agent rules, Redirects) and Maintenance (Setup audit, Startup),
|
|
9
|
+
with a count of open items next to each. Every section says what it is for; choices apply as soon as they are
|
|
10
|
+
picked, and typed values keep a save button next to them. Light and dark follow the system; under 860 px the menu
|
|
11
|
+
becomes a row of tabs.
|
|
12
|
+
- An outdated hook says so. The setup screen compares each agent's Smart Tool hook entry with the one this version
|
|
13
|
+
writes and lists what the old one misses (tools not covered, an old address or timeout). **Update hook** shows the
|
|
14
|
+
exact entry first and, after you confirm, rewrites only Smart Tool's entry (other hooks stay, the file is backed up).
|
|
15
|
+
The tray notice also names an outdated hook.
|
|
16
|
+
- Agent rules (redirect behavior, documentation and duplicate checks on edit, block pattern proposals) moved off the
|
|
17
|
+
Agents section into their own, with the recommended choice marked.
|
|
18
|
+
|
|
3
19
|
## 0.9.15 - beta
|
|
4
20
|
|
|
5
21
|
- The hook redirects the folder searches that slipped past it in a shell: wrapped (`bash -c`, `sh -lc`,
|
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ registered as the `playwright` server where this machine lets a browser be drive
|
|
|
15
15
|
An optional hook routes the agent's native Grep/Glob/Read/Bash/WebSearch/WebFetch calls to these tools when they
|
|
16
16
|
are cheaper, or just tells the agent what Smart Tool would do.
|
|
17
17
|
|
|
18
|
-
**Status:** 0.9.
|
|
18
|
+
**Status:** 0.9.16 beta. Windows only. What changed in each version: [CHANGELOG.md](CHANGELOG.md).
|
|
19
19
|
|
|
20
20
|
## How it works
|
|
21
21
|
|
|
@@ -89,7 +89,10 @@ State lives in `~/.smart-tool`: `config.json`, your model adapters in `adapters/
|
|
|
89
89
|
|
|
90
90
|
## Set up
|
|
91
91
|
|
|
92
|
-
Open the setup screen from the tray icon ("Open settings") or at `http://127.0.0.1:8765/setup`.
|
|
92
|
+
Open the setup screen from the tray icon ("Open settings") or at `http://127.0.0.1:8765/setup`. It opens on
|
|
93
|
+
**Overview**: everything Smart Tool needs, checked on this machine, with what needs you first and a button that takes
|
|
94
|
+
you to the fix. The side menu groups the rest under Connect (Agents, Models, Web search), Behavior (Agent rules,
|
|
95
|
+
Redirects) and Maintenance (Setup audit, Startup).
|
|
93
96
|
|
|
94
97
|
1. **Model gateway**: pick an adapter and fill its fields. The built-in **OpenAI-compatible** adapter takes a base
|
|
95
98
|
URL ending where the API starts, like the OpenAI SDK `base_url` (`https://api.openai.com/v1`,
|
|
@@ -98,7 +101,8 @@ Open the setup screen from the tray icon ("Open settings") or at `http://127.0.0
|
|
|
98
101
|
reasoning: web search tier order and result checks), the index classification model (also reviews block patterns) and the research model. Any id the gateway
|
|
99
102
|
accepts works; the catalog is shown as suggestions.
|
|
100
103
|
3. **Agents**: register the MCP server in Claude Code or Codex (runs their official `mcp add` command), install the
|
|
101
|
-
hook and choose its behavior
|
|
104
|
+
hook and choose its behavior under **Agent rules**. A hook written by an older Smart Tool shows as outdated, with
|
|
105
|
+
what an update changes; updating previews the entry and rewrites only Smart Tool's, after a backup.
|
|
102
106
|
|
|
103
107
|
**Browser control** comes with the registration, and with every update for clients where smart-tool is registered:
|
|
104
108
|
the official Playwright MCP (pinned in `web_adapters/node`) is registered as the `playwright` server, driving the
|
package/client_hooks.py
CHANGED
|
@@ -55,8 +55,13 @@ def _without_ours(groups):
|
|
|
55
55
|
return kept
|
|
56
56
|
|
|
57
57
|
|
|
58
|
-
def
|
|
59
|
-
""
|
|
58
|
+
def _target(handler):
|
|
59
|
+
return handler.get("url") or handler.get("command") or ""
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def inspect(client):
|
|
63
|
+
"""Our hook in the client's config: `current`, `missing`, or `outdated` (an older entry of ours) with `changes`,
|
|
64
|
+
plain sentences saying what an update rewrites (tools the old matcher leaves out, an old address or timeout)."""
|
|
60
65
|
spec = CLIENTS[client]
|
|
61
66
|
for path in spec["files"]:
|
|
62
67
|
try:
|
|
@@ -67,30 +72,56 @@ def installed(client):
|
|
|
67
72
|
if MARKER not in text and HTTP_PATH not in text:
|
|
68
73
|
continue
|
|
69
74
|
if not path.endswith(".json"):
|
|
70
|
-
return
|
|
75
|
+
return {"state": "current", "changes": []}
|
|
71
76
|
data = json.loads(text)
|
|
72
77
|
hooks = data.get("hooks") if isinstance(data, dict) else None
|
|
73
78
|
groups = hooks.get(spec["event"]) if isinstance(hooks, dict) else None
|
|
79
|
+
ours = [group for group in groups if _ours(group)] if isinstance(groups, list) else []
|
|
80
|
+
if not ours:
|
|
81
|
+
return {"state": "outdated", "changes": [f"Smart Tool's entry is not under {spec['event']}."]}
|
|
74
82
|
expected = _handler(client)
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
83
|
+
if any(group.get("matcher") == spec["matcher"] and expected in group["hooks"] for group in ours):
|
|
84
|
+
return {"state": "current", "changes": []}
|
|
85
|
+
group = ours[0]
|
|
86
|
+
changes = []
|
|
87
|
+
covered = str(group.get("matcher") or "").split("|")
|
|
88
|
+
left_out = [tool for tool in spec["matcher"].split("|") if tool not in covered]
|
|
89
|
+
if left_out:
|
|
90
|
+
changes.append("It does not cover " + ", ".join(left_out) + ".")
|
|
91
|
+
found = next(hook for hook in group["hooks"] if _our_hook(hook))
|
|
92
|
+
if _target(found) != _target(expected):
|
|
93
|
+
changes.append(f"It calls {_target(found)} instead of {_target(expected)}.")
|
|
94
|
+
elif found != expected:
|
|
95
|
+
changes.append("Its timeout or type is older than the current one.")
|
|
96
|
+
if not changes:
|
|
97
|
+
changes.append("Its tool list is ordered or written differently from the current one.")
|
|
98
|
+
return {"state": "outdated", "changes": changes}
|
|
99
|
+
return {"state": "missing", "changes": []}
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def installed(client):
|
|
103
|
+
"""Our hook is present and current; an older entry of ours counts as not installed."""
|
|
104
|
+
return inspect(client)["state"] == "current"
|
|
78
105
|
|
|
79
106
|
|
|
80
107
|
def status(client_info):
|
|
108
|
+
"""Hook state for an MCP client's clientInfo: `installed` (bool, None when unreadable or unknown client), `state`
|
|
109
|
+
(current/outdated/missing), `changes` an update would make, `error`, the config `files` and `docs`."""
|
|
81
110
|
client = identify(client_info)
|
|
82
111
|
if client is None:
|
|
83
112
|
return {"client": None, "name": (client_info or {}).get("name"), "installed": None, "error": None}
|
|
84
113
|
spec = CLIENTS[client]
|
|
85
114
|
try:
|
|
86
|
-
|
|
115
|
+
found, error = inspect(client), None
|
|
87
116
|
except (OSError, ValueError) as exc:
|
|
88
|
-
|
|
89
|
-
return {"client": client, "name": client_info.get("name"),
|
|
90
|
-
"
|
|
117
|
+
found, error = {"state": None, "changes": []}, f"{type(exc).__name__}: {exc}"[:200]
|
|
118
|
+
return {"client": client, "name": client_info.get("name"),
|
|
119
|
+
"installed": None if found["state"] is None else found["state"] == "current", "state": found["state"],
|
|
120
|
+
"changes": found["changes"], "error": error, "files": spec["files"], "docs": spec["docs"]}
|
|
91
121
|
|
|
92
122
|
|
|
93
123
|
def notice(state):
|
|
124
|
+
"""Sentence for the agent when the hook is not current (from `status`), or None when nothing needs saying."""
|
|
94
125
|
if state["client"] is None:
|
|
95
126
|
return (f"Unrecognized MCP client ({state['name'] or 'no clientInfo'}): Smart Tool does not check the hook "
|
|
96
127
|
"that redirects Grep/Read to smart_search and WebSearch/WebFetch to web_search/web_fetch in this client.")
|
|
@@ -101,7 +132,10 @@ def notice(state):
|
|
|
101
132
|
return None
|
|
102
133
|
action = spec.get("blocked") or ("If the user asks, use project_manage action=install_hook_preview, show the "
|
|
103
134
|
"change and confirm with action=install_hook (makes a backup).")
|
|
104
|
-
|
|
135
|
+
if state.get("state") == "outdated":
|
|
136
|
+
return (f"Smart Tool hook outdated in {spec['label']} ({spec['files'][0]}): {' '.join(state['changes'])} "
|
|
137
|
+
f"{action} Docs: {spec['docs']}")
|
|
138
|
+
return (f"Smart Tool hook missing in {spec['label']} ({spec['files'][0]}): Grep/Read/Bash are not "
|
|
105
139
|
f"redirected to smart_search, nor WebSearch/WebFetch to web_search/web_fetch. {action} Docs: {spec['docs']}")
|
|
106
140
|
|
|
107
141
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allansantos-dev/smart-tool",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.16",
|
|
4
4
|
"description": "Local MCP server that gives coding agents (Claude Code, Codex) cheaper, sharper tools than their built-in search. Windows.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Allan Santos",
|