Commit Graph
1551 Commits
Author SHA1 Message Date
Alex 9f19bc9fc7 Merge pull request #2637 from arc53/fix/docling-parse-error-and-schedule-status
Fix/docling parse error and schedule status
2026-08-06 12:55:54 +01:00
Alex 0ecb421954 fix: error type fixes and docling parsing improvements 2026-08-06 12:29:51 +01:00
Alex 23e249fca1 fix(workflows): validate CEL at save time and document which fields use it
Workflows ship two expression languages in adjacent fields. Agent
`prompt_template` and end `output_template` are Jinja2, so `{{query}}` is
correct there. State and condition `expression` fields are bare CEL,
where the same string is a parse error.

Nothing told users this. docs/content/Agents/nodes.mdx documented the
pre-CEL Set State node with `{{variable_name}}` examples and Set /
Increment / Append operations that no longer exist — "CEL" appeared
nowhere in the docs. The builder's own placeholder was `input.foo + 1`,
referencing an `input` namespace that is not in workflow state, while the
panel beside it advertised `{{ agent.variable }}`.

There was also no validation anywhere: neither validateWorkflow nor
validate_workflow_structure looked at state nodes at all, and conditions
were only checked for a non-empty string. A workflow containing
`{{query}}` saved and published clean, then aborted on the first message
with a bare caret dump that sanitize_api_error collapsed into "An error
occurred … please try again later" — advice that sends the user round the
same loop, which is what the 2026-08-01 report shows.

Adds validate_cel_expression (compile-only, since state is built at run
time and unresolved names are not knowable when saving) and wires it into
the workflow save path for both node types, plus the half-configured
state operations the engine silently skips. `{{ }}` gets a targeted hint,
raised only after compilation has already failed so valid CEL that
contains braces — `x == "{{y}}"`, or a nested map literal — is not
rejected.

celpy errors are now summarized: undeclared-reference messages embed a
repr of the entire activation, thousands of characters including the
user's own query, and others interpolate the offending state value.
Quoted fragments that are not bare identifiers are redacted, since
config errors now bypass sanitize_api_error to reach the user, and a
shared agent's runner is not its owner.

Docs rewritten with a table of which field takes which syntax, CEL
examples for Set State, and the Condition node section that basics.mdx
has been linking to all along.
2026-08-05 11:26:23 +01:00
Alex fcef3e68e5 Merge pull request #2622 from arc53/agent-key-rotation
Agent key rotation
2026-08-04 16:46:03 +02:00
Pavel 10e1cbb359 Copilot comments v1 2026-07-27 19:37:17 +02:00
ManishMadan2882 e8b7ca3c83 (fix)bubble: min-w-0 noise 2026-07-27 16:33:57 +05:30
ManishMadan2882 686a052771 (fix)ui/chat: extended message input, bubble overflowing width 2026-07-27 16:12:31 +05:30
Pavel 1394a7a0b4 Agent key rotation
Added button to rotate api key. This is required for better UX, now user has to remake agent if key is lost.
A migration is needed to keep track of proper usage + to not leave any orphan entries.
2026-07-25 18:15:56 +02:00
ManishMadan2882andClaude Opus 4.8 4cf529476f (fix)workflow: stable outside-click handler, drop trailing whitespace
Address Copilot review on #2600:
- pass a useCallback handler to useOutsideAlerter so the global mousedown
  listener isn't torn down/re-added on every WorkflowBuilder render
- remove trailing spaces after {displayName} in AgentPageHeader

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 18:32:12 +05:30
ManishMadan2882 19648a98fc (fix)worflow: ux, close the wrkflw settings on lclick outside even if the canva clicked 2026-07-21 03:12:33 +05:30
ManishMadan2882 f8aa67fc3a (fix)workflow ux: fixed width for title 2026-07-21 02:51:58 +05:30
Pavel 1fc43d5b9b Merge pull request #2591 from ManishMadan2882/feat/scroller-migration
(feat)chats: shadcn msg scroller, fix jitter
2026-07-16 19:44:52 +03:00
ManishMadan2882 563ead105a (feat)message scroller - no explicit space, workflow prev uses message scroller 2026-07-16 19:01:30 +05:30
Alex 3e34f45f96 Merge pull request #2594 from arc53/chunks-review
Chunks preview
2026-07-16 11:35:27 +02:00
ManishMadan2882 3fea44c4ee (chore)locales/fe: sync with en 2026-07-16 03:26:10 +05:30
Alex ca5f80995d fix: accurate per-call token usage and oversized-context guards
Token accounting:
- Drain each tool round's provider stream to exhaustion before running
  tools and recursing, so the usage decorator persists exactly one
  token_usage row per LLM call, at call end. Previously every round's
  generator was abandoned mid-iteration and flushed together at request
  teardown, writing N near-identical rows stamped with the final
  round's provider counts (duplicate billing).
- Consume the Chat Completions include_usage terminal chunk (it arrives
  after finish_reason and was never read) so streamed calls record
  provider-exact token counts instead of tiktoken estimates.
- Claim provider-reported usage once per call (_last_usage_claimed) so
  a late-finalized generator can never adopt another call's counts.

Oversized-context guards:
- Enforce Responses API function_call/function_call_output pairing in
  the input builder (drop unpaired items; bypassed for store-mode
  previous_response_id chaining where calls are matched server-side).
- Hard pre-send context gate: shrink oversized tool results and refuse
  payloads that cannot fit the model's window before dispatch, so a
  hopeless request is never sent or billed.
- Cap a single tool result entering the LLM context
  (TOOL_RESULT_MAX_TOKENS, default 20000); the tool journal and
  persistence keep the full result. Applied on the resume/continuation
  path too.
- Skip the fallback attempt when the payload cannot fit the fallback
  model's context window (10% estimation slack).
- Compression: never save a compression point that does not reduce
  tokens; bound oversized verbatim fields kept after a compression
  point (COMPRESSION_RECENT_FIELD_MAX_TOKENS, default 8000).

Robustness fixes from review:
- Google parallel function calls: complete index-less ToolCalls are no
  longer merged into one another (dict arguments raised TypeError on
  +=; second call could execute with the first call's arguments).
- Trailing-frame failures after a delivered answer no longer error the
  stream or restream the whole answer from the fallback
  (_stream_reached_finish).
- In-memory compression falls back to minimal pruning when the summary
  is not smaller than the original.
- keep<=0 guard in the middle-truncation helpers (a tiny cap returned
  marker + full text).

Frontend: tooltip on the Analytics tokens stat card explaining that
agent tool loops re-send conversation context on every step.
2026-07-15 21:20:39 +01:00
Pavel 0447eb9b8d Chunks preview 2026-07-13 23:22:17 +03:00
Alex 0adf88abed feat: improved compatability layer and responses api handing 2026-07-13 09:37:58 +01:00
ManishMadan2882 d78ddeadd0 (feat)chats: shadcn msg scroller, fix jitter 2026-07-12 20:27:36 +05:30
Alex 9f19bc64b5 fix: minor parser and id hardening 2026-07-09 18:43:48 +01:00
Alex 223a7588aa feat: small qol in fe 2026-07-09 13:03:57 +01:00
Alex 6dd5cf472a feat: improve workflow agent tool interation 2026-07-09 10:22:44 +01:00
Alex 7f57e06531 feat: multi select chip bug 2026-07-08 23:00:44 +01:00
Alex c3de3e47de Merge remote-tracking branch 'origin/main' into artifacts-and-code-executors
# Conflicts:
#	frontend/src/agents/workflow/WorkflowBuilder.tsx
2026-07-08 21:54:09 +01:00
Alex 89eb3f68fc fix: remove mcp artefacts, handle non fatal issues on workflow
gracefully
2026-07-08 21:05:40 +01:00
Alex 12dfefdd05 fix: clean up and better artefact consistency 2026-07-08 20:06:31 +01:00
Alex 66786c2760 fix: remove code exec as default and sec improvements 2026-07-08 18:50:10 +01:00
ManishMadan2882 e9c377378c (fixes)worflow: gracefully handle delete on key event 2026-07-08 00:57:58 +05:30
ManishMadan2882 3356ca19a9 (feat)workflows: add undo/redo 2026-07-06 16:38:33 +05:30
Alex 94a845aa82 fix: more artefact hardening 2026-07-04 11:42:27 +02:00
ManishMadan2882 e340fed164 (fix)sources popup: last item in the list squashed 2026-07-03 01:05:22 +05:30
ManishMadan2882 3dc4887c6d (feat)message-input: scrollbar 2026-06-29 16:15:25 +05:30
Alex b61e190df3 feat: code exec tool and desc 2026-06-26 11:30:55 +01:00
Alex 0606c5ddcb Wrap multiple artifact chips instead of overflowing horizontally
An assistant message with several produced artifacts rendered one chip each in a
non-wrapping flex row, so 3+ chips overflowed and the bubble showed a horizontal
scrollbar. Add flex-wrap + gap-y-2 (the existing per-chip mr-2 keeps the
horizontal spacing) so the chips wrap to the next line, matching the other
artifact-chip render branch.
2026-06-26 08:10:24 +01:00
Alex 06c5810664 Add icons for the code, artifact, and read-document tools
Add Material Symbols-style SVG icons (terminal / document / document-scanner) for
code_executor, artifact_generator, and read_document so they render with an icon
like the other tools. The ToolIcon import.meta.glob resolves tool_<name>.svg by
backend tool name automatically — no registration needed.
2026-06-25 19:05:55 +01:00
Alex 636f299e67 Default the code and artifact tools; scope read_document to workflows
Enable code_executor and artifact_generator by default in chats (added to
DEFAULT_CHAT_TOOLS) — they load via the synthetic-id path user- and
conversation-scoped like scheduler, and persist artifacts (no user_tools FK).
Make read_document an internal agent-builtin flagged workflow_only so it appears
only in the workflow builder, not the classic agent picker or the Add-Tool
catalog (reuses the builtin synthetic-id path; still run-scoped and authz-gated).

Per decision, default-on code_executor runs sandboxed code without an approval
prompt (the sandbox is the trust boundary); this is documented in settings and
the threat model, and multi-tenant deployments should add per-tenant isolation
(Daytona / gVisor / egress policy).
2026-06-25 18:37:04 +01:00
ManishMadan2882 f6f741ba23 (feat:ui) message input, search icon 2026-06-25 19:27:44 +05:30
Alex 7c91517d62 Fix workflow Preview run blockers and multi-artifact chips
Make the doc-driven Preview flow usable and surface every produced artifact:
- A Preview submit with attachments but no text now runs the workflow (opt-in on
  MessageInput; no filler text is injected), so a doc-driven workflow can be run
  by attaching its documents.
- The builder's global Escape no longer tears down the whole Preview/drawer, and
  no longer fires from inside text fields.
- The Preview drawer has a visible close button, and the upload toast moves off
  the attach/send controls (to the left) while the Preview is open.
- A turn that produces multiple artifacts now renders one chip per artifact
  (labelled by tool, indexed when several), instead of exposing only the last.
2026-06-25 14:18:38 +01:00
Alex 60a06081ad Share one file-input control between code and agent workflow nodes
The code node's Input files and the agent node's Documents now render the same
NodeDocumentsControl: an All/None/Choose toggle, a multiselect of upstream
document/artifact refs, and a free-text add-ref escape (a typed A1/id appears as
a removable chip). The control owns its toggle state so Choose is reachable from
an empty selection — retiring the per-node parent flag. File passing stays
agent-only; the code node keeps its inputs field name and stages the selected
refs as files in the sandbox.
2026-06-25 13:45:51 +01:00
Alex 273c830b55 Make the Choose documents mode reachable on a fresh agent node
Clicking "Choose…" with nothing selected now opens the document picker. The
mode was derived purely from the stored input_documents, so an empty selection
read back as None and the picker never appeared — leaving per-node document
selection unreachable unless a value was already set. An explicit per-node flag
now keeps Choose mode active even when empty, without leaking across nodes.
2026-06-25 12:23:41 +01:00
Alex 542ceb4497 Surface orphaned document selections as removable chips
An input_documents entry with no matching upstream option (a renamed or deleted
upstream output variable, or a literal ref) now appears as a removable chip in
the agent node's Choose-mode document selector instead of silently vanishing,
so the stored selection stays visible and editable.

Adds withChosenDocumentOptions to merge stored selections into the multiselect
options, with tests.
2026-06-25 11:52:26 +01:00
Alex 51b0dd8d45 Add a Documents control to workflow agent nodes
The agent-node panel gains a Documents section (All input docs / None / Choose
upstream document variables) and a file-passing selector (auto / native /
extract), writing the input_documents and file_passing config the engine
consumes. Selections persist as bare state-variable names so they resolve
against run state; the toggle, chosen docs, and file-passing mode re-derive from
the stored config on reload. Reuses the existing multiselect, select, and
upstream-variable enumeration.

Known minor: an input_documents entry whose upstream variable was renamed or
deleted is preserved in config but not shown as a removable chip in Choose mode.
2026-06-25 11:43:03 +01:00
Alex 0d6c873358 Surface document and artifact variables in the prompt variable pickers
Add the run input-documents variable to the workflow builder's variable
dropdown (workflow input) and the artifact-by-id lookup to both the workflow
builder and the agent prompt builder, so the variables exposed by the shared
template namespaces are discoverable. agent.input_documents is workflow-only
(injected from run state) and stays out of the agent builder, which would
render it empty.
2026-06-25 09:17:40 +01:00
Alex 5a87fa6258 Add document I/O to workflows and surface run artifacts
Let workflow runs consume and produce documents end to end: bridge uploaded
attachments into run-scoped artifacts so nodes receive the input documents
(with a per-run cap and server-computed size/sha256, and the run row pre-created
so produced artifacts are authorized during the run); emit the run id to the
client and add a builder panel that lists, previews, and downloads a run's
artifacts; and allow attaching documents to a Preview run via the existing
upload flow.

Also fixes issues a compliance workflow surfaced: attachment ownership now keys
on the raw identity instead of a sanitized one (the sanitized form could not be
read back and could collide across users); workflow code nodes read prior state
from a state.json data file instead of templating it into the program, so
untrusted document content can never be interpolated into executed code;
structured node output wrapped in code fences is recovered; and the live
speech-to-text ownership check compares the raw identity.
2026-06-24 22:50:37 +01:00
Alex d573bab4a0 Add the code node to the workflow builder
Expose the workflow code node in the builder UI: a draggable palette entry, a
canvas node, and a config panel for the code, inputs, output variable, timeout,
and an optional JSON schema (validated before save). The panel serializes to the
same config the engine reads, so a code node built in the UI runs and produces an
artifact reference; workflows without code nodes load unchanged.
2026-06-24 15:47:49 +01:00
Alex a06b348c34 Preview artifact bytes inline in the sidebar
Render produced-artifact bytes inline when a version has no embedded spec:
HTML and SVG in the existing sandboxed iframe (with the restrictive CSP),
images inline via a blob URL, and Markdown/CSV/JSON/plain text as escaped text;
office documents and PDFs keep the download card. Bytes are fetched through the
existing authenticated download path, version-aware, with object URLs revoked on
change. Untrusted HTML/SVG renders only inside the scriptless sandboxed iframe
and Markdown is rendered without raw HTML, so artifact content cannot script the
app.
2026-06-24 15:23:49 +01:00
Alex 182a14d257 Add artifact preview, versions, and download to the sidebar
Extend the artifact sidebar with a document/file view: a version selector,
authenticated download honoring Content-Disposition (following the backend
redirect to a presigned URL when configured), and version restore. Preview is
chosen by kind - html, svg, and mermaid render inside a sandboxed iframe with a
restrictive CSP (mermaid via its own sandboxed render so untrusted diagram text
never reaches the app DOM), office documents and PDFs show a download card, and
code or data render as text. Wires the new artifact endpoints into the API
service and leaves the existing notes/todo path unchanged.
2026-06-24 11:29:33 +01:00
Alex 9c0803f017 Merge pull request #2557 from ManishMadan2882/main
minor ui, filter users intead of exact match
2026-06-23 21:32:39 +01:00
ManishMadan2882 aa10146e25 (fix)ui/settings: prompts dropdown 2026-06-24 01:08:02 +05:30
Alex d7bbfcfe17 fix: minor graph rag improvements 2026-06-23 20:10:41 +01:00