@allansantos-dev/smart-tool 0.0.0-stage → 0.9.1
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 +35 -0
- package/LICENSE +202 -0
- package/NOTICE +32 -0
- package/README.md +116 -2
- package/atomic_io.py +94 -0
- package/autostart.py +199 -0
- package/bin/smart-tool.mjs +86 -0
- package/browser_service_client.py +232 -0
- package/capabilities.py +63 -0
- package/client_hooks.py +192 -0
- package/code_graph.py +403 -0
- package/code_graph_java.mjs +49 -0
- package/code_graph_js.cjs +135 -0
- package/config.py +241 -0
- package/daemon_launcher.py +165 -0
- package/directory_watch.py +131 -0
- package/document_text.py +69 -0
- package/duplicates.py +313 -0
- package/embedding_cache.py +99 -0
- package/endpoint_sync.py +179 -0
- package/folder_picker.py +73 -0
- package/freshness.py +278 -0
- package/gateway.py +220 -0
- package/hook_decision.py +96 -0
- package/hooks/pretool_router.py +45 -0
- package/index_inventory.py +75 -0
- package/index_profile.py +167 -0
- package/index_scope.py +458 -0
- package/index_views.py +121 -0
- package/indexer.py +878 -0
- package/install.py +353 -0
- package/install_runtime.py +283 -0
- package/integration_metrics.py +82 -0
- package/local_embedder.py +172 -0
- package/model_adapters/__init__.py +0 -0
- package/model_adapters/openai_compatible.py +57 -0
- package/model_catalog.py +74 -0
- package/model_client.py +38 -0
- package/model_defaults.py +70 -0
- package/package.json +33 -4
- package/paths.py +6 -0
- package/project_identity.py +42 -0
- package/project_insights_ui.py +38 -0
- package/project_maps_ui.py +96 -0
- package/project_monitor.py +204 -0
- package/project_scheduler.py +61 -0
- package/project_storage.py +165 -0
- package/project_store.py +220 -0
- package/projects_ui.py +146 -0
- package/requirements.txt +8 -0
- package/research_cache.py +171 -0
- package/research_metrics.py +110 -0
- package/router.py +582 -0
- package/secret_store.py +121 -0
- package/setup_ui.py +986 -0
- package/site_memory.py +53 -0
- package/smart_tool_daemon.py +3604 -0
- package/tray.py +245 -0
- package/update_check.py +22 -0
- package/usage_meter.py +124 -0
- package/version.py +18 -0
- package/view_compare.py +68 -0
- package/web_adapters/browser/browser_service.py +302 -0
- package/web_adapters/browser/crawl4ai_search.py +236 -0
- package/web_adapters/browser/fetch_camoufox.py +28 -0
- package/web_adapters/browser/requirements.txt +2 -0
- package/web_adapters/node/adapter-common.mjs +40 -0
- package/web_adapters/node/ddg-search.mjs +89 -0
- package/web_adapters/node/open-websearch-adapter.mjs +77 -0
- package/web_adapters/node/package-lock.json +2720 -0
- package/web_adapters/node/package.json +12 -0
- package/web_adapters/node/wikipedia-search.mjs +44 -0
- package/web_document_graph.py +71 -0
- package/web_fetch.py +242 -0
- package/web_search_adapters.py +193 -0
- package/web_search_ddgs.py +42 -0
- package/web_search_external.py +288 -0
- package/web_search_health.py +88 -0
package/site_memory.py
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Sinais diários de sites pesquisados: tópico, domínio, título, URL e trecho.
|
|
3
|
+
|
|
4
|
+
O daemon usa similaridade (embedding + rerank) para priorizar domínios nas
|
|
5
|
+
buscas frescas. O conteúdo bruto não é reutilizado nas respostas MCP sem um
|
|
6
|
+
gate de atualidade; esse papel pertence a `research_cache.py`/`freshness.py`.
|
|
7
|
+
Design em `design/planos/smart-tool-agente-pesquisa-plano.md`.
|
|
8
|
+
|
|
9
|
+
Reset diário por comparação de data, não por reinício do processo: o daemon roda como
|
|
10
|
+
serviço de longa duração (autostart), então só reiniciar o processo não cobre "resetar por
|
|
11
|
+
dia". Sem persistência entre dias e sem ligação com `capture_lesson` — o Smart Tool é MCP
|
|
12
|
+
standalone (não depende do plugin que expõe essa tool), e quem tem contexto de sessão pra
|
|
13
|
+
decidir se algo virou lição é o agente principal, não o pesquisador aqui dentro, que só
|
|
14
|
+
recebe o tópico.
|
|
15
|
+
"""
|
|
16
|
+
import threading
|
|
17
|
+
import time
|
|
18
|
+
from datetime import date
|
|
19
|
+
|
|
20
|
+
# Toda leitura/escrita passa por este lock: o daemon é multi-thread, e chamadas
|
|
21
|
+
# concorrentes de web_search mutam o mesmo dict.
|
|
22
|
+
_LOCK = threading.Lock()
|
|
23
|
+
_daily = {"day": None, "records": []} # records: [{"topic","domain","tier","title","url","snippet","ts"}]
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _today():
|
|
27
|
+
return date.today().isoformat()
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def _ensure_today_locked():
|
|
31
|
+
# Chamado sempre dentro de _LOCK.
|
|
32
|
+
today = _today()
|
|
33
|
+
if _daily["day"] != today:
|
|
34
|
+
_daily["day"] = today
|
|
35
|
+
_daily["records"] = []
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def record(topic, domain, tier, title="", url="", snippet=""):
|
|
39
|
+
if not domain:
|
|
40
|
+
return
|
|
41
|
+
with _LOCK:
|
|
42
|
+
_ensure_today_locked()
|
|
43
|
+
_daily["records"].append({
|
|
44
|
+
"topic": topic, "domain": domain, "tier": tier,
|
|
45
|
+
"title": title, "url": url, "snippet": snippet, "ts": time.time(),
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def snapshot():
|
|
50
|
+
"""Cópia das entradas do dia de hoje — quem chama decide como usar (embed+rerank)."""
|
|
51
|
+
with _LOCK:
|
|
52
|
+
_ensure_today_locked()
|
|
53
|
+
return list(_daily["records"])
|