Skip to content

feat(chat): create workflow artifacts from chat#2794

Merged
daryllimyt merged 5 commits into
mainfrom
feat/mission-control-workflow-artifact
Jun 1, 2026
Merged

feat(chat): create workflow artifacts from chat#2794
daryllimyt merged 5 commits into
mainfrom
feat/mission-control-workflow-artifact

Conversation

@daryllimyt
Copy link
Copy Markdown
Contributor

@daryllimyt daryllimyt commented May 31, 2026

Summary

  • add a Workspace Chat workflow creation tool backed by the internal workflow create API
  • project created workflows into chat artifacts so the artifact drawer can open them
  • render workflow artifacts with an embedded workflow canvas and compact latest-run events view

Verification

  • uv run ruff check packages/tracecat-registry/tracecat_registry/core/workflow.py packages/tracecat-registry/tracecat_registry/sdk/workflows.py tracecat/artifacts/bindings.py tracecat/chat/tools.py tracecat/workflow/executions/internal_router.py
  • uv run basedpyright packages/tracecat-registry/tracecat_registry/core/workflow.py packages/tracecat-registry/tracecat_registry/sdk/workflows.py tracecat/artifacts/bindings.py tracecat/chat/tools.py tracecat/workflow/executions/internal_router.py
  • pnpm -C frontend exec biome check src/components/builder/canvas/canvas.tsx src/components/workspace-chat/artifacts/artifact-content.tsx src/components/workspace-chat/artifacts/workflow-artifact-view.tsx
  • pnpm -C frontend run typecheck
  • pre-commit hooks during commit

Summary by cubic

Create and preview workflows directly from chat with a new workflow artifact that embeds the canvas, run controls, and a compact run viewer. Adds the core.workflow.create_workflow tool and API, and keeps workflow lists in sync when chat creates a new workflow.

  • New Features

    • Added core.workflow.create_workflow tool (enabled in chat defaults); binds results to workflow artifacts with id/title and a default swatch color.
    • Introduced WorkflowArtifactView: lazy-loaded artifact with embedded WorkflowCanvas, a hover-expand actions pill, Manual Run, and a compact Events/Input/Result (+Interaction) viewer with a single-row run header; auto-focuses events on run and shares viewer logic with the builder for consistency.
    • Added embedded mode to WorkflowCanvas with fit tuned for small graphs and a collapsible toolbar that shrinks to a pill and expands on hover.
    • Exposed POST /internal/workflows (workflow:create scope; returns id/title) and SDK WorkflowsClient.create_workflow(...).
  • Bug Fixes

    • Refresh workflow lists and detail queries when a workflow artifact streams in so chat-created workflows appear immediately in dashboards and pickers.

Written for commit 38c0493. Summary will update on new commits.

Review in cubic

@daryllimyt daryllimyt added enhancement New feature or request ui Improvements or additions to UI/UX api Improvements or additions to the backend API agents LLM agents labels May 31, 2026
Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@blacksmith-sh

This comment has been minimized.

@zeropath-ai
Copy link
Copy Markdown

zeropath-ai Bot commented May 31, 2026

No security or compliance issues detected. Reviewed everything up to 38c0493.

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► frontend/src/components/builder/canvas/canvas-toolbar.tsx
    Introduce embedded mode for canvas toolbar
    Add PlusIcon component
    Implement hover and popover expansion logic for toolbar
► frontend/src/components/builder/canvas/canvas.tsx
    Add embedded prop to WorkflowCanvas
    Adjust fitViewOptions for embedded mode
► frontend/src/components/builder/events/events-shared.tsx
    Add EventsLoading component
    Add ResolvedLastExecution type
    Implement useResolvedLastExecution hook
    Add NoWorkflowRuns component
    Add buildEventsTabItems function
    Add CompactWorkflowEventsHeader component
► frontend/src/components/builder/events/events-sidebar.tsx
    Integrate useResolvedLastExecution hook
    Use buildEventsTabItems for tab generation
► frontend/src/components/builder/events/events-workflow.tsx
    Add formatRunDuration utility function
    Implement CompactWorkflowEventsHeader component
    Add embedded prop to WorkflowEventsHeader
► frontend/src/components/nav/builder-nav.tsx
    Add onAfterTrigger prop to WorkflowManualTrigger
► frontend/src/components/workspace-chat/artifacts/artifact-content.tsx
    Add dynamic import for WorkflowArtifactView
    Add workflow artifact type handling
► frontend/src/components/workspace-chat/artifacts/artifact-registry.tsx
    Add core.workflow.create_workflow to artifact registry
► frontend/src/components/workspace-chat/artifacts/workflow-artifact-view.tsx
    Create WorkflowArtifactView component
    Implement WorkflowArtifactToolbar
    Implement WorkflowArtifactCanvas
    Implement WorkflowArtifactBottomPanel
    Create CompactWorkflowEvents component
    Create CompactWorkflowEventsList component
► packages/tracecat-registry/tracecat_registry/core/workflow.py
    Add create_workflow registry function
► packages/tracecat-registry/tracecat_registry/sdk/workflows.py
    Implement create_workflow method in WorkflowsClient
► tests/unit/test_artifacts.py
    Add core.workflow.create_workflow to artifact bindings
► tests/unit/test_chat_tools.py
    Add core.workflow.create_workflow to default tools
► tracecat/artifacts/bindings.py
    Add WorkflowArtifactPayload typing
    Add _WorkflowToolResult model
    Add _build_workflow_artifact function
    Add ArtifactBinding for core.workflow.create_workflow
► tracecat/chat/tools.py
    Add core.workflow.create_workflow to tool list
► tracecat/workflow/executions/internal_router.py
    Add InternalWorkflowCreateRequest model
    Add InternalWorkflowCreateResponse model
    Implement create_workflow endpoint
Refactor ► frontend/src/components/builder/events/events-sidebar.tsx
    Extract shared event loading and resolution logic to events-shared.tsx
► frontend/src/components/builder/events/events-shared.tsx
    Create EventsLoading component
    Create useResolvedLastExecution hook
    Create NoWorkflowRuns component
    Create buildEventsTabItems function
► frontend/src/components/workspace-chat/artifacts/artifact-content.tsx
    Add dynamic import for WorkflowArtifactView
► frontend/src/components/workspace-chat/artifacts/workflow-artifact-view.tsx
    Extract UI components into separate functions
Other ► frontend/src/components/workspace-chat/artifacts/workflow-artifact-view.tsx
    Add key prop to WorkflowBuilderErrorBoundary and WorkflowProvider

- Run button and selected-action inputs in the embedded workflow artifact
- Collapsible action toolbar that shrinks to a pill and expands on hover
- Compact run view with Events/Input/Result tabs and inline result viewing
- Condensed single-row run header (status + trigger + duration) when embedded
@blacksmith-sh

This comment has been minimized.

@daryllimyt daryllimyt marked this pull request as ready for review June 1, 2026 19:33
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 13 files

Confidence score: 5/5

  • This PR looks low risk to merge: the only reported concern is a low-severity (3/10) maintainability issue rather than a concrete runtime bug or regression.
  • frontend/src/components/workspace-chat/artifacts/workflow-artifact-view.tsx introduces events-panel logic that duplicates existing builder events-sidebar behavior, which could increase long-term drift and update overhead.
  • Pay close attention to frontend/src/components/workspace-chat/artifacts/workflow-artifact-view.tsx - duplicated events-sidebar logic may diverge from builder behavior over time.

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Extract the last-execution resolution, loading/empty/error states, and
events tab construction shared by the builder events sidebar and the
embedded workflow artifact into events-shared, removing the duplicated
panel logic between them.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2eb8ed830a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tracecat/artifacts/bindings.py
The workflow artifact type had no query invalidator, so chat-created
workflows did not appear in already-mounted dashboards or workflow/subflow
pickers until the 5-minute workflow-list stale window lapsed. Invalidate
the workflow list and detail queries when a workflow artifact streams in,
matching the case/table/agent entries.
@daryllimyt daryllimyt merged commit 158d0dc into main Jun 1, 2026
19 checks passed
@daryllimyt daryllimyt deleted the feat/mission-control-workflow-artifact branch June 1, 2026 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents LLM agents api Improvements or additions to the backend API enhancement New feature or request ui Improvements or additions to UI/UX

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant