From 0d6c873358ac83cb90b87f56838e9ac3ac455293 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 25 Jun 2026 09:17:40 +0100 Subject: [PATCH] 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. --- .../src/agents/workflow/components/PromptTextArea.tsx | 10 ++++++++++ frontend/src/locale/en.json | 3 ++- frontend/src/preferences/PromptsModal.tsx | 4 ++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/frontend/src/agents/workflow/components/PromptTextArea.tsx b/frontend/src/agents/workflow/components/PromptTextArea.tsx index b53383f4..cb363e0b 100644 --- a/frontend/src/agents/workflow/components/PromptTextArea.tsx +++ b/frontend/src/agents/workflow/components/PromptTextArea.tsx @@ -62,6 +62,11 @@ const GLOBAL_CONTEXT_VARIABLES: WorkflowVariable[] = [ templatePath: 'system.user_id', section: 'Global context', }, + { + label: 'artifacts.artifact(id)', + templatePath: 'artifacts.artifact(id)', + section: 'Global context', + }, ]; function toAgentTemplatePath(variableName: string): string { @@ -109,6 +114,11 @@ function extractUpstreamVariables( templatePath: 'agent.chat_history', section: 'Workflow input', }, + { + label: 'agent.input_documents', + templatePath: 'agent.input_documents', + section: 'Workflow input', + }, ...GLOBAL_CONTEXT_VARIABLES, ]; const seen = new Set(variables.map((variable) => variable.templatePath)); diff --git a/frontend/src/locale/en.json b/frontend/src/locale/en.json index f0de03e9..2efb9eb0 100644 --- a/frontend/src/locale/en.json +++ b/frontend/src/locale/en.json @@ -932,7 +932,8 @@ "systemTime": "Current time (HH:MM:SS)", "systemTimestamp": "ISO 8601 timestamp", "systemRequestId": "Unique request identifier", - "systemUserId": "Current user ID" + "systemUserId": "Current user ID", + "artifactsLookup": "Artifact metadata by id" }, "learnAboutPrompts": "Learn about Prompts →", "publicPromptEditDisabled": "Public prompts cannot be edited", diff --git a/frontend/src/preferences/PromptsModal.tsx b/frontend/src/preferences/PromptsModal.tsx index efb34a45..0491e188 100644 --- a/frontend/src/preferences/PromptsModal.tsx +++ b/frontend/src/preferences/PromptsModal.tsx @@ -89,6 +89,10 @@ const systemVariableOptionDefinitions = [ labelKey: 'modals.prompts.systemVariableOptions.systemUserId', value: 'system.user_id', }, + { + labelKey: 'modals.prompts.systemVariableOptions.artifactsLookup', + value: 'artifacts.artifact(id)', + }, ]; const buildSystemVariableOptions = (translate: (key: string) => string) =>