Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend-v2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ v2 只做核心执行,有几项界面在、但不会出现或不可用:服

Agent 和模型清单读取与 Chat 相同的 `/chat/executors`,保存后端返回的 `agentId` / `modelId`,目录为空或读取失败时不提供演示选项。旧占位配置保留并提示重新选择。角色目录读取工作区服务端目录(与设置页同一份数据);Skill 清单合并当前用户的服务端技能库与租户各空间已确认安装的 Skill 插件,插件标识保留 `namespace/identifier`,运行时检查目标项目的安装回执。MCP 候选读取租户真实安装目录,展示配置是否完整。卸载后已有绑定保留并提示不可用。每个节点最多启用 16 个 MCP,配置使用团队共享设置。安装和选择可以保存,非空执行须待 Node 与服务端完整生命周期接入;当前明确报错,不会忽略已启用的 MCP 后继续运行。

Agent 检查器在「必需 Skill」下方提示“运行的节点会话对团队可见,所选个人 Skill 的内容也会被看到”,并在交互模式旁标「暂不生效」和一句原因(`editor/workflow-unapplied-setting-hint.tsx`)。标哪几项只看 v2-server analyze 返回的 `unappliedSettings`,它和运行结果里的 `payload.unapplied` 出自同一段服务端代码;前端只知道每项放在哪个字段旁、原因怎么说,不自己判断。角色、Skill、MCP 与重试已经应用,新分析不再列出它们;历史运行 payload 里保存的 `role`、`skill`、`retry` 标记仍按原样显示。服务端列出某项时提示出现,不再列出时自动消失;列出前端还没有对应字段的项时,在 Agent 设置末尾统一说明。浏览器里的旧工作流库(`local-workflow-backend.ts`)不执行运行,这两项总是空的。工作流页本身不运行工作流,运行在对话页里(见"运行工作流")。
Agent 检查器在「必需 Skill」下方提示“运行时读取发起人同名的个人 Skill,其内容在节点会话中对团队可见”(工作流创建/启动对话框、任务处理/拆分/评论 `@` 工作流和定时任务表单在所选工作流启用了个人 Skill 时同步提示),并在交互模式旁标「暂不生效」和一句原因(`editor/workflow-unapplied-setting-hint.tsx`)。标哪几项只看 v2-server analyze 返回的 `unappliedSettings`,它和运行结果里的 `payload.unapplied` 出自同一段服务端代码;前端只知道每项放在哪个字段旁、原因怎么说,不自己判断。角色、Skill、MCP 与重试已经应用,新分析不再列出它们;历史运行 payload 里保存的 `role`、`skill`、`retry` 标记仍按原样显示。服务端列出某项时提示出现,不再列出时自动消失;列出前端还没有对应字段的项时,在 Agent 设置末尾统一说明。浏览器里的旧工作流库(`local-workflow-backend.ts`)不执行运行,这两项总是空的。工作流页本身不运行工作流,运行在对话页里(见"运行工作流")。

### Unapplied settings and start warnings (English)

Expand Down
55 changes: 55 additions & 0 deletions frontend-v2/src/features/chat/workflow-run/run-flow.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -762,4 +762,59 @@ describe('workflow runs in chat', () => {
dialog = await openDialog()
expect(within(dialog).getByRole('checkbox', { name: '节点重跑时把上次失败原因告诉智能体' })).toBeChecked()
})

it('shows the personal Skill team visibility hint in create and start dialogs only when enabled', async () => {
const hint = '运行时读取发起人同名的个人 Skill,其内容在节点会话中对团队可见。'
const graphWithPersonalSkill = {
nodes: [
{ id: 'start', type: 'workflow', position: { x: 0, y: 100 }, data: { kind: 'start', title: '开始', description: '' } },
{
id: 'agent-1',
type: 'workflow',
position: { x: 300, y: 100 },
data: {
kind: 'agent',
title: '审查节点',
description: '',
agentConfig: {
skills: [{ skillId: 'my-personal-skill', enabled: true }],
},
},
},
{ id: 'output', type: 'workflow', position: { x: 600, y: 100 }, data: { kind: 'output', title: '输出', description: '', outputs: [] } },
],
edges: [
{ id: 'e1', source: 'start', target: 'agent-1' },
{ id: 'e2', source: 'agent-1', target: 'output' },
],
}
const created = workflows.backend.create({ name: '带个人技能的工作流', graph: JSON.stringify(graphWithPersonalSkill) })
workflows.backend.publish({ workflowId: created.workflow.id, version: 'v1' })

const user = userEvent.setup()
await renderPage()

// Workflow without personal Skills does not show the hint.
await user.click(within(project()).getByRole('button', { name: '在 ora-space/cloud 新建对话' }))
await user.click(await screen.findByRole('menuitem', { name: '运行工作流' }))
fireEvent.click(await screen.findByRole('menuitem', { name: /示例:代码审查/ }))
const plainDialog = await screen.findByRole('dialog', { name: '运行工作流' })
expect(within(plainDialog).queryByText(hint)).not.toBeInTheDocument()
await user.keyboard('{Escape}')
await waitFor(() => expect(screen.queryByRole('dialog', { name: '运行工作流' })).not.toBeInTheDocument())

// Workflow with an enabled personal Skill shows the hint in both create and start dialogs.
await user.click(within(project()).getByRole('button', { name: '在 ora-space/cloud 新建对话' }))
await user.click(await screen.findByRole('menuitem', { name: '运行工作流' }))
fireEvent.click(await screen.findByRole('menuitem', { name: /带个人技能的工作流/ }))
const createDialog = await screen.findByRole('dialog', { name: '运行工作流' })
expect(within(createDialog).getByText(hint)).toBeInTheDocument()
await user.click(within(createDialog).getByRole('button', { name: '创建运行' }))

const pane = await screen.findByRole('region', { name: '工作流运行' })
await within(pane).findByRole('button', { name: '启动' }, { timeout: 10_000 })
await user.click(within(pane).getByRole('button', { name: '启动' }))
const startDialog = await screen.findByRole('dialog')
expect(within(startDialog).getByText(hint)).toBeInTheDocument()
}, 20_000)
})
2 changes: 2 additions & 0 deletions frontend-v2/src/features/chat/workflow-run/run-pane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { useDarkTheme } from '@/lib/workflows/host/theme'
import { toast } from '@/lib/workflows/host/ui'
import { ContractError } from '@/lib/workflows/contracts'
import { localizeContractError } from '@/lib/workflows/host/contract-error'
import { hasEnabledPersonalSkills } from '@/lib/workflows/personal-skills'
import { isTerminalRunStatus, type GraphWorkflowRun, type WorkflowArtifact, type WorkflowNodeConversationItem } from '@/lib/workflows/runtime'
import { WorkspaceNavigationProvider } from '@/components/workspace-panel/navigation'
import { useWorkspacePanel, type WorkspacePanelState } from '@/components/workspace-panel/use-panel'
Expand Down Expand Up @@ -487,6 +488,7 @@ function RunWorkspace({ tenantId, run, readOnly, hostedWorkspace, leading, refre
unsupportedNodes={unsupportedNodes}
analyzing={preflight.analyzing}
analysisFailed={preflight.failed}
hasPersonalSkills={hasEnabledPersonalSkills(run.definitionSnapshot.nodes)}
busy={busy}
onOpenChange={setStartOpen}
onStart={async (prompt, variables) => {
Expand Down
6 changes: 6 additions & 0 deletions frontend-v2/src/features/chat/workflow-run/run-sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { createHttpWorkflowContracts } from '@/lib/workflows/data/contracts-clie
import { ContractError } from '@/lib/workflows/contracts'
import { localizeContractError } from '@/lib/workflows/host/contract-error'
import { workflowI18n } from '@/lib/workflows/host/i18n'
import { WORKFLOW_PERSONAL_SKILL_TEAM_VISIBILITY_HINT } from '@/lib/workflows/personal-skills'
import { isTerminalRunStatus } from '@/lib/workflows/runtime'
import { FadeText } from '../components/fade-text'
import { useChatStore } from '../store'
Expand Down Expand Up @@ -210,6 +211,11 @@ function RunWorkflowForm({
{workflowRunTranslations['zh-CN']['workflowRun.injectLastFailure']}
</Label>
</div>
{workflow.hasPersonalSkills && (
<p className="text-xs leading-relaxed text-muted-foreground">
{WORKFLOW_PERSONAL_SKILL_TEAM_VISIBILITY_HINT}
</p>
)}
{error && <p className="text-sm text-destructive">{error}</p>}
<DialogFooter>
<DialogClose render={<Button variant="outline" type="button" />}>取消</DialogClose>
Expand Down
11 changes: 10 additions & 1 deletion frontend-v2/src/features/chat/workflow-run/server-runs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
} from '@/lib/workflows/api/generated'
import { ContractError } from '@/lib/workflows/contracts'
import { contractError, type WorkflowContracts } from '@/lib/workflows/data/contracts-client'
import { graphHasEnabledPersonalSkills } from '@/lib/workflows/personal-skills'
import {
isTerminalRunStatus,
normalizeWorkflowDefinition,
Expand All @@ -45,6 +46,8 @@ export interface PublishedWorkflow {
* version is deleted, so the run is checked against this, never against the name.
*/
snapshotId: string
/** True when any Agent node in the published snapshot enables a personal Skill. */
hasPersonalSkills?: boolean
}

/**
Expand Down Expand Up @@ -74,7 +77,13 @@ export async function listPublishedWorkflows(library: WorkflowContracts, signal?
.map(async (w): Promise<PublishedWorkflow | null> => {
try {
const { workflow, published } = await library.get({ workflowId: w.id }, { signal })
return published && { id: workflow.id, name: workflow.name, version: published.version, snapshotId: published.id }
return published && {
id: workflow.id,
name: workflow.name,
version: published.version,
snapshotId: published.id,
hasPersonalSkills: graphHasEnabledPersonalSkills(published.graph),
}
} catch (error) {
if (error instanceof ContractError && error.code === 'workflow_not_found') return null
throw error
Expand Down
9 changes: 7 additions & 2 deletions frontend-v2/src/features/chat/workflow-run/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ export const workflowRunTranslations = {
"errors.workflow_run_validation": "工作流运行校验失败。",
"errors.workflow_run_input_invalid":
"启动变量 {{variable}} 的输入无效:{{reason}}",
"errors.workflow_skill_not_found": "该工作流需要的技能不可用。",
"errors.workflow_skill_not_found":
"该工作流需要的技能不可用,请先在个人技能页导入同名技能或确认市场技能已下发到项目后重试。",
"errors.workflow_skill_not_found_detail":
"节点「{{nodeTitle}}」需要的技能 {{skillId}} 不可用,请先在个人技能页导入同名技能或确认市场技能已下发到项目后重试。",
"errors.workflow_role_not_found":
"工作流引用的角色在工作区角色目录里不存在,请先在设置的角色页新建同名角色再启动。",
"errors.workflow_run_start_failed": "启动工作流运行失败。",
Expand Down Expand Up @@ -639,7 +642,9 @@ export const workflowRunTranslations = {
"errors.workflow_run_input_invalid":
"Invalid input for start variable '{{variable}}': {{reason}}",
"errors.workflow_skill_not_found":
"A skill required by this workflow is unavailable.",
"A skill required by this workflow is unavailable. Import the personal skill or verify the marketplace skill is deployed to the project, then retry.",
"errors.workflow_skill_not_found_detail":
"The skill {{skillId}} required by node '{{nodeTitle}}' is unavailable. Import the personal skill or verify the marketplace skill is deployed to the project, then retry.",
"errors.workflow_role_not_found":
"The role this workflow references is missing from the workspace's role catalog. Create it on the Roles settings page, then start the run again.",
"errors.workflow_run_start_failed": "Failed to start the workflow run.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
import type { WorkflowInputVariable } from "@/lib/workflows/mock";
import { WorkflowStartVariableFields } from "@/lib/workflows/host/start-variable-fields";
import { workflowStartDrafts, parseWorkflowStartDrafts } from "@/lib/workflows/host/start-variable-drafts";
import { WORKFLOW_PERSONAL_SKILL_TEAM_VISIBILITY_HINT } from "@/lib/workflows/personal-skills";

/** A reachable node start will refuse, named as the author titled it. */
export interface WorkflowRunUnsupportedNode {
Expand All @@ -38,6 +39,8 @@ interface WorkflowRunStartDialogProps {
analyzing?: boolean;
/** Keeps a failed preflight visible while server start remains the authority. */
analysisFailed?: boolean;
/** True when any Agent node in the frozen snapshot enables a personal Skill. */
hasPersonalSkills?: boolean;
busy: boolean;
onOpenChange: (open: boolean) => void;
onStart: (
Expand All @@ -55,6 +58,7 @@ export function WorkflowRunStartDialog({
unsupportedNodes = [],
analyzing = false,
analysisFailed = false,
hasPersonalSkills = false,
busy,
onOpenChange,
onStart,
Expand All @@ -69,6 +73,7 @@ export function WorkflowRunStartDialog({
unsupportedNodes={unsupportedNodes}
analyzing={analyzing}
analysisFailed={analysisFailed}
hasPersonalSkills={hasPersonalSkills}
busy={busy}
onCancel={() => onOpenChange(false)}
onStart={onStart}
Expand All @@ -86,6 +91,7 @@ function WorkflowRunStartDialogContent({
unsupportedNodes,
analyzing,
analysisFailed,
hasPersonalSkills,
busy,
onCancel,
onStart,
Expand Down Expand Up @@ -142,6 +148,11 @@ function WorkflowRunStartDialogContent({
{unsupportedNodes.length > 0 && (
<UnsupportedNodesWarning nodes={unsupportedNodes} />
)}
{hasPersonalSkills && (
<p className="text-xs leading-relaxed text-muted-foreground">
{WORKFLOW_PERSONAL_SKILL_TEAM_VISIBILITY_HINT}
</p>
)}
<WorkflowStartVariableFields variables={variables} drafts={drafts} setDrafts={setDrafts} attemptedStart={attemptedStart} />
<div className="space-y-1.5">
<div className="flex items-baseline justify-between gap-2">
Expand Down
3 changes: 3 additions & 0 deletions frontend-v2/src/features/collaboration/task-composer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Input } from '@/components/ui/input'
import { NativeSelect, NativeSelectOption } from '@/components/ui/native-select'
import { Switch } from '@/components/ui/switch'
import { Textarea } from '@/components/ui/textarea'
import { useWorkflowHasPersonalSkills, WORKFLOW_PERSONAL_SKILL_TEAM_VISIBILITY_HINT } from '@/lib/workflows/personal-skills'
import {
extractWorkflowInputServerError,
resolveFormDraftValues,
Expand Down Expand Up @@ -186,6 +187,7 @@ export function TaskComposer({ tenantId, task, me, inSquad, sending, error, subm
undefined,
{ query: { enabled: !!tenantId && !!stagedWorkflow?.formRef, staleTime: 60_000 } },
)
const stagedWorkflowHasPersonalSkills = useWorkflowHasPersonalSkills(tenantId, stagedWorkflow?.workflowId)
const reach = agentReach(task, me, inSquad)
const taskFinished = isTaskFinished(task.status)
const sendToAgent = !stagedWorkflow && reach.ok && (toAgent ?? true)
Expand Down Expand Up @@ -346,6 +348,7 @@ export function TaskComposer({ tenantId, task, me, inSquad, sending, error, subm
</div>}
{formQuery.data && <>
{formQuery.data.description && <p className="mc-muted text-xs">{formQuery.data.description}</p>}
{stagedWorkflowHasPersonalSkills && <p className="mc-muted text-xs">{WORKFLOW_PERSONAL_SKILL_TEAM_VISIBILITY_HINT}</p>}
{fields.length > 0
? <div className="mc-wf-fields">
{fields.map(field => {
Expand Down
3 changes: 3 additions & 0 deletions frontend-v2/src/features/collaboration/task-decomposition.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Field, FieldDescription, FieldGroup, FieldLabel } from '@/components/ui
import { NativeSelect, NativeSelectOptGroup, NativeSelectOption } from '@/components/ui/native-select'
import { listDecompositionWorkflows } from './decomposition-api/generated'
import { PanelDialog } from '@/components/panel/panel-dialog'
import { useWorkflowHasPersonalSkills, WORKFLOW_PERSONAL_SKILL_TEAM_VISIBILITY_HINT } from '@/lib/workflows/personal-skills'
import { decompositionMessageFor, DEMO_DECOMPOSITION_WORKFLOW, taskStatusLabel } from './task-model'
import { startTaskDecomposition, type Task, type TaskDecomposition } from './tasks-api/generated'
import { useTaskList } from './workspace'
Expand Down Expand Up @@ -38,6 +39,7 @@ export function DecomposeDialog({ tenantId, task, onClose, onStarted }: {
for (const w of blocked) blockedByReason.set(w.decompositionBlockedReason, [...(blockedByReason.get(w.decompositionBlockedReason) ?? []), w.name])
const [picked, setPicked] = useState('')
const workflowId = picked || (eligible.find(w => w.name === DEMO_DECOMPOSITION_WORKFLOW) ?? eligible[0])?.id || ''
const hasPersonalSkills = useWorkflowHasPersonalSkills(tenantId, workflowId)
const [key] = useState(() => crypto.randomUUID())
const [error, setError] = useState('')
const start = useMutation({
Expand Down Expand Up @@ -73,6 +75,7 @@ export function DecomposeDialog({ tenantId, task, onClose, onStarted }: {
</NativeSelectOptGroup>}
</NativeSelect>
<FieldDescription>{hint}</FieldDescription>
{hasPersonalSkills && <FieldDescription>{WORKFLOW_PERSONAL_SKILL_TEAM_VISIBILITY_HINT}</FieldDescription>}
{blocked.length > 0 && <details className="text-sm">
<summary className="cursor-pointer text-muted-foreground">有 {blocked.length} 个已发布工作流不能用于拆分</summary>
<div className="mt-1 max-h-32 space-y-1 overflow-y-auto">
Expand Down
9 changes: 9 additions & 0 deletions frontend-v2/src/features/collaboration/task-model.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,15 @@ describe('task errors', () => {
expect(boardMoveMessageFor(http(400, 'invalid_transition'))).toContain('待处理 → 进行中 → 待验收 → 已完成')
expect(boardMoveMessageFor(http(403, 'forbidden'))).toBe('只有任务创建人或工作区管理员能确认完成、退回或取消任务。')
expect(taskRunMessageFor(http(400, 'workflow_role_not_found'))).toBe('工作流引用的角色在工作区角色目录里不存在,请先在设置的角色页新建同名角色再启动。')
expect(taskRunMessageFor(http(400, 'workflow_skill_not_found'))).toBe('工作流引用的技能不可用,请先在个人技能页导入同名技能或确认市场技能已下发到项目后再启动。')
expect(taskRunMessageFor({
isAxiosError: true,
response: { status: 400, data: { code: 'workflow_skill_not_found', params: { nodeId: 'a1', nodeTitle: '代码审查', skillId: 'my-skill' } } },
})).toBe('节点「代码审查」需要的技能 my-skill 不可用,请先在个人技能页导入同名技能或确认市场技能已下发到项目后再启动。')
expect(taskRunMessageFor({
isAxiosError: true,
response: { status: 400, data: { code: 'workflow_skill_not_found', params: { nodeId: 'a1', nodeTitle: ' ', skillId: 'official/pack' } } },
})).toBe('节点「a1」需要的技能 official/pack 不可用,请先在个人技能页导入同名技能或确认市场技能已下发到项目后再启动。')
})
})

Expand Down
Loading
Loading