mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-29 19:35:20 +02:00
Closes the create loop in chat: the agent describes user intent → the drafter sub-LLM produces an AutomationCreate JSON → this card surfaces a structured preview → approve persists; reject cancels. Edits flow through chat refinement (re-call with a refined intent), not in-card, so the card stays simple and the multi-turn checkpointer carries the context. Tool UI (components/tool-ui/automation/): - create-automation.tsx — entry dispatcher + ApprovalCard chrome (pending/processing/complete/rejected via useHitlPhase) + SavedCard (links to the detail page) + InvalidCard (lists drafter validation issues) + ErrorCard (verbatim message). Rejection result is hidden because the approval card itself shows the rejected phase inline. - automation-draft-preview.tsx — structured preview body: name + description + goal, triggers (humanised cron + tz + static-input keys), plan steps (step_id → action), and a collapsible raw JSON for power users. Wiring: - components/tool-ui/index.ts — re-export. - features/chat-messages/timeline/tool-registry/registry.ts — register create_automation → CreateAutomationToolUI (dynamic import, same pattern as other connector tools). - contracts/enums/toolIcons.tsx — Workflow icon + "Create automation" display name so fallback chrome (and timeline headers) are honest. Shared util: - lib/automations/describe-cron.ts — lifted from the route slice's lib/ folder since both the dashboard slice and the new approval card now render schedule descriptions. Slice imports updated; the now- empty slice lib/ folder is gone. Backend prompt fragments: - main_agent/system_prompt/.../create_automation/description.md and the tool's docstring no longer promise in-card edits. They make the refinement path explicit: if the user wants changes after seeing the draft, they reply in chat and the agent calls the tool again with a refined intent. v1 deliberately excludes: - In-card edit form / right-side edit panel — defer until we see real demand. The chat refinement loop covers the common case. - approve_always / persistent allow rules — automations are a single artifact, not a repeated mutation, so the "trust this kind of call" affordance doesn't apply.
62 lines
1.8 KiB
TypeScript
62 lines
1.8 KiB
TypeScript
/**
|
|
* Tool UI Components
|
|
*
|
|
* This module exports custom UI components for assistant tools.
|
|
* These components are registered with assistant-ui to render
|
|
* rich UI when specific tools are called by the agent.
|
|
*/
|
|
|
|
export { Audio } from "./audio";
|
|
export { CreateAutomationToolUI } from "./automation";
|
|
export { CreateDropboxFileToolUI, DeleteDropboxFileToolUI } from "./dropbox";
|
|
export {
|
|
type GenerateImageArgs,
|
|
GenerateImageArgsSchema,
|
|
type GenerateImageResult,
|
|
GenerateImageResultSchema,
|
|
GenerateImageToolUI,
|
|
} from "./generate-image";
|
|
export { GeneratePodcastToolUI } from "./generate-podcast";
|
|
export { GenerateReportToolUI } from "./generate-report";
|
|
export { CreateGoogleDriveFileToolUI, DeleteGoogleDriveFileToolUI } from "./google-drive";
|
|
export {
|
|
Image,
|
|
ImageErrorBoundary,
|
|
ImageLoading,
|
|
type ImageProps,
|
|
ImageSkeleton,
|
|
parseSerializableImage,
|
|
type SerializableImage,
|
|
} from "./image";
|
|
export {
|
|
CreateLinearIssueToolUI,
|
|
DeleteLinearIssueToolUI,
|
|
UpdateLinearIssueToolUI,
|
|
} from "./linear";
|
|
export { CreateNotionPageToolUI, DeleteNotionPageToolUI, UpdateNotionPageToolUI } from "./notion";
|
|
export { CreateOneDriveFileToolUI, DeleteOneDriveFileToolUI } from "./onedrive";
|
|
export {
|
|
Plan,
|
|
PlanErrorBoundary,
|
|
type PlanProps,
|
|
type PlanTodo,
|
|
parseSerializablePlan,
|
|
type SerializablePlan,
|
|
type TodoStatus,
|
|
} from "./plan";
|
|
export {
|
|
type ExecuteArgs,
|
|
ExecuteArgsSchema,
|
|
type ExecuteResult,
|
|
ExecuteResultSchema,
|
|
SandboxExecuteToolUI,
|
|
} from "./sandbox-execute";
|
|
export {
|
|
type UpdateMemoryArgs,
|
|
UpdateMemoryArgsSchema,
|
|
type UpdateMemoryResult,
|
|
UpdateMemoryResultSchema,
|
|
UpdateMemoryToolUI,
|
|
} from "./user-memory";
|
|
export { GenerateVideoPresentationToolUI } from "./video-presentation";
|
|
export { type WriteTodosData, WriteTodosSchema, WriteTodosToolUI } from "./write-todos";
|