Handoff to Sommatic App
终止节点:将已完成工作流的结果移交给某个 Sommatic AI App。它会创建一个携带打开描述符的持久化 HITL 任务;若有活动的 Command Center 会话订阅,则立即打开该应用。它是 sommatic.app.execute(应用作为关卡)的对称形态;此节点是应用作为终点:工作流就此结束,不会恢复。
终止交接:为用户创建携带应用打开描述符(应用 slug、路由、输入、启动模式)的任务,并返回该描述符,以便运行结果可打开应用。
工作原理
- 解析配置并合并到输入 payload 之上(配置优先);
input_mapping中的{{ }}在服务器端解析。 - 构建描述符:
app_slug取target.app_slug,route_path取target.route(默认/),launch_mode取target.launch_mode(默认command-center),input_payload取input_mapping(默认{})。 - 检查
app_slug、organization_id、assignee和task_title。 - 提交一个任务:用户负责人、状态
queued、source为workflow,并带metadata.app_handoff_descriptor;后端会为该用户认领。task_type默认review,task_priority默认medium。 - 通过
out在顶层返回{ app_handoff_descriptor, task_id, task_title },运行结果可从中获取描述符;之后打开该任务会重新启动预填数据的应用。
在工作流中
节点在工作流文件(draft_nodes[])中的写法,以及一次成功运行的 envelope。
{
"node_id": "node-handoff-approval",
"label": "Hand off to approval desk",
"operator_slug": "sommatic.app.handoff",
"operator_version": "1.0.0",
"config": {
"target": {
"app_slug": "sommatic-approval-desk",
"route": "/",
"launch_mode": "command-center"
},
"input_mapping": {
"order_id": "{{ $json.order_id }}",
"amount": "{{ $json.amount }}"
},
"organization_id": "<organization_id>",
"assignee": "[email protected]",
"task_title": "Approve order {{ $json.order_id }}"
}
}{
"ok": true,
"port": "out",
"app_handoff_descriptor": {
"app_slug": "sommatic-approval-desk",
"route_path": "/",
"input_payload": {
"order_id": "ord_123",
"amount": 1250
},
"launch_mode": "command-center"
},
"task_id": "task-xxxxxxxxxxxxxxx",
"task_title": "Approve order ord_123"
}配置
-
targetobject 必填 -
-
app_slugstring 必填 -
要移交的 Sommatic AI App 的 slug(例如 my-review-app)。
-
routestring 可选 -
在应用内打开的路由(例如 /new-sentence)。默认为 /。
-
launch_modestring 可选 -
存在活动会话时应用的打开方式。
-
-
input_mappingobject 可选 -
预填入应用的载荷,由服务端根据 {{...}} 表达式解析。
-
organization_idstring 必填 -
拥有所创建任务的组织。
-
assigneestring 必填 -
任务分配给的身份(邮箱)。
-
task_titlestring 必填 -
为此次移交创建的持久化 HITL 任务的标题。
-
task_typeobject 可选 -
任务类型描述符。默认为 review。
-
task_priorityobject 可选 -
任务优先级描述符。默认为 medium。
配置中会显示通用执行设置,但该节点目前不执行重试(retryOnFail、maxTries)。所有节点均未实现 continueOnFail。
代码中的行为
除 schema 描述之外,实现代码对这些键的实际处理。
-
task_type - 默认对象为
{ id: 1, name: "review", title: "Review" },而后端目录中review的 id 是 12。若收件箱按 id 过滤,请显式设置task_type。 -
target - 也会读取未声明的顶层备选键:
app_slug、route、launch_mode、input_payload、title、type和priority。
输出端口
out 默认 任务已创建。运行应在此结束;不会挂起。
{
"port": "out",
"app_handoff_descriptor": {
"app_slug": "sommatic-approval-desk",
"route_path": "/",
"input_payload": {
"order_id": "ord_123",
"amount": 1250
},
"launch_mode": "command-center"
},
"task_id": "task-xxxxxxxxxxxxxxx",
"task_title": "Approve order ord_123"
}error 缺少必填字段或后端调用失败。
{
"port": "error",
"error": "Missing 'assignee'"
}在表达式中
后续节点可通过 $("Handoff to Sommatic App").item.json.<路径> 读取此节点输出中的内容(请把 Handoff to Sommatic App 换成你的节点标签)。Editor 标记工作流编辑器在 Previous Nodes 中提示的路径(输出契约);Worker 标记 worker 实际通过 out 返回的路径,依据“端口”一节所示的输出。
| 表达式 | Editor | Worker |
|---|---|---|
$("Handoff to Sommatic App").item.json.app_handoff_descriptor | ||
$("Handoff to Sommatic App").item.json.task_id | ||
$("Handoff to Sommatic App").item.json.task_title | ||
$("Handoff to Sommatic App").item.json.port | — | |
$("Handoff to Sommatic App").item.json.app_handoff_descriptor.app_slug | — | |
$("Handoff to Sommatic App").item.json.app_handoff_descriptor.route_path | — | |
$("Handoff to Sommatic App").item.json.app_handoff_descriptor.input_payload | — | |
$("Handoff to Sommatic App").item.json.app_handoff_descriptor.launch_mode | — |
— Worker: worker 会返回它,但编辑器不会提示:请手动输入。对象内部的键可能取决于你的数据或配置(例如每个标签一个键)。
错误
| 消息 | 端口 | 原因与处理 |
|---|---|---|
Missing 'target.app_slug' | error | 没有 target.app_slug(顶层也没有 app_slug)。 |
Missing 'organization_id' | error | 配置和 payload 中都没有。 |
Missing 'assignee' | error | 交接始终需要用户身份(邮箱)。 |
Missing 'task_title' | error | task_title(或 title)为空。 |
Backend did not return a task id | error | 后端响应中没有 result.id。 |
Request failed with status code <status> | error | 后端拒绝了该任务。 |
services.apiManager.uri is not resolved in dependencies.config — check Link Loom Cloud environment config. | error | 编排器未配置后端地址。这是服务配置问题,与节点无关。 |
输入契约
-
targetobject 可选 -
input_mappingobject 可选 -
organization_idstring 可选 -
assigneestring 可选 -
task_titlestring 可选
输出契约
-
app_handoff_descriptorobject 可选 -
task_idstring 可选 -
task_titlestring 可选
契约(JSON Schema)
与编排器声明完全一致的定义。All 是完整的 *.definition.js;可与上方各节对照,找出文档与 schema 之间的差异。发布前可用它校验节点。
{
"slug": "sommatic.app.handoff",
"name": "Handoff to Sommatic App",
"category": "hitl",
"version": "1.0.0",
"description": "Terminal node: hands a finished workflow's result to a Sommatic AI App. Creates a durable HITL Task carrying the open descriptor and, if a live Command Center session is subscribed, opens the app instantly. Symmetric counterpart of sommatic.app.execute (app-as-gate); this is app-as-terminal — the workflow ends and does not resume.",
"capabilities": [
"ui",
"human",
"terminal"
],
"config_schema": {
"type": "object",
"required": [
"target",
"organization_id",
"assignee",
"task_title"
],
"properties": {
"target": {
"type": "object",
"title": "Target App",
"required": [
"app_slug"
],
"properties": {
"app_slug": {
"type": "string",
"title": "App Slug",
"description": "Slug of the Sommatic AI App to hand off to (e.g. my-review-app)."
},
"route": {
"type": "string",
"title": "Route Path",
"description": "Route opened inside the app (e.g. /new-sentence). Defaults to /.",
"default": "/"
},
"launch_mode": {
"type": "string",
"title": "Launch Mode",
"description": "How the app is opened when a live session exists.",
"default": "command-center"
}
}
},
"input_mapping": {
"type": "object",
"title": "Input Payload",
"description": "Payload pre-filled into the app, resolved server-side from {{...}} expressions."
},
"organization_id": {
"type": "string",
"title": "Organization",
"description": "Organization that owns the created Task."
},
"assignee": {
"type": "string",
"title": "Assignee",
"ui_widget": "user_picker",
"description": "Identity (email) the Task is assigned to."
},
"task_title": {
"type": "string",
"title": "Task Title",
"description": "Title of the durable HITL Task created for the handoff."
},
"task_type": {
"type": "object",
"title": "Task Type",
"description": "Task type descriptor. Defaults to review."
},
"task_priority": {
"type": "object",
"title": "Task Priority",
"description": "Task priority descriptor. Defaults to medium."
},
"execution": {
"type": "object",
"title": "Execution Settings",
"properties": {
"alwaysOutputData": {
"type": "boolean",
"title": "Always Output Data",
"description": "Always output data, even on error (if configured).",
"default": false
},
"retryOnFail": {
"type": "boolean",
"title": "Retry On Fail",
"description": "Retry the execution if it fails.",
"default": false
},
"maxTries": {
"type": "integer",
"title": "Max Retries",
"description": "Number of retries.",
"default": 3,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"waitBetweenTries": {
"type": "integer",
"title": "Wait Between Retries (ms)",
"default": 1000,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"continueOnFail": {
"type": "boolean",
"title": "Continue On Fail",
"description": "Do not crash workflow on error.",
"default": false
},
"timeout_ms": {
"type": "integer",
"title": "Timeout (ms)",
"description": "Max execution time for this node before it is killed, in milliseconds. Honored by long-running operators (e.g. OCR/extraction, inline code). Default 300000 (5 min).",
"default": 300000
}
}
}
}
},
"input_contract_schema": {
"type": "object",
"properties": {
"target": {
"type": "object"
},
"input_mapping": {
"type": "object"
},
"organization_id": {
"type": "string"
},
"assignee": {
"type": "string"
},
"task_title": {
"type": "string"
}
}
},
"output_contract_schema": {
"type": "object",
"properties": {
"app_handoff_descriptor": {
"type": "object"
},
"task_id": {
"type": "string"
},
"task_title": {
"type": "string"
}
}
},
"ports": [
{
"port_id": "out",
"label": "Out",
"is_default": true,
"description": "Handoff delivered (Task created; app opened if live session)."
},
{
"port_id": "error",
"label": "Error"
}
],
"execution_mode": "sync",
"tags": [
"ui",
"terminal",
"handoff"
],
"is_stateful": false,
"publisher": {
"identity": "org_sommatic_ai",
"profile": {
"name": "Sommatic AI",
"verified": true,
"url": "https://me.veripass.com/sommatic",
"logo_url": null
}
}
}{
"type": "object",
"required": [
"target",
"organization_id",
"assignee",
"task_title"
],
"properties": {
"target": {
"type": "object",
"title": "Target App",
"required": [
"app_slug"
],
"properties": {
"app_slug": {
"type": "string",
"title": "App Slug",
"description": "Slug of the Sommatic AI App to hand off to (e.g. my-review-app)."
},
"route": {
"type": "string",
"title": "Route Path",
"description": "Route opened inside the app (e.g. /new-sentence). Defaults to /.",
"default": "/"
},
"launch_mode": {
"type": "string",
"title": "Launch Mode",
"description": "How the app is opened when a live session exists.",
"default": "command-center"
}
}
},
"input_mapping": {
"type": "object",
"title": "Input Payload",
"description": "Payload pre-filled into the app, resolved server-side from {{...}} expressions."
},
"organization_id": {
"type": "string",
"title": "Organization",
"description": "Organization that owns the created Task."
},
"assignee": {
"type": "string",
"title": "Assignee",
"ui_widget": "user_picker",
"description": "Identity (email) the Task is assigned to."
},
"task_title": {
"type": "string",
"title": "Task Title",
"description": "Title of the durable HITL Task created for the handoff."
},
"task_type": {
"type": "object",
"title": "Task Type",
"description": "Task type descriptor. Defaults to review."
},
"task_priority": {
"type": "object",
"title": "Task Priority",
"description": "Task priority descriptor. Defaults to medium."
},
"execution": {
"type": "object",
"title": "Execution Settings",
"properties": {
"alwaysOutputData": {
"type": "boolean",
"title": "Always Output Data",
"description": "Always output data, even on error (if configured).",
"default": false
},
"retryOnFail": {
"type": "boolean",
"title": "Retry On Fail",
"description": "Retry the execution if it fails.",
"default": false
},
"maxTries": {
"type": "integer",
"title": "Max Retries",
"description": "Number of retries.",
"default": 3,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"waitBetweenTries": {
"type": "integer",
"title": "Wait Between Retries (ms)",
"default": 1000,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"continueOnFail": {
"type": "boolean",
"title": "Continue On Fail",
"description": "Do not crash workflow on error.",
"default": false
},
"timeout_ms": {
"type": "integer",
"title": "Timeout (ms)",
"description": "Max execution time for this node before it is killed, in milliseconds. Honored by long-running operators (e.g. OCR/extraction, inline code). Default 300000 (5 min).",
"default": 300000
}
}
}
}
}{
"type": "object",
"properties": {
"target": {
"type": "object"
},
"input_mapping": {
"type": "object"
},
"organization_id": {
"type": "string"
},
"assignee": {
"type": "string"
},
"task_title": {
"type": "string"
}
}
}{
"type": "object",
"properties": {
"app_handoff_descriptor": {
"type": "object"
},
"task_id": {
"type": "string"
},
"task_title": {
"type": "string"
}
}
}[
{
"port_id": "out",
"label": "Out",
"is_default": true,
"description": "Handoff delivered (Task created; app opened if live session)."
},
{
"port_id": "error",
"label": "Error"
}
]执行
- 执行方式
sync- 有状态
- 否
- 重试(
retryOnFail) - 否
- 能力
uihumanterminal- 标签
uiterminalhandoff
说明与限制
- 不会挂起或等待:连接到
out的节点会立即执行。请将其作为运行的最后一个节点。 - 任务的
context.workflow_instance_id和context.trace_id以空值发送:worker 从运行时未设置的字段读取它们,因此任务不会关联到本次运行。 - 非幂等:每次执行都会创建新任务。HTTP 调用不会重试。
- worker 将字段直接放在信封顶层、不使用
data,因此引擎把整个信封(包括port键)作为下一个节点的 payload。 - worker 不设置
ok(示例中显示为true);引擎只按port路由。
已对照编排器代码核实 · 31e874b · 2026-11-26