Commit graph

184 commits

Author SHA1 Message Date
CREDO23
c8b756ae8f hitl/wire: rename 'always' decision-type to 'approve_always'
Renames the SurfSense HITL extension decision-type from "always" to
"approve_always" so it sits in the same verb-first family as "approve",
"reject", and "edit". The Python constant is now SURFSENSE_DECISION_APPROVE_ALWAYS;
the wire value, the permission-domain decision_type, and the FE union members
all match (no wire/internal mismatch).

Both the multi_agent_chat permission middleware and the legacy new_chat one
accept the new wire value; the FE types.ts union is updated accordingly.

The "context.always" payload key is intentionally left untouched - it's the
patterns-to-promote field, semantically distinct from the decision type.
2026-05-15 14:47:32 +02:00
CREDO23
6671c91841 multi_agent_chat/permissions: persist 'always' decisions to trusted-tools list
Until now an "Always Allow" reply only updated the in-memory runtime
ruleset, evaporating after the session ended. Persist it to the
existing connector.config['trusted_tools'] list so the next session's
fetch_user_allowlist_rulesets picks it up and the user is never asked
again for the same (connector, tool) pair.

- TrustedToolSaver + make_trusted_tool_saver(user_id) in
  user_tool_allowlist: opens its own session via async_session_maker
  per call, logs and swallows failures (in-memory promotion is the
  canonical "always" path, durable persistence is opportunistic).

- PermissionMiddleware._process is now pure: returns
  (state_update, list[_AlwaysPromotion]). aafter_model awaits the
  saver for each promotion; after_model discards them. Promotions are
  only emitted for tools whose metadata exposes mcp_connector_id, so
  native tools and KB FS ops are correctly skipped.

- main_agent factory builds the saver once per turn and stashes it in
  dependencies["trusted_tool_saver"]; pack_subagent and the KB
  middleware stack forward it through build_permission_mw.

- Renamed pm._process(state, None) call sites in two existing tests to
  pm.after_model(state, None) so they exercise the public hook
  contract instead of the now-tuple-returning private method.
2026-05-15 14:07:08 +02:00
CREDO23
a97d1548a6 multi_agent_chat/permissions: surface MCP tool metadata into ask interrupts
The FE permission card needs mcp_connector_id, mcp_server, and
tool_description in the interrupt context to render "Always Allow"
against the right connected account. Thread the tool through the
ask pipeline:

- pack_subagent → build_permission_mw(tools=...) → PermissionMiddleware
  (tools_by_name) → request_permission_decision(tool=...) →
  build_permission_ask_payload(tool=...) projects card fields out of
  BaseTool.

- mcp_tool.py: stdio path now stashes mcp_connector_id in metadata for
  parity with the HTTP path.
2026-05-15 11:28:06 +02:00
CREDO23
ef1152b80e multi_agent_chat/permissions: layer user allow-list into subagent compile 2026-05-14 21:57:38 +02:00
CREDO23
d45dfbfbd6 multi_agent_chat: pack_subagent owns per-subagent PermissionMiddleware via Ruleset 2026-05-14 20:09:29 +02:00
CREDO23
0723702320 multi_agent_chat: real-graph regressions for unified HITL paths + format pass 2026-05-14 17:41:24 +02:00
CREDO23
a36b15b834 multi_agent_chat/middleware: tighten parallel-keying test with heterogeneous bundles and per-slice assertions 2026-05-14 10:11:51 +02:00
CREDO23
d69d2cc1fc multi_agent_chat/middleware: tighten heterogeneous slice arithmetic to (2,3) bundles 2026-05-14 10:05:04 +02:00
CREDO23
668b89927b multi_agent_chat/middleware: real-graph regression test for partial-pause parallel routing 2026-05-14 09:47:24 +02:00
CREDO23
8e10f38f32 multi_agent_chat/middleware: real-graph regression test for all-reject parallel routing 2026-05-14 09:36:03 +02:00
CREDO23
ca57b2106e multi_agent_chat/middleware: real-graph regression test for heterogeneous parallel decisions 2026-05-14 09:26:08 +02:00
CREDO23
f2495092da chat/stream_resume: salt thinking-step prefix with turn_id to avoid duplicate React keys 2026-05-13 21:15:51 +02:00
CREDO23
0fd87ccb7f chat/stream_resume: key Command(resume=...) by Interrupt.id for parallel HITL 2026-05-13 20:59:57 +02:00
CREDO23
c06dd6e8ba chat/stream_new_chat: emit one SSE frame per pending interrupt 2026-05-13 20:59:48 +02:00
CREDO23
1001f56206 multi_agent_chat/middleware: parallel task tests and full bridge coverage 2026-05-13 19:57:57 +02:00
CREDO23
6fb011c95c multi_agent_chat/middleware: real-graph regression tests for interrupt stamping 2026-05-13 19:57:09 +02:00
CREDO23
fc2c5b6445 multi_agent_chat/middleware: per-call thread_id, tcid-keyed resume, decisions slicer 2026-05-13 19:56:51 +02:00
CREDO23
246dae40a8 Merge upstream/dev into feature/multi-agent 2026-05-12 21:23:37 +02:00
CREDO23
d843468256 multi_agent_chat/subagents: dict-keyed middleware_stack + always-on KB 2026-05-12 18:04:54 +02:00
DESKTOP-RTLN3BA\$punk
c8374e6c5b feat: improved document, folder mentions rendering
Some checks are pending
Build and Push Docker Images / tag_release (push) Waiting to run
Build and Push Docker Images / build (./surfsense_backend, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_backend, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_web, ./surfsense_web/Dockerfile, web, surfsense-web, ubuntu-24.04-arm, linux/arm64, arm64) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_web, ./surfsense_web/Dockerfile, web, surfsense-web, ubuntu-latest, linux/amd64, amd64) (push) Blocked by required conditions
Build and Push Docker Images / create_manifest (backend, surfsense-backend) (push) Blocked by required conditions
Build and Push Docker Images / create_manifest (web, surfsense-web) (push) Blocked by required conditions
2026-05-09 22:15:51 -07:00
Rohan Verma
28a02a9143
Merge pull request #1357 from CREDO23/feature/multi-agent
[Feature] Multi-agent chat: hierarchical timeline, live subagent streaming, and inline HITL approvals
2026-05-09 16:13:04 -07:00
Rohan Verma
fa31da9937
Merge branch 'dev' into feat/e2e-testing 2026-05-09 16:10:45 -07:00
CREDO23
2ab6b1c757 Merge upstream/dev into feature/multi-agent. 2026-05-09 23:00:56 +02:00
Anish Sarkar
de6fc80dbd chore: ran linting 2026-05-09 05:28:09 +05:30
Anish Sarkar
f7bac59a4b test(integration): enhance Drive indexer credential resolution tests for Composio and native connectors 2026-05-09 05:26:36 +05:30
Anish Sarkar
dbf575fbd0 chore: ran linting 2026-05-09 05:16:20 +05:30
CREDO23
1761b60c16 Carry thinkingStepId on tool output and extend builder and parity tests. 2026-05-08 23:17:12 +02:00
CREDO23
007a0a30ec Cover tool_activity_metadata for span-only, step-only, and combined cases. 2026-05-08 23:16:56 +02:00
CREDO23
f944cdacb7 Add helpers to open and close task delegation span ids. 2026-05-08 22:47:03 +02:00
CREDO23
78f4747382 refactor(chat): stream agent events via stream_output and remove parity v2 flag 2026-05-07 19:40:10 +02:00
CREDO23
7e07092f67 refactor(chat): drop alternate streaming entry path; use graph_stream 2026-05-07 19:25:20 +02:00
CREDO23
52895e37e9 build streaming contexts for chat resume and regenerate paths 2026-05-07 17:57:27 +02:00
CREDO23
a04b2e88bd wire orchestrator streaming context path and align event relay outputs 2026-05-07 17:06:17 +02:00
CREDO23
0f40279d95 Expand orchestration gate coverage to resume and regenerate flows. 2026-05-07 16:18:29 +02:00
CREDO23
52593d88db Reorganize streaming orchestration modules into relay and orchestration folders. 2026-05-07 16:00:15 +02:00
CREDO23
f8754a9dab Rename streaming runtime modules for clearer SRP boundaries. 2026-05-07 15:41:33 +02:00
CREDO23
4e664652a8 Add streaming runtime helpers with behavior-focused unit tests. 2026-05-07 15:13:22 +02:00
CREDO23
8b6ffd12b8 Add parity unit tests for extracted chat streaming vs legacy. 2026-05-06 20:08:48 +02:00
CREDO23
366122da6e Add unit tests for streaming interrupts and service propagation. 2026-05-06 20:08:48 +02:00
CREDO23
619a8362b7 Add unit tests for streaming emitters and registry wiring. 2026-05-06 20:08:48 +02:00
CREDO23
3d8c4be369 Add unit tests for streaming SSE envelope behavior. 2026-05-06 20:08:48 +02:00
Anish Sarkar
8536bac29a test(backend): enhance Drive file filtering and add unit tests for _drive_list_files 2026-05-06 17:58:58 +05:30
Anish Sarkar
d4f806f134 test(backend): add OAuth state security unit tests 2026-05-06 17:18:31 +05:30
DESKTOP-RTLN3BA\$punk
4e174f17f2 chore: linting 2026-05-05 17:08:34 -07:00
CREDO23
a3c3db2a18 test(multi-agent): pin first-wins assumption on pending subagent interrupts 2026-05-05 22:57:35 +02:00
CREDO23
73272ce348 refactor(multi-agent): switch compile graph to new orchestrator and drop deepagent_stack 2026-05-05 20:55:38 +02:00
CREDO23
9a4ee5d16b chore: trim narrative comments and docstrings 2026-05-05 18:27:46 +02:00
CREDO23
1745d7dccf feat(middleware): scope model fallback to provider/network errors only 2026-05-05 18:04:47 +02:00
CREDO23
f695298d30 feat(multi-agent): wire model fallback and retry into subagent middleware 2026-05-05 17:39:27 +02:00
CREDO23
fa6f3015a9 test(hitl): regression net for bundle decision shape preservation 2026-05-05 17:19:39 +02:00