amfs-http-server 0.1.3__tar.gz → 0.3.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.
- {amfs_http_server-0.1.3 → amfs_http_server-0.3.0}/PKG-INFO +1 -1
- {amfs_http_server-0.1.3 → amfs_http_server-0.3.0}/pyproject.toml +1 -1
- {amfs_http_server-0.1.3 → amfs_http_server-0.3.0}/src/amfs_http/auth.py +7 -6
- {amfs_http_server-0.1.3 → amfs_http_server-0.3.0}/src/amfs_http/models.py +18 -4
- {amfs_http_server-0.1.3 → amfs_http_server-0.3.0}/src/amfs_http/server.py +968 -69
- {amfs_http_server-0.1.3 → amfs_http_server-0.3.0}/.gitignore +0 -0
- {amfs_http_server-0.1.3 → amfs_http_server-0.3.0}/src/amfs_http/__init__.py +0 -0
- {amfs_http_server-0.1.3 → amfs_http_server-0.3.0}/src/amfs_http/pro_proxy.py +0 -0
- {amfs_http_server-0.1.3 → amfs_http_server-0.3.0}/src/amfs_http/sse.py +0 -0
- {amfs_http_server-0.1.3 → amfs_http_server-0.3.0}/src/amfs_http/tenant_middleware.py +0 -0
|
@@ -26,6 +26,10 @@ def _check_db_key(api_key: str) -> bool:
|
|
|
26
26
|
|
|
27
27
|
Keys are stored as SHA-256 hex digests, so we hash the incoming raw key
|
|
28
28
|
before comparing.
|
|
29
|
+
|
|
30
|
+
Uses SECURITY DEFINER functions to bypass RLS — this connection does not
|
|
31
|
+
set amfs.current_account_id, so direct table queries would return nothing
|
|
32
|
+
when FORCE ROW LEVEL SECURITY is enabled.
|
|
29
33
|
"""
|
|
30
34
|
try:
|
|
31
35
|
import psycopg
|
|
@@ -39,16 +43,13 @@ def _check_db_key(api_key: str) -> bool:
|
|
|
39
43
|
|
|
40
44
|
with psycopg.connect(dsn, row_factory=dict_row) as conn:
|
|
41
45
|
row = conn.execute(
|
|
42
|
-
"SELECT
|
|
43
|
-
"WHERE key_hash = %s AND active = TRUE "
|
|
44
|
-
"AND (expires_at IS NULL OR expires_at > NOW()) "
|
|
45
|
-
"LIMIT 1",
|
|
46
|
+
"SELECT * FROM amfs_authenticate_api_key(%s)",
|
|
46
47
|
(key_hash,),
|
|
47
48
|
).fetchone()
|
|
48
49
|
if row:
|
|
49
50
|
conn.execute(
|
|
50
|
-
"
|
|
51
|
-
(row["
|
|
51
|
+
"SELECT amfs_touch_api_key_usage(%s)",
|
|
52
|
+
(row["key_id"],),
|
|
52
53
|
)
|
|
53
54
|
return row is not None
|
|
54
55
|
except Exception:
|
|
@@ -38,6 +38,7 @@ class SearchRequest(BaseModel):
|
|
|
38
38
|
limit: int = 100
|
|
39
39
|
sort_by: str = "confidence"
|
|
40
40
|
branch: str = "main"
|
|
41
|
+
depth: int = 3
|
|
41
42
|
|
|
42
43
|
|
|
43
44
|
class ContextRequest(BaseModel):
|
|
@@ -88,11 +89,24 @@ class UpdateTeamMemberRequest(BaseModel):
|
|
|
88
89
|
|
|
89
90
|
|
|
90
91
|
class RunPatternDetectionRequest(BaseModel):
|
|
91
|
-
incident_threshold: int = 2
|
|
92
|
-
stale_days: int = 30
|
|
93
|
-
hot_entity_stddev: float = 2.0
|
|
94
|
-
drift_stddev: float = 2.0
|
|
95
92
|
entity_path: str | None = None
|
|
93
|
+
agent_id: str | None = None
|
|
94
|
+
stale_days: int = 14
|
|
95
|
+
orphan_days: int = 7
|
|
96
|
+
pr_stale_days: int = 3
|
|
97
|
+
similarity_threshold: float = 0.75
|
|
98
|
+
incident_threshold: int = 2
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
# ──────────────────────────────────────────────────────────────────────
|
|
102
|
+
# Agent Snapshots
|
|
103
|
+
# ──────────────────────────────────────────────────────────────────────
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
class CreateSnapshotRequest(BaseModel):
|
|
107
|
+
name: str
|
|
108
|
+
description: str = ""
|
|
109
|
+
snapshot_data: dict[str, Any] = Field(default_factory=dict)
|
|
96
110
|
|
|
97
111
|
|
|
98
112
|
# ──────────────────────────────────────────────────────────────────────
|