Skip to content

Commit 1c9ab20

Browse files
committed
chore: bumped version to 0.0.31
1 parent 8df8565 commit 1c9ab20

56 files changed

Lines changed: 520 additions & 190 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.30
1+
0.0.31

surfsense_backend/alembic/env.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
from logging.config import fileConfig
66

77
import sqlalchemy as sa
8-
from alembic.script import ScriptDirectory
98
from sqlalchemy import pool
109
from sqlalchemy.engine import Connection
1110
from sqlalchemy.ext.asyncio import async_engine_from_config
1211

1312
from alembic import context
13+
from alembic.script import ScriptDirectory
1414

1515
# Ensure the app directory is in the Python path
1616
# This allows Alembic to find your models
@@ -81,9 +81,7 @@ def _fast_forward_fresh_db(connection: Connection) -> bool:
8181
step rather than resurrecting the replay.
8282
"""
8383
for table in ("documents", "searchspaces", BOOTSTRAP_MARKER_TABLE):
84-
if connection.execute(
85-
sa.text("SELECT to_regclass(:t)"), {"t": table}
86-
).scalar():
84+
if connection.execute(sa.text("SELECT to_regclass(:t)"), {"t": table}).scalar():
8785
return False
8886
if connection.execute(sa.text("SELECT to_regclass('alembic_version')")).scalar():
8987
current = connection.execute(

surfsense_backend/alembic/versions/171_add_runs_and_tool_output_spills.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@ def upgrade() -> None:
4141
);
4242
"""
4343
)
44-
op.execute(
45-
"CREATE INDEX IF NOT EXISTS ix_runs_workspace_id ON runs (workspace_id)"
46-
)
44+
op.execute("CREATE INDEX IF NOT EXISTS ix_runs_workspace_id ON runs (workspace_id)")
4745
op.execute("CREATE INDEX IF NOT EXISTS ix_runs_user_id ON runs (user_id)")
4846
op.execute("CREATE INDEX IF NOT EXISTS ix_runs_capability ON runs (capability)")
4947
op.execute("CREATE INDEX IF NOT EXISTS ix_runs_created_at ON runs (created_at)")

surfsense_backend/app/agents/chat/multi_agent_chat/subagents/builtins/mcp_discovery/agent.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ def _augment_allowlist_for_collision_prefixes(
5050
continue
5151
original = meta.get("mcp_original_tool_name")
5252
if original in trusted_names and tool.name not in trusted_names:
53-
alias_rules.append(
54-
Rule(permission=tool.name, pattern="*", action="allow")
55-
)
53+
alias_rules.append(Rule(permission=tool.name, pattern="*", action="allow"))
5654

5755
if not alias_rules:
5856
return dependencies

surfsense_backend/app/agents/chat/multi_agent_chat/subagents/builtins/mcp_discovery/tools/get_connected_accounts.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@ async def _impl() -> str:
8585
# ``server_config`` presence == the connector produces agent
8686
# tools. Native rows without it are connected for indexing
8787
# only and need a reconnect via MCP.
88-
"usable_in_chat": isinstance(cfg, dict)
89-
and "server_config" in cfg,
88+
"usable_in_chat": isinstance(cfg, dict) and "server_config" in cfg,
9089
"account": account_meta,
9190
}
9291
)

surfsense_backend/app/agents/chat/multi_agent_chat/subagents/mcp_tools/index.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ def resolve_tool_name_collisions(
8383
or original_name,
8484
"mcp_collision_prefixed": True,
8585
}
86-
resolved.append(tool.model_copy(update={"name": new_name, "metadata": new_meta}))
86+
resolved.append(
87+
tool.model_copy(update={"name": new_name, "metadata": new_meta})
88+
)
8789
return resolved
8890

8991

surfsense_backend/app/agents/chat/multi_agent_chat/subagents/shared/run_reader.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def _cell(value: Any) -> str:
128128
"""Render one CSV cell: scalars as-is, nested structures as compact JSON."""
129129
if value is None:
130130
return ""
131-
if isinstance(value, (dict, list)):
131+
if isinstance(value, dict | list):
132132
return json.dumps(value, ensure_ascii=False, default=str)
133133
return str(value)
134134

@@ -230,9 +230,7 @@ async def _read_run(
230230
count = min(max(1, limit), _MAX_LIMIT)
231231
window = lines[start : start + count]
232232
if not window:
233-
return (
234-
f"No lines at offset {start} (total {len(lines)} lines in {ref})."
235-
)
233+
return f"No lines at offset {start} (total {len(lines)} lines in {ref})."
236234
window_body = "\n".join(window)
237235
start_char = max(0, char_offset)
238236
if start_char >= len(window_body) > 0:
@@ -328,10 +326,14 @@ async def _export_run(
328326
records = _rows_from_body(body, rows)
329327
if include_pattern:
330328
inc = _build_matcher(include_pattern.strip())
331-
records = [r for r in records if inc(" ".join(map(_cell, r.values()))) is not None]
329+
records = [
330+
r for r in records if inc(" ".join(map(_cell, r.values()))) is not None
331+
]
332332
if exclude_pattern:
333333
exc = _build_matcher(exclude_pattern.strip())
334-
records = [r for r in records if exc(" ".join(map(_cell, r.values()))) is None]
334+
records = [
335+
r for r in records if exc(" ".join(map(_cell, r.values()))) is None
336+
]
335337
if not records:
336338
return (
337339
f"Error: no rows to export from {ref} "
@@ -353,7 +355,9 @@ async def _export_run(
353355

354356
preview_lines = csv_text.split("\n")[:4]
355357
truncated_note = (
356-
f" (capped at {_EXPORT_MAX_ROWS} rows)" if row_count >= _EXPORT_MAX_ROWS else ""
358+
f" (capped at {_EXPORT_MAX_ROWS} rows)"
359+
if row_count >= _EXPORT_MAX_ROWS
360+
else ""
357361
)
358362
return (
359363
f"Exported {row_count} rows{truncated_note} to {final_path} "

surfsense_backend/app/app.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -627,9 +627,13 @@ async def _sweep_stale_scraper_runs() -> None:
627627
async with async_session_maker() as session:
628628
swept = await fail_stale_running_runs(session)
629629
if swept:
630-
logger.info("[startup] Marked %d stale running scraper run(s) as error", swept)
630+
logger.info(
631+
"[startup] Marked %d stale running scraper run(s) as error", swept
632+
)
631633
except Exception:
632-
logger.warning("[startup] Stale scraper-run sweep failed (non-fatal)", exc_info=True)
634+
logger.warning(
635+
"[startup] Stale scraper-run sweep failed (non-fatal)", exc_info=True
636+
)
633637

634638

635639
@asynccontextmanager

surfsense_backend/app/capabilities/core/access/rest.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,10 @@ async def _execute_async_run(
209209
raise
210210
except (SurfSenseError, HTTPException) as exc:
211211
await _finalize_async(
212-
run_id, status="error", error=str(exc), started=started,
212+
run_id,
213+
status="error",
214+
error=str(exc),
215+
started=started,
213216
progress=reporter.coarse,
214217
)
215218
_publish_finished(run_id, "error", error=str(exc))

surfsense_backend/app/capabilities/core/runs.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,9 @@ async def record_spill(
291291
return None
292292

293293

294-
async def _maybe_cleanup(session: AsyncSession, table: str, retention_days: int) -> None:
294+
async def _maybe_cleanup(
295+
session: AsyncSession, table: str, retention_days: int
296+
) -> None:
295297
"""Delete a bounded batch of expired rows on ~1% of inserts."""
296298
if random.random() >= _CLEANUP_SAMPLE_RATE:
297299
return

0 commit comments

Comments
 (0)