Vertesia DSL 工作流参考
vertesia-dsl-workflow
DSL 工作流定义、远程活动、变量解析和条件处理的参考。在创建或调试调用插件远程活动的 DSL 工作流时使用。
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-14
- Stars
- ★ 5
- Forks
- 2
01 前言 Front Matter
- name
- vertesia-dsl-workflow
- description
- Reference for DSL workflow definitions, remote activities, variable resolution, and conditions. Use when creating or debugging DSL workflows that call remote activities from plugins.
03 SKILL.md 正文
DSL Workflows & Remote Activities
DSL workflows are declarative step-by-step pipelines defined as JSON. They can call built-in activities and remote activities provided by plugins.
Key Source Files
| File | Purpose |
|---|---|
composableai/packages/workflow/src/dsl/dsl-workflow.ts |
DSL engine: variable init, step execution, remote activity calls |
composableai/packages/workflow/src/dsl/vars.ts |
Vars class: variable storage, resolution (${varName}), dotted path access |
composableai/packages/workflow/src/dsl/conditions.ts |
matchCondition(): operator-based condition matching |
composableai/packages/workflow/src/activities/getObjectFromStore.ts |
Built-in activity to load a ContentObject into workflow vars |
composableai/packages/tools-sdk/src/ActivityCollection.ts |
ActivityCollection class for registering plugin activities |
Workflow Definition Structure
await client.workflows.definitions.create({
name: 'MyWorkflow',
description: 'Description',
debug_mode: true,
steps: [
{ name: 'activityName', type: 'activity', params: { ... } },
// ...
],
vars: {}, // initial workflow variables
});
Built-in Activities
Common built-in activities available in all DSL workflows:
| Activity | Purpose | Key Params |
|---|---|---|
setDocumentStatus |
Set document status | { status: 'processing' | 'completed' | ... } |
getObjectFromStore |
Load ContentObject into vars | { } (uses objectId automatically) |
generateEmbeddings |
Compute embeddings | { type: 'text' | 'properties' } |
getObjectFromStore Pattern
Use output to store the loaded object in a named variable, then access nested fields with dotted paths:
{ name: 'getObjectFromStore', type: 'activity', output: 'task' },
// Now 'task' is in vars — access fields as 'task.properties.my_field'
Remote Activities
Plugin activities registered via ActivityCollection are invoked as DSL steps using the naming convention:
app:<plugin-name>:<collection-name>:<activity-name>
Example: app:bpce-orchestrator:intake:categorize_task
App interactions used by executeInteraction follow a similar pattern:
app:<plugin-name>:<collection-name>:<interaction-name>
Do not assume a bare interaction name like ExtractContractMetadata will resolve inside a workflow if the interaction is contributed by an app.
Variable Resolution for Remote Activities
CRITICAL: Remote activity params are resolved in a new Vars scope (see dsl-workflow.ts:422). Workflow-level variables like objectId are NOT automatically available in remote activity params.
You must use import to bring workflow variables into scope:
// WRONG - ${objectId} will be undefined
{
name: 'app:my-plugin:collection:my_activity',
type: 'activity',
params: { task_id: '${objectId}' },
}
// CORRECT - import brings objectId into the new Vars scope
{
name: 'app:my-plugin:collection:my_activity',
type: 'activity',
import: ['objectId'],
params: { task_id: '${objectId}' },
output: 'result',
}
The import field tells the DSL engine to copy the listed variables from the workflow scope into the activity's Vars scope via vars.createImportVars(activity.import) at dsl-workflow.ts:378.
How objectId is Initialized
At dsl-workflow.ts:133, the DSL engine initializes workflow vars with:
objectId= first object ID from the trigger event (objectIds[0])- Plus any vars defined in the workflow definition's
varsfield
Conditions on Steps
Use condition to skip steps based on workflow variable values.
Condition Syntax
Conditions use operator objects from conditions.ts. The matchCondition() function iterates the keys of the condition value and looks them up in the conditionFns registry.
Available operators:
| Operator | Description | Example |
|---|---|---|
$eq |
Equals | { $eq: 'value' } |
$ne |
Not equals | { $ne: 'value' } |
$in |
In array | { $in: ['a', 'b'] } |
$nin |
Not in array | { $nin: ['a', 'b'] } |
$exists |
Field exists | { $exists: true } |
$null |
Is null/undefined | { $null: true } |
$gt, $gte, $lt, $lte |
Comparisons | { $gt: 50 } |
$regexp |
Regex match | { $regexp: '^EPR-' } |
$startsWith, $endsWith, $contains |
String ops | { $contains: 'text' } |
$or |
OR conditions | { $or: [{ $eq: 'a' }, { $eq: 'b' }] } |
CRITICAL: Always Use Operator Objects
NEVER pass plain values as conditions. Plain strings/numbers cause Unknown condition: 0 errors because matchCondition() iterates string characters as keys.
// WRONG - causes "Unknown condition: 0" error
condition: { 'task.properties.task_status': 'categorisation' }
// CORRECT - use operator object
condition: { 'task.properties.task_status': { $eq: 'categorisation' } }
Dotted Path Access in Conditions
Conditions support dotted paths to access nested variables. The vars.match() method uses getValue(path) which resolves dotted paths like task.properties.task_status:
{
name: 'app:my-plugin:collection:my_activity',
type: 'activity',
condition: { 'task.properties.field_name': { $eq: 'expected_value' } },
import: ['objectId'],
params: { task_id: '${objectId}' },
}
This requires a prior getObjectFromStore step with output: 'task' to populate the variable.
Complete Workflow Example
A workflow that loads a task, conditionally processes it, computes embeddings, and sets status:
steps: [
{ name: 'setDocumentStatus', type: 'activity', params: { status: 'processing' } },
{ name: 'getObjectFromStore', type: 'activity', output: 'task' },
{
name: 'app:my-plugin:intake:categorize_task',
type: 'activity',
condition: { 'task.properties.task_status': { $eq: 'categorisation' } },
import: ['objectId'],
params: { task_id: '${objectId}' },
output: 'categorize_result',
},
{
name: 'app:my-plugin:intake:compute_priority',
type: 'activity',
condition: { 'task.properties.task_status': { $eq: 'categorisation' } },
import: ['objectId'],
params: { task_id: '${objectId}' },
output: 'priority_result',
},
{ name: 'generateEmbeddings', type: 'activity', params: { type: 'text' } },
{ name: 'generateEmbeddings', type: 'activity', params: { type: 'properties' } },
{ name: 'setDocumentStatus', type: 'activity', params: { status: 'completed' } },
]
Workflow Rules
Workflow rules trigger workflows based on events. They match on event name and content type:
await client.workflows.rules.create({
name: 'My Rule',
endpoint: `wf:${workflowDefinitionId}`,
match: {
'$and': [
{ 'event.name': 'create' },
{ 'event.data.type.name': 'my_content_type' },
]
},
});
When reusing a standard intake workflow such as StandardDocumentIntake, prefer staging custom enrichment on a later update event after the generic intake marks the object completed. This avoids two workflows racing on the same create event.
Common Pitfalls
${objectId}undefined in remote activity params: Addimport: ['objectId']to the stepUnknown condition: 0error: Condition value is a plain string, not an operator object — wrap with{ $eq: ... }- Condition not matching nested fields: Ensure a prior
getObjectFromStorestep withoutputset to populate the variable - Activities not found: Verify the naming convention
app:<plugin-name>:<collection>:<activity>and that theActivityCollectionis exported fromsrc/modules/app/resources/activities/index.ts - App interaction not found from
executeInteraction: Use the full app interaction idapp:<plugin-name>:<collection>:<interaction>, not a bare interaction name - App child record creation fails with app type not found: Pass the in-code app type string directly to
client.objects.create({ type: 'app:<plugin-name>:<type-name>', ... }); do not resolve it to a project-local ObjectId withclient.types.getTypeByName()ortypes.list() - Custom CLM/business enrichment races standard intake: move the custom rule off
createand trigger on a laterupdatecondition such asstatus=completed
04 同仓库更多 Skills
用户选项收集
user-select
向用户呈现选项并收集其选择,用于交互式决策
Vertesia React UI 组件开发
vertesia-ui
使用 @vertesia/ui 构建 UI 的参考资料。涵盖组件 API(Input、Button、VModal、VTabs、Table)、支持无限滚动的列表/详情表格、可排序表头、带 URL 持久化和内联行过滤的 FilterProvider、布局组件(Sidebar、FullHeightLayout、GenericPageNavHeader)、路由(NestedRouterProvider、useParams、useNavigate)、智能体对话(ModernAgentConversation)、样式与安全。当创建或修改 React UI 页面或组件时使用。
Vertesia 工具服务器资源创建
vertesia-tool-server-resource
为 Vertesia 插件工具服务器创建工具、技能、交互、内容类型、渲染模板、钩子和事件订阅。处理文件脚手架搭建与模块资源索引接线。当向此插件添加新的工具服务器资源时使用。
Vertesia 插件架构参考
vertesia-plugin
关于插件架构、双构建系统、导入钩子和部署的参考资料。用于理解插件结构或构建配置。创建资源请使用 vertesia-tool-server-resource;构建 UI 请使用 vertesia-ui;客户端 API 请使用 vertesia-api。
Vertesia 需求能力差距评估
vertesia-gap-assessment
在提出实现方案之前,评估任意需求与现有 Vertesia 能力之间的差距。在审查 Vertesia 应用、插件、工作流或智能体的需求文档、调研笔记、演示请求或功能请求时使用,以便区分平台原生支持、已安装的项目能力、当前应用实现和真正需要自定义开发的工作。
Vertesia 演示种子内容生成
vertesia-demo-content
为 Vertesia 应用生成真实且可复用的演示或种子内容,并通过 Vertesia CLI、API 或浏览器会话上传。在构建 Vertesia 自定义应用、插件、原型、仓库工作流、AI 提取工作流、搜索/筛选页面,或需要使用真实存储对象而非硬编码模拟数组的演示时使用;包括检查当前活动的 CLI 配置文件,以及在修改 Vertesia 项目前先询问确认。