Skip to content

Update/synco ai agent - #31

Closed
MisterPapaye wants to merge 6 commits into
mainfrom
update/synco-ai-agent
Closed

MisterPapaye wants to merge 6 commits into
mainfrom
update/synco-ai-agent

Conversation

@MisterPapaye

Copy link
Copy Markdown
Member

No description provided.

MisterPapaye and others added 6 commits September 9, 2026 16:49
AIService.ts gains chatAgentTurn/resumeAgentTurn, talking to the new
POST /api/orgs/:orgId/ai/chat (+ /tool-result) SSE endpoints — separate
from the existing chatOpenAICompatible/chatGemini regex-based paths,
which keep working unchanged for mistral/gemini/custom/local until
Phase 3 migrates them too.

OrgAI.vue: sendMessage branches to sendMessageViaAgent() when the
org's provider is 'openai'. consumeAgentStream() turns the new SSE
event vocabulary (text/tool_call_result/tool_call_pending/
tool_call_client_required/done/error) into message bubbles;
handleAgentToolDecision() answers a paused tool call — for a
server-mutating tool it just posts {accepted}, for a 'client' tool
(search_messages/create_thread/read_documentation/request_image_upload,
extracted into executeClientTool()) it actually runs the existing
client-side logic first and posts the real result. Session
persistence for this path lives entirely server-side now; syncSession
is only reached by the untouched legacy path.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Replaces the one-tool-call-per-bubble hack from the earlier agent
loop integration with a proper structured-turn model: each assistant
turn (OpenAI/Mistral/Gemini path) is a single message holding
interleaved text/tool parts in arrival order, exactly like a real
Claude turn — text, then a tool step, then more text, all in one
continuous block instead of spawning a new bubble per tool call.

New components (src/views/OrgSpace/components/ai/):
- AgentTurn.vue: renders a turn's parts, markdown text via the shared
  MarkdownRender.vue, tool parts via ToolStepItem.
- ToolStepItem.vue: the connected-dot/line timeline look (grey outline
  pending, pulsing primary while executing, filled primary when done,
  red on error/reject), collapsed by default, accept/refuse inline for
  mutating tools, dedicated slot for the interactive image-upload tool.
- ToolResultBody.vue: per-tool result rendering — search_messages
  reuses ThreadMessage.vue so results look and behave like real
  messages, with a teleport-to-thread button; create_task/create_space/
  create_thread get clickable cards; list_* tools get a plain list;
  everything else falls back to a readable JSON dump.

OrgAI.vue: user bubbles stay bubbles, but assistant turns are now
full-width (no boxed/mono chat-bubble look) for both the new
structured path and the legacy per-provider-migration path (local/
custom), which keeps its existing single tool_call widget untouched
functionally, just visually aligned with the new full-width style.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds EntityRow.vue (icon/logo-or-avatar + title + subtitle, hover
chevron) as the shared building block for anything the agent lists:

- list_spaces: grid of space cards (logo or icon), click navigates
  into the workspace.
- list_threads / create_thread: salon cards (hash or vocal icon),
  click opens the thread.
- list_members: member cards (avatar), click opens a DM with them.
- read_tasks (flattened across lists + unlisted) / get_task /
  create_task: task cards, click opens TaskDetailsModal.
- create_space: same card, click navigates into the new space.

Read-only tool results (list_*, search_messages, read_tasks, get_task)
now expand by default instead of staying collapsed behind a click —
that's the actual payload the user asked for, not an implementation
detail to hide. Mutating tools stay collapsed by default since their
text confirmation already says what happened.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
loadSession() was assigning the backend's structured StoredMessage[]
(role 'user'/'assistant'/'tool', toolCalls arrays, toolCallId/
toolResult) straight into aiSessionMessages — a completely different
shape from the parts-based turns OrgAI.vue renders live, so every
reopened conversation silently lost its tool steps and results,
showing only... whatever happened to survive the shape mismatch.

convertStoredMessagesToChatMessages() rebuilds the same {viaAgentLoop,
parts: [...]} turns the live SSE consumer builds: one turn per
'user'-delimited run of assistant/tool messages, tool results matched
back to their call by toolCallId. A cheap heuristic
(isStructuredAgentTranscript) only applies this when the loaded
messages are actually in the new format, so old-format sessions
(local/custom's flat syncSession() writes) keep loading as before.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- Floating button appears once the user scrolls more than ~200px
  away from the bottom of the conversation, click jumps back down
  (mirrors the existing scrollToBottom()).
- The composer textarea now grabs focus on mount too, not just on
  session switch (that watcher already existed).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
'../../../../../doc/*.md' from OrgAI.vue (src/views/OrgSpace/views/)
resolves to the GitHub/ parent directory, not synco_app/doc/ where
the 8 real .md files live — so import.meta.glob matched nothing and
the tool always returned just the header, no chapters. Pre-existing
bug (present in the old handleToolCall before this rework), carried
over verbatim into executeClientTool. Fixed both occurrences to
'../../../../doc/*.md' (4 levels up reaches synco_app/).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant