@allansantos-dev/smart-tool 0.9.76 → 0.9.77

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,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.9.77 - beta
4
+
5
+ - The Claude Code hooks Smart Tool writes name their owner and the file that holds their port: the two HTTP hook URLs
6
+ carry `hook-origin=smart-tool` and `port-file=~/.smart-tool/data/daemon.json` (the daemon's own announcement), so the
7
+ hook audit sees the owner and a managed port instead of a literal one, and the daemon's port move rewrites the URLs
8
+ with the parameters kept. An older entry shows as outdated and the update rewrites it. Tests:
9
+ `tests/test_endpoint_sync.py`.
10
+
3
11
  ## 0.9.76 - beta
4
12
 
5
13
  - A project is only the folder where the agent session started. A new project is refused, with the reason and nothing
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.76 beta. Windows only. What changed in each version: [CHANGELOG.md](CHANGELOG.md).
20
+ **Status:** 0.9.77 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.76 install
86
+ npx @allansantos-dev/smart-tool@0.9.77 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
@@ -390,7 +390,7 @@ fails to load is listed in the setup screen with its error and does not affect t
390
390
  ## Uninstall
391
391
 
392
392
  ```powershell
393
- npx @allansantos-dev/smart-tool@0.9.76 uninstall [--target DIR] [--keep-data]
393
+ npx @allansantos-dev/smart-tool@0.9.77 uninstall [--target DIR] [--keep-data]
394
394
  ```
395
395
 
396
396
  It asks nothing and opens no window. It stops the tray and the daemon, removes the logon task, the hook entries of Smart
package/client_hooks.py CHANGED
@@ -242,6 +242,15 @@ def _command(client):
242
242
  return f"{_shell_safe(sys.executable)} {_shell_safe(HOOK_SCRIPT)} --client {client} {HOOK_ORIGIN}"
243
243
 
244
244
 
245
+ def _port_file():
246
+ """The daemon's announcement file as `~/<path>`, the form the hook audit reads to know the URL port is managed."""
247
+ relative = os.path.relpath(daemon_launcher.REGISTRY_PATH, os.path.expanduser("~")).replace("\\", "/")
248
+ if relative.startswith(".."):
249
+ raise ValueError(f"The daemon announcement ({daemon_launcher.REGISTRY_PATH}) is outside the home folder; "
250
+ "the hook cannot name it as its port file.")
251
+ return f"~/{relative}"
252
+
253
+
245
254
  def _handler(client, route=HTTP_PATH, timeout=HTTP_TIMEOUT_S):
246
255
  """Claude Code posts the payload straight to the warm daemon (`type: "http"`, no process per tool call); other
247
256
  clients run the thin command that forwards to the PreToolUse route."""
@@ -249,7 +258,8 @@ def _handler(client, route=HTTP_PATH, timeout=HTTP_TIMEOUT_S):
249
258
  registry = daemon_launcher.read_registry()
250
259
  if not registry or not registry.get("url"):
251
260
  raise ValueError("Smart Tool daemon has no registered URL; start the daemon before installing the hook.")
252
- return {"type": "http", "url": f"{registry['url']}{route}?client={client}", "timeout": timeout}
261
+ query = f"client={client}&hook-origin={OWNER}&port-file={_port_file()}"
262
+ return {"type": "http", "url": f"{registry['url']}{route}?{query}", "timeout": timeout}
253
263
  return {"type": "command", "command": _command(client), "timeout": timeout}
254
264
 
255
265
 
@@ -860,6 +860,7 @@
860
860
  "Its {0} entry does not cover {1}.": "A entrada {0} dele não cobre {1}.",
861
861
  "It calls {0} instead of {1}.": "Ele chama {0} em vez de {1}.",
862
862
  "Its tool list is ordered or written differently from the current one.": "A lista de ferramentas dele está em outra ordem ou escrita de outro jeito que a atual.",
863
+ "The daemon announcement ({0}) is outside the home folder; the hook cannot name it as its port file.": "O anúncio do daemon ({0}) está fora da pasta do usuário; o hook não consegue nomeá-lo como seu arquivo de porta.",
863
864
  "Path contains a space and has no 8.3 short name ({0}); the hook was not installed.": "O caminho tem um espaço e não tem nome curto 8.3 ({0}); o hook não foi instalado.",
864
865
  "{0} does not have the expected format (object with 'hooks'); nothing was changed.": "{0} não tem o formato esperado (objeto com 'hooks'); nada foi alterado.",
865
866
  "{0} does not appear in {1} after writing; the file was restored.": "{0} não aparece em {1} depois de gravar; o arquivo foi restaurado.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allansantos-dev/smart-tool",
3
- "version": "0.9.76",
3
+ "version": "0.9.77",
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": "Smart Tool contributors",
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.76"
4
+ VERSION = "0.9.77"
5
5
  _CONTACT_RE = re.compile(r"^(?:[^\s@()<>;]+@[^\s@()<>;]+\.[^\s@()<>;]+|https?://[^\s()<>;]+)$")
6
6
 
7
7