@allansantos-dev/smart-tool 0.9.55 → 0.9.56

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 CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.9.56 - beta
4
+
5
+ - Every command hook Smart Tool writes ends with `--hook-origin=smart-tool`: the Codex redirect hook
6
+ (`hooks/pretool_router.py --client codex`) and the session-start hook (`hooks/session_audit.py`) in Claude Code and
7
+ Codex. The command line then names its owner under the hook origin convention the other local projects follow. An
8
+ entry written by an older version shows as outdated on the setup page, and updating it or turning it off takes out
9
+ the unsigned and the signed form alike, so no second entry is left. In Codex the signed entry waits for approval in
10
+ `/hooks` like any changed hook. Claude Code's redirect hooks are HTTP entries and have no command line to sign
11
+ (`tests/test_codex_audit_hook.py`).
12
+
3
13
  ## 0.9.55 - beta
4
14
 
5
15
  - The agent learns about the problems of the project it works on, and the user is not notified about them. The first
package/README.md CHANGED
@@ -17,7 +17,7 @@ registered as the `playwright` server where this machine lets a browser be drive
17
17
  An optional hook routes the agent's native Grep/Glob/Read/Bash/WebSearch/WebFetch calls to these tools when they
18
18
  are cheaper, or just tells the agent what Smart Tool would do.
19
19
 
20
- **Status:** 0.9.55 beta. Windows only. What changed in each version: [CHANGELOG.md](CHANGELOG.md).
20
+ **Status:** 0.9.56 beta. Windows only. What changed in each version: [CHANGELOG.md](CHANGELOG.md).
21
21
 
22
22
  ## How it works
23
23
 
@@ -83,7 +83,7 @@ gateway such as Ollama, nothing about your code leaves the machine.
83
83
  ## Install
84
84
 
85
85
  ```powershell
86
- npx @allansantos-dev/smart-tool@0.9.55 install
86
+ npx @allansantos-dev/smart-tool@0.9.56 install
87
87
  ```
88
88
 
89
89
  Updates install themselves, on by default: the tray checks npm when it starts (at logon) and every 24 h, and when there
@@ -146,7 +146,11 @@ Redirects) and Maintenance (Setup audit, Startup).
146
146
  the usage meter: it is a sidecar on your machine with no price, and its state is the **Local models** section.
147
147
  3. **Agents**: register the MCP server in Claude Code or Codex (runs their official `mcp add` command), install the
148
148
  hook and choose its behavior under **Agent rules**. A hook written by an older Smart Tool shows as outdated, with
149
- what an update changes; updating previews the entry and rewrites only Smart Tool's, after a backup.
149
+ what an update changes; updating previews the entry and rewrites only Smart Tool's, after a backup. Every
150
+ command hook it writes (the Codex redirect hook and the session-start hook) ends with
151
+ `--hook-origin=smart-tool`, so its command line names Smart Tool as its owner; an entry written before that shows
152
+ as outdated, and updating replaces it instead of adding a second one. Claude Code's redirect hooks are HTTP
153
+ entries with no command line.
150
154
 
151
155
  **Browser control** comes with the registration, and with every update for clients where smart-tool is registered:
152
156
  the official Playwright MCP (pinned in `web_adapters/node`) is registered as the `playwright` server, driving the
package/client_hooks.py CHANGED
@@ -14,6 +14,8 @@ HOOK_SCRIPT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "hooks",
14
14
  MARKER = "pretool_router.py"
15
15
  AUDIT_SCRIPT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "hooks", "session_audit.py")
16
16
  AUDIT_MARKER = "session_audit.py"
17
+ # Hook origin convention shared by every project that installs hooks: a failed command hook names its owner.
18
+ HOOK_ORIGIN = "--hook-origin=smart-tool"
17
19
  AUDIT_MATCHER = "startup|resume|clear|compact|fork"
18
20
  AUDIT_TIMEOUT_S = 10
19
21
  AUDIT_CLIENTS = ("claude", "codex")
@@ -185,7 +187,8 @@ def _shell_safe(path):
185
187
 
186
188
 
187
189
  def _command(client):
188
- return f"{_shell_safe(sys.executable)} {_shell_safe(HOOK_SCRIPT)} --client {client}"
190
+ """The PreToolUse command of a client without HTTP hooks, signed with HOOK_ORIGIN at the end."""
191
+ return f"{_shell_safe(sys.executable)} {_shell_safe(HOOK_SCRIPT)} --client {client} {HOOK_ORIGIN}"
189
192
 
190
193
 
191
194
  def _handler(client, route=HTTP_PATH, timeout=HTTP_TIMEOUT_S):
@@ -282,8 +285,10 @@ def _audit_hook(hook):
282
285
 
283
286
 
284
287
  def _audit_entry():
288
+ """The SessionStart group of the session-start hook, its command signed with HOOK_ORIGIN at the end."""
285
289
  return {"matcher": AUDIT_MATCHER,
286
- "hooks": [{"type": "command", "command": f"{_shell_safe(sys.executable)} {_shell_safe(AUDIT_SCRIPT)}",
290
+ "hooks": [{"type": "command",
291
+ "command": f"{_shell_safe(sys.executable)} {_shell_safe(AUDIT_SCRIPT)} {HOOK_ORIGIN}",
287
292
  "timeout": AUDIT_TIMEOUT_S}]}
288
293
 
289
294
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allansantos-dev/smart-tool",
3
- "version": "0.9.55",
3
+ "version": "0.9.56",
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",
@@ -4088,7 +4088,7 @@ def _session_audit_hook(handler):
4088
4088
  handler._read_body(HOOK_MAX_BODY_BYTES)
4089
4089
  except ValueError as exc:
4090
4090
  _log(f"SessionStart hook body refused: {exc}")
4091
- updates =" ".join(notice for _key, notice in _update_notices())
4091
+ updates = " ".join(notice for _key, notice in _update_notices())
4092
4092
  context = "\n".join(part for part in (updates, _proposals_notice()) if part)
4093
4093
  if not context:
4094
4094
  return {}
package/version.py CHANGED
@@ -1,7 +1,7 @@
1
1
  """Single source of the Smart Tool version and of the User-Agent sent to public APIs."""
2
2
  import re
3
3
 
4
- VERSION = "0.9.55"
4
+ VERSION = "0.9.56"
5
5
  _CONTACT_RE = re.compile(r"^(?:[^\s@()<>;]+@[^\s@()<>;]+\.[^\s@()<>;]+|https?://[^\s()<>;]+)$")
6
6
 
7
7