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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: amfs-http-server
3
- Version: 0.1.3
3
+ Version: 0.3.0
4
4
  Summary: AMFS HTTP/REST API server with SSE support
5
5
  License-Expression: Apache-2.0
6
6
  Requires-Python: >=3.11
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "amfs-http-server"
3
- version = "0.1.3"
3
+ version = "0.3.0"
4
4
  description = "AMFS HTTP/REST API server with SSE support"
5
5
  requires-python = ">=3.11"
6
6
  license = "Apache-2.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 id FROM amfs_api_keys "
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
- "UPDATE amfs_api_keys SET last_used = NOW() WHERE id = %s",
51
- (row["id"],),
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
  # ──────────────────────────────────────────────────────────────────────