Commit graph

287 commits

Author SHA1 Message Date
CREDO23
98b6977c68 permissions/ask: gate 'approve_always' palette entry on MCP-ness
Only MCP tools have a persistence target for 'approve_always' (the
connector's trusted-tools list); for native tools the decision lives
only in the in-memory runtime ruleset. Reflect that in the wire palette
so the FE can stay a pure renderer of allowed_decisions instead of
peeking at context.mcp_connector_id to decide whether to show the
'Always Allow' button.

The backend still accepts an 'approve_always' reply for any tool kind
(in-memory promotion is harmless), it just doesn't advertise it when
there's nowhere to persist.
2026-05-15 14:54:16 +02:00
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
Anish Sarkar
2f540ee065 refactor(tests): simplify logging messages and enhance manual upload journey tests 2026-05-09 05:10:05 +05:30
Anish Sarkar
fbfde74cdc test(e2e): route connector PDF canary responses in chat fake & add connector PDF canaries 2026-05-09 05:03:38 +05:30
Anish Sarkar
5a2357b981 test(e2e): serve binary PDF bytes from storage connector fakes 2026-05-09 05:03:07 +05:30
Anish Sarkar
ad226853e5 test(e2e): wire PDF metadata into connector fixture JSONs 2026-05-09 05:02:40 +05:30
Anish Sarkar
fc32ab0cf3 test(e2e): add shared binary fixture loader for connector fakes 2026-05-09 05:02:23 +05:30
Anish Sarkar
523563b948 test(e2e): add canary PDFs and reproducer for connector docling coverage 2026-05-09 05:02:04 +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
Anish Sarkar
e211028866 test(e2e): add ClickUp MCP backend fake 2026-05-08 13:12:34 +05:30
Anish Sarkar
7303e3ebb3 test(e2e): wire Dropbox Playwright fixtures 2026-05-08 12:28:26 +05:30
Anish Sarkar
69437b1fe4 test(e2e): add Dropbox backend fake 2026-05-08 12:27:45 +05:30
Anish Sarkar
da8b151634 test(e2e): wire OneDrive fake into harness 2026-05-08 03:48:35 +05:30
Anish Sarkar
3ee633cb23 test(e2e): add OneDrive Graph backend fake 2026-05-08 03:48:18 +05:30
Anish Sarkar
73b6375688 test(e2e): wire Slack fake into harness 2026-05-08 03:08:36 +05:30
Anish Sarkar
bf23cb2381 test(e2e): add Slack MCP backend fake 2026-05-08 02:24:39 +05:30
Anish Sarkar
d36bd33733 test(backend): route Confluence canary responses in E2E chat 2026-05-08 01:09:49 +05:30
Anish Sarkar
b74caf157b test(backend): add Confluence indexing E2E fake 2026-05-08 01:09:40 +05:30
Anish Sarkar
640ae03030 test(backend): add Confluence OAuth E2E fakes 2026-05-08 01:02:52 +05:30
Anish Sarkar
ebdf6cbaed test(backend): route Jira tool responses in E2E chat 2026-05-08 00:15:18 +05:30
Anish Sarkar
369f0aaff3 test(backend): add Jira MCP E2E fakes 2026-05-08 00:15:08 +05:30
Anish Sarkar
e6297e2e40 test(backend): add shared MCP runtime E2E fake 2026-05-08 00:14:43 +05:30
Anish Sarkar
43eae11197 test(backend): add shared MCP OAuth E2E fake 2026-05-08 00:14:34 +05:30